From 50bb38a3dc24eb252097e958387d5a7075717a5a Mon Sep 17 00:00:00 2001 From: Thomas Blume Date: Fri, 18 Jul 2014 09:13:36 -0400 Subject: [PATCH] systemd-detect-virt: detect s390 virtualization A system that is running on a logical partition (LPAR) provided by PR/SM has access to physical hardware (except CPU). It is true that PR/SM abstracts the hardware, but only for sharing purposes. Details are statet at: http://publib.boulder.ibm.com/infocenter/eserver/v1r2/topic/eicaz/eicazzlpar.htm -->-- In other words, PR/SM transforms physical resources into virtual resources so that many logical partitions can share the same physical resources. --<-- Still, from the OS point of view, the shared virtual resource is real hardware. ConditionVirtualization must be set to false if the OS runs directly on PR/SM (e.g. in an LPAR). [zj: reorder code so that variables are not allocated when #if-def is false. Add commit message.] Conflicts: src/shared/virt.c (cherry picked from commit f41925b4e442a34c93ad120ef1426c974a047ed1) Resolves: #1139149 --- man/systemd.unit.xml | 1 + src/shared/virt.c | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml index 4704352..c500953 100644 --- a/man/systemd.unit.xml +++ b/man/systemd.unit.xml @@ -969,6 +969,7 @@ virtualization solution, or one of qemu, kvm, + zvm, vmware, microsoft, oracle, diff --git a/src/shared/virt.c b/src/shared/virt.c index 4f8134a..5466d97 100644 --- a/src/shared/virt.c +++ b/src/shared/virt.c @@ -175,6 +175,22 @@ int detect_vm(const char **id) { return 1; } +#if defined(__s390__) + { + _cleanup_free_ char *t = NULL; + + r = get_status_field("/proc/sysinfo", "VM00 Control Program:", &t); + if (r >= 0) { + if (streq(t, "z/VM")) + _id = "zvm"; + else + _id = "kvm"; + + return 1; + } + } +#endif + return 0; }