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