change CreateOpts from structure to map to avoid default null values
diff --git a/acceptance/openstack/blockstorage_test.go b/acceptance/openstack/blockstorage_test.go
index ad40590..31a2d6b 100644
--- a/acceptance/openstack/blockstorage_test.go
+++ b/acceptance/openstack/blockstorage_test.go
@@ -61,10 +61,12 @@
return
}
v, err := volumes.Create(client, volumes.CreateOpts{
- Size: 1,
+ "size": 1,
+ "display_name": "test-volume",
})
if err != nil {
t.Error(err)
return
}
+ fmt.Printf("%+v\n", v)
}
diff --git a/openstack/blockstorage/v1/client.go b/openstack/blockstorage/v1/client.go
index 4547d0b..dfce924 100644
--- a/openstack/blockstorage/v1/client.go
+++ b/openstack/blockstorage/v1/client.go
@@ -22,10 +22,14 @@
}
}
-func (c *Client) GetVolumeURL() string {
+func (c *Client) GetVolumesURL() string {
return fmt.Sprintf("%s/volumes", c.endpoint)
}
+func (c *Client) GetVolumeURL(id string) string {
+ return fmt.Sprintf("%s/volumes/%s", c.endpoint, id)
+}
+
func (c *Client) GetHeaders() (map[string]string, error) {
t, err := c.getAuthToken()
if err != nil {
diff --git a/openstack/blockstorage/v1/volumes/requests.go b/openstack/blockstorage/v1/volumes/requests.go
index b1f45cd..34ae20e 100644
--- a/openstack/blockstorage/v1/volumes/requests.go
+++ b/openstack/blockstorage/v1/volumes/requests.go
@@ -11,7 +11,7 @@
if err != nil {
return v, err
}
- url := c.GetVolumeURL()
+ url := c.GetVolumesURL()
_, err = perigee.Request("POST", url, perigee.Options{
Results: &v,
ReqBody: map[string]interface{}{
diff --git a/openstack/blockstorage/v1/volumes/volumes.go b/openstack/blockstorage/v1/volumes/volumes.go
index 35c416b..e7eaeea 100644
--- a/openstack/blockstorage/v1/volumes/volumes.go
+++ b/openstack/blockstorage/v1/volumes/volumes.go
@@ -1,7 +1,9 @@
package volumes
type Volume map[string]interface{}
+type CreateOpts map[string]interface{}
+/*
type CreateOpts struct {
Availability_zone string `json:"size"`
Source_volid string `json:"source_volid"`
@@ -14,3 +16,4 @@
Bootable bool `json:"bootable"`
Metadata map[string]string `json:"metadata"`
}
+*/