ryantimwilson / rpms / systemd

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