Import Virtual Machines in CloudStack

Import Virtual Machines in CloudStack

Since CloudStack 4.14 it has been possible to import virtual machines (VMs) from a vSphere cluster directly into CloudStack, which introduced the concept of managed and unmanaged VMs. Managed VMs are those controlled by CloudStack, whereas unmanaged VMs have been either deployed directly on the hypervisor or removed from CloudStack (using the unmanageVirtualMachine API).
To work with these unmanaged and managed VMs the following APIs are available, but there was no support in the UI:

  • listUnmanagedInstances: list all unmanaged VMs (for a vSphere cluster)
  • importUnmanagedInstance: import an unmanaged VM (from vSphere cluster) into CloudStack

With the next LTS release of CloudStack a new ‘Import-Export Instances’ tool has been added to the UI for listing and importing unmanaged VMs.
unmanageVirtualMachine (un-manage / export a VM running on a VMware host) was added in 4.15.1, and supported in the UI, but we have added it to the tool so all these related functions are in the same place in the UI.

Import-Export page in the UI

The Import-Export Instances tool shows all managed and unmanaged VMs for a selected vSphere cluster. This page is accessible only to Admin accounts as the corresponding import and unmanage APIs are also admin-only.
For un-managing managed instances, the operator can select multiple instances, and on confirmation, the selected VMs are un-managed from CloudStack and moved from the managed instances list to the unmanaged instance list. The VM instance continues to exist on the hypervisor host, and no changes are made to the VM on the hypervisor.

UI for selecting multiple instances for unmanaging

While importing an unmanaged instance, the UI shows the Import Instance form, showing details of the VM from vCenter and all appropriate parameters for CloudStack to use after import. Once imported, the VM is manageable in CloudStack and shows up in the managed instances list. The operator needs to be mindful of a few prerequisites while importing an unmanaged instance which can be found here. The Import Instance form in the UI tries to automatically assign a number of parameters such as template, service offering, disk offerings for data disks, networks for NICs, etc., which can be manually defined if necessary. This makes the import process much easier compared to using the API.

Import instance form in the UI

These additions to the UI simplify importing and un-managing / exporting VMware VMs. Furthermore, these additions bring the concept of Tools in the CloudStack UI and in the future new actions and tools for facilitating CloudStack usage could be added there. These changes will be available in the next LTS release, scheduled for Q4 2021.


Related Posts:

Download a step-by-step guide to migrate your existing vSphere environment to a robust IaaS cloud environment based on Apache CloudStack and the KVM Hypervisor, ensuring a smooth, low-friction migration journey.