Fix openstack blockstorage attachments types
This commit changes the blockstorage attachments type from
a slice of strings to a slice of string maps to better suit the
actual returned results.
diff --git a/openstack/blockstorage/v1/volumes/fixtures.go b/openstack/blockstorage/v1/volumes/fixtures.go
index a01ad05..a1b8697 100644
--- a/openstack/blockstorage/v1/volumes/fixtures.go
+++ b/openstack/blockstorage/v1/volumes/fixtures.go
@@ -45,8 +45,16 @@
{
"volume": {
"display_name": "vol-001",
- "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22"
- }
+ "id": "d32019d3-bc6e-4319-9c1d-6722fc136a22",
+ "attachments": [
+ {
+ "device": "/dev/vde",
+ "server_id": "a740d24b-dc5b-4d59-ac75-53971c2920ba",
+ "id": "d6da11e5-2ed3-413e-88d8-b772ba62193d",
+ "volume_id": "d6da11e5-2ed3-413e-88d8-b772ba62193d"
+ }
+ ]
+ }
}
`)
})
diff --git a/openstack/blockstorage/v1/volumes/requests_test.go b/openstack/blockstorage/v1/volumes/requests_test.go
index 067f89b..7643375 100644
--- a/openstack/blockstorage/v1/volumes/requests_test.go
+++ b/openstack/blockstorage/v1/volumes/requests_test.go
@@ -56,6 +56,7 @@
th.AssertEquals(t, v.Name, "vol-001")
th.AssertEquals(t, v.ID, "d32019d3-bc6e-4319-9c1d-6722fc136a22")
+ th.AssertEquals(t, v.Attachments[0]["device"], "/dev/vde")
}
func TestCreate(t *testing.T) {
diff --git a/openstack/blockstorage/v1/volumes/results.go b/openstack/blockstorage/v1/volumes/results.go
index aff60bc..2fd4ef1 100644
--- a/openstack/blockstorage/v1/volumes/results.go
+++ b/openstack/blockstorage/v1/volumes/results.go
@@ -16,7 +16,7 @@
Name string `mapstructure:"display_name"`
// Instances onto which the volume is attached.
- Attachments []string `mapstructure:"attachments"`
+ Attachments []map[string]interface{} `mapstructure:"attachments"`
// This parameter is no longer used.
AvailabilityZone string `mapstructure:"availability_zone"`