SHA256
1
0
forked from pool/libvirt
libvirt/5a64c202-xenconfig-support-max-grant-frames.patch
James Fehlig 6db7ff9129 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
2019-03-13 23:35:01 +00:00

171 lines
5.1 KiB
Diff

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");