chiark / gitweb /
systemd-detect-virt: detect s390 virtualization
authorThomas Blume <Thomas.Blume@suse.com>
Fri, 18 Jul 2014 13:13:36 +0000 (09:13 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 18 Jul 2014 13:20:13 +0000 (09:20 -0400)
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.]

man/systemd.unit.xml
src/shared/virt.c

index 644758470611eafe914a3f6bbc220d903cb38c4e..86a8cbb330e8d3a5bf4e5afe0dc80b5fa35faf7e 100644 (file)
                                 virtualization solution, or one of
                                 <varname>qemu</varname>,
                                 <varname>kvm</varname>,
                                 virtualization solution, or one of
                                 <varname>qemu</varname>,
                                 <varname>kvm</varname>,
+                                <varname>zvm</varname>,
                                 <varname>vmware</varname>,
                                 <varname>microsoft</varname>,
                                 <varname>oracle</varname>,
                                 <varname>vmware</varname>,
                                 <varname>microsoft</varname>,
                                 <varname>oracle</varname>,
index 20a8d7c5bfc4287bdb6bbea0da1aac0a7bf4734a..b4368952ffac3d8f3dde431caff786e39f11a5b8 100644 (file)
@@ -220,6 +220,23 @@ int detect_vm(const char **id) {
                 goto finish;
         }
 
                 goto finish;
         }
 
+#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";
+                        r = 1;
+
+                        goto finish;
+                }
+        }
+#endif
+
         r = 0;
 
 finish:
         r = 0;
 
 finish: