func (opts CreateOpts) ToServerCreateMap() (map[string]interface{}, error) {
	base := os.CreateOpts{
		Name:             opts.Name,
		ImageRef:         opts.ImageRef,
		FlavorRef:        opts.FlavorRef,
		SecurityGroups:   opts.SecurityGroups,
		UserData:         opts.UserData,
		AvailabilityZone: opts.AvailabilityZone,
		Networks:         opts.Networks,
		Metadata:         opts.Metadata,
		Personality:      opts.Personality,
		ConfigDrive:      opts.ConfigDrive,
		AdminPass:        opts.AdminPass,
	}
	drive := diskconfig.CreateOptsExt{
		CreateOptsBuilder: base,
		DiskConfig:        opts.DiskConfig,
	}
	res, err := drive.ToServerCreateMap()
	if err != nil {
		return nil, err
	}
	if len(opts.BlockDevice) != 0 {
		bfv := bootfromvolume.CreateOptsExt{
			CreateOptsBuilder: drive,
			BlockDevice:       opts.BlockDevice,
		}
		res, err = bfv.ToServerCreateMap()
		if err != nil {
			return nil, err
		}
	}
	serverMap := res["server"].(map[string]interface{})
	serverMap["key_name"] = opts.KeyPair
	return res, nil
}
ToServerCreateMap constructs a request body using all of the OpenStack extensions that are
active on Rackspace.
package servers
import (
	"github.com/rackspace/gophercloud/openstack/compute/v2/extensions/bootfromvolume"
	"github.com/rackspace/gophercloud/openstack/compute/v2/extensions/diskconfig"
	os "github.com/rackspace/gophercloud/openstack/compute/v2/servers"
)
type CreateOpts struct {
	Name string
	ImageRef string
	FlavorRef string
	SecurityGroups []string
	UserData []byte
	AvailabilityZone string
	Networks []os.Network
	Metadata map[string]string
	Personality []byte
	ConfigDrive bool
	AdminPass string
	KeyPair string
	DiskConfig diskconfig.DiskConfig
	BlockDevice []bootfromvolume.BlockDevice
}