How to determine the type of VM from inside the VM in OVM x86 ?

We know that in case of OVM we are dealing with three types of VMs. To determine the type of VM we are taking the OVM GUI after that we are checking the type of VM. We can do the same thing at VM level as well. This method can help to quickly response on your bridge call.

  • HVM
  • PVM
  • HVM with PV drivers.

Case 1 : HVM (Hyper Virtual Machine)

In this case VM is not customized to run in Virtual envirnoment. Below are the method to verify from inside the VM nature of VM.

We can check the dmesg.

vm-hvm01 ~> dmesg | grep -i xen
ACPI: RSDP 00000000000ea020 00024 (v02 Xen)
ACPI: XSDT 00000000fc00eaa0 00034 (v01 Xen HVM 00000000 HVML 00000000)
ACPI: FACP 00000000fc00e8c0 000F4 (v04 Xen HVM 00000000 HVML 00000000)
ACPI: DSDT 00000000fc002c40 0BBF1 (v02 Xen HVM 00000000 INTL 20110112)
ACPI: APIC 00000000fc00e9c0 000D8 (v02 Xen HVM 00000000 HVML 00000000)

If we look at module we will find that the module which we are using is the kernel module not any customized module.

vm-hvm01 ~> cat /etc/modprobe.conf | grep -i eth0
alias eth0 8139cp

vm-hvm01 ~> modinfo 8139cp
filename: /lib/modules/2.6.32-100.26.2.el5/kernel/drivers/net/8139cp.ko
license: GPL
version: 1.3
description: RealTek RTL-8139C+ series 10/100 PCI Ethernet driver
author: Jeff Garzik <jgarzik@pobox.com>
srcversion: 93DF48CB0077E555C8819AE
alias: pci:v00000357d0000000Asv*sd*bc*sc*i*
alias: pci:v000010ECd00008139sv*sd*bc*sc*i*
depends: mii
vermagic: 2.6.32-100.26.2.el5 SMP mod_unload modversions
parm: debug:8139cp: bitmapped message enable number (int)
parm: multicast_filter_limit:8139cp: maximum number of filtered multicast addresses (int)

Further we can check the hwconfiguration of VM using below command.

vm-hvm01 ~> cat /etc/sysconfig/hwconf | grep -i qemu
desc: “ATA QEMU HARDDISK”
desc: “ATA QEMU HARDDISK”

Case 2 PVM (Para Virtualized Machine)

We are not seeing thing related to HVM in dmesg.

[root@phl3dsmfdb02 ~]# dmesg | grep -i xen
Xen: 0000000000000000 – 00000000000a0000 (usable)
Xen: 00000000000a0000 – 0000000000100000 (reserved)
Xen: 0000000000100000 – 0000001580000000 (usable)
#1 [000d4bb000 – 000d52a000] XEN PAGETABLES ==> [000d4bb000 – 000d52a000]
#5 [00028b8000 – 000d4bb000] XEN START INFO ==> [00028b8000 – 000d4bb000]
Booting paravirtualized kernel on Xen
Xen version: 4.1.3OVM (preserve-AD)
Xen: using vcpu_info placement
Xen: using vcpuop timer interface
installing Xen timer for CPU 0
installing Xen timer for CPU 1
installing Xen timer for CPU 2
installing Xen timer for CPU 3
xen_balloon: Initialising balloon driver.
Switching to clocksource xen
input: Xen Virtual Keyboard as /class/input/input1
input: Xen Virtual Pointer as /class/input/input2
XENBUS: Device with no driver: device/vbd/51712
XENBUS: Device with no driver: device/vbd/51728
XENBUS: Device with no driver: device/vbd/51744
XENBUS: Device with no driver: device/vbd/51760
XENBUS: Device with no driver: device/vbd/51776
XENBUS: Device with no driver: device/vif/0
XENBUS: Device with no driver: device/vif/1
XENBUS: Device with no driver: device/vif/2
We can see the module configuration file to check the status of modules and we can clearly see that we are using xen modules.

[root@phl3dsmfdb02 ~]# cat /etc/modprobe.conf
alias eth0 xennet
alias scsi_hostadapter xenblk

[root@phl3dsmfdb02 ~]# lsmod | grep -i xen
xen_netfront 16356 0
xen_blkfront 12731 13

[root@phl3dsmfdb02 ~]# modinfo xen_netfront
filename: /lib/modules/2.6.32-100.26.2.el5/kernel/drivers/net/xen-netfront.ko
alias: xennet
alias: xen:vif
license: GPL
description: Xen virtual network device frontend
srcversion: 770DD0C26EFB5A5D1CAA2A9
depends:
vermagic: 2.6.32-100.26.2.el5 SMP mod_unload modversions

Another verification step can be checking the hardware configuration file.

root@phl3dsmfdb02 ~]# cat /etc/sysconfig/hwconf

class: OTHER
bus: PSAUX
detached: 0
driver: pcspkr
desc: “PC Speaker”

class: OTHER
bus: PSAUX
detached: 0
desc: “Xen Virtual Pointer”

class: NETWORK
bus: XEN
detached: 0
device: eth0
driver: xennet
desc: “Xen Virtual Ethernet”
network.hwaddr: 00:16:3e:5d:9e:0d

class: MOUSE
bus: PSAUX
detached: 0
device: input/mice
driver: generic3ps/2
desc: “Macintosh mouse button emulation”

class: VIDEO
bus: XEN
detached: 0
device: fb0
driver: xenfb
desc: “Xen Virtual Framebuffer”
video.xdriver: fbdev

class: HD
bus: XEN
detached: 0
device: xvda
driver: xenblk
desc: “Xen Virtual Block Device”

class: KEYBOARD
bus: PSAUX
detached: 0
desc: “Xen Virtual Keyboard”

Case 3 : HVM with PV drivers

If you take first look you will say this is HVM machine but its not.

[root@phl3fisndb03 ~]# dmesg | grep -i xen
DMI: Xen HVM domU, BIOS 4.1.3OVM 02/22/2014
Hypervisor detected: Xen HVM
Xen version 4.1.
Xen Platform PCI: I/O protocol version 1
Netfront and the Xen platform PCI driver have been compiled for this kernel: unp lug emulated NICs.
Blkfront and the Xen platform PCI driver have been compiled for this kernel: unp lug emulated disks.
ACPI: RSDP 00000000000ea020 00024 (v02 Xen)
ACPI: XSDT 00000000fc00eaa0 00034 (v01 Xen HVM 00000000 HVML 00000000)
ACPI: FACP 00000000fc00e8c0 000F4 (v04 Xen HVM 00000000 HVML 00000000)
ACPI: DSDT 00000000fc002c40 0BBF1 (v02 Xen HVM 00000000 INTL 20110112)
ACPI: APIC 00000000fc00e9c0 000D8 (v02 Xen HVM 00000000 HVML 00000000)
Booting paravirtualized kernel on Xen HVM
xen:events: Xen HVM callback vector for event delivery is enabled

If you see the module it belongs to xen hypervisor. So finally it become HVM with PV drivers.

[root@phl3fisndb03 ~]# lsmod | grep -i xen
xen_netfront 21082 0
xen_blkfront 21314 4
[root@phl3fisndb03 ~]# modinfo xen_netfront
filename: /lib/modules/3.8.13-16.3.1.el6uek.x86_64/kernel/drivers/net/xen-netfront.ko
alias: xennet
alias: xen:vif
license: GPL
description: Xen virtual network device frontend
srcversion: 8072CF1E596590C4EC5603F
depends:
intree: Y
vermagic: 3.8.13-16.3.1.el6uek.x86_64 SMP mod_unload modversions
[root@phl3fisndb03 ~]# modinfo xen_blkfront
filename: /lib/modules/3.8.13-16.3.1.el6uek.x86_64/kernel/drivers/block/xen-blkfront.ko
alias: xenblk
alias: xen:vbd
alias: block-major-202-*
license: GPL
description: Xen virtual block device frontend
srcversion: 391F354010EE075E7AA3A79
depends:
intree: Y
vermagic: 3.8.13-16.3.1.el6uek.x86_64 SMP mod_unload modversions
parm: max:Maximum amount of segments in indirect requests (default is 32) (int)

I hope this will help you  while troubleshooting 🙂

Advertisements

One thought on “How to determine the type of VM from inside the VM in OVM x86 ?

  1. Pingback: How to tell if your guest VM is vulnerable to Venom | Steve Harville's Blog

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 )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s