Tuesday, January 26, 2016

Nutanix Acropolis Hypervisor - Adding VMs to Image Service

If you've read my previous posts, you'll see I've provided instructions for building a new VM in Acropolis Hypervisor (AHV), as well as bringing a VM from ESXi into AHV. This post is going to focus on turning one of those VMs into an image (that's Nutanix for "Template") so that you can build new VMs from it quickly and easily as needed.

This post assumes you've already got a Windows VM built, either new or imported from ESXi. In either case, now would be a good time to patch it and make any other updates that you've been putting off.

Once you're ready to clone this VM, make sure to run Sysprep to generalize the Windows OS.

While the new and improved Image Service allows you to upload ISOs and disks using Prism, it doesn't allow you to add a VM that's already running on Nutanix to Image Service that way. For that you'll need to roll up your sleeves and use the Acropolis Command Line Interface (acli).

Login to any Controller VM (CVM) via SSH.
Type acli and press enter.
The first thing we need is the UUID of the vmdisk, so for that we'll use the vm.disk_get command. Like any good cli, you can use the tab key to auto populate information. If you type vm.disk_get and hit tab you'll see the names of all VMs in your cluster.

<acropolis> vm.disk_get
TestVM        W2K12R2-Test  blmpower1

Start typing the name of the VM you want to query and press tab again to fill in the rest.

<acropolis> vm.disk_get W2K12R2-Test
addr {
  bus: "ide"
  index: 0
}
cdrom: true
empty: true
addr {
  bus: "scsi"
  index: 0
}
vmdisk_uuid: "69df5abd-6570-4ce1-ba77-2d117c3df7e5"
source_vmdisk_uuid: "d6c7a984-421c-403e-b579-4885961c698d"
container_id: 8
vmdisk_size: 42949672960

Here you see the vmdisk_uuid. Select the whole string inside of the quotes.

Now use the image.create command (covered in a previous post) to create a new image using the existing disk.

<acropolis> image.create W2K12R2-Template clone_from_vmdisk=69df5abd-6570-4ce1-ba77-2d117c3df7e5 image_type=kDiskImage
ImageCreate: complete

Now when you click the gear icon in Prism and select Image Configuration, you'll see the new image listed there. Now it can be selected straight from Image Service by anyone who needs it when building a new VM.


No comments:

Post a Comment