Skip to content

Commit

Permalink
mantle/openstack: stop using boot-from-volume
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mnaser authored and dustymabe committed Feb 19, 2025
1 parent 1f84d64 commit 4b6d89f
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions mantle/platform/api/openstack/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"github.com/coreos/pkg/capnslog"
"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack/blockstorage/v3/volumes"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/bootfromvolume"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/floatingips"
"github.com/gophercloud/gophercloud/openstack/compute/v2/extensions/keypairs"
"github.com/gophercloud/gophercloud/openstack/compute/v2/flavors"
Expand Down Expand Up @@ -295,6 +294,7 @@ func (a *API) CreateServer(name, sshKeyID, userdata string) (*Server, error) {
CreateOptsBuilder: servers.CreateOpts{
Name: name,
FlavorRef: a.opts.Flavor,
ImageRef: a.opts.Image,
Metadata: map[string]string{
"CreatedBy": "mantle",
},
Expand All @@ -308,23 +308,7 @@ func (a *API) CreateServer(name, sshKeyID, userdata string) (*Server, error) {
},
KeyName: sshKeyID,
}
// Create a boot device volume and create an instance from that by
// using "boot-from-volume". This means the instances boot a bit faster.
// Previously we were timing out because it was taking 10+ minutes for
// instances to come up in VexxHost. This helps with that.
bootVolume := []bootfromvolume.BlockDevice{
{
UUID: a.opts.Image,
VolumeSize: 10,
DeleteOnTermination: true,
SourceType: bootfromvolume.SourceImage,
DestinationType: bootfromvolume.DestinationVolume,
},
}
server, err := bootfromvolume.Create(a.computeClient, bootfromvolume.CreateOptsExt{
CreateOptsBuilder: serverCreateOpts,
BlockDevice: bootVolume,
}).Extract()
server, err := servers.Create(a.computeClient, serverCreateOpts).Extract()
if err != nil {
return nil, fmt.Errorf("creating server: %v", err)
}
Expand Down

0 comments on commit 4b6d89f

Please sign in to comment.