AHV, English, Technology

Feature: AHV scripted virtual machine installation

This blog is about a feature that is truly a pearl in the feature set of AHV. AHV is Nutanix’s own hypervisor based on KVM. Nutanix stripped out all unnecessary components like shared storage features and build the hypervisor from the ground up with an enterprise grade feature set.

One of the AHV features is “VM scripted install”. When you create a VM, there is the option presented in the creation wizard to add an “autounattend.xml” file. This XML file will do a fully unattended installation of for example Windows. This blog post is about how to setup the VM create wizard to do a Windows 2019 unattended installation from an ISO file in combination with the VirtIO drivers. The VirtIO drivers are necessary so that Windows understands the Nutanix Distributed Storage Fabric (DSF). You can download the VirtIO ISO file from the Nutanix portal.

Before you begin with the “Create VM” wizard, you need to upload a Windows 2019 and VirtIO ISO file to the AHV “Image Service”.

  1. Go to Prism and login
  2. Go to the settings dashboard and click “Upload Image”

Make sure you upload both images as “Image Type” ISO. When the upload is done, go to the VM dashboard in Prism.

  1. In the VM dashboard click on “Create VM” at the right hand topside
  2. Fill in the name of the VM
  3. Specify the amount of vCPU and memory for the VM

The wizard automatically adds a CD-ROM to the VM. For the unattended installation we need 2 x CD-ROMs and 1 x vdisk for the Windows installation.

  1. Click edit on the existing CD-ROM
  2. Select at “Operation” field: “Clone from Image Service”
  3. Select at “Image” field: the uploaded Windows ISO file
  4. Click “Update”
  5. Click “Add new disk” and select “Type” CD-ROM
  6. Select at “Operation” field: “Clone from Image Service”
  7. Select at “Image” field: the uploaded VirtIO ISO file
  8. Click “Add”
  9. Click “Add new disk” and select “Type” DISK
  10. Select at “Operation” field: “Allocate on Storage Container”
  11. Select at “Storage Container” field: “Default” container (or another container that you created)
  12. Specify the size of the disk in the field “Size GiB” and click “Add”

Above configuration looks as follows:

Now that we specified the Name, Resources and disks we can add a Network Interface to the VM.

  1. Scroll down and click “+ Add New NIC”
  2. Select a network from the field “Network Name”
  3. Click “Add”

After we added the NIC to the VM we can enable the VM Script feature.

  1. Select “Custom Script”
  2. Select option “Upload a File”
  3. Click “Save”

This configuration looks like this:

Attached you find an example XML file which can be uploaded with this option. It is also possible to copy the XML content and paste it in the option field: “Type Or Paste Script”.

The VM is created and can now be “Powered On” in Prism. After the VM is powered on the option “Launch Console” can be used to watch the installation process of the VM.

An unattended installation is often the first step when creating a template VM. With this custom script feature you don’t need an automation framework to setup first.