Thursday 27 April 2017

Create and deploy AHV images

In this post I will explain how to make an AHV image, or template, that you can use for future deployments of VM on your AHV cluster. The first thing I will do is upload some ISO files so we can use them to build our VM.
  • Log into PRISM and select Image Configuration under the gear icon
  • Click upload image

  • Enter a name and annotation
  • Set Disk Type to iso
  • Select a destination datastore and select ISO file


  • Click Save and the upload procedure will start
  • Click close on the confirmation window
  • Repeat for other ISO
In this example we will be building a Windows 2012 R2 VM. The first thing you will need to do is download the VirtIO driver from the Nutanix portal. Once this has been done you will need to upload it to the Image Configuration as explained above. Without this driver you will not be able to install your Windows OS.
  • Go Home > VM > Create VM
  • Assign  a name as well as your desired compute details

  • Select the CD Rom and click the pencil icon
  • Set operation to "Clone from Image Service" and select the image you created previously

  • Add a second CD Rom and assign the VirtIO iso to it

  • Next we add another disk and this one is for the purpose of our VM's system disk
  • Set operation to "Allocate on container". Specify desired container and size

  • Last thing you will need to when creating a VM is adding a NIC. Click "Add new NIC" button. Assign it to correct VLAN


At this point we are ready to install the operating system. Power on the VM and follow the Windows screen prompts until you reach the screen for where to install Windows
  • Click Load Driver

  • Browse to the mounted virtio iso and select the folder for your OS
  • Select the drivers to install

  • You can now select the disk you added during VM creation process

  • Complete the Windows install
Now you can customize the windows install to your liking. I recommend you snapshot your VM before starting sysprep as this makes it easy to revert your changes.

  • From the command prompt in the C:\Windows\System32\Sysprep directory run the 'sysprep /generalize /shutdown /oobe' command. This will start the sysprep process.

  • The VM will shutdown once the process is complete.
You now have an image that you can clone or import in the image configuration so you can use it for future deployment of VM.

The image configuration does not allow for a VM to be imported through its GUI but you can do so via the acli
  • SSH into one of your CVM and go to acli interface. Enter the vm namespace
  • Retrieve the listing of your VM with vm.list command
  • Retrieve disk information from your vm with vm.disk_get <vmname>

  • To create an image we will be using the image.create command from the acli interface. You will need to specify the vmdisk_uid you retrieved above
  • Run the command  image.create "Template Windows2012 R2" clone_from_vmdisk=a74820ad-209d-4cee-8001-555bc1ab3647 image_type=kDiskImage
  • Run image.list and you should image listed.
  • In PRISM you can see that the image is listed in the Image Configuration GUI

  • Now when we deploy a new VM we will need to add a disk and specify to clone from image service and pick our new image

  • Configure the rest of the settings, such as network, to your liking
  • Enable the custom script checkbox and enter your sysprep script. I am not going into detail here about sysprep scripts but you can quickly generate one, as I did for this exercise, with the Windows Answer File Generator website


  • Power on your VM and launch its console.
  • All going well your VM should be customized according to your script.
If you are looking to clone VM rather than using image configuration you follow a similar process.
  • Select the VM you want to clone
  • Click on the clone link
  • Specify the amount of clones you want and a name. The other fields will be populated with the details of the machine you are cloning.

  • You can re-use the sysprep script again if you desire and click save
  • The process will start and in no time you will have your clones deployed

In a future post I will be re-utilizing my image for deployment with the Nutanix Self Service Portal

Friday 14 April 2017

Nutanix Self Service Restore (SSR)

The self service restore functionality in Nutanix has been around for a while but was driven from the cli until the release of AOS 5.0. Users will now have the ability to restore files and folders for themselves through a web interface that is accessible via a shortcut on their desktop.

Obviously you will need something to restore from and that would be your snapshots. It is assumed that you have a protection domain configured and that your VM is being protected. In  addition to that you will need to install the Nutanix Guest Tools onto your VM.

The self service restore is supported on both ESXi and AHV but my instructions are based on AHV and a Windows 2012 R2, which is only one of several supported OS.

  • Log into PRISM and go to Home > VM menu
  • Select your VM from the table and click the Mange Guest Tools link
  • Select all the options. This will require an empty cd-rom slot. Click submit

  • Log into your VM and click the setup installer from mounted cd-rom
  • Once the installer is finished you should see a shortcut on the desktop


  • Click shortcut and this will take you to the restore portal


  • Log in with your username and password. You will see the available snapshots

  • Click the snapshot you want to restore from. Select the disk and from disk action menu select mount. The disk will appear as mounted

  • Go into Windows explorer and you will notice that the snapshot is mounted under G: drive. 
  • This will allow you to copy files over from snapshot.Once done go back to portal and select the disk under mounted snapshots.

  • Click unmount and you are finished. Snapshots will auto unmount after 24 hours