Nutanix Acropolis Hypervisor (AHV) – Create an Image Service Template from an Existing VM
This lesson will show you how to create an image service template from an existing virtual machine, without having to export/import the VM.
Setup a Template Virtual Machine
Setup a template virtual machine via Prism (eg: installing your software, patches, and anything else you need). Once the VM is ready, note the name of the VM for the following steps.
Can’t Use Image Service to "Import" an Existing VM..
Normally you’d think you could just go into the Image Configuration and find a way to "import" an existing virtual machine to make it available as a template.
In Prism, you can only create images by either specifying a location of the VM on the network or by uploading the VM from a location available to your computer. Unfortunately, there isn’t an option to just clone an existing Virtual Machine (yet anyway 🙂 ).
Create Image via Acropolis CLI (ACLI)
Thankfully we can create an image from an existing VM with 1 simple command. SSH into a Controller VM (CVM) and issue the following command:
acli image.create MyTemplateName clone_from_vmdisk=vm:Win2k12-msdn:scsi.0
Replace "MyTemplateName" with the name you want to use for the image.
Replace "Win2k12-msdn" with the name of your VM you want to make into an image.
If needed, replace "scsi.0" with the disk location of the VM’s primary disk.
VM Template Now Available in Image Configuration
Now, if you go back into Prism under the Image Configuration area, you will see the template image that we created above. You can now use this image to deploy other virtual machines.
The syntax of the command has changed slightly to:
image.create name-of-vm-template clone_from_vmdisk=vm:vm-name-to-clone:scsi.0
For Example (using spaces in VM name as well):
image.create Linux-CentOS-Template clone_from_vmdisk=vm:CentOS\ 7\ Minimal\ Template:scsi.0
Note- this will not work if Prism is registered to Prism Central starting in AOS 5.5 or greater. I’ll make a new post discussing that and will link here once completed.
was very excited about this write up until i read the note at the end. looking forward to your updated post for
Great tutorial! Any updates on how to do this if Prism is registered to Prism Central?
Starting in AOS 5.8 or greater, you can now use the above again even when Prism is registered with a Prism Central instance.
acli image.create “CentOS 7 Minimal Template” clone_from_vmdisk=vm:”CentOS 7 Minimal Template”:scsi.0
HI, if a VM configured with multiple SCSI adaptors and multiple disks attached to it, do we need to modify anything on the command line to create the image?
Hello, the first command for the first disk (eg: scsi.0) would be the same as above. Then you would add each additional disk to the same image by using the “acli image.update” command.
acli image.update “CentOS 7 Minimal Template” clone_from_vmdisk=vm:”CentOS 7 Minimal Template”:scsi.1
Repeat the command for each of the additional disks for the source VM (scsi.1, scsi.2, etc).