create volumeType
diff --git a/acceptance/openstack/blockstorage/v1/volumeTypes_test.go b/acceptance/openstack/blockstorage/v1/volumeTypes_test.go
new file mode 100644
index 0000000..b4bff75
--- /dev/null
+++ b/acceptance/openstack/blockstorage/v1/volumeTypes_test.go
@@ -0,0 +1,43 @@
+// +build acceptance
+
+package v1
+
+import (
+ "strconv"
+ "testing"
+
+ "github.com/rackspace/gophercloud/openstack/blockstorage/v1/volumeTypes"
+)
+
+var numVolTypes = 1
+
+func TestVolumeTypes(t *testing.T) {
+ client, err := newClient()
+ if err != nil {
+ t.Fatalf("Failed to create Block Storage v1 client: %v", err)
+ }
+
+ var cvt *volumeTypes.VolumeType
+ for i := 0; i < numVolTypes; i++ {
+ cvt, err = volumeTypes.Create(client, volumeTypes.CreateOpts{
+ ExtraSpecs: map[string]string{
+ "capabilities": "gpu",
+ },
+ Name: "gophercloud-test-volumeType-200" + strconv.Itoa(i),
+ })
+ if err != nil {
+ t.Error(err)
+ return
+ } /*
+ defer func() {
+ time.Sleep(10000 * time.Millisecond)
+ err = volumeTypes.Delete(client, cvt.ID)
+ if err != nil {
+ t.Error(err)
+ return
+ }
+ }*/
+ t.Logf("created volume type: %+v\n", cvt)
+ }
+
+}
diff --git a/openstack/blockstorage/v1/volumeTypes/requests.go b/openstack/blockstorage/v1/volumeTypes/requests.go
new file mode 100644
index 0000000..694a44b
--- /dev/null
+++ b/openstack/blockstorage/v1/volumeTypes/requests.go
@@ -0,0 +1,53 @@
+package volumeTypes
+
+import (
+ "fmt"
+ "github.com/racker/perigee"
+ "github.com/rackspace/gophercloud"
+ "github.com/rackspace/gophercloud/openstack/utils"
+)
+
+type CreateOpts struct {
+ ExtraSpecs map[string]string
+ Name string
+}
+
+func Create(client *gophercloud.ServiceClient, opts CreateOpts) (*VolumeType, error) {
+ type volumeType struct {
+ ExtraSpecs map[string]string `json:"extra_specs,omitempty"`
+ Name *string `json:"name,omitempty"`
+ }
+
+ type request struct {
+ VolumeType volumeType `json:"volume_type"`
+ }
+
+ reqBody := request{
+ VolumeType: volumeType{},
+ }
+
+ reqBody.VolumeType.Name = utils.MaybeString(opts.Name)
+ reqBody.VolumeType.ExtraSpecs = opts.ExtraSpecs
+
+ type response struct {
+ VolumeType VolumeType `json:"volume_type"`
+ }
+
+ var respBody response
+
+ _, err := perigee.Request("POST", volumeTypesURL(client), perigee.Options{
+ MoreHeaders: client.Provider.AuthenticatedHeaders(),
+ OkCodes: []int{200},
+ ReqBody: &reqBody,
+ Results: &respBody,
+ })
+ if err != nil {
+ return nil, err
+ }
+
+ fmt.Printf("req: %+v\n", reqBody)
+ fmt.Printf("res: %+v\n", respBody)
+
+ return &respBody.VolumeType, nil
+
+}
diff --git a/openstack/blockstorage/v1/volumeTypes/results.go b/openstack/blockstorage/v1/volumeTypes/results.go
new file mode 100644
index 0000000..36de240
--- /dev/null
+++ b/openstack/blockstorage/v1/volumeTypes/results.go
@@ -0,0 +1,15 @@
+package volumeTypes
+
+import (
+//"fmt"
+
+//"github.com/rackspace/gophercloud/pagination"
+
+//"github.com/mitchellh/mapstructure"
+)
+
+type VolumeType struct {
+ ExtraSpecs map[string]interface{} `json:"extra_specs" mapstructure:"extra_specs"`
+ ID string `json:"id" mapstructure:"id"`
+ Name string `json:"name" mapstructure:"name"`
+}
diff --git a/openstack/blockstorage/v1/volumeTypes/urls.go b/openstack/blockstorage/v1/volumeTypes/urls.go
new file mode 100644
index 0000000..8df75cd
--- /dev/null
+++ b/openstack/blockstorage/v1/volumeTypes/urls.go
@@ -0,0 +1,11 @@
+package volumeTypes
+
+import "github.com/rackspace/gophercloud"
+
+func volumeTypesURL(c *gophercloud.ServiceClient) string {
+ return c.ServiceURL("types")
+}
+
+func volumeTypeURL(c *gophercloud.ServiceClient, id string) string {
+ return c.ServiceURL("types", id)
+}