ryantimwilson / rpms / systemd

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