don't put extension params in 'CreateOpts' if unset; working rackspace acceptance test
diff --git a/openstack/compute/v2/extensions/diskconfig/requests.go b/openstack/compute/v2/extensions/diskconfig/requests.go
index cc390f7..7407e0d 100644
--- a/openstack/compute/v2/extensions/diskconfig/requests.go
+++ b/openstack/compute/v2/extensions/diskconfig/requests.go
@@ -41,7 +41,7 @@
servers.CreateOptsBuilder
// DiskConfig [optional] controls how the created server's disk is partitioned.
- DiskConfig DiskConfig
+ DiskConfig DiskConfig `json:"OS-DCF:diskConfig,omitempty"`
}
// ToServerCreateMap adds the diskconfig option to the base server creation options.
@@ -51,6 +51,10 @@
return nil, err
}
+ if string(opts.DiskConfig) == "" {
+ return base, nil
+ }
+
serverMap := base["server"].(map[string]interface{})
serverMap["OS-DCF:diskConfig"] = string(opts.DiskConfig)