Question

Get all VM's of storage container in cvm with acli

  • 29 April 2021
  • 5 replies
  • 2337 views

Hi!

We are running about 100 vm’s in our cluster - so find out a specific information manually for each vm is pretty hard.

I want to get the information which vm’s are stored in a specific storage container with acli on cvm.

I know that i could perform acli vm.get <vm-name>  and look for the source_nfs_path of the vmdisks but it is way too much effort for 100 vm’s. 

Another way would be establishing a connection via SSH to /storage-container/.acropolis/vmdisk of of the cvm but i only see the vmdisk-uuids there, not the vm names i need.

Is there any possibility, maybe with a for loop on each vm and a grep filter?


5 replies

Userlevel 1
Badge +1

Did you ever find a solution to this?  I’d be interested to know

Userlevel 5
Badge +6

Hello @isvd and @MWStu 

List Virtual Disks

 

ncli> vdisk {} [="names" ] [="vm_id" ] [="ctr_id" ]

Required arguments

None

Optional arguments

names

A comma-separated list of the names of the Virtual Disks

vm-id

ID of a Virtual Machine that the Virtual Disk is mapped to

ctr-id

Get Virtual Disks in the specified Storage Container

 


<ncli> vdisk list

    Name                      : 0005f33e-7ed0-d3b4-8888::NFS:3:0:46
8
    Container ID              : 0005f33e-7ed0-d3b4-8888::1115
    Container Uuid            : 36a47405-df4f-4a95-b2ab888
    Max Capacity              : 120 GiB (128,849,018,880 bytes)
    Reserved Capacity         : -
    Read-only                 : false
    NFS File Name             : 9fc5329e-f2c1-4721-8447-2028888
    NFS Parent File Name (... : 9f02308b-78fd-45e6-98a8-7bdd8888
    Fingerprint On Write      : none
    On-Disk Dedup             : none
 

Userlevel 1
Badge +1

Thanks @Moustafa Hindawi  !

So I can use “ncli vdisk list” to create a list of VM disks and the container they are located on

How can I identify the VM the disk belongs to?  I have tried this command using the NFS File Name but don’t get any results

 

ncli vm list | grep “f2fecb12-eff3-46a1-96d8-9813ac78a8cd”

 

 

 Name                      : 0005e412-b5c0-wdffe-1c55-7cc255055495::NFS:4:0:621
    Container ID              : 0005e412-b5c0-dad9-1c55-7cc255055495::4749
    Container Uuid            : adbc8ae6-10cb-41be-9aba-54d50e7e4ff7
    Max Capacity              : 40 GiB (42,949,672,960 bytes)
    Reserved Capacity         : -
    Read-only                 : false
    NFS File Name             : f2fecb12-eff3-46a1-96d8-9813ac78a8cd
    NFS Parent File Name (... :
    Fingerprint On Write      : none
    On-Disk Dedup             : none

 

Userlevel 1
Badge +1

Maybe I should use Nutanix powershell

Userlevel 1
Badge +1

Using Nutanix powershell I have run these commands and then matched them up in Excel by the containerUUID value.

 

Get list of containers:

Get-NTNXContainer | select name, containerUuid

 

Get list of VMs and their containers

Get-NTNXVM | select vmName, containerUuids

Reply