«

»

Manage Nutanix Guest Tools For Cloned VMs

This blog post will cover how you can manage, enable, Nutanix Guest Tools (NGT) for cloned VMs instead of doing it manually for every new clone VM. A description of NGT can be found here.
The manual process is described in the Nutanix Prism Web Console GuideΒ but is you create multiple VMs it might be good to just run a script which will take care of the enablement for you.

Check out the Nutanix Guest Tools Report Via REST APIΒ blog post if you want to create a Nutanix Guest Tools report.

To verify what VMs have NGT enabled you can can use both cli and Prism UI where Prism UI will be per VM meaning a quite cumbersome task if you have many VMs

  • cli using the command “ncli ngt list”
  • Prism UI by clicking the “Manage Guest Tools” link under each VM and the below VM obviously got NGT enabled.

So if you want to clone a few VMs from the VM, win2012-demo-1, with NGT installed and then enable NGT for the newly cloned VMs you can follow the below steps:

  • Clone the VM with NGT installed. In my case I used acli since I used AHV:
    • acli vm.clone ngt01,ngt02,ngt03,ngt04 clone_from_vm=win2012-demo01
  • If you check the NGT status for the newly created VMs in Prism it will look like the below and you can enable NGT per VMs as previously said:
  • Copy, to a CVM, change the vmprefix variable to match your newly created VMs and finally run the scriptΒ to enable NGT on multiple VMs same time.
    • sh ngt.sh
  • If you list status for all VMs with NGT enabled you’ll see that the communication link between the VM and the Nutanix cluster is not established and that’s because the VMs are not powered on yet.
    • ncli ngt list
  • Power on the VMs using cli or Prism UI. In this case I used acli command:
    • acli vm.on ngt*
  • If you list the NGT status for the VMs again you’ll see that the communication link is up and running given communication is allowed from the network where the VM is placed and where the CVMs are running.

Script

Download from my GitHub repository or copy from below but the GitHub version will always hold the most up 2 date version.

#/bin/bash
# Script to enable Nutanix Guest Tools for cloned VMs.
# Author: Magnus Andersson - Sr Staff Solutions Architect @Nutanix
#
# ----Script Edit section starts here----
# Specify the VM prefix for the VMs you will enable NGT
vmprefix="ngt"
#
# ----Script Edit section ends here----
#
ngtvms=`ncli vm list | grep -B 1 $vmprefix | grep -v Name | awk -F ":" '{print $2}' | awk -F "[[:space:]]*" '{print $0}'`
for i in $ngtvms ; do
echo Enable NGT on VM with Uuid $i
ncli ngt mount vm-id=$i
done

This script has been tested on AOS version 5.6, AHV version 20170830.115 and ESXi version 6.5 U3.

2 pings

Comments have been disabled.