Skip to content

Commit 75ea552

Browse files
author
Max Rantil
committed
Make it able to bring your own OpenStack volume
Signed-off-by: Max Rantil <[email protected]>
1 parent 141013b commit 75ea552

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

hack/ci/cloud-init/controller.yaml.tpl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,9 @@
150150
openstack aggregate add host "$aggregateid" "$host"
151151
done
152152

153+
# Create volume types
154+
openstack volume type create "test-volume-type" --description "Test volume type" --public
155+
153156
# the flavors are created in a way that we can execute at least 2 e2e tests in parallel (overall we have 32 vCPUs)
154157
openstack flavor delete m1.tiny
155158
openstack flavor create --ram 512 --disk 1 --ephemeral 1 --vcpus 1 --public --id 1 m1.tiny --property hw_rng:allowed='True'

test/e2e/suites/e2e/e2e_test.go

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -898,16 +898,17 @@ func createTestVolumeType(e2eCtx *shared.E2EContext) {
898898
volumeClient, err := openstack.NewBlockStorageV3(providerClient, gophercloud.EndpointOpts{Region: clientOpts.RegionName})
899899
Expect(err).NotTo(HaveOccurred())
900900

901-
shared.Logf("Creating test volume type")
902-
_, err = volumetypes.Create(volumeClient, &volumetypes.CreateOpts{
903-
Name: e2eCtx.E2EConfig.GetVariable(shared.OpenStackVolumeTypeAlt),
904-
Description: "Test volume type",
905-
IsPublic: pointer.Bool(true),
906-
ExtraSpecs: map[string]string{},
907-
}).Extract()
908-
if capoerrors.IsConflict(err) {
909-
shared.Logf("Volume type already exists. This may happen in development environments, but it is not expected in CI.")
910-
return
901+
volumeTypeName := e2eCtx.E2EConfig.GetVariable(shared.OpenStackVolumeTypeAlt)
902+
903+
shared.Logf("Checking if test volume type '%s' exists", volumeTypeName)
904+
_, err = volumetypes.Get(volumeClient, volumeTypeName).Extract()
905+
906+
if err != nil {
907+
if capoerrors.IsConflict(err) {
908+
shared.Logf("Volume type already exists. This may happen in development environments, but it is not expected in CI.")
909+
return
910+
}
911+
Expect(err).NotTo(HaveOccurred())
911912
}
912-
Expect(err).NotTo(HaveOccurred())
913+
shared.Logf("Proceeding with volume type '%s'.", volumeTypeName)
913914
}

0 commit comments

Comments
 (0)