From 449242ebda104f19876985d6f756bfc2024e047e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Budai?= Date: Thu, 25 Feb 2021 14:08:11 +0100 Subject: [PATCH] test/openstack: increase timeout for the instance to become ACTIVE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The openstack boot test often ruins our days with: Waiting for instance 63ac19be-2e19-44e2-8bef-9770d68a190c to become Active failed: A timeout occurred I decided to investigate. It turns out the first boot of an image can take up to 18 minutes. The subsequent ones are usually much faster (but don't rely on this fact, I saw 15 minutes there). This commit bumps the timeout to 30 minutes. This should be plenty of time for the instance to spin up and get into the ACTIVE state. Honestly, I'm not very happy with the solution but it should help with the failing Schutzbot. As a follow up, I will reach to the PSI OpenStack team and ask them if we could somehow speed up the process (maybe by using another flavor, ci.m1.medium.ephemeral just might be slow for some reason, I don't know). Anyway, this should help us in the short term because I strongly believe that a slow test is still better than a failing one. Signed-off-by: Ondřej Budai --- internal/boot/openstacktest/openstack.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/internal/boot/openstacktest/openstack.go b/internal/boot/openstacktest/openstack.go index 8fdd7def3..4a5e90b3d 100644 --- a/internal/boot/openstacktest/openstack.go +++ b/internal/boot/openstacktest/openstack.go @@ -8,12 +8,12 @@ import ( "github.com/gophercloud/gophercloud" "github.com/gophercloud/gophercloud/openstack" - "github.com/gophercloud/gophercloud/openstack/imageservice/v2/images" - "github.com/gophercloud/gophercloud/openstack/imageservice/v2/imagedata" "github.com/gophercloud/gophercloud/openstack/compute/v2/servers" + "github.com/gophercloud/gophercloud/openstack/imageservice/v2/imagedata" + "github.com/gophercloud/gophercloud/openstack/imageservice/v2/images" ) -const WaitTimeout = 600 // in seconds +const WaitTimeout = 30 * 60 // 30 minutes in seconds func UploadImageToOpenStack(p *gophercloud.ProviderClient, imagePath string, imageName string) (*images.Image, error) { client, err := openstack.NewImageServiceV2(p, gophercloud.EndpointOpts{ @@ -25,8 +25,8 @@ func UploadImageToOpenStack(p *gophercloud.ProviderClient, imagePath string, ima // create a new image which gives us the ID image, err := images.Create(client, images.CreateOpts{ - Name: imageName, - DiskFormat: "qcow2", + Name: imageName, + DiskFormat: "qcow2", ContainerFormat: "bare", }).Extract() if err != nil { @@ -84,10 +84,10 @@ func WithBootedImageInOpenStack(p *gophercloud.ProviderClient, imageID, userData server, err := servers.Create(client, servers.CreateOpts{ Name: "osbuild-composer-vm-for-" + imageID, FlavorRef: "77b8cf27-be16-40d9-95b1-81db4522be1e", // ci.m1.medium.ephemeral - Networks: []servers.Network{ // provider_net_cci_2 + Networks: []servers.Network{ // provider_net_cci_2 servers.Network{UUID: "74e8faa7-87ba-41b2-a000-438013194814"}, }, - ImageRef: imageID, + ImageRef: imageID, UserData: []byte(userData), }).Extract() if err != nil { @@ -95,7 +95,7 @@ func WithBootedImageInOpenStack(p *gophercloud.ProviderClient, imageID, userData } // cleanup - defer func(){ + defer func() { err := servers.ForceDelete(client, server.ID).ExtractErr() if err != nil { fmt.Printf("Force deleting instance %s failed: %v", server.ID, err)