don't put extension params in 'CreateOpts' if unset; working rackspace acceptance test
diff --git a/rackspace/compute/v2/bootfromvolume/delegate.go b/rackspace/compute/v2/bootfromvolume/delegate.go
new file mode 100644
index 0000000..636ced6
--- /dev/null
+++ b/rackspace/compute/v2/bootfromvolume/delegate.go
@@ -0,0 +1,12 @@
+package bootfromvolume
+
+import (
+ "github.com/rackspace/gophercloud"
+ osBFV "github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume"
+ osServers "github.com/rackspace/gophercloud/openstack/compute/v2/servers"
+)
+
+// Create requests the creation of a server from the given block device mapping.
+func Create(client *gophercloud.ServiceClient, opts osServers.CreateOptsBuilder) osBFV.CreateResult {
+ return osBFV.Create(client, opts)
+}
diff --git a/rackspace/compute/v2/bootfromvolume/delegate_test.go b/rackspace/compute/v2/bootfromvolume/delegate_test.go
new file mode 100644
index 0000000..a564982
--- /dev/null
+++ b/rackspace/compute/v2/bootfromvolume/delegate_test.go
@@ -0,0 +1 @@
+package bootfromvolume
diff --git a/rackspace/compute/v2/servers/requests.go b/rackspace/compute/v2/servers/requests.go
index 357b174..4f40e83 100644
--- a/rackspace/compute/v2/servers/requests.go
+++ b/rackspace/compute/v2/servers/requests.go
@@ -89,7 +89,10 @@
serverMap := res["server"].(map[string]interface{})
serverMap["key_name"] = opts.KeyPair
- serverMap["block_device_mapping_v2"] = opts.BlockDevice
+ var bd bootfromvolume.BlockDevice
+ if opts.BlockDevice != bd {
+ serverMap["block_device_mapping_v2"] = []bootfromvolume.BlockDevice{opts.BlockDevice}
+ }
return res, nil
}