blob: 2c89a00771c3b5bd66346bd52a21596a7d605066 [file] [log] [blame]
// +build acceptance
package v2
import (
"testing"
"github.com/gophercloud/gophercloud/acceptance/tools"
osBFV "github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/bootfromvolume"
"github.com/gophercloud/gophercloud/rackspace/compute/v2/bootfromvolume"
"github.com/gophercloud/gophercloud/rackspace/compute/v2/servers"
th "github.com/gophercloud/gophercloud/testhelper"
)
func TestBootFromVolume(t *testing.T) {
client, err := newClient()
th.AssertNoErr(t, err)
if testing.Short() {
t.Skip("Skipping test that requires server creation in short mode.")
}
options, err := optionsFromEnv()
th.AssertNoErr(t, err)
name := tools.RandomString("Gophercloud-", 8)
t.Logf("Creating server [%s].", name)
bd := []osBFV.BlockDevice{
osBFV.BlockDevice{
UUID: options.imageID,
SourceType: osBFV.Image,
VolumeSize: 10,
},
}
server, err := bootfromvolume.Create(client, servers.CreateOpts{
Name: name,
FlavorRef: "performance1-1",
BlockDevice: bd,
}).Extract()
th.AssertNoErr(t, err)
t.Logf("Created server: %+v\n", server)
defer deleteServer(t, client, server)
getServer(t, client, server)
listServers(t, client)
}