delete volumes rewrite
diff --git a/acceptance/openstack/blockstorage/v1/volumes_test.go b/acceptance/openstack/blockstorage/v1/volumes_test.go
index 37d64d4..b6f6335 100644
--- a/acceptance/openstack/blockstorage/v1/volumes_test.go
+++ b/acceptance/openstack/blockstorage/v1/volumes_test.go
@@ -6,6 +6,7 @@
"os"
"strconv"
"testing"
+ "time"
"github.com/rackspace/gophercloud"
"github.com/rackspace/gophercloud/openstack"
@@ -39,25 +40,23 @@
}
for i := 0; i < numVols; i++ {
- _, err = volumes.Create(client, volumes.VolumeOpts{
+ cv, err := volumes.Create(client, volumes.VolumeOpts{
Size: 1,
Name: "gophercloud-test-volume-" + strconv.Itoa(i),
})
if err != nil {
t.Error(err)
return
- } /*
- defer func() {
- time.Sleep(10000 * time.Millisecond)
- err = volumes.Delete(client, volumes.DeleteOpts{
- "id": cv.Id,
- })
- if err != nil {
- t.Error(err)
- return
- }
- }()
- */
+ }
+ defer func() {
+ time.Sleep(10000 * time.Millisecond)
+ err = volumes.Delete(client, cv.ID)
+ if err != nil {
+ t.Error(err)
+ return
+ }
+ }()
+
}
pager := volumes.List(client, volumes.ListOpts{})
diff --git a/openstack/blockstorage/v1/volumes/requests.go b/openstack/blockstorage/v1/volumes/requests.go
index b6f3edf..f32e061 100644
--- a/openstack/blockstorage/v1/volumes/requests.go
+++ b/openstack/blockstorage/v1/volumes/requests.go
@@ -92,16 +92,11 @@
})
return v, err
}
+*/
-func Delete(c *blockstorage.Client, opts DeleteOpts) error {
- h, err := c.GetHeaders()
- if err != nil {
- return err
- }
- url := c.GetVolumeURL(opts["id"])
- _, err = perigee.Request("DELETE", url, perigee.Options{
- MoreHeaders: h,
+func Delete(client *gophercloud.ServiceClient, id string) error {
+ _, err := perigee.Request("DELETE", volumeURL(client, id), perigee.Options{
+ MoreHeaders: client.Provider.AuthenticatedHeaders(),
})
return err
}
-*/
diff --git a/openstack/blockstorage/v1/volumes/results.go b/openstack/blockstorage/v1/volumes/results.go
index bceaedf..429ab8c 100644
--- a/openstack/blockstorage/v1/volumes/results.go
+++ b/openstack/blockstorage/v1/volumes/results.go
@@ -18,7 +18,7 @@
SnapshotID string
SourceVolID string
Metadata map[string]string
- Id string
+ ID string
Size int
}