When creating an instance, it is easy to misjudge what resources it will require. It is also often the case that after creating a VM, its intended uses will evolve, demanding a different amount of resources to before. This article considers your options for resizing a Nectar instance.
Before proceeding with any of these instructions you should make sure your instance and data are backed up. You can refer to the documentation for ways to do this:
There is also a tutorial available to show you how to resize a Nectar instance. Please go to the Nectar Tutorial website.
Direct resize using Dashboard
In the dashboard, go to the Project -> Compute -> Instances tab. At the end of the row for your instance there is a drop down menu for choosing instance actions. Select Resize Instance:
That will open a dialog in which you can select a new flavor for the instance:
Note that the screenshot above shows m1 and m2 flavors in the "new" flavor list. These flavors are deprecated, and are no longer available when resizing an instance via the Dashboard. Furthermore, resizing will not work when the "old" flavor has an ephemeral file system OR when the old flavor's root file system size is larger than the new flavor's. For example:
- Resizing any m1 flavor, or an m2.large or m2.xlarge to an m3, r3, c3 or t3 flavor is not possible because none of the 3rd generation flavors have an ephemeral file system. You need to use the "alternative approach" for this flavor change; see below.
- Resizing an m3, r3 or c3 to a t3 is not possible because a t3 flavor's root file system is too small. For this transition, please contact Nectar support for advice.
After you resize, you will be asked for confirmation, as shown in the following screenshot:
Remember to click the Confirm Resize/Migrate button in order to complete the process.
Direct resize using Command Line
You can also use the OpenStack command line tools to resize your instances. If you're not familiar with the OpenStack command line you can get started using our documentation at https://support.ehelp.edu.au/support/solutions/articles/6000075747-api
Use the following command to perform a resize:
nova resize --poll <instance> <new-flavor>
You can use either the instance name or instance ID for <instance>.
The same rules apply as for resizing through the dashboard; you may refer to the above diagram to seek valid entries for <new-flavor>.
Resizing from the command line also requires confirmation, like in the dashboard approach above. In fact, you can use the dashboard to confirm a resize that was started from the command line; conversely, you can use the command line to confirm a resize initiated from the dashboard.
To proceed with confirmation:
nova resize-confirm <instance>
On the other hand, if you have changed your mind, you can discard the resize and retain the instance in its current flavor like so:
nova resize-revert <instance>
An alternative approach
In cases where resizing will not work, you can employ a similar procedure to the one for migrating instances between availability zones, which is documented at https://support.ehelp.edu.au/support/solutions/articles/6000191165-migrating-instances-between-availability-zones
For simple scenarios, this is just a matter of snapshotting the instance and launching a new instance from the snapshot. However, various factors could make it more complicated. You should work through the migration guide and contact the Nectar helpdesk if you have any questions or concerns.
There are a few things to pay special attention to:
- Be sure to do the migration steps in the following order to minimize the risk that you will lose data:
- shutdown the current instance,
- snapshot the current instance in shutdown state,
- launch the new instance from the snapshot,
- check that the new instance works and has all of your files,
- terminate the old instance.
- If you have any important data in the old instance's Ephemeral Storage, you will need to save it manually. Ephemeral Storage is not captured in instance snapshots.
- If you need the extra space afforded by an ephemeral file system, apply for Volume Storage quota so that you can copy the data to a new volume ahead of the instance migration.
- The 5 step migration procedure requires enough instance and VCPU quota to run the old and new instances simultaneously. If you need a temporary quota increase to facilitate this, apply ahead of time.
There are some resizing scenarios that even the "snapshot and relaunch" approach does not support; for example:
- If the new flavor has a smaller root disk than the old flavor, you will not be able to launch the snapshot with the new flavor. (This is not permitted as it is liable to corrupt the root file system.)
- An instance that was running on a compute node with specialized hardware (e.g. a GPU) might not launch with the new flavor.
In scenarios like these, the simplest solution may be to rebuild your instance from a fresh (more recent) base image.
Error: No valid host was found
Even if you choose a valid flavor to resize to, you might get an error saying that "no valid host was found". This usually happens because your (new) instance is being launched in an Availability Zone where resources are near capacity, and none of the hosts (i.e. servers running instances) are currently able to accommodate an instance with the chosen flavor.
In this case, if you really need the resize to take place, you can contact the Nectar helpdesk, and it might be possible to move some other instances around to create some room for you. This requires agreement from the Node hosting your instance. It might simply be impossible to create the room you need.