}
#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)
{
goto cleanup;
#endif
+#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS
+ if (xenParseXLGntLimits(conf, def) < 0)
+ goto cleanup;
+#endif
+
if (xenParseXLCPUID(conf, def) < 0)
goto cleanup;
}
#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)
{
goto cleanup;
#endif
+#ifdef LIBXL_HAVE_BUILDINFO_GRANT_LIMITS
+ if (xenFormatXLGntLimits(conf, def) < 0)
+ goto cleanup;
+#endif
+
if (xenFormatXLDomainDisks(conf, def) < 0)
goto cleanup;
--- /dev/null
+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" ]
--- /dev/null
+<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>