Nutanix, Nutanix AHV

Creating VM Template in Nutanix AHV

One of the benifits of virtualization is using VM templates to create quick and fast multiple VMs from single template.

VMware provides you easy option to convert any VM to template and deploy VMs from the templates, Hyper-V provides with SCVMM.

But Nutanix AHV its easier with integrated Image management if you know how to.. so…

  1. Create a VM in AHV
  2. Install Nutanix VirtIO
  3. Customize the OS or configure.
  4. Shutdown the VM

To add the VM disk image to Image service, login to any of CVMs and use any below methods,

Method 1

acli image.create DISK_TEMPLATE_VM clone_from_vmdisk=vm:MASTER_VM_NAME:ide.1

here:

DISK_TEMPLATE_VM is as it should be displayed in AHV Image Configuration,

MASTER_VM_NAME is name of VM, template to be created from, followed by disk type and disk id e.g. ide.1 or scsi.0

Now you can create VM and use clone from AHV Image configuration.

Method 2

Use below commands to get VM disk UUID

acli vm.get MASTER_VM_NAME

or

vm.disk_get MASTER_VM_NAME

and look for UUID in the output as below for appropriate disk and disk type.

 vmdisk_uuid: "fae801fc-d24d-4909-9b32-be844ddc4b74"

To create image use below command:

image.create DISK_TEMPLATE_VM clone_from_vmdisk=fae801fc-d24d-4909-9b32-be844ddc4b74 image_type=kDiskImage

DISK_TEMPLATE_VM is as it should be displayed in AHV Image Configuration, and UUID from above commands.

Use Clone from Image Service when you create VMs using disk which are added to Image Configuration.

To customized the deployment refer to here for Windows Guest, here for Linux guest.

NOTE : In order to avoid issue with time reverting to UTC timezone after VM power cycle use below settings.

For  Windows Operating Systems

Configure the “RealTimeIsUniversal” registry key in the Windows guest OS (this should be the preferred method):

a. Open regedit
b. Navigate to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation
c. Create a new 32-bit DWORD. You can right-click white area and select New –> DWORD (32-bit Value)
d. Give the key the name RealTimeIsUniversal
e. Double-click on it and set the value to 1

Or in the command prompt with administrative right and run the following command:
reg add “HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation” /v RealTimeIsUniversal /d 1 /t REG_DWORD /f

For  Linux Operating Systems

If the UTC line in /etc/adjtime reads LOCAL, the hwclock command and the date command will display a difference in time. The timezone is reflected correctly, but since the /etc/adjtime file has been set to LOCAL, it is padding the local time as if the timezone was still set to UTC.

  • Use the cat command to check the /etc/adjtime file and verify that it says UTC instead of LOCAL. If it does not, use an editor of your choice and edit the file to read UTC.
  • Shutdown the VM and boot it back up.
  • Issue the command hwclock
  • Issue the command date
  • Confirm the values align.

 

 

Advertisements

One thought on “Creating VM Template in Nutanix AHV

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s