Offline docs (switch to live docs)                         UI-only  CLI-only 

Overseeing individual virtual machines

Mastering virtual machine management with MAAS

Errors or typos? Topics missing? Hard to read? Let us know!

If you have already taken the first step of setting up a VM host on MAAS, you're ready to delve into the art of managing your virtual machines (VMs). Whether it's adding, deleting, or configuring VMs, we've got you covered. Below are detailed guides for both UI and CLI methods, tailored to various MAAS versions.

Add a VM from the UI (MAAS v3.4)

Creating a VM via the UI, on MAAS version 3.4, is straightforward. Here's a step-by-step guide:

  1. Navigate to KVM > .

  2. Choose the VM host by clicking on its name.

  3. Click on Add VM.

  4. If you wish, input a VM name.

  5. Choose between Use any available core(s) or Pin VM to specific core(s). If choosing the latter, specify core identities.

  6. Input the amount of RAM needed.

  7. For advanced settings like Domain, Zone, Resource pool, or Architecture, click on Show advanced and make your modifications.

  8. Optionally, you can Define interfaces.

  9. Add disks if necessary by selecting Add disks.

  10. Finally, click Compose machine to spawn your VM.

Extra Information

You'll find the newly composed VM in the 'Machines' tab after a brief period, during which it undergoes auto-commissioning. Resources are automatically deducted from the selected VM host.

Add a VM from the UI (MAAS v3.3 and below)

  1. From the VM host's details view, locate the 'Take action' drop-down menu and select 'Compose'.

  2. Choose your preferred storage pool from the provided drop-down list.

Note: When adding multiple disks, the last disk in the list will function as the boot disk.

  1. Click 'Compose machine'. You'll be redirected to the VM host detail view.

Your new machine will be auto-commissioned, and its resources will be deducted from the VM host. The 'Machines' tab will update to reflect these changes.

How to delete a VM

Deleting a VM in MAAS is as straightforward as deleting any other machine:

  1. Choose the machine from the machine list.

  2. Select 'Delete' from the 'Take Action' drop-down menu.

Managing VMs with the MAAS CLI (all versions)

This section delves into the CLI approach for managing virtual machines in MAAS. We cover how to add a VM, set resource specifications, specify architecture, manage storage, define interfaces, locate VM host IDs, and delete a VM.

Additional background material on VM hosting is available for those interested in a deeper understanding.

How to Add a VM from the CLI

Creating a basic VM is as simple as running:

maas $PROFILE vm-host compose $VM_HOST_ID

Resource Specifications

You can specify the resources for your VM using the cores and memory options:

maas $PROFILE vm-host compose $VM_HOST_ID cores=4 memory=8G

Specifying Architecture

To define the architecture for your VM, add the architecture option:

maas $PROFILE vm-host compose $VM_HOST_ID architecture=amd64

Storage Parameters

Disk and storage configuration can also be defined when you create a VM:

maas $PROFILE vm-host compose $VM_HOST_ID disks=1:size=20G

Defining Interfaces

Network interfaces can be specified during VM creation:

maas $PROFILE vm-host compose $VM_HOST_ID interfaces=0:space=default

Locating VM Host IDs

To find the ID for your VM host, you can use the following command:

maas $PROFILE vm-hosts read

Deleting a VM

To delete a VM, execute:

maas $PROFILE machine delete $SYSTEM_ID

CLI Summary

Here's a quick summary of the CLI commands covered:

Additional background material on VM hosting is available for those interested in a deeper understanding.

Hopefully, this documentation provides a comprehensive guide on VM management in MAAS. Would you like to know more? Feel free to ask questions.