basic/virt: Detect PowerVM hypervisor

Currently systemd-detect-virt fails to detect running under PowerVM.

Add code to detect PowerVM based on code in util-linux.

Signed-off-by: Michal Suchanek <msuchanek@suse.de>
This commit is contained in:
Michal Suchanek 2020-10-02 11:05:23 +02:00 committed by Zbigniew Jędrzejewski-Szmek
parent bf645844f7
commit 3224e38bb6
4 changed files with 14 additions and 1 deletions

View File

@ -62,7 +62,7 @@
</thead>
<tbody>
<row>
<entry valign="top" morerows="12">VM</entry>
<entry valign="top" morerows="13">VM</entry>
<entry><varname>qemu</varname></entry>
<entry>QEMU software virtualization, without KVM</entry>
</row>
@ -92,6 +92,11 @@
<entry>Oracle VM VirtualBox (historically marketed by innotek and Sun Microsystems), for legacy and KVM hypervisor</entry>
</row>
<row>
<entry><varname>powervm</varname></entry>
<entry>IBM PowerVM hypervisor - comes as firmware with some IBM POWER servers</entry>
</row>
<row>
<entry><varname>xen</varname></entry>
<entry>Xen hypervisor (only domU, not dom0)</entry>

View File

@ -1160,6 +1160,7 @@
<literal>vmware</literal>,
<literal>microsoft</literal>,
<literal>oracle</literal>,
<literal>powervm</literal>,
<literal>xen</literal>,
<literal>bochs</literal>,
<literal>uml</literal>,

View File

@ -93,6 +93,11 @@ static int detect_vm_device_tree(void) {
_cleanup_closedir_ DIR *dir = NULL;
struct dirent *dent;
if (access("/proc/device-tree/ibm,partition-name", F_OK) == 0 &&
access("/proc/device-tree/hmc-managed?", F_OK) == 0 &&
access("/proc/device-tree/chosen/qemu,graphic-width", F_OK) != 0)
return VIRTUALIZATION_POWERVM;
dir = opendir("/proc/device-tree");
if (!dir) {
if (errno == ENOENT) {
@ -679,6 +684,7 @@ static const char *const virtualization_table[_VIRTUALIZATION_MAX] = {
[VIRTUALIZATION_BHYVE] = "bhyve",
[VIRTUALIZATION_QNX] = "qnx",
[VIRTUALIZATION_ACRN] = "acrn",
[VIRTUALIZATION_POWERVM] = "powervm",
[VIRTUALIZATION_VM_OTHER] = "vm-other",
[VIRTUALIZATION_SYSTEMD_NSPAWN] = "systemd-nspawn",

View File

@ -22,6 +22,7 @@ enum {
VIRTUALIZATION_BHYVE,
VIRTUALIZATION_QNX,
VIRTUALIZATION_ACRN,
VIRTUALIZATION_POWERVM,
VIRTUALIZATION_VM_OTHER,
VIRTUALIZATION_VM_LAST = VIRTUALIZATION_VM_OTHER,