Nutanix – How to register a disk image in Prism Central

Since AOS 5.5 the Self Service Portal and therefore the image management has moved to Prism Central.

When you want to register a disk image from a VM from one of your AHV clusters to Prism Central you have to use the NFS path to the image.

For example:

nfs://<clusterip>/container_1/.acropolis/vmdisk/01c96451-1e72-4f0d-a8f5-d15ed90227a4

 

how to get the image path from my VM image?

in this case I want to get the image path from the VM with the name Centos_Base_Image

therefore I have to connect to any CVM in the cluster and use an acli command:

:~$ acli vm.get Centos_Base_Image include_vmdisk_paths=true
Centos_Base_Image {
config {
agent_vm: False
allow_live_migrate: True
disk_list {
addr {
bus: “ide”
index: 0
}
cdrom: True
device_uuid: “9691bb69-3051-4981-b94a-edb05ce098a9”
empty: True
}
disk_list {
addr {
bus: “scsi”
index: 0
}
container_id: 1277
container_uuid: “8a2b6760-d08e-44d9-bafb-7451fb186d04”
device_uuid: “0fb03dcd-3c35-4c61-8741-8e9e91e58259”
vmdisk_nfs_path: “/container_1/.acropolis/vmdisk/01c96451-1e72-4f0d-a8f5-d15ed90227a4
vmdisk_size: 8589934592
vmdisk_uuid: “01c96451-1e72-4f0d-a8f5-d15ed90227a4”
}

and here it is: /container_1/.acropolis/vmdisk/01c96451-1e72-4f0d-a8f5-d15ed90227a4

now just add “nfs://<clusterip>” before and you got it.

To make my life easier I wrote some lines of bash code to generate the image path:

imgname='Centos_Base_Image'
clusterip=`ncli cluster get-params | grep 'External IP Address' | awk '{print $5}'`
nfspath=`acli vm.get $imgname  include_vmdisk_paths=true | grep nfs_path | awk '{print $2}' | sed 's/"//g'`
echo 'nfs://'$clusterip'/'$nfspath

Example:

nutanix@NTNX–C-CVM:10.x.y.71:~$ imgname=’Centos_Base_Image’
nutanix@NTNX–C-CVM:10.x.y.71:~$ clusterip=`ncli cluster get-params | grep ‘External IP Address’ | awk ‘{print $5}’`
nutanix@NTNX–C-CVM:10.x.y.71:~$ nfspath=`acli vm.get $imgname include_vmdisk_paths=true | grep nfs_path | awk ‘{print $2}’ | sed ‘s/”//g’`
nutanix@NTNX–C-CVM:10.x.y.71:~$ echo ‘nfs://’$clusterip’/’$nfspath
nfs://10.11.11.60//container_1/.acropolis/vmdisk/01c96451-1e72-4f0d-a8f5-d15ed90227a4

Now I can add the image in Prism Central using the URL:

123

I’m pretty sure that we will see some improvements for this process in one of the upcoming releases.

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 )

Google photo

You are commenting using your Google 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 )

Connecting to %s