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
This commit is contained in:
James Fehlig 2019-03-13 23:35:01 +00:00 committed by Git OBS Bridge
parent a0ca4c8c64
commit 6db7ff9129
14 changed files with 2246 additions and 97 deletions

View File

@ -1,46 +0,0 @@
From b1a50c10c95747dacd31a23b5c73ec4f938af329 Mon Sep 17 00:00:00 2001
From: Jim Fehlig <jfehlig@suse.com>
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 <jfehlig@suse.com>
---
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);

View File

@ -1,40 +0,0 @@
From 85001fd799deb33338aed627b3c3a6870cb70d2d Mon Sep 17 00:00:00 2001
From: Viktor Mihajlovski <mihajlov@linux.ibm.com>
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 <mihajlov@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
---
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);
}

View File

@ -0,0 +1,201 @@
commit 09eb1ae0ec7e592133eb98f4a0fe2f6daa5ba2d9
Author: Jim Fehlig <jfehlig@suse.com>
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 <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
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 @@
&lt;driver iothread='4'/&gt;
&lt;address type='pci' domain='0x0000' bus='0x00' slot='0x0b' function='0x0'/&gt;
&lt;/controller&gt;
+ &lt;controller type='xenbus' maxGrantFrames='64'/&gt;
...
&lt;/devices&gt;
...</pre>
@@ -4155,6 +4156,11 @@
<dd><span class="since">Since 3.10.0</span> for the vbox driver, the
<code>ide</code> controller has an optional attribute
<code>model</code>, which is one of "piix3", "piix4" or "ich6".</dd>
+ <dt><code>xenbus</code></dt>
+ <dd><span class="since">Since 5.2.0</span>, the <code>xenbus</code>
+ controller has an optional attribute <code>maxGrantFrames</code>,
+ which specifies the maximum number of grant frames the controller
+ makes available for connected devices.</dd>
</dl>
<p>
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 @@
</attribute>
</optional>
</group>
+ <!-- xenbus has an optional attribute "maxGrantFrames" -->
+ <group>
+ <attribute name="type">
+ <value>xenbus</value>
+ </attribute>
+ <optional>
+ <attribute name="maxGrantFrames">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
+ </group>
</choice>
<optional>
<element name="driver">
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;

View File

@ -0,0 +1,45 @@
commit 411cdaf884f35b8dac2be17fcc24e052e11b7d60
Author: Jim Fehlig <jfehlig@suse.com>
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 <jfehlig@suse.com>
Acked-by: Jamie Strandboge <jamie@canonical.com>
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);

View File

@ -0,0 +1,170 @@
commit 5a64c202ccdac82f5868e638e5619e2b48c0444b
Author: Jim Fehlig <jfehlig@suse.com>
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 <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
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 @@
+<domain type='xen'>
+ <name>XenGuest1</name>
+ <uuid>45b60f51-88a9-47a8-a3b3-5e66d71b2283</uuid>
+ <memory unit='KiB'>524288</memory>
+ <currentMemory unit='KiB'>524288</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <bootloader>/usr/bin/pygrub</bootloader>
+ <os>
+ <type arch='x86_64' machine='xenpv'>linux</type>
+ </os>
+ <clock offset='utc' adjustment='reset'/>
+ <on_poweroff>preserve</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>preserve</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source file='/var/lib/xen/images/debian/disk.qcow2'/>
+ <target dev='xvda' bus='xen'/>
+ </disk>
+ <controller type='xenbus' index='0' maxGrantFrames='64'/>
+ <interface type='ethernet'>
+ <mac address='5a:36:0e:be:00:09'/>
+ </interface>
+ <console type='pty'>
+ <target type='xen' port='0'/>
+ </console>
+ <input type='mouse' bus='xen'/>
+ <input type='keyboard' bus='xen'/>
+ <memballoon model='xen'/>
+ </devices>
+</domain>
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");

View File

@ -0,0 +1,38 @@
commit 696239ba6f83c65ded476e87d3ba77b424e16fd1
Author: Viktor Mihajlovski <mihajlov@linux.ibm.com>
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 <mihajlov@linux.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
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);
}

View File

@ -0,0 +1,184 @@
commit ec5a11910d12f80e26f5d9905840c109e74939db
Author: Jim Fehlig <jfehlig@suse.com>
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 <jfehlig@suse.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
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 @@
+<domain type='xen'>
+ <name>test-hvm</name>
+ <description>None</description>
+ <uuid>2147d599-9cc6-c0dc-92ab-4064b5446e9b</uuid>
+ <memory>1048576</memory>
+ <currentMemory>1048576</currentMemory>
+ <vcpu>4</vcpu>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <clock offset='utc'/>
+ <os>
+ <type>hvm</type>
+ <loader>/usr/lib/xen/boot/hvmloader</loader>
+ <boot dev='hd'/>
+ </os>
+ <features>
+ <apic/>
+ <acpi/>
+ <pae/>
+ </features>
+ <devices>
+ <emulator>/bin/true</emulator>
+ <disk type='file' device='disk'>
+ <driver name='qemu'/>
+ <source file='/var/lib/xen/images/test-hvm.img'/>
+ <target dev='hda'/>
+ </disk>
+ <controller type='xenbus' maxGrantFrames='64'/>
+ <interface type='bridge'>
+ <source bridge='br0'/>
+ <mac address='00:16:3e:66:12:b4'/>
+ <script path='/etc/xen/scripts/vif-bridge'/>
+ </interface>
+ <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'/>
+ </devices>
+</domain>
Index: libvirt-5.1.0/tests/libxlxml2domconfigtest.c
===================================================================
--- libvirt-5.1.0.orig/tests/libxlxml2domconfigtest.c
+++ libvirt-5.1.0/tests/libxlxml2domconfigtest.c
@@ -217,6 +217,9 @@ mymain(void)
DO_TEST("fullvirt-cpuid-legacy-nest");
# endif
+# ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS
+ DO_TEST("max-gntframes-hvm");
+# endif
unlink("libxl-driver.log");

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,41 @@
-------------------------------------------------------------------
Wed Mar 13 23:09:27 UTC 2019 - James Fehlig <jfehlig@suse.com>
- hook: encode incoming XML to UTF-8 before passing to lxml etree
fromstring method
Modifed suse-qemu-domain-hook.py
boo#1123642
-------------------------------------------------------------------
Wed Mar 13 21:09:58 UTC 2019 - James Fehlig <jfehlig@suse.com>
- libxl: change autoballooning default to disabled
suse-libxl-disable-autoballoon.patch
jsc#SLE-3059
-------------------------------------------------------------------
Wed Mar 13 18:59:43 UTC 2019 - James Fehlig <jfehlig@suse.com>
- 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
-------------------------------------------------------------------
Wed Mar 13 18:57:13 UTC 2019 - James Fehlig <jfehlig@suse.com>
- 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
-------------------------------------------------------------------
Mon Mar 11 22:50:43 UTC 2019 - James Fehlig <jfehlig@suse.com>

View File

@ -335,11 +335,15 @@ Source100: %{name}-rpmlintrc
# Upstream patches
Patch0: 4ec3cf9a-apparmor-rules.patch
Patch1: f38ef0fa-no-RDMA-check.patch
Patch2: 411cdaf8-apparmor-check-profile-name.patch
Patch3: 696239ba-qemu-fix-query-cpus-fast.patch
Patch4: 09eb1ae0-conf-add-xenbus-controller.patch
Patch5: fb059757-libxl-add-xenbus-controller.patch
Patch6: ec5a1191-libxl-support-max-grant-frames.patch
Patch7: 5a64c202-xenconfig-support-max-grant-frames.patch
# Patches pending upstream review
Patch100: libxl-dom-reset.patch
Patch101: network-don-t-use-dhcp-authoritative-on-static-netwo.patch
Patch102: 0001-apparmor-Check-libvirtd-profile-status-by-name.patch
Patch103: 0001-qemu-Fix-query-cpus-fast-target-architecture-detecti.patch
# Need to go upstream
Patch150: xen-pv-cdrom.patch
Patch151: blockcopy-check-dst-identical-device.patch
@ -367,6 +371,7 @@ Patch212: apparmor-no-mount.patch
Patch213: qemu-apparmor-screenshot.patch
Patch214: libvirt-suse-netcontrol.patch
Patch215: lxc-wait-after-eth-del.patch
Patch216: suse-libxl-disable-autoballoon.patch
# SLES-Only patches
%if ! 0%{?is_opensuse}
Patch400: virt-create-rootfs.patch
@ -872,10 +877,14 @@ libvirt plugin for NSS for translating domain names into IP addresses.
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1
%patch103 -p1
%patch150 -p1
%patch151 -p1
%patch152 -p1
@ -901,6 +910,7 @@ libvirt plugin for NSS for translating domain names into IP addresses.
%patch213 -p1
%patch214 -p1
%patch215 -p1
%patch216 -p1
%if ! 0%{?is_opensuse}
%patch400 -p1
%endif

View File

@ -7,7 +7,7 @@ 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
@@ -884,6 +884,30 @@ libxlDiskSetDiscard(libxl_device_disk *x
@@ -893,6 +893,30 @@ libxlDiskSetDiscard(libxl_device_disk *x
#endif
}
@ -38,7 +38,7 @@ Index: libvirt-5.1.0/src/libxl/libxl_conf.c
static char *
libxlMakeNetworkDiskSrcStr(virStorageSourcePtr src,
const char *username,
@@ -1132,6 +1156,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
@@ -1141,6 +1165,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
x_disk->is_cdrom = l_disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM ? 1 : 0;
if (libxlDiskSetDiscard(x_disk, l_disk->discard) < 0)
return -1;

View File

@ -11,7 +11,7 @@ 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
@@ -884,6 +884,25 @@ libxlDiskSetDiscard(libxl_device_disk *x
@@ -893,6 +893,25 @@ libxlDiskSetDiscard(libxl_device_disk *x
#endif
}
@ -37,7 +37,7 @@ Index: libvirt-5.1.0/src/libxl/libxl_conf.c
static void
libxlDiskSetCacheMode(libxl_device_disk *x_disk, int cachemode)
{
@@ -1029,6 +1048,7 @@ libxlMakeNetworkDiskSrc(virStorageSource
@@ -1038,6 +1057,7 @@ libxlMakeNetworkDiskSrc(virStorageSource
int
libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk)
{
@ -45,7 +45,7 @@ Index: libvirt-5.1.0/src/libxl/libxl_conf.c
const char *driver = virDomainDiskGetDriver(l_disk);
int format = virDomainDiskGetFormat(l_disk);
int actual_type = virStorageSourceGetActualType(l_disk->src);
@@ -1044,7 +1064,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
@@ -1053,7 +1073,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
if (libxlMakeNetworkDiskSrc(l_disk->src, &x_disk->pdev_path) < 0)
return -1;
} else {
@ -54,7 +54,7 @@ Index: libvirt-5.1.0/src/libxl/libxl_conf.c
return -1;
}
@@ -1157,6 +1177,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
@@ -1166,6 +1186,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk
if (libxlDiskSetDiscard(x_disk, l_disk->discard) < 0)
return -1;
libxlDiskSetCacheMode(x_disk, l_disk->cachemode);

View File

@ -0,0 +1,81 @@
libxl: disable autoballooning
Xen 4.12 introduced a CONFIG_DOM0_MEM option, which our xen package uses
to configure dom0 with a sensible initial memory value and disables
autoballooning. This patch changes libvirt to also disable autoballooning
by default. It can only be enabled with the 'autoballoon' setting in
libxl.conf. See jsc#SLE-3059 for more details.
Index: libvirt-5.1.0/src/libxl/libxl.conf
===================================================================
--- libvirt-5.1.0.orig/src/libxl/libxl.conf
+++ libvirt-5.1.0/src/libxl/libxl.conf
@@ -4,12 +4,11 @@
# Enable autoballooning of domain0
#
-# By default, autoballooning of domain0 is enabled unless its memory
-# is already limited with Xen's "dom0_mem=" parameter, in which case
-# autoballooning is disabled. Override the default behavior with the
-# autoballoon setting.
+# By default, autoballooning of domain0 is disabled. Traditionally it
+# could also be disabled by using Xen's "dom0_mem=" parameter. Set to
+# 1 to enable autoballooning.
#
-#autoballoon = 1
+#autoballoon = 0
# In order to prevent accidentally starting two domains that
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
@@ -22,7 +22,6 @@
#include <config.h>
-#include <regex.h>
#include <libxl.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -1760,14 +1759,12 @@ libxlMakeBuildInfoVfb(virPortAllocatorRa
/*
* Get domain0 autoballoon configuration. Honor user-specified
* setting in libxl.conf first. If not specified, autoballooning
- * is disabled when domain0's memory is set with 'dom0_mem'.
- * Otherwise autoballooning is enabled.
+ * is disabled.
*/
static int
libxlGetAutoballoonConf(libxlDriverConfigPtr cfg,
virConfPtr conf)
{
- regex_t regex;
int res;
res = virConfGetValueBool(conf, "autoballoon", &cfg->autoballoon);
@@ -1776,21 +1773,8 @@ libxlGetAutoballoonConf(libxlDriverConfi
else if (res == 1)
return 0;
- if ((res = regcomp(&regex,
- "(^| )dom0_mem=((|min:|max:)[0-9]+[bBkKmMgG]?,?)+($| )",
- REG_NOSUB | REG_EXTENDED)) != 0) {
- char error[100];
- regerror(res, &regex, error, sizeof(error));
- virReportError(VIR_ERR_INTERNAL_ERROR,
- _("Failed to compile regex %s"),
- error);
-
- return -1;
- }
-
- res = regexec(&regex, cfg->verInfo->commandline, 0, NULL, 0);
- regfree(&regex);
- cfg->autoballoon = res == REG_NOMATCH;
+ /* make it explicit */
+ cfg->autoballoon = 0;
return 0;
}

View File

@ -278,7 +278,7 @@ disk_devs = []
phase = sys.argv[2]
vmxml = sys.stdin.read()
tree = etree.fromstring(vmxml)
tree = etree.fromstring(vmxml.encode("utf-8", "ignore"))
devs = tree.xpath("/domain/devices/disk")
dmmd_configs = tree.xpath("/domain/metadata/hook:dmmd/disk", namespaces={'hook': HOOK_NAMESPACE})