fixes to creat and list volumes
diff --git a/openstack/blockstorage/v1/volumes/requests.go b/openstack/blockstorage/v1/volumes/requests.go
index 18f8a41..b6f3edf 100644
--- a/openstack/blockstorage/v1/volumes/requests.go
+++ b/openstack/blockstorage/v1/volumes/requests.go
@@ -3,22 +3,21 @@
import (
"github.com/racker/perigee"
"github.com/rackspace/gophercloud"
+ "github.com/rackspace/gophercloud/openstack/utils"
"github.com/rackspace/gophercloud/pagination"
- "github.com/rackspace/gophercloud/utils"
)
type VolumeOpts struct {
- Availability string
- Description string
- ImageID string
- Metadata map[string]string
- Name string
- Size int
- SnapshotID string
- Type string
+ Availability string
+ Description string
+ Metadata map[string]string
+ Name string
+ Size int
+ SnapshotID, SourceVolID, ImageID string
+ VolumeType string
}
-func Create(client *gophercloud.ServiceClient, opts VolumeOpts) (Volume, error) {
+func Create(client *gophercloud.ServiceClient, opts VolumeOpts) (*Volume, error) {
type volume struct {
Availability *string `json:"availability_zone,omitempty"`
@@ -55,9 +54,9 @@
var respBody response
- _, err = perigee.Request("POST", volumesURL(client), perigee.Options{
- MoreHeaders: c.Provider.AuthenticatedHeaders(),
- OkCodes: []int{201},
+ _, err := perigee.Request("POST", volumesURL(client), perigee.Options{
+ MoreHeaders: client.Provider.AuthenticatedHeaders(),
+ OkCodes: []int{200, 201},
ReqBody: &reqBody,
Results: &respBody,
})
@@ -69,30 +68,15 @@
}
func List(client *gophercloud.ServiceClient, opts ListOpts) pagination.Pager {
- var url string
-
- query := utils.BuildQuery(opts.Params)
-
- if !opts.Full {
- url = c.volumesURL()
- } else {
- url = c.volumeURL("detail")
- }
createPage := func(r pagination.LastHTTPResponse) pagination.Page {
- p := ListResult{
- pagination.MarkerPageBase{
- LastHTTPResponse: r,
- },
- }
- p.MarkerPageBase.Owner = p
- return p
+ return ListResult{pagination.SinglePageBase(r)}
}
- pager := pagination.NewPager(client, url, createPage)
- return pager
+ return pagination.NewPager(client, volumesURL(client), createPage)
}
+/*
func Get(c *blockstorage.Client, opts GetOpts) (Volume, error) {
var v Volume
h, err := c.GetHeaders()
@@ -120,3 +104,4 @@
})
return err
}
+*/