Best way to detect type of container virtualization, virt-what not reliable with Proxmox.?

seneca214

Active Member
Dec 3, 2012
26
3
43
Hello,

With previous versions of Proxmox, the 'virt-what' command worked well in determining what type of virtualization was used for the VM in question. We've noticed with Proxmox 4+, virt-what is no longer reliable - specifically with VMs that were migrated from OpenVZ to LXC. On our Proxmox nodes virt-what now only reports LXC containers if they were newly created on Proxmox 4 (not migrated from previous version). virt-what incorrectly outputs nothing on migrated LXC containers (indicating a physical machine). virt-what works fine with KVM, regardless.

Has anyone else noticed this issue with virt-what and Proxmox? We have all CentOS 6 and 7 containers (fully updated)

We currently use dmidecode output (or lack thereof) to determine if the VM is a container or not. Are there any better suggestions?

Thanks
 
Inside lxc containers the 'container' environment variable is set for init (process number 1):

# cat /proc/1/environ | tr \\0 \\n
...
container=lxc
...
 
Thank you.

Anyone else notice virt-what not working with Proxmox with converted/migrated OpenVZ->LXC containers?
 
Hello,

If it is a problem with virt-what, its only in regards to OpenVZ -> LXC migrated VMs. virt-what works fine with other CentOS physicial servers, KVM VMs and LXC VMs that weren't migrated.
 
To dig deeper, you can do a file level find of both machines and compare them. You could also look at the source code of virt-what to see how openvz is detected. Maybe it is some file in /etc/ that signals that it's openvz based.