2014-06-18 15:37:26 +02:00
|
|
|
bnc#880438 - systemd-detect-virt doesn't work on System z
|
|
|
|
|
|
|
|
--- systemd-210/src/shared/virt.c
|
2014-06-27 10:18:35 +02:00
|
|
|
+++ systemd-210/src/shared/virt.c 2014-06-26 07:55:30.081608729 +0000
|
|
|
|
@@ -196,6 +196,30 @@
|
2014-06-18 15:37:26 +02:00
|
|
|
} else
|
|
|
|
return r;
|
|
|
|
|
|
|
|
+#if defined(__s390x__)
|
|
|
|
+ /* First layer virtualization (PR/SM) is always present on s390x */
|
|
|
|
+ _id = "PR/SM";
|
|
|
|
+ r = 1;
|
|
|
|
+
|
|
|
|
+ /* Check for second layer virtualization */
|
|
|
|
+ _cleanup_fclose_ FILE *f = NULL;
|
|
|
|
+ char line[LINE_MAX];
|
|
|
|
+ f = fopen("/proc/sysinfo", "re");
|
|
|
|
+ if (f) {
|
|
|
|
+ FOREACH_LINE(line, f, return -errno) {
|
|
|
|
+ if (startswith(line, "VM00 Control Program:")) {
|
|
|
|
+ if (strstr(line,"z/VM"))
|
|
|
|
+ _id = "z/VM";
|
2014-06-27 10:18:35 +02:00
|
|
|
+ else if (strstr(line,"KVM/Linux"))
|
|
|
|
+ _id = "KVM";
|
2014-06-18 15:37:26 +02:00
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ goto finish;
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
/* this will set _id to "other" and return 0 for unknown hypervisors */
|
|
|
|
r = detect_vm_cpuid(&_id);
|
|
|
|
if (r != 0)
|