From 6db7ff91293a6fa3a27d125e3f4e5dfeef0145528f97a7d7cf0b1d198568d867 Mon Sep 17 00:00:00 2001 From: James Fehlig Date: Wed, 13 Mar 2019 23:35:01 +0000 Subject: [PATCH] Accepting request 684801 from home:jfehlig:branches:Virtualization - hook: encode incoming XML to UTF-8 before passing to lxml etree fromstring method Modifed suse-qemu-domain-hook.py boo#1123642 - libxl: change autoballooning default to disabled suse-libxl-disable-autoballoon.patch jsc#SLE-3059 - conf: add new 'xenbus' controller type 09eb1ae0-conf-add-xenbus-controller.patch - libxl: support Xen's max_grant_frames setting with maxGrantFrames attribute on the xenbus controller fb059757-libxl-add-xenbus-controller.patch, ec5a1191-libxl-support-max-grant-frames.patch, 5a64c202-xenconfig-support-max-grant-frames.patch bsc#1126325 - Replace patches with upstream variants Old: 0001-apparmor-Check-libvirtd-profile-status-by-name.patch, 0001-qemu-Fix-query-cpus-fast-target-architecture-detecti.patch New: 411cdaf8-apparmor-check-profile-name.patch, 696239ba-qemu-fix-query-cpus-fast.patch OBS-URL: https://build.opensuse.org/request/show/684801 OBS-URL: https://build.opensuse.org/package/show/Virtualization/libvirt?expand=0&rev=740 --- ...heck-libvirtd-profile-status-by-name.patch | 46 - ...pus-fast-target-architecture-detecti.patch | 40 - 09eb1ae0-conf-add-xenbus-controller.patch | 201 +++ 411cdaf8-apparmor-check-profile-name.patch | 45 + ...2-xenconfig-support-max-grant-frames.patch | 170 ++ 696239ba-qemu-fix-query-cpus-fast.patch | 38 + ec5a1191-libxl-support-max-grant-frames.patch | 184 +++ fb059757-libxl-add-xenbus-controller.patch | 1468 +++++++++++++++++ libvirt.changes | 38 + libvirt.spec | 18 +- libxl-set-cach-mode.patch | 4 +- libxl-support-block-script.patch | 8 +- suse-libxl-disable-autoballoon.patch | 81 + suse-qemu-domain-hook.py | 2 +- 14 files changed, 2246 insertions(+), 97 deletions(-) delete mode 100644 0001-apparmor-Check-libvirtd-profile-status-by-name.patch delete mode 100644 0001-qemu-Fix-query-cpus-fast-target-architecture-detecti.patch create mode 100644 09eb1ae0-conf-add-xenbus-controller.patch create mode 100644 411cdaf8-apparmor-check-profile-name.patch create mode 100644 5a64c202-xenconfig-support-max-grant-frames.patch create mode 100644 696239ba-qemu-fix-query-cpus-fast.patch create mode 100644 ec5a1191-libxl-support-max-grant-frames.patch create mode 100644 fb059757-libxl-add-xenbus-controller.patch create mode 100644 suse-libxl-disable-autoballoon.patch diff --git a/0001-apparmor-Check-libvirtd-profile-status-by-name.patch b/0001-apparmor-Check-libvirtd-profile-status-by-name.patch deleted file mode 100644 index b2192d1..0000000 --- a/0001-apparmor-Check-libvirtd-profile-status-by-name.patch +++ /dev/null @@ -1,46 +0,0 @@ -From b1a50c10c95747dacd31a23b5c73ec4f938af329 Mon Sep 17 00:00:00 2001 -From: Jim Fehlig -Date: Fri, 1 Mar 2019 14:34:17 -0700 -Subject: [PATCH 1/2] apparmor: Check libvirtd profile status by name - -Commit a3ab6d42 changed the libvirtd profile to a named profile, -breaking the apparmor driver's ability to detect if the profile is -active. When the apparmor driver loads it checks the status of the -libvirtd profile using the full binary path, which fails since the -profile is now referenced by name. If the apparmor driver is -explicitly requested in /etc/libvirt/qemu.conf, then libvirtd fails -to load too. - -Instead of only checking the profile status by full binary path, -also check by profile name. The full path check is retained in case -users have a customized libvirtd profile with full path. - -Signed-off-by: Jim Fehlig ---- - src/security/security_apparmor.c | 12 +++++++++--- - 1 file changed, 9 insertions(+), 3 deletions(-) - -Index: libvirt-5.1.0/src/security/security_apparmor.c -=================================================================== ---- libvirt-5.1.0.orig/src/security/security_apparmor.c -+++ libvirt-5.1.0/src/security/security_apparmor.c -@@ -257,10 +257,16 @@ use_apparmor(void) - if (access(APPARMOR_PROFILES_PATH, R_OK) != 0) - goto cleanup; - -+ /* First check profile status using full binary path. If that fails -+ * check using profile name. -+ */ - rc = profile_status(libvirt_daemon, 1); -- /* Error or unconfined should all result in -1*/ -- if (rc < 0) -- rc = -1; -+ if (rc < 0) { -+ rc = profile_status("libvirtd", 1); -+ /* Error or unconfined should all result in -1*/ -+ if (rc < 0) -+ rc = -1; -+ } - - cleanup: - VIR_FREE(libvirt_daemon); diff --git a/0001-qemu-Fix-query-cpus-fast-target-architecture-detecti.patch b/0001-qemu-Fix-query-cpus-fast-target-architecture-detecti.patch deleted file mode 100644 index d38c8d3..0000000 --- a/0001-qemu-Fix-query-cpus-fast-target-architecture-detecti.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 85001fd799deb33338aed627b3c3a6870cb70d2d Mon Sep 17 00:00:00 2001 -From: Viktor Mihajlovski -Date: Fri, 1 Mar 2019 11:29:51 +0100 -Subject: [PATCH] qemu: Fix query-cpus-fast target architecture detection - -Since qemu 2.13 reports the target architecture in a property called -'target' additionally to the property 'arch', that has been used in -qemu 2.12 in the response data of 'query-cpus-fast'. -Libvirts monitor code prefers the 'target' property over 'arch'. - -At least for s390(x), target is reported as 's390x' while arch is 's390'. -In a later step a comparison is performed against 's390' which fails for -qemu 2.13 and later. - -In consequence the architecture specific data for s390 won't be extracted -from the returned data, leading to incorrect values being reported by -virsh domstats --vcpu. - -Changing to check explicitly for 's390' and 's390x'. - -Signed-off-by: Viktor Mihajlovski -Reviewed-by: Bjoern Walk -Reviewed-by: Boris Fiuczynski ---- - src/qemu/qemu_monitor_json.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: libvirt-5.1.0/src/qemu/qemu_monitor_json.c -=================================================================== ---- libvirt-5.1.0.orig/src/qemu/qemu_monitor_json.c -+++ libvirt-5.1.0/src/qemu/qemu_monitor_json.c -@@ -1772,7 +1772,7 @@ qemuMonitorJSONExtractCPUInfo(virJSONVal - goto cleanup; - - /* process optional architecture-specific data */ -- if (STREQ_NULLABLE(arch, "s390")) -+ if (STREQ_NULLABLE(arch, "s390") || STREQ_NULLABLE(arch, "s390x")) - qemuMonitorJSONExtractCPUS390Info(entry, cpus + i); - } - diff --git a/09eb1ae0-conf-add-xenbus-controller.patch b/09eb1ae0-conf-add-xenbus-controller.patch new file mode 100644 index 0000000..e815345 --- /dev/null +++ b/09eb1ae0-conf-add-xenbus-controller.patch @@ -0,0 +1,201 @@ +commit 09eb1ae0ec7e592133eb98f4a0fe2f6daa5ba2d9 +Author: Jim Fehlig +Date: Wed Mar 6 15:59:29 2019 -0700 + + conf: Add a new 'xenbus' controller type + + xenbus is virtual controller (akin to virtio controllers) for Xen + paravirtual devices. Although all Xen VMs have a xenbus, it has + never been modeled in libvirt, or in Xen native VM config format + for that matter. + + Recently there have been requests to support Xen's max_grant_frames + setting in libvirt. max_grant_frames is best modeled as an attribute + of xenbus. It describes the maximum IO buffer space (or DMA space) + available in xenbus for use by connected paravirtual devices. This + patch introduces a new xenbus controller type that includes a + maxGrantFrames attribute. + + Signed-off-by: Jim Fehlig + Reviewed-by: Daniel P. Berrangé + +Index: libvirt-5.1.0/docs/formatdomain.html.in +=================================================================== +--- libvirt-5.1.0.orig/docs/formatdomain.html.in ++++ libvirt-5.1.0/docs/formatdomain.html.in +@@ -4108,6 +4108,7 @@ + <driver iothread='4'/> + <address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/> + </controller> ++ <controller type='xenbus' maxGrantFrames='64'/> + ... + </devices> + ... +@@ -4155,6 +4156,11 @@ +
Since 3.10.0 for the vbox driver, the + ide controller has an optional attribute + model, which is one of "piix3", "piix4" or "ich6".
++
xenbus
++
Since 5.2.0, the xenbus ++ controller has an optional attribute maxGrantFrames, ++ which specifies the maximum number of grant frames the controller ++ makes available for connected devices.
+ + +

+Index: libvirt-5.1.0/docs/schemas/domaincommon.rng +=================================================================== +--- libvirt-5.1.0.orig/docs/schemas/domaincommon.rng ++++ libvirt-5.1.0/docs/schemas/domaincommon.rng +@@ -2315,6 +2315,17 @@ + + + ++ ++ ++ ++ xenbus ++ ++ ++ ++ ++ ++ ++ + + + +Index: libvirt-5.1.0/src/conf/domain_conf.c +=================================================================== +--- libvirt-5.1.0.orig/src/conf/domain_conf.c ++++ libvirt-5.1.0/src/conf/domain_conf.c +@@ -347,6 +347,7 @@ VIR_ENUM_IMPL(virDomainController, VIR_D + "ccid", + "usb", + "pci", ++ "xenbus", + ); + + VIR_ENUM_IMPL(virDomainControllerModelPCI, VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST, +@@ -2041,6 +2042,9 @@ virDomainControllerDefNew(virDomainContr + def->opts.pciopts.targetIndex = -1; + def->opts.pciopts.numaNode = -1; + break; ++ case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: ++ def->opts.xenbusopts.maxGrantFrames = -1; ++ break; + case VIR_DOMAIN_CONTROLLER_TYPE_IDE: + case VIR_DOMAIN_CONTROLLER_TYPE_FDC: + case VIR_DOMAIN_CONTROLLER_TYPE_SCSI: +@@ -10791,6 +10795,20 @@ virDomainControllerDefParseXML(virDomain + def->opts.pciopts.numaNode = numaNode; + } + break; ++ case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: { ++ VIR_AUTOFREE(char *) gntframes = virXMLPropString(node, "maxGrantFrames"); ++ ++ if (gntframes) { ++ int r = virStrToLong_i(gntframes, NULL, 10, ++ &def->opts.xenbusopts.maxGrantFrames); ++ if (r != 0 || def->opts.xenbusopts.maxGrantFrames < 0) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, ++ _("Invalid maxGrantFrames: %s"), gntframes); ++ goto error; ++ } ++ } ++ break; ++ } + + default: + break; +@@ -24752,6 +24770,13 @@ virDomainControllerDefFormat(virBufferPt + } + break; + ++ case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: ++ if (def->opts.xenbusopts.maxGrantFrames != -1) { ++ virBufferAsprintf(buf, " maxGrantFrames='%d'", ++ def->opts.xenbusopts.maxGrantFrames); ++ } ++ break; ++ + default: + break; + } +Index: libvirt-5.1.0/src/conf/domain_conf.h +=================================================================== +--- libvirt-5.1.0.orig/src/conf/domain_conf.h ++++ libvirt-5.1.0/src/conf/domain_conf.h +@@ -687,6 +687,7 @@ typedef enum { + VIR_DOMAIN_CONTROLLER_TYPE_CCID, + VIR_DOMAIN_CONTROLLER_TYPE_USB, + VIR_DOMAIN_CONTROLLER_TYPE_PCI, ++ VIR_DOMAIN_CONTROLLER_TYPE_XENBUS, + + VIR_DOMAIN_CONTROLLER_TYPE_LAST + } virDomainControllerType; +@@ -819,6 +820,12 @@ struct _virDomainUSBControllerOpts { + int ports; /* -1 == undef */ + }; + ++typedef struct _virDomainXenbusControllerOpts virDomainXenbusControllerOpts; ++typedef virDomainXenbusControllerOpts *virDomainXenbusControllerOptsPtr; ++struct _virDomainXenbusControllerOpts { ++ int maxGrantFrames; /* -1 == undef */ ++}; ++ + /* Stores the virtual disk controller configuration */ + struct _virDomainControllerDef { + int type; +@@ -833,6 +840,7 @@ struct _virDomainControllerDef { + virDomainVirtioSerialOpts vioserial; + virDomainPCIControllerOpts pciopts; + virDomainUSBControllerOpts usbopts; ++ virDomainXenbusControllerOpts xenbusopts; + } opts; + virDomainDeviceInfo info; + virDomainVirtioOptionsPtr virtio; +Index: libvirt-5.1.0/src/qemu/qemu_command.c +=================================================================== +--- libvirt-5.1.0.orig/src/qemu/qemu_command.c ++++ libvirt-5.1.0/src/qemu/qemu_command.c +@@ -3024,6 +3024,7 @@ qemuBuildControllerDevStr(const virDomai + + case VIR_DOMAIN_CONTROLLER_TYPE_IDE: + case VIR_DOMAIN_CONTROLLER_TYPE_FDC: ++ case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: + case VIR_DOMAIN_CONTROLLER_TYPE_LAST: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported controller type: %s"), +Index: libvirt-5.1.0/src/qemu/qemu_domain.c +=================================================================== +--- libvirt-5.1.0.orig/src/qemu/qemu_domain.c ++++ libvirt-5.1.0/src/qemu/qemu_domain.c +@@ -5841,6 +5841,7 @@ qemuDomainDeviceDefValidateController(co + case VIR_DOMAIN_CONTROLLER_TYPE_VIRTIO_SERIAL: + case VIR_DOMAIN_CONTROLLER_TYPE_CCID: + case VIR_DOMAIN_CONTROLLER_TYPE_USB: ++ case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: + case VIR_DOMAIN_CONTROLLER_TYPE_LAST: + break; + } +@@ -6459,6 +6460,7 @@ qemuDomainControllerDefPostParse(virDoma + case VIR_DOMAIN_CONTROLLER_TYPE_CCID: + case VIR_DOMAIN_CONTROLLER_TYPE_IDE: + case VIR_DOMAIN_CONTROLLER_TYPE_FDC: ++ case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: + case VIR_DOMAIN_CONTROLLER_TYPE_LAST: + break; + } +Index: libvirt-5.1.0/src/qemu/qemu_domain_address.c +=================================================================== +--- libvirt-5.1.0.orig/src/qemu/qemu_domain_address.c ++++ libvirt-5.1.0/src/qemu/qemu_domain_address.c +@@ -669,6 +669,7 @@ qemuDomainDeviceCalculatePCIConnectFlags + + case VIR_DOMAIN_CONTROLLER_TYPE_FDC: + case VIR_DOMAIN_CONTROLLER_TYPE_CCID: ++ case VIR_DOMAIN_CONTROLLER_TYPE_XENBUS: + case VIR_DOMAIN_CONTROLLER_TYPE_LAST: + /* should be 0 */ + return pciFlags; diff --git a/411cdaf8-apparmor-check-profile-name.patch b/411cdaf8-apparmor-check-profile-name.patch new file mode 100644 index 0000000..61b7139 --- /dev/null +++ b/411cdaf8-apparmor-check-profile-name.patch @@ -0,0 +1,45 @@ +commit 411cdaf884f35b8dac2be17fcc24e052e11b7d60 +Author: Jim Fehlig +Date: Fri Mar 1 14:34:17 2019 -0700 + + apparmor: Check libvirtd profile status by name + + Commit a3ab6d42 changed the libvirtd profile to a named profile, + breaking the apparmor driver's ability to detect if the profile is + active. When the apparmor driver loads it checks the status of the + libvirtd profile using the full binary path, which fails since the + profile is now referenced by name. If the apparmor driver is + explicitly requested in /etc/libvirt/qemu.conf, then libvirtd fails + to load too. + + Instead of only checking the profile status by full binary path, + also check by profile name. The full path check is retained in case + users have a customized libvirtd profile with full path. + + Signed-off-by: Jim Fehlig + Acked-by: Jamie Strandboge + +Index: libvirt-5.1.0/src/security/security_apparmor.c +=================================================================== +--- libvirt-5.1.0.orig/src/security/security_apparmor.c ++++ libvirt-5.1.0/src/security/security_apparmor.c +@@ -257,10 +257,16 @@ use_apparmor(void) + if (access(APPARMOR_PROFILES_PATH, R_OK) != 0) + goto cleanup; + ++ /* First check profile status using full binary path. If that fails ++ * check using profile name. ++ */ + rc = profile_status(libvirt_daemon, 1); +- /* Error or unconfined should all result in -1*/ +- if (rc < 0) +- rc = -1; ++ if (rc < 0) { ++ rc = profile_status("libvirtd", 1); ++ /* Error or unconfined should all result in -1*/ ++ if (rc < 0) ++ rc = -1; ++ } + + cleanup: + VIR_FREE(libvirt_daemon); diff --git a/5a64c202-xenconfig-support-max-grant-frames.patch b/5a64c202-xenconfig-support-max-grant-frames.patch new file mode 100644 index 0000000..465aeea --- /dev/null +++ b/5a64c202-xenconfig-support-max-grant-frames.patch @@ -0,0 +1,170 @@ +commit 5a64c202ccdac82f5868e638e5619e2b48c0444b +Author: Jim Fehlig +Date: Fri Mar 8 11:51:57 2019 -0700 + + xenconfig: Add support for max_grant_frames + + Add support in the domXML<->native config converter for + max_grant_frames. Include a test for the conversion. + + Signed-off-by: Jim Fehlig + Reviewed-by: Daniel P. Berrangé + +Index: libvirt-5.1.0/src/xenconfig/xen_xl.c +=================================================================== +--- libvirt-5.1.0.orig/src/xenconfig/xen_xl.c ++++ libvirt-5.1.0/src/xenconfig/xen_xl.c +@@ -607,6 +607,34 @@ xenParseXLVnuma(virConfPtr conf, + } + #endif + ++#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS ++static int ++xenParseXLGntLimits(virConfPtr conf, virDomainDefPtr def) ++{ ++ unsigned long max_gntframes; ++ int ctlr_idx; ++ virDomainControllerDefPtr xenbus_ctlr; ++ ++ if (xenConfigGetULong(conf, "max_grant_frames", &max_gntframes, 0) < 0) ++ return -1; ++ ++ if (max_gntframes <= 0) ++ return 0; ++ ++ ctlr_idx = virDomainControllerFindByType(def, VIR_DOMAIN_CONTROLLER_TYPE_XENBUS); ++ if (ctlr_idx == -1) ++ xenbus_ctlr = virDomainDefAddController(def, VIR_DOMAIN_CONTROLLER_TYPE_XENBUS, -1, -1); ++ else ++ xenbus_ctlr = def->controllers[ctlr_idx]; ++ ++ if (xenbus_ctlr == NULL) ++ return -1; ++ ++ xenbus_ctlr->opts.xenbusopts.maxGrantFrames = max_gntframes; ++ return 0; ++} ++#endif ++ + static int + xenParseXLDiskSrc(virDomainDiskDefPtr disk, char *srcstr) + { +@@ -1165,6 +1193,11 @@ xenParseXL(virConfPtr conf, + goto cleanup; + #endif + ++#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS ++ if (xenParseXLGntLimits(conf, def) < 0) ++ goto cleanup; ++#endif ++ + if (xenParseXLCPUID(conf, def) < 0) + goto cleanup; + +@@ -1517,6 +1550,24 @@ xenFormatXLDomainVnuma(virConfPtr conf, + } + #endif + ++#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS ++static int ++xenFormatXLGntLimits(virConfPtr conf, virDomainDefPtr def) ++{ ++ size_t i; ++ ++ for (i = 0; i < def->ncontrollers; i++) { ++ if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_XENBUS && ++ def->controllers[i]->opts.xenbusopts.maxGrantFrames > 0) { ++ if (xenConfigSetInt(conf, "max_grant_frames", ++ def->controllers[i]->opts.xenbusopts.maxGrantFrames) < 0) ++ return -1; ++ } ++ } ++ return 0; ++} ++#endif ++ + static char * + xenFormatXLDiskSrcNet(virStorageSourcePtr src) + { +@@ -2166,6 +2217,11 @@ xenFormatXL(virDomainDefPtr def, virConn + goto cleanup; + #endif + ++#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS ++ if (xenFormatXLGntLimits(conf, def) < 0) ++ goto cleanup; ++#endif ++ + if (xenFormatXLDomainDisks(conf, def) < 0) + goto cleanup; + +Index: libvirt-5.1.0/tests/xlconfigdata/test-max-gntframes.cfg +=================================================================== +--- /dev/null ++++ libvirt-5.1.0/tests/xlconfigdata/test-max-gntframes.cfg +@@ -0,0 +1,13 @@ ++name = "XenGuest1" ++uuid = "45b60f51-88a9-47a8-a3b3-5e66d71b2283" ++maxmem = 512 ++memory = 512 ++vcpus = 1 ++localtime = 0 ++on_poweroff = "preserve" ++on_reboot = "restart" ++on_crash = "preserve" ++vif = [ "mac=5a:36:0e:be:00:09" ] ++bootloader = "/usr/bin/pygrub" ++max_grant_frames = 64 ++disk = [ "format=qcow2,vdev=xvda,access=rw,backendtype=qdisk,target=/var/lib/xen/images/debian/disk.qcow2" ] +Index: libvirt-5.1.0/tests/xlconfigdata/test-max-gntframes.xml +=================================================================== +--- /dev/null ++++ libvirt-5.1.0/tests/xlconfigdata/test-max-gntframes.xml +@@ -0,0 +1,32 @@ ++ ++ XenGuest1 ++ 45b60f51-88a9-47a8-a3b3-5e66d71b2283 ++ 524288 ++ 524288 ++ 1 ++ /usr/bin/pygrub ++ ++ linux ++ ++ ++ preserve ++ restart ++ preserve ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ +Index: libvirt-5.1.0/tests/xlconfigtest.c +=================================================================== +--- libvirt-5.1.0.orig/tests/xlconfigtest.c ++++ libvirt-5.1.0/tests/xlconfigtest.c +@@ -299,6 +299,10 @@ mymain(void) + DO_TEST_FORMAT("fullvirt-direct-kernel-boot-extra", false); + DO_TEST_FORMAT("fullvirt-direct-kernel-boot-bogus-extra", false); + #endif ++#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS ++ DO_TEST("max-gntframes"); ++#endif ++ + DO_TEST("vif-typename"); + DO_TEST("vif-multi-ip"); + DO_TEST("usb"); diff --git a/696239ba-qemu-fix-query-cpus-fast.patch b/696239ba-qemu-fix-query-cpus-fast.patch new file mode 100644 index 0000000..a78dcc6 --- /dev/null +++ b/696239ba-qemu-fix-query-cpus-fast.patch @@ -0,0 +1,38 @@ +commit 696239ba6f83c65ded476e87d3ba77b424e16fd1 +Author: Viktor Mihajlovski +Date: Fri Mar 1 11:29:51 2019 +0100 + + qemu: Fix query-cpus-fast target architecture detection + + Since qemu 2.13 reports the target architecture in a property called + 'target' additionally to the property 'arch', that has been used in + qemu 2.12 in the response data of 'query-cpus-fast'. + Libvirts monitor code prefers the 'target' property over 'arch'. + + At least for s390(x), target is reported as 's390x' while arch is 's390'. + In a later step a comparison is performed against 's390' which fails for + qemu 2.13 and later. + + In consequence the architecture specific data for s390 won't be extracted + from the returned data, leading to incorrect values being reported by + virsh domstats --vcpu. + + Changing to check explicitly for 's390' and 's390x'. + + Signed-off-by: Viktor Mihajlovski + Reviewed-by: Bjoern Walk + Reviewed-by: Boris Fiuczynski + +Index: libvirt-5.1.0/src/qemu/qemu_monitor_json.c +=================================================================== +--- libvirt-5.1.0.orig/src/qemu/qemu_monitor_json.c ++++ libvirt-5.1.0/src/qemu/qemu_monitor_json.c +@@ -1772,7 +1772,7 @@ qemuMonitorJSONExtractCPUInfo(virJSONVal + goto cleanup; + + /* process optional architecture-specific data */ +- if (STREQ_NULLABLE(arch, "s390")) ++ if (STREQ_NULLABLE(arch, "s390") || STREQ_NULLABLE(arch, "s390x")) + qemuMonitorJSONExtractCPUS390Info(entry, cpus + i); + } + diff --git a/ec5a1191-libxl-support-max-grant-frames.patch b/ec5a1191-libxl-support-max-grant-frames.patch new file mode 100644 index 0000000..5170862 --- /dev/null +++ b/ec5a1191-libxl-support-max-grant-frames.patch @@ -0,0 +1,184 @@ +commit ec5a11910d12f80e26f5d9905840c109e74939db +Author: Jim Fehlig +Date: Thu Mar 7 15:16:09 2019 -0700 + + libxl: Add support for max_grant_frames + + Add support for setting max_grant_frames in libxl domain config + object and include a test to check that it is properly converted + from XML to libxl domain config. + + Signed-off-by: Jim Fehlig + Reviewed-by: Daniel P. Berrangé + +Index: libvirt-5.1.0/src/libxl/libxl_conf.c +=================================================================== +--- libvirt-5.1.0.orig/src/libxl/libxl_conf.c ++++ libvirt-5.1.0/src/libxl/libxl_conf.c +@@ -393,6 +393,15 @@ libxlMakeDomBuildInfo(virDomainDefPtr de + def->mem.cur_balloon = VIR_ROUND_UP(def->mem.cur_balloon, 1024); + b_info->max_memkb = virDomainDefGetMemoryInitial(def); + b_info->target_memkb = def->mem.cur_balloon; ++ ++#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS ++ for (i = 0; i < def->ncontrollers; i++) { ++ if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_XENBUS && ++ def->controllers[i]->opts.xenbusopts.maxGrantFrames > 0) ++ b_info->max_grant_frames = def->controllers[i]->opts.xenbusopts.maxGrantFrames; ++ } ++#endif ++ + if (hvm || pvh) { + if (caps && + def->cpu && def->cpu->mode == (VIR_CPU_MODE_HOST_PASSTHROUGH)) { +Index: libvirt-5.1.0/tests/libxlxml2domconfigdata/max-gntframes-hvm.json +=================================================================== +--- /dev/null ++++ libvirt-5.1.0/tests/libxlxml2domconfigdata/max-gntframes-hvm.json +@@ -0,0 +1,90 @@ ++{ ++ "c_info": { ++ "type": "hvm", ++ "name": "test-hvm", ++ "uuid": "2147d599-9cc6-c0dc-92ab-4064b5446e9b" ++ }, ++ "b_info": { ++ "max_vcpus": 4, ++ "avail_vcpus": [ ++ 0, ++ 1, ++ 2, ++ 3 ++ ], ++ "max_memkb": 1048576, ++ "target_memkb": 1048576, ++ "video_memkb": 8192, ++ "shadow_memkb": 12288, ++ "max_grant_frames": 64, ++ "device_model_version": "qemu_xen", ++ "device_model": "/bin/true", ++ "sched_params": { ++ ++ }, ++ "type.hvm": { ++ "pae": "True", ++ "apic": "True", ++ "acpi": "True", ++ "vga": { ++ "kind": "cirrus" ++ }, ++ "vnc": { ++ "enable": "True", ++ "listen": "0.0.0.0", ++ "findunused": "False" ++ }, ++ "sdl": { ++ "enable": "False" ++ }, ++ "spice": { ++ ++ }, ++ "boot": "c", ++ "rdm": { ++ ++ } ++ }, ++ "arch_arm": { ++ ++ } ++ }, ++ "disks": [ ++ { ++ "pdev_path": "/var/lib/xen/images/test-hvm.img", ++ "vdev": "hda", ++ "backend": "qdisk", ++ "format": "raw", ++ "removable": 1, ++ "readwrite": 1 ++ } ++ ], ++ "nics": [ ++ { ++ "devid": 0, ++ "mac": "00:16:3e:66:12:b4", ++ "bridge": "br0", ++ "script": "/etc/xen/scripts/vif-bridge", ++ "nictype": "vif_ioemu" ++ } ++ ], ++ "vfbs": [ ++ { ++ "devid": -1, ++ "vnc": { ++ "enable": "True", ++ "listen": "0.0.0.0", ++ "findunused": "False" ++ }, ++ "sdl": { ++ "enable": "False" ++ } ++ } ++ ], ++ "vkbs": [ ++ { ++ "devid": -1 ++ } ++ ], ++ "on_reboot": "restart" ++} +Index: libvirt-5.1.0/tests/libxlxml2domconfigdata/max-gntframes-hvm.xml +=================================================================== +--- /dev/null ++++ libvirt-5.1.0/tests/libxlxml2domconfigdata/max-gntframes-hvm.xml +@@ -0,0 +1,37 @@ ++ ++ test-hvm ++ None ++ 2147d599-9cc6-c0dc-92ab-4064b5446e9b ++ 1048576 ++ 1048576 ++ 4 ++ destroy ++ restart ++ destroy ++ ++ ++ hvm ++ /usr/lib/xen/boot/hvmloader ++ ++ ++ ++ ++ ++ ++ ++ ++ /bin/true ++ ++ ++ ++ ++ ++ ++ ++ ++ ++