Allow ImageRef to be empty when block device is present (#97)
This commit removes the requirement for ImageRef to be set when creating
a server. This is to enable booting from a volume to work properly.
A unit test was added to verify this is possible.
Acceptance tests were also modified to handle this.
diff --git a/acceptance/openstack/compute/v2/bootfromvolume_test.go b/acceptance/openstack/compute/v2/bootfromvolume_test.go
index 05c0a99..844a7cb 100644
--- a/acceptance/openstack/compute/v2/bootfromvolume_test.go
+++ b/acceptance/openstack/compute/v2/bootfromvolume_test.go
@@ -26,22 +26,24 @@
blockDevices := []bootfromvolume.BlockDevice{
bootfromvolume.BlockDevice{
- UUID: choices.ImageID,
- SourceType: bootfromvolume.Image,
- VolumeSize: 10,
+ UUID: choices.ImageID,
+ SourceType: bootfromvolume.Image,
+ DeleteOnTermination: true,
+ DestinationType: "volume",
+ VolumeSize: 2,
},
}
server, err := CreateBootableVolumeServer(t, client, blockDevices, choices)
if err != nil {
- t.Fatal("Unable to create server: %v", err)
+ t.Fatalf("Unable to create server: %v", err)
}
defer DeleteServer(t, client, server)
PrintServer(t, server)
}
-func TestBootFromVolumeMultiEphemeral(t *testing.T) {
+func TestBootFromMultiEphemeralServer(t *testing.T) {
if testing.Short() {
t.Skip("Skipping test that requires server creation in short mode.")
}
@@ -83,7 +85,7 @@
},
}
- server, err := CreateBootableVolumeServer(t, client, blockDevices, choices)
+ server, err := CreateMultiEphemeralServer(t, client, blockDevices, choices)
if err != nil {
t.Fatalf("Unable to create server: %v", err)
}