Skip to content

Commit 4b6d89f

Browse files
mnaserdustymabe
authored andcommitted
mantle/openstack: stop using boot-from-volume
Since Mantle seems to upload QCOW2 images, when using boot from volume, it leaves a huge load on the remote control plane due to the fact that the image needs to be converted from QCOW2 into RAW and then booted. The reason why this was initially changed was because boots were taking a long time, but now OpenStack has a download-direct from the storage backend which will do a distributed pull that would be way faster than download-on-convert on a single system.
1 parent 1f84d64 commit 4b6d89f

File tree

1 file changed

+2
-18
lines changed
  • mantle/platform/api/openstack

1 file changed

+2
-18
lines changed

mantle/platform/api/openstack/api.go

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"github.com/coreos/pkg/capnslog"
2424
"github.com/gophercloud/gophercloud"
2525
"github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes"
26-
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/bootfromvolume"
2726
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/floatingips"
2827
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/keypairs"
2928
"github.com/gophercloud/gophercloud/openstack/compute/v2/flavors"
@@ -295,6 +294,7 @@ func (a *API) CreateServer(name, sshKeyID, userdata string) (*Server, error) {
295294
CreateOptsBuilder: servers.CreateOpts{
296295
Name: name,
297296
FlavorRef: a.opts.Flavor,
297+
ImageRef: a.opts.Image,
298298
Metadata: map[string]string{
299299
"CreatedBy": "mantle",
300300
},
@@ -308,23 +308,7 @@ func (a *API) CreateServer(name, sshKeyID, userdata string) (*Server, error) {
308308
},
309309
KeyName: sshKeyID,
310310
}
311-
// Create a boot device volume and create an instance from that by
312-
// using "boot-from-volume". This means the instances boot a bit faster.
313-
// Previously we were timing out because it was taking 10+ minutes for
314-
// instances to come up in VexxHost. This helps with that.
315-
bootVolume := []bootfromvolume.BlockDevice{
316-
{
317-
UUID: a.opts.Image,
318-
VolumeSize: 10,
319-
DeleteOnTermination: true,
320-
SourceType: bootfromvolume.SourceImage,
321-
DestinationType: bootfromvolume.DestinationVolume,
322-
},
323-
}
324-
server, err := bootfromvolume.Create(a.computeClient, bootfromvolume.CreateOptsExt{
325-
CreateOptsBuilder: serverCreateOpts,
326-
BlockDevice: bootVolume,
327-
}).Extract()
311+
server, err := servers.Create(a.computeClient, serverCreateOpts).Extract()
328312
if err != nil {
329313
return nil, fmt.Errorf("creating server: %v", err)
330314
}

0 commit comments

Comments
 (0)