[wip] create snapshot rewrite; test not passing because need
diff --git a/acceptance/openstack/blockstorage/v1/snapshots_test.go b/acceptance/openstack/blockstorage/v1/snapshots_test.go
index b7b1f99..1224aa9 100644
--- a/acceptance/openstack/blockstorage/v1/snapshots_test.go
+++ b/acceptance/openstack/blockstorage/v1/snapshots_test.go
@@ -1 +1,49 @@
+// +build acceptance
+
package v1
+
+import (
+ "strconv"
+ "testing"
+ //"time"
+
+ "github.com/rackspace/gophercloud/openstack/blockstorage/v1/snapshots"
+ "github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumes"
+)
+
+func waitForVolume(id string) {
+
+}
+
+var numSnapshots = 1
+
+func TestSnapshots(t *testing.T) {
+ client, err := newClient()
+ if err != nil {
+ t.Fatalf("Failed to create Block Storage v1 client: %v", err)
+ }
+
+ cv, err := volumes.Create(client, volumes.CreateOpts{
+ Size: 1,
+ Name: "gophercloud-test-volume",
+ })
+ if err != nil {
+ t.Fatalf("Failed to create volume: %v", err)
+ }
+
+ waitForVolume(cv.ID)
+
+ var sss []*snapshots.Snapshot
+ for i := 0; i < numSnapshots; i++ {
+ css, err := snapshots.Create(client, snapshots.CreateOpts{
+ Name: "gophercloud-test-snapshot-" + strconv.Itoa(i),
+ VolumeID: cv.ID,
+ })
+ if err != nil {
+ t.Errorf("Failed to create snapshot: %v\n", err)
+ }
+ sss = append(sss, css)
+ }
+
+ t.Logf("Created snapshots: %+v\n", sss)
+}
diff --git a/openstack/blockstorage/v1/snapshots/requests.go b/openstack/blockstorage/v1/snapshots/requests.go
index b13fa46..b60c295 100644
--- a/openstack/blockstorage/v1/snapshots/requests.go
+++ b/openstack/blockstorage/v1/snapshots/requests.go
@@ -17,7 +17,7 @@
func Create(client *gophercloud.ServiceClient, opts CreateOpts) (*Snapshot, error) {
type snapshot struct {
Description *string `json:"display_description,omitempty"`
- Force *bool `json:"force,omitempty"`
+ Force bool `json:"force,omitempty"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
Name *string `json:"display_name,omitempty"`
VolumeID *string `json:"volume_id,omitempty"`
@@ -32,10 +32,11 @@
}
reqBody.Snapshot.Description = utils.MaybeString(opts.Description)
- reqBody.Snapshot.Force = utils.MaybeString(opts.Force)
reqBody.Snapshot.Name = utils.MaybeString(opts.Name)
reqBody.Snapshot.VolumeID = utils.MaybeString(opts.VolumeID)
+ reqBody.Snapshot.Force = opts.Force
+
type response struct {
Snapshot Snapshot `json:"snapshot"`
}