additionally return 'error' from 'ToCreateServerMap'
diff --git a/rackspace/compute/v2/servers/requests.go b/rackspace/compute/v2/servers/requests.go
index b83a893..4ba7619 100644
--- a/rackspace/compute/v2/servers/requests.go
+++ b/rackspace/compute/v2/servers/requests.go
@@ -55,7 +55,7 @@
// ToServerCreateMap constructs a request body using all of the OpenStack extensions that are
// active on Rackspace.
-func (opts CreateOpts) ToServerCreateMap() map[string]interface{} {
+func (opts CreateOpts) ToServerCreateMap() (map[string]interface{}, error) {
base := os.CreateOpts{
Name: opts.Name,
ImageRef: opts.ImageRef,
@@ -74,14 +74,17 @@
DiskConfig: opts.DiskConfig,
}
- result := drive.ToServerCreateMap()
+ res, err := drive.ToServerCreateMap()
+ if err != nil {
+ return nil, err
+ }
// key_name doesn't actually come from the extension (or at least isn't documented there) so
// we need to add it manually.
- serverMap := result["server"].(map[string]interface{})
+ serverMap := res["server"].(map[string]interface{})
serverMap["key_name"] = opts.KeyPair
- return result
+ return res, nil
}
// RebuildOpts represents all of the configuration options used in a server rebuild operation that