Managing KVM hypervisor and Virtual machines hosted by it are very much easy if you know what they are capable of. In this post we will see how to view different settings, Hardware info etc for both KVM hypervisor and Guest virtual machine details. Below the concepts already covered in this series.
- What is Virtualization in Linux way?
- Types of Virtualization available in Linux/Unix
- Advantages of Virtualization
- What is KVM virtualization in Linux?
- KVM Virtualization: Find Hardware support KVM/VMware ESXi or not?
- KVM virtualization: Install KVM hypervisor in Redhat/CentOS/Fedora Linux?
- KVM virtualization: Install KVM hypervisor in Ubuntu/Debian Linux?
- KVM virtualization: Install Ubuntu Linux as Guest OS in KVM hypervisor?
- KVM virtualization: Install Redhat/CentOS/Fedora as Guest OS in KVM hypervisor?
- KVM virtualization: Network(NAT) configuration in KVM hypervisor?
- KVM: Connect to a virtual machine(SSH, VNC, Console, virt-viewer etc)
- KVM: Start/stop/save/restart guest VM’s in Hypervisor
Get KVM Hypervisor details
Example1: Get KVM version installed on the host machine
Compiled against library: libvir 0.9.13
Using library: libvir 0.9.13
Using API: QEMU 0.9.13
Running hypervisor: QEMU 1.2.0
Example2: Get KVM Hypervisor(Host) Memory info
total : 8027952 KiB
free : 2772452 KiB
buffers: 264476 KiB
cached : 1677176 KiB
Example3: Get KVM Hypervisor CPU info
Note: The above numbers are in nanoseconds of time available for user/system/idle etc.
If you want we can even get individual CPU, if you have more than 1 CPU. Suppose if we want to get CPU2 details use –cpu 1 for that
virsh nodecpustats –cpu 1
How about getting the values in percentage of total CPU available?
virsh nodecpustats –percent
Example4: How to get number of Guest Virtual machines irrespective of state such as running, save, shutdown etc.
virsh list –all
Id Name State
1 BaseMachine running
– bt51 shut off
– centos-64 shut off
– Clusterbase shut off
– mint1 shut off
– node.linuxnix.com shut off
– node1.linuxnix.com shut off
– node2.linuxnix.com shut off
To get only running machines in KVM hypervisor
Id Name State
1 BaseMachine running
Example5: To get all the networks available for KVM hypervisor
Name State Autostart
default active yes
net1 active yes
net2 active yes
NewNAT active yes
To get info of particular network use below command
virsh net-info default
Get KVM Guest machine details
Example6: Get Hardware information of a KVM guest machine
virsh dominfo BaseMachine
OS Type: hvm
CPU time: 32.4s
Max memory: 1048576 KiB
Used memory: 1048576 KiB
Managed save: no
Security model: apparmor
Security DOI: 0
Security label: libvirt-78c48a29-7c2c-4b84-8968-198f8ed17db2 (enforcing)
Example7: Get guest machine CPU details like how many vCPU’s etc.
virsh vcpucount centos-64
maximum config 2
maximum live 2
current config 2
current live 2
Example8: Get guest machine RAM details
virsh dommemstat centos-64
Note: The above numbers in KB, so I assigned 3GB of RAM to this machine.
Example9: List all networks available for a VM
virsh domiflist centos-64
Interface Type Source Model MAC
vnet1 network default virtio 52:54:00:cf:99:0c
In our next post we will see on how to edit VM vCPU’s and RAM.
Latest posts by Surendra Anne (see all)
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018
- wget download a file to a directory in Linux/Unix - June 4, 2018
- GIT: How to compare two GIT branches? - June 3, 2018
- Online training on Linux Bash shell scripting - February 8, 2018