Administering user VMs from the command line with virsh | Nutanix Community
Skip to main content

Let’s say you need to administer your user VMs from the command line interface.

 

The Controller VM resources are shown under the VM page In the Nutanix Prism, but you will not be able to change the resources configuration unless you connected to the Acropolis hypervisor (host) and modified the configurations using virsh.

 

virsh: is a command line interface tool for managing guests and the hypervisor.” Centos.org.

First you can review the settings of the CVM under the VM Page on Prism.

image1
 

image2

 

Connect to the Acropolis hypervisor (host) using the root account with password “nutanix/4u”

 

image3

Lists all the VMs on a host > virsh list –all

 

image5

Displays information about a VM > virsh dominfo VM_Name

 

image6

Displays information about the vCPU > virsh vcpuinfo VM_Name

 

image7

Sets the number of virtual processors > virsh setvcpus VM_name count

 

Note: The count value cannot exceed the number of processors specified for the guest.

 

image8

You can increase the number of processors by editing the virsh XML configuration file > virsh edit VM_Name

 

  • Change from command mode to insert mode by typing <i>.

  • Use the arrow keys to move to line “vcpu placement”, increase the value as required.

  • Go back to command mode by pressing <Esc>.

  • Save and exit by Typing <:wq>

image9

image10

 

Allocates memory for a guest > virsh setmem VM_Name count

You must specify the 0count] in kilobytes. The new count value cannot exceed the amount you specified when you created the guest. A higher maximum memory value will not affect the active guest unless the new value is lower which will shrink the available memory usage.

 

image11

image12

image13

Sets the maximum memory limit for a guest > virsh setmaxmem VM_Name

 

image14

image15

Shutdown the VM > virsh shutdown VM_Name

 

image16

image17

Starts an inactive VM > virsh start VM_Name

 

image18

Restarts the VM > virsh reboot VM_Name

 

image19

 

Check this video on TechTopX: Managing Controller VMs with virsh.

https://www.youtube.com/watch?v=9rDoOWPJXGU&feature=youtu.be