-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide information about running in a Virtual Machine #1103
Comments
I doubt there is a standardized way to do this on Linux, let alone on other platforms. Also, we're dealing with different independent technologies (virtualbox, xen, etc.), so each one is free to provide its own method to determine this, and that same method (such as relying on |
I can't recall why I opened this issue, but these days |
|
Possible fallback / solution to detect vmware in a "cross-platform" fashion (utility needs to be installed though): import subprocess, shutil
if shutil.which("vmware-checkvm"):
code = subprocess.call(["vmware-checkvm"], stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
if code == 0:
return "vmware" Source code: https://github.com/vmware/open-vm-tools/blob/master/open-vm-tools/checkvm/checkvm.c |
I would like to see something as
psutil.virtualized
added to psutil if that falls in the use case of the library.An ugly example implementation:
This however does not determine the virtualisation method such as vmware, kvm, lxc.
There are some alternatives available such as virt-what, dmidecode or systemd-detect-virt.
Some background info.
http://unix.stackexchange.com/questions/89714/easy-way-to-determine-virtualization-technology
The text was updated successfully, but these errors were encountered: