Overseeing individual virtual machines
Mastering virtual machine management with MAAS
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:
-
Navigate to KVM > .
-
Choose the VM host by clicking on its name.
-
Click on Add VM.
-
If you wish, input a VM name.
-
Choose between Use any available core(s) or Pin VM to specific core(s). If choosing the latter, specify core identities.
-
Input the amount of RAM needed.
-
For advanced settings like Domain, Zone, Resource pool, or Architecture, click on Show advanced and make your modifications.
-
Optionally, you can Define interfaces.
-
Add disks if necessary by selecting Add disks.
-
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)
-
From the VM host’s details view, locate the ‘Take action’ drop-down menu and select ‘Compose’.
-
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.
- 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:
-
Choose the machine from the machine list.
-
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.
- How to add a VM
- Resource specifications
- Specifying architecture
- Storage parameters
- Defining interfaces
- Locating VM host IDs
- Deleting 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:
-
Creating a basic VM:
maas $PROFILE vm-host compose $VM_HOST_ID
-
Specifying resources:
maas $PROFILE vm-host compose $VM_HOST_ID cores=4 memory=8G
-
Setting architecture:
maas $PROFILE vm-host compose $VM_HOST_ID architecture=amd64
-
Adding storage:
maas $PROFILE vm-host compose $VM_HOST_ID disks=1:size=20G
-
Defining interfaces:
maas $PROFILE vm-host compose $VM_HOST_ID interfaces=0:space=default
-
Finding VM host IDs:
maas $PROFILE vm-hosts read
-
Deleting a VM:
maas $PROFILE machine delete $SYSTEM_ID
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.
Last updated a month ago.