Hello community, here is the log from the commit of package libvirt for openSUSE:Factory checked in at 2016-05-23 16:38:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libvirt (Old) and /work/SRC/openSUSE:Factory/.libvirt.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libvirt" Changes: -------- --- /work/SRC/openSUSE:Factory/libvirt/libvirt.changes 2016-05-14 12:23:23.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.libvirt.new/libvirt.changes 2016-05-23 16:38:54.000000000 +0200 @@ -1,0 +2,26 @@ +Wed May 18 04:55:22 UTC 2016 - jfeh...@suse.com + +- spec: Remove %defattr usage + Inspired by upstream commit 90f9193c + +------------------------------------------------------------------- +Fri May 13 18:12:40 UTC 2016 - jfeh...@suse.com + +- libxl: support Xen migration stream V2 + fccf2725-libxl-API-4.4.patch, + 5325123d-libxl-migv2-save-restore.patch, + f9edcfa4-libxl-migv2-migration.patch + bsc#978361 + +------------------------------------------------------------------- +Fri May 13 17:23:24 UTC 2016 - jfeh...@suse.com + +- Fix default video RAM setting + e4d131b8-mv-virDomainDefPostParseInternal.patch, + 3e428670-post-parse-implicit-video.patch, + 538012c8-default-vram.patch, 96b21fb0-vram-tests.patch, + 400e716d-libxl-noprope-emulator.patch, + b90c4b5f-tests-use-qemu-xen.patch + bsc#979397 + +------------------------------------------------------------------- New: ---- 3e428670-post-parse-implicit-video.patch 400e716d-libxl-noprope-emulator.patch 5325123d-libxl-migv2-save-restore.patch 538012c8-default-vram.patch 96b21fb0-vram-tests.patch b90c4b5f-tests-use-qemu-xen.patch e4d131b8-mv-virDomainDefPostParseInternal.patch f9edcfa4-libxl-migv2-migration.patch fccf2725-libxl-API-4.4.patch ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libvirt.spec ++++++ --- /var/tmp/diff_new_pack.8tjuew/_old 2016-05-23 16:38:56.000000000 +0200 +++ /var/tmp/diff_new_pack.8tjuew/_new 2016-05-23 16:38:56.000000000 +0200 @@ -458,6 +458,15 @@ Source99: baselibs.conf Source100: %{name}-rpmlintrc # Upstream patches +Patch0: e4d131b8-mv-virDomainDefPostParseInternal.patch +Patch1: 3e428670-post-parse-implicit-video.patch +Patch2: 538012c8-default-vram.patch +Patch3: 96b21fb0-vram-tests.patch +Patch4: 400e716d-libxl-noprope-emulator.patch +Patch5: b90c4b5f-tests-use-qemu-xen.patch +Patch6: fccf2725-libxl-API-4.4.patch +Patch7: 5325123d-libxl-migv2-save-restore.patch +Patch8: f9edcfa4-libxl-migv2-migration.patch # Patches pending upstream review # Need to go upstream Patch150: xen-pv-cdrom.patch @@ -981,6 +990,15 @@ %prep %setup -q +%patch0 -p1 +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +%patch8 -p1 %patch150 -p1 %patch151 -p1 %patch152 -p1 @@ -1536,13 +1554,11 @@ %endif %files -%defattr(-, root, root) %doc %{_docdir}/%{name}/libvirt.README %if %{with_libvirtd} %files daemon -%defattr(-, root, root) %{_sbindir}/libvirtd %{_sbindir}/virtlogd %{_sbindir}/virtlockd @@ -1677,7 +1693,6 @@ %if %{with_network} %files daemon-config-network -%defattr(-, root, root) %dir %{_datadir}/libvirt/networks/ %{_datadir}/libvirt/networks/default.xml %endif @@ -1685,7 +1700,6 @@ %if %{with_nwfilter} %files daemon-config-nwfilter -%defattr(-, root, root) %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/nwfilter/ %{_sysconfdir}/libvirt/nwfilter/*.xml %endif @@ -1694,7 +1708,6 @@ %if %{with_interface} %files daemon-driver-interface -%defattr(-, root, root) %dir %{_libdir}/%{name}/connection-driver %{_libdir}/%{name}/connection-driver/libvirt_driver_interface.so %endif @@ -1702,7 +1715,6 @@ %if %{with_network} %files daemon-driver-network -%defattr(-, root, root) %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/ %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/ %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/qemu/networks/autostart @@ -1716,7 +1728,6 @@ %if %{with_nodedev} %files daemon-driver-nodedev -%defattr(-, root, root) %dir %{_libdir}/%{name}/connection-driver %{_libdir}/%{name}/connection-driver/libvirt_driver_nodedev.so %endif @@ -1724,21 +1735,18 @@ %if %{with_nwfilter} %files daemon-driver-nwfilter -%defattr(-, root, root) %dir %attr(0700, root, root) %{_sysconfdir}/libvirt/nwfilter/ %dir %{_libdir}/%{name}/connection-driver %{_libdir}/%{name}/connection-driver/libvirt_driver_nwfilter.so %endif %files daemon-driver-secret -%defattr(-, root, root) %dir %{_libdir}/%{name}/connection-driver %{_libdir}/%{name}/connection-driver/libvirt_driver_secret.so %if %{with_storage} %files daemon-driver-storage -%defattr(-, root, root) %if %{with_storage_disk} %attr(0755, root, root) %{_libdir}/%{name}/libvirt_parthelper %endif @@ -1749,8 +1757,6 @@ %if %{with_qemu} %files daemon-driver-qemu -%defattr(-, root, root) -%defattr(-, root, root) %config(noreplace) %{_sysconfdir}/libvirt/qemu.conf %config(noreplace) %{_sysconfdir}/libvirt/qemu-lockd.conf %config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.qemu @@ -1766,7 +1772,6 @@ %if %{with_lxc} %files daemon-driver-lxc -%defattr(-, root, root) %config(noreplace) %{_sysconfdir}/libvirt/lxc.conf %config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.lxc %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/lxc/ @@ -1782,7 +1787,6 @@ %if %{with_uml} %files daemon-driver-uml -%defattr(-, root, root) %config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.uml %dir %attr(0700, root, root) %{_localstatedir}/lib/libvirt/uml/ %dir %attr(0700, root, root) %{_localstatedir}/log/libvirt/uml/ @@ -1793,7 +1797,6 @@ %if %{with_xen} %files daemon-driver-xen -%defattr(-, root, root) %dir %{_libdir}/%{name}/connection-driver %{_libdir}/%{name}/connection-driver/libvirt_driver_xen.so %endif @@ -1801,7 +1804,6 @@ %if %{with_libxl} %files daemon-driver-libxl -%defattr(-, root, root) %config(noreplace) %{_sysconfdir}/libvirt/libxl.conf %config(noreplace) %{_sysconfdir}/logrotate.d/libvirtd.libxl %config(noreplace) %{_sysconfdir}/libvirt/libxl-lockd.conf @@ -1816,7 +1818,6 @@ %if %{with_vbox} %files daemon-driver-vbox -%defattr(-, root, root) %{_libdir}/%{name}/connection-driver/libvirt_driver_vbox.so %endif %endif # with_driver_modules @@ -1824,41 +1825,35 @@ %if %{with_qemu} %files daemon-qemu -%defattr(-, root, root) %doc %{_docdir}/%{name}/libvirt-daemon-qemu.README %endif %if %{with_lxc} %files daemon-lxc -%defattr(-, root, root) %doc %{_docdir}/%{name}/libvirt-daemon-lxc.README %endif %if %{with_uml} %files daemon-uml -%defattr(-, root, root) %doc %{_docdir}/%{name}/libvirt-daemon-uml.README %endif %if %{with_xen} || %{with_libxl} %files daemon-xen -%defattr(-, root, root) %doc %{_docdir}/%{name}/libvirt-daemon-xen.README %endif %if %{with_vbox} %files daemon-vbox -%defattr(-, root, root) %doc %{_docdir}/%{name}/libvirt-daemon-vbox.README %endif %endif # with_libvirtd %files client -f %{name}.lang -%defattr(-, root, root) %doc AUTHORS ChangeLog.gz NEWS README COPYING COPYING.LESSER TODO %doc %{_mandir}/man1/virsh.1* %doc %{_mandir}/man1/virt-xml-validate.1* @@ -1909,7 +1904,6 @@ %endif %files devel -%defattr(-, root, root) %{_libdir}/libvirt.so %{_libdir}/libvirt-qemu.so %{_libdir}/libvirt-lxc.so @@ -1923,7 +1917,6 @@ %{_datadir}/libvirt/api/libvirt-lxc-api.xml %files doc -%defattr(-, root, root) # Website %dir %{_docdir}/libvirt %doc %{_docdir}/%{name}/*.png @@ -1940,7 +1933,6 @@ %if %{with_sanlock} %files lock-sanlock -%defattr(-, root, root) %doc %{_mandir}/man8/virt-sanlock-cleanup.8* %if %{with_qemu} %config(noreplace) %{_sysconfdir}/%{name}/qemu-sanlock.conf @@ -1963,7 +1955,6 @@ %if %{with_wireshark} %files -n wireshark-plugin-libvirt -%defattr(-, root, root) %{_libdir}/wireshark/plugins/libvirt.so %endif ++++++ 3e428670-post-parse-implicit-video.patch ++++++ commit 3e4286703273b06a21ae07f3e76a66f9661199dc Author: Ján Tomko <jto...@redhat.com> Date: Wed May 11 12:13:51 2016 +0200 Call per-device post-parse callback even on implicit video Commit 6879be48 moved adding of an implicit video device after XML parsing. As a result, libxlDomainDeviceDefPostParse() is no longer called to set the default vram when adding an implicit device. Commit 6879be48 assumes virDomainVideoDefaultRAM() will set the default vram, but it returns 0 if the domain virtType is VIR_DOMAIN_VIRT_XEN. Attempting to start an HVM domain with vram=0 results in error: unsupported configuration: videoram must be at least 4MB for CIRRUS The default vram setting for Xen HVM domains depends on the device model used (qemu-xen vs qemu-traditional), hence setting the default is deferred to libxlDomainDeviceDefPostParse(). Call the device post-parse callback even for implicit video, to fill out the default vram even for VIR_DOMAIN_VIRT_XEN. https://bugzilla.redhat.com/show_bug.cgi?id=1334557 Most-of-commit-message-by: Jim Fehlig <jfeh...@suse.com> Index: libvirt-1.3.4/src/conf/domain_conf.c =================================================================== --- libvirt-1.3.4.orig/src/conf/domain_conf.c +++ libvirt-1.3.4/src/conf/domain_conf.c @@ -4321,8 +4321,7 @@ virDomainDefPostParseDeviceIterator(virD static int virDomainDefPostParseInternal(virDomainDefPtr def, - virCapsPtr caps ATTRIBUTE_UNUSED, - unsigned int parseFlags) + struct virDomainDefPostParseDeviceIteratorData *data) { /* verify init path for container based domains */ if (def->os.type == VIR_DOMAIN_OSTYPE_EXE && !def->os.init) { @@ -4331,7 +4330,7 @@ virDomainDefPostParseInternal(virDomainD return -1; } - if (virDomainDefPostParseMemory(def, parseFlags) < 0) + if (virDomainDefPostParseMemory(def, data->parseFlags) < 0) return -1; if (virDomainDefRejectDuplicateControllers(def) < 0) @@ -4346,11 +4345,22 @@ virDomainDefPostParseInternal(virDomainD if (virDomainDefAddImplicitDevices(def) < 0) return -1; - /* Mark the first video as primary. If the user specified primary="yes", - * the parser already inserted the device at def->videos[0] */ - if (def->nvideos != 0) + if (def->nvideos != 0) { + virDomainDeviceDef device = { + .type = VIR_DOMAIN_DEVICE_VIDEO, + .data.video = def->videos[0], + }; + + /* Mark the first video as primary. If the user specified primary="yes", + * the parser already inserted the device at def->videos[0] */ def->videos[0]->primary = true; + /* videos[0] might have been added in AddImplicitDevices, after we've + * done the per-device post-parse */ + if (virDomainDefPostParseDeviceIterator(NULL, &device, NULL, data) < 0) + return -1; + } + /* clean up possibly duplicated metadata entries */ virDomainDefMetadataSanitize(def); @@ -4388,7 +4398,7 @@ virDomainDefPostParse(virDomainDefPtr de return ret; - if ((ret = virDomainDefPostParseInternal(def, caps, parseFlags)) < 0) + if ((ret = virDomainDefPostParseInternal(def, &data)) < 0) return ret; if (virDomainDefPostParseCheckFeatures(def, xmlopt) < 0) ++++++ 400e716d-libxl-noprope-emulator.patch ++++++ commit 400e716d7d8371fa718c27bb4f05b9a68929e64a Author: Jim Fehlig <jfeh...@suse.com> Date: Thu May 12 14:40:28 2016 -0600 libxl: don't attempt to probe a non-existent emulator When probing the <emulator> with '-help' to determine if it is the old qemu, errors are reported if the emulator doesn't exist libvirt: error : internal error: Child process (/usr/lib/xen/bin/qemu-dm -help) unexpected exit status 127: libvirt: error : cannot execute binary /usr/lib/xen/bin/qemu-dm: No such file or directory Avoid the probe if the specified emulator doesn't exist, squelching the error. There is no behavior change since libxlDomainGetEmulatorType() would return LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN if the probe failed via virCommandRun(). Signed-off-by: Jim Fehlig <jfeh...@suse.com> Index: libvirt-1.3.4/src/libxl/libxl_conf.c =================================================================== --- libvirt-1.3.4.orig/src/libxl/libxl_conf.c +++ libvirt-1.3.4/src/libxl/libxl_conf.c @@ -916,6 +916,9 @@ libxlDomainGetEmulatorType(const virDoma if (def->os.type == VIR_DOMAIN_OSTYPE_HVM) { if (def->emulator) { + if (!virFileExists(def->emulator)) + goto cleanup; + cmd = virCommandNew(def->emulator); virCommandAddArgList(cmd, "-help", NULL); ++++++ 5325123d-libxl-migv2-save-restore.patch ++++++ commit 5325123d235deb07f39b73c06a7d9ab6494fa2c8 Author: Jim Fehlig <jfeh...@suse.com> Date: Mon May 2 12:00:39 2016 -0600 libxl: support Xen migration stream V2 in save/restore Xen 4.6 introduced a new migration stream commonly referred to as "migration V2". Xen 4.6 and newer always produce this new stream, whereas Xen 4.5 and older always produce the legacy stream. Support for migration stream V2 can be detected at build time with LIBXL_HAVE_SRM_V2 from libxl.h. The legacy and V2 streams are not compatible, but a V2 host can accept and convert a legacy stream. Commit e7440656 changed the libxl driver to use the lowest libxl API version possible (version 0x040200) to ensure the driver builds against older Xen releases. The old 4.2 restore API does not support specifying a stream version and assumes a legacy stream, even if the incoming stream is migration V2. Thinking it has been given a legacy stream, libxl will fail to convert an incoming stream that is already V2, which causes the entire restore operation to fail. Xen's libvirt-related OSSTest has been failing since commit e7440656 landed in libvirt.git master. One of the more recent failures can be seen here http://lists.xenproject.org/archives/html/xen-devel/2016-05/msg00071.html This patch changes the call to libxl_domain_create_restore() to include the stream version if LIBXL_HAVE_SRM_V2 is defined. The version field of the libxlSavefileHeader struct is also updated to '2' when LIBXL_HAVE_SRM_V2 is defined, ensuring the stream version in the header matches the actual stream version produced by Xen. Along with bumping the libxl API requirement to 0x040400, this patch fixes save/restore on a migration V2 Xen host. Oddly, migration has never used the libxlSavefileHeader. It handles passing configuration in the Begin and Prepare phases, and then calls libxl directly to transfer domain state/memory in the Perform phase. A subsequent patch will add stream version handling in the Begin and Prepare phase handshaking, which will fix the migration related OSSTest failures. Signed-off-by: Jim Fehlig <jfeh...@suse.com> Index: libvirt-1.3.4/src/libxl/libxl_conf.h =================================================================== --- libvirt-1.3.4.orig/src/libxl/libxl_conf.h +++ libvirt-1.3.4/src/libxl/libxl_conf.h @@ -148,7 +148,11 @@ struct _libxlDriverPrivate { }; # define LIBXL_SAVE_MAGIC "libvirt-xml\n \0 \r" -# define LIBXL_SAVE_VERSION 1 +# ifdef LIBXL_HAVE_SRM_V2 +# define LIBXL_SAVE_VERSION 2 +# else +# define LIBXL_SAVE_VERSION 1 +# endif typedef struct _libxlSavefileHeader libxlSavefileHeader; typedef libxlSavefileHeader *libxlSavefileHeaderPtr; Index: libvirt-1.3.4/src/libxl/libxl_domain.c =================================================================== --- libvirt-1.3.4.orig/src/libxl/libxl_domain.c +++ libvirt-1.3.4/src/libxl/libxl_domain.c @@ -514,7 +514,7 @@ libxlDomainShutdownThread(void *opaque) } libxlDomainDestroyInternal(driver, vm); libxlDomainCleanup(driver, vm); - if (libxlDomainStart(driver, vm, false, -1) < 0) { + if (libxlDomainStartNew(driver, vm, false) < 0) { virErrorPtr err = virGetLastError(); VIR_ERROR(_("Failed to restart VM '%s': %s"), vm->def->name, err ? err->message : _("unknown error")); @@ -1006,14 +1006,23 @@ libxlDomainCreateIfaceNames(virDomainDef } +#ifdef LIBXL_HAVE_SRM_V2 +# define LIBXL_DOMSTART_RESTORE_VER_ATTR /* empty */ +#else +# define LIBXL_DOMSTART_RESTORE_VER_ATTR ATTRIBUTE_UNUSED +#endif + /* * Start a domain through libxenlight. * * virDomainObjPtr must be locked and a job acquired on invocation */ -int -libxlDomainStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm, - bool start_paused, int restore_fd) +static int +libxlDomainStart(libxlDriverPrivatePtr driver, + virDomainObjPtr vm, + bool start_paused, + int restore_fd, + uint32_t restore_ver LIBXL_DOMSTART_RESTORE_VER_ATTR) { libxl_domain_config d_config; virDomainDefPtr def = NULL; @@ -1049,6 +1058,7 @@ libxlDomainStart(libxlDriverPrivatePtr d goto cleanup; restore_fd = managed_save_fd; + restore_ver = hdr.version; if (STRNEQ(vm->def->name, def->name) || memcmp(vm->def->uuid, def->uuid, VIR_UUID_BUFLEN)) { @@ -1117,6 +1127,9 @@ libxlDomainStart(libxlDriverPrivatePtr d &domid, NULL, &aop_console_how); } else { libxl_domain_restore_params_init(¶ms); +#ifdef LIBXL_HAVE_SRM_V2 + params.stream_version = restore_ver; +#endif ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid, restore_fd, ¶ms, NULL, &aop_console_how); @@ -1203,6 +1216,25 @@ libxlDomainStart(libxlDriverPrivatePtr d return ret; } +int +libxlDomainStartNew(libxlDriverPrivatePtr driver, + virDomainObjPtr vm, + bool start_paused) +{ + return libxlDomainStart(driver, vm, start_paused, -1, LIBXL_SAVE_VERSION); +} + +int +libxlDomainStartRestore(libxlDriverPrivatePtr driver, + virDomainObjPtr vm, + bool start_paused, + int restore_fd, + uint32_t restore_ver) +{ + return libxlDomainStart(driver, vm, start_paused, + restore_fd, restore_ver); +} + bool libxlDomainDefCheckABIStability(libxlDriverPrivatePtr driver, virDomainDefPtr src, Index: libvirt-1.3.4/src/libxl/libxl_domain.h =================================================================== --- libvirt-1.3.4.orig/src/libxl/libxl_domain.h +++ libvirt-1.3.4/src/libxl/libxl_domain.h @@ -142,10 +142,16 @@ libxlDomainSetVcpuAffinities(libxlDriver virDomainObjPtr vm); int -libxlDomainStart(libxlDriverPrivatePtr driver, - virDomainObjPtr vm, - bool start_paused, - int restore_fd); +libxlDomainStartNew(libxlDriverPrivatePtr driver, + virDomainObjPtr vm, + bool start_paused); + +int +libxlDomainStartRestore(libxlDriverPrivatePtr driver, + virDomainObjPtr vm, + bool start_paused, + int restore_fd, + uint32_t restore_ver); bool libxlDomainDefCheckABIStability(libxlDriverPrivatePtr driver, Index: libvirt-1.3.4/src/libxl/libxl_driver.c =================================================================== --- libvirt-1.3.4.orig/src/libxl/libxl_driver.c +++ libvirt-1.3.4/src/libxl/libxl_driver.c @@ -323,7 +323,7 @@ libxlAutostartDomain(virDomainObjPtr vm, } if (vm->autostart && !virDomainObjIsActive(vm) && - libxlDomainStart(driver, vm, false, -1) < 0) { + libxlDomainStartNew(driver, vm, false) < 0) { err = virGetLastError(); VIR_ERROR(_("Failed to autostart VM '%s': %s"), vm->def->name, @@ -998,8 +998,8 @@ libxlDomainCreateXML(virConnectPtr conn, goto cleanup; } - if (libxlDomainStart(driver, vm, (flags & VIR_DOMAIN_START_PAUSED) != 0, - -1) < 0) { + if (libxlDomainStartNew(driver, vm, + (flags & VIR_DOMAIN_START_PAUSED) != 0) < 0) { if (!vm->persistent) { virDomainObjListRemove(driver->domains, vm); vm = NULL; @@ -1818,7 +1818,9 @@ libxlDomainRestoreFlags(virConnectPtr co goto cleanup; } - ret = libxlDomainStart(driver, vm, (flags & VIR_DOMAIN_SAVE_PAUSED) != 0, fd); + ret = libxlDomainStartRestore(driver, vm, + (flags & VIR_DOMAIN_SAVE_PAUSED) != 0, + fd, hdr.version); if (ret < 0 && !vm->persistent) virDomainObjListRemove(driver->domains, vm); @@ -2681,7 +2683,8 @@ libxlDomainCreateWithFlags(virDomainPtr goto endjob; } - ret = libxlDomainStart(driver, vm, (flags & VIR_DOMAIN_START_PAUSED) != 0, -1); + ret = libxlDomainStartNew(driver, vm, + (flags & VIR_DOMAIN_START_PAUSED) != 0); if (ret < 0) goto endjob; dom->id = vm->def->id; Index: libvirt-1.3.4/src/libxl/libxl_migration.c =================================================================== --- libvirt-1.3.4.orig/src/libxl/libxl_migration.c +++ libvirt-1.3.4/src/libxl/libxl_migration.c @@ -106,7 +106,7 @@ libxlDoMigrateReceive(void *opaque) * Always start the domain paused. If needed, unpause in the * finish phase, after transfer of the domain is complete. */ - ret = libxlDomainStart(driver, vm, true, recvfd); + ret = libxlDomainStartRestore(driver, vm, true, recvfd, LIBXL_SAVE_VERSION); if (ret < 0 && !vm->persistent) remove_dom = true; ++++++ 538012c8-default-vram.patch ++++++ commit 538012c8a30230065d1bfe09892279dd8b89193f Author: Ján Tomko <jto...@redhat.com> Date: Wed May 11 12:39:52 2016 +0200 Fill out default vram in DeviceDefPostParse Move filling out the default video (v)ram to DeviceDefPostParse. This means it can be removed from virDomainVideoDefParseXML and qemuParseCommandLine. Also, we no longer need to special case VIR_DOMAIN_VIRT_XEN, since the per-driver callback gets called before the generic one. Index: libvirt-1.3.4/src/conf/domain_conf.c =================================================================== --- libvirt-1.3.4.orig/src/conf/domain_conf.c +++ libvirt-1.3.4/src/conf/domain_conf.c @@ -4155,6 +4155,12 @@ virDomainDeviceDefPostParseInternal(virD if (dev->type == VIR_DOMAIN_DEVICE_VIDEO) { virDomainVideoDefPtr video = dev->data.video; + /* Fill out (V)RAM if the driver-specific callback did not do so */ + if (video->ram == 0 && video->type == VIR_DOMAIN_VIDEO_TYPE_QXL) + video->ram = virDomainVideoDefaultRAM(def, video->type); + if (video->vram == 0) + video->vram = virDomainVideoDefaultRAM(def, video->type); + video->ram = VIR_ROUND_UP_POWER_OF_TWO(video->ram); video->vram = VIR_ROUND_UP_POWER_OF_TWO(video->vram); } @@ -11970,10 +11976,6 @@ unsigned int virDomainVideoDefaultRAM(const virDomainDef *def, const virDomainVideoType type) { - /* Defer setting default vram to the Xen drivers */ - if (def->virtType == VIR_DOMAIN_VIRT_XEN) - return 0; - switch (type) { case VIR_DOMAIN_VIDEO_TYPE_VGA: case VIR_DOMAIN_VIDEO_TYPE_CIRRUS: @@ -12152,8 +12154,6 @@ virDomainVideoDefParseXML(xmlNodePtr nod _("cannot parse video ram '%s'"), ram); goto error; } - } else if (def->type == VIR_DOMAIN_VIDEO_TYPE_QXL) { - def->ram = virDomainVideoDefaultRAM(dom, def->type); } if (vram) { @@ -12162,8 +12162,6 @@ virDomainVideoDefParseXML(xmlNodePtr nod _("cannot parse video vram '%s'"), vram); goto error; } - } else { - def->vram = virDomainVideoDefaultRAM(dom, def->type); } if (vram64) { @@ -18612,7 +18610,6 @@ virDomainDefAddImplicitVideo(virDomainDe _("cannot determine default video type")); goto cleanup; } - video->vram = virDomainVideoDefaultRAM(def, video->type); video->heads = 1; if (VIR_APPEND_ELEMENT(def->videos, def->nvideos, video) < 0) goto cleanup; Index: libvirt-1.3.4/src/qemu/qemu_parse_command.c =================================================================== --- libvirt-1.3.4.orig/src/qemu/qemu_parse_command.c +++ libvirt-1.3.4/src/qemu/qemu_parse_command.c @@ -2585,9 +2585,7 @@ qemuParseCommandLine(virCapsPtr caps, vid->type = VIR_DOMAIN_VIDEO_TYPE_XEN; else vid->type = video; - vid->vram = virDomainVideoDefaultRAM(def, vid->type); if (vid->type == VIR_DOMAIN_VIDEO_TYPE_QXL) { - vid->ram = virDomainVideoDefaultRAM(def, vid->type); vid->vgamem = QEMU_QXL_VGAMEM_DEFAULT; } else { vid->ram = 0; ++++++ 96b21fb0-vram-tests.patch ++++++ ++++ 958 lines (skipped) ++++++ b90c4b5f-tests-use-qemu-xen.patch ++++++ commit b90c4b5f505698d600303c5b4f03f5d229b329dd Author: Jim Fehlig <jfeh...@suse.com> Date: Thu May 12 14:40:29 2016 -0600 xlconfigtests: use qemu-xen in all test data files Some of the test configuration files in tests/xlconfigdata use the old qemu-dm as the emulator. Many of the configuration features tested (spice, rbd, multi-usb) are not even usable with the old qemu. Change these files to use the new qemu-xen (also known as qemu upstream) emulator. Note: This change fixes xlconfigtest failures when the old qemu is actually installed on the system. During device post parse, the libxl driver attempts to invoke the emulator to determine if it is the old or new qemu so it can properly set video RAM defaults. With the old qemu installed, the default video RAM was set differently than the expected value. Changing all the test data files to use qemu-xen ensures predictable results wrt default video RAM size. Signed-off-by: Jim Fehlig <jfeh...@suse.com> Index: libvirt-1.3.4/tests/xlconfigdata/test-disk-positional-parms-full.cfg =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-disk-positional-parms-full.cfg +++ libvirt-1.3.4/tests/xlconfigdata/test-disk-positional-parms-full.cfg @@ -12,7 +12,7 @@ localtime = 0 on_poweroff = "destroy" on_reboot = "restart" on_crash = "restart" -device_model = "/usr/lib/xen/bin/qemu-dm" +device_model = "/usr/lib/xen/bin/qemu-system-i386" sdl = 0 vnc = 1 vncunused = 1 Index: libvirt-1.3.4/tests/xlconfigdata/test-disk-positional-parms-full.xml =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-disk-positional-parms-full.xml +++ libvirt-1.3.4/tests/xlconfigdata/test-disk-positional-parms-full.xml @@ -19,7 +19,7 @@ <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> - <emulator>/usr/lib/xen/bin/qemu-dm</emulator> + <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator> <disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/HostVG/XenGuest2'/> Index: libvirt-1.3.4/tests/xlconfigdata/test-disk-positional-parms-partial.cfg =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-disk-positional-parms-partial.cfg +++ libvirt-1.3.4/tests/xlconfigdata/test-disk-positional-parms-partial.cfg @@ -12,7 +12,7 @@ localtime = 0 on_poweroff = "destroy" on_reboot = "restart" on_crash = "restart" -device_model = "/usr/lib/xen/bin/qemu-dm" +device_model = "/usr/lib/xen/bin/qemu-system-i386" sdl = 0 vnc = 1 vncunused = 1 Index: libvirt-1.3.4/tests/xlconfigdata/test-disk-positional-parms-partial.xml =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-disk-positional-parms-partial.xml +++ libvirt-1.3.4/tests/xlconfigdata/test-disk-positional-parms-partial.xml @@ -19,7 +19,7 @@ <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> - <emulator>/usr/lib/xen/bin/qemu-dm</emulator> + <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator> <disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/HostVG/XenGuest2'/> Index: libvirt-1.3.4/tests/xlconfigdata/test-fullvirt-multiusb.cfg =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-fullvirt-multiusb.cfg +++ libvirt-1.3.4/tests/xlconfigdata/test-fullvirt-multiusb.cfg @@ -12,7 +12,7 @@ localtime = 0 on_poweroff = "destroy" on_reboot = "restart" on_crash = "restart" -device_model = "/usr/lib/xen/bin/qemu-dm" +device_model = "/usr/lib/xen/bin/qemu-system-i386" sdl = 0 vnc = 1 vncunused = 1 Index: libvirt-1.3.4/tests/xlconfigdata/test-fullvirt-multiusb.xml =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-fullvirt-multiusb.xml +++ libvirt-1.3.4/tests/xlconfigdata/test-fullvirt-multiusb.xml @@ -19,7 +19,7 @@ <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> - <emulator>/usr/lib/xen/bin/qemu-dm</emulator> + <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator> <disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/HostVG/XenGuest2'/> Index: libvirt-1.3.4/tests/xlconfigdata/test-fullvirt-nohap.cfg =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-fullvirt-nohap.cfg +++ libvirt-1.3.4/tests/xlconfigdata/test-fullvirt-nohap.cfg @@ -13,7 +13,7 @@ localtime = 0 on_poweroff = "destroy" on_reboot = "restart" on_crash = "restart" -device_model = "/usr/lib/xen/bin/qemu-dm" +device_model = "/usr/lib/xen/bin/qemu-system-i386" sdl = 0 vnc = 1 vncunused = 1 Index: libvirt-1.3.4/tests/xlconfigdata/test-fullvirt-nohap.xml =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-fullvirt-nohap.xml +++ libvirt-1.3.4/tests/xlconfigdata/test-fullvirt-nohap.xml @@ -20,7 +20,7 @@ <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> - <emulator>/usr/lib/xen/bin/qemu-dm</emulator> + <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator> <disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/HostVG/XenGuest2'/> Index: libvirt-1.3.4/tests/xlconfigdata/test-new-disk.cfg =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-new-disk.cfg +++ libvirt-1.3.4/tests/xlconfigdata/test-new-disk.cfg @@ -12,7 +12,7 @@ localtime = 0 on_poweroff = "destroy" on_reboot = "restart" on_crash = "restart" -device_model = "/usr/lib/xen/bin/qemu-dm" +device_model = "/usr/lib/xen/bin/qemu-system-i386" sdl = 0 vnc = 1 vncunused = 1 Index: libvirt-1.3.4/tests/xlconfigdata/test-new-disk.xml =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-new-disk.xml +++ libvirt-1.3.4/tests/xlconfigdata/test-new-disk.xml @@ -19,7 +19,7 @@ <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> - <emulator>/usr/lib/xen/bin/qemu-dm</emulator> + <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator> <disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/HostVG/XenGuest2'/> Index: libvirt-1.3.4/tests/xlconfigdata/test-rbd-multihost-noauth.cfg =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-rbd-multihost-noauth.cfg +++ libvirt-1.3.4/tests/xlconfigdata/test-rbd-multihost-noauth.cfg @@ -12,7 +12,7 @@ localtime = 0 on_poweroff = "destroy" on_reboot = "restart" on_crash = "restart" -device_model = "/usr/lib/xen/bin/qemu-dm" +device_model = "/usr/lib/xen/bin/qemu-system-i386" sdl = 0 vnc = 1 vncunused = 1 Index: libvirt-1.3.4/tests/xlconfigdata/test-rbd-multihost-noauth.xml =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-rbd-multihost-noauth.xml +++ libvirt-1.3.4/tests/xlconfigdata/test-rbd-multihost-noauth.xml @@ -19,7 +19,7 @@ <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> - <emulator>/usr/lib/xen/bin/qemu-dm</emulator> + <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator> <disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/HostVG/XenGuest2'/> Index: libvirt-1.3.4/tests/xlconfigdata/test-spice-features.cfg =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-spice-features.cfg +++ libvirt-1.3.4/tests/xlconfigdata/test-spice-features.cfg @@ -12,7 +12,7 @@ localtime = 0 on_poweroff = "destroy" on_reboot = "restart" on_crash = "restart" -device_model = "/usr/lib/xen/bin/qemu-dm" +device_model = "/usr/lib/xen/bin/qemu-system-i386" vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000" ] parallel = "none" serial = "none" Index: libvirt-1.3.4/tests/xlconfigdata/test-spice-features.xml =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-spice-features.xml +++ libvirt-1.3.4/tests/xlconfigdata/test-spice-features.xml @@ -19,7 +19,7 @@ <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> - <emulator>/usr/lib/xen/bin/qemu-dm</emulator> + <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator> <disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/HostVG/XenGuest2'/> Index: libvirt-1.3.4/tests/xlconfigdata/test-spice.cfg =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-spice.cfg +++ libvirt-1.3.4/tests/xlconfigdata/test-spice.cfg @@ -12,7 +12,7 @@ localtime = 0 on_poweroff = "destroy" on_reboot = "restart" on_crash = "restart" -device_model = "/usr/lib/xen/bin/qemu-dm" +device_model = "/usr/lib/xen/bin/qemu-system-i386" vif = [ "mac=00:16:3e:66:92:9c,bridge=xenbr1,script=vif-bridge,model=e1000" ] parallel = "none" serial = "none" Index: libvirt-1.3.4/tests/xlconfigdata/test-spice.xml =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-spice.xml +++ libvirt-1.3.4/tests/xlconfigdata/test-spice.xml @@ -19,7 +19,7 @@ <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> - <emulator>/usr/lib/xen/bin/qemu-dm</emulator> + <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator> <disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/HostVG/XenGuest2'/> Index: libvirt-1.3.4/tests/xlconfigdata/test-vif-rate.cfg =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-vif-rate.cfg +++ libvirt-1.3.4/tests/xlconfigdata/test-vif-rate.cfg @@ -12,7 +12,7 @@ localtime = 0 on_poweroff = "destroy" on_reboot = "restart" on_crash = "restart" -device_model = "/usr/lib/xen/bin/qemu-dm" +device_model = "/usr/lib/xen/bin/qemu-system-i386" sdl = 0 vnc = 1 vncunused = 1 Index: libvirt-1.3.4/tests/xlconfigdata/test-vif-rate.xml =================================================================== --- libvirt-1.3.4.orig/tests/xlconfigdata/test-vif-rate.xml +++ libvirt-1.3.4/tests/xlconfigdata/test-vif-rate.xml @@ -19,7 +19,7 @@ <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> - <emulator>/usr/lib/xen/bin/qemu-dm</emulator> + <emulator>/usr/lib/xen/bin/qemu-system-i386</emulator> <disk type='block' device='disk'> <driver name='phy' type='raw'/> <source dev='/dev/HostVG/XenGuest2'/> ++++++ e4d131b8-mv-virDomainDefPostParseInternal.patch ++++++ commit e4d131b8cb12679814b6fda159281f472b615524 Author: Ján Tomko <jto...@redhat.com> Date: Wed May 11 11:57:33 2016 +0200 Move virDomainDefPostParseInternal after virDomainDeviceDefPostParse Future commit will call DeviceDefPostParse on a device auto-added in DomainDefPostParse. Index: libvirt-1.3.4/src/conf/domain_conf.c =================================================================== --- libvirt-1.3.4.orig/src/conf/domain_conf.c +++ libvirt-1.3.4/src/conf/domain_conf.c @@ -3905,45 +3905,6 @@ virDomainDefPostParseTimer(virDomainDefP } -static int -virDomainDefPostParseInternal(virDomainDefPtr def, - virCapsPtr caps ATTRIBUTE_UNUSED, - unsigned int parseFlags) -{ - /* verify init path for container based domains */ - if (def->os.type == VIR_DOMAIN_OSTYPE_EXE && !def->os.init) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("init binary must be specified")); - return -1; - } - - if (virDomainDefPostParseMemory(def, parseFlags) < 0) - return -1; - - if (virDomainDefRejectDuplicateControllers(def) < 0) - return -1; - - if (virDomainDefRejectDuplicatePanics(def) < 0) - return -1; - - if (virDomainDefPostParseTimer(def) < 0) - return -1; - - if (virDomainDefAddImplicitDevices(def) < 0) - return -1; - - /* Mark the first video as primary. If the user specified primary="yes", - * the parser already inserted the device at def->videos[0] */ - if (def->nvideos != 0) - def->videos[0]->primary = true; - - /* clean up possibly duplicated metadata entries */ - virDomainDefMetadataSanitize(def); - - return 0; -} - - /* Check if a drive type address $controller:$bus:$target:$unit is already * taken by a disk or not. */ @@ -4358,6 +4319,45 @@ virDomainDefPostParseDeviceIterator(virD } +static int +virDomainDefPostParseInternal(virDomainDefPtr def, + virCapsPtr caps ATTRIBUTE_UNUSED, + unsigned int parseFlags) +{ + /* verify init path for container based domains */ + if (def->os.type == VIR_DOMAIN_OSTYPE_EXE && !def->os.init) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("init binary must be specified")); + return -1; + } + + if (virDomainDefPostParseMemory(def, parseFlags) < 0) + return -1; + + if (virDomainDefRejectDuplicateControllers(def) < 0) + return -1; + + if (virDomainDefRejectDuplicatePanics(def) < 0) + return -1; + + if (virDomainDefPostParseTimer(def) < 0) + return -1; + + if (virDomainDefAddImplicitDevices(def) < 0) + return -1; + + /* Mark the first video as primary. If the user specified primary="yes", + * the parser already inserted the device at def->videos[0] */ + if (def->nvideos != 0) + def->videos[0]->primary = true; + + /* clean up possibly duplicated metadata entries */ + virDomainDefMetadataSanitize(def); + + return 0; +} + + int virDomainDefPostParse(virDomainDefPtr def, virCapsPtr caps, ++++++ f9edcfa4-libxl-migv2-migration.patch ++++++ commit f9edcfa47396fdaab69ed72f0d5e0b751aa014fa Author: Jim Fehlig <jfeh...@suse.com> Date: Fri Apr 29 15:08:05 2016 -0600 libxl: support migration stream V2 in migration Similar to "support Xen migration stream V2 in save/restore", add support for indicating the migration stream version in the migration code. To accomplish this, add a minimal migration cookie in the libxl driver that is passed between source and destination hosts. Initially, the cookie is only used in the Begin and Prepare phases of migration to communicate the version of the migration stream produced by the source. Signed-off-by: Jim Fehlig <jfeh...@suse.com> Index: libvirt-1.3.4/src/libxl/libxl_driver.c =================================================================== --- libvirt-1.3.4.orig/src/libxl/libxl_driver.c +++ libvirt-1.3.4/src/libxl/libxl_driver.c @@ -5151,8 +5151,8 @@ static char * libxlDomainMigrateBegin3Params(virDomainPtr domain, virTypedParameterPtr params, int nparams, - char **cookieout ATTRIBUTE_UNUSED, - int *cookieoutlen ATTRIBUTE_UNUSED, + char **cookieout, + int *cookieoutlen, unsigned int flags) { const char *xmlin = NULL; @@ -5193,15 +5193,16 @@ libxlDomainMigrateBegin3Params(virDomain return NULL; } - return libxlDomainMigrationBegin(domain->conn, vm, xmlin); + return libxlDomainMigrationBegin(domain->conn, vm, xmlin, + cookieout, cookieoutlen); } static int libxlDomainMigratePrepare3Params(virConnectPtr dconn, virTypedParameterPtr params, int nparams, - const char *cookiein ATTRIBUTE_UNUSED, - int cookieinlen ATTRIBUTE_UNUSED, + const char *cookiein, + int cookieinlen, char **cookieout ATTRIBUTE_UNUSED, int *cookieoutlen ATTRIBUTE_UNUSED, char **uri_out, @@ -5240,7 +5241,8 @@ libxlDomainMigratePrepare3Params(virConn if (virDomainMigratePrepare3ParamsEnsureACL(dconn, def) < 0) goto error; - if (libxlDomainMigrationPrepare(dconn, &def, uri_in, uri_out, flags) < 0) + if (libxlDomainMigrationPrepare(dconn, &def, uri_in, uri_out, + cookiein, cookieinlen, flags) < 0) goto error; return 0; Index: libvirt-1.3.4/src/libxl/libxl_migration.c =================================================================== --- libvirt-1.3.4.orig/src/libxl/libxl_migration.c +++ libvirt-1.3.4/src/libxl/libxl_migration.c @@ -48,6 +48,18 @@ VIR_LOG_INIT("libxl.libxl_migration"); +typedef struct _libxlMigrationCookie libxlMigrationCookie; +typedef libxlMigrationCookie *libxlMigrationCookiePtr; +struct _libxlMigrationCookie { + /* Host properties */ + char *srcHostname; + uint32_t xenMigStreamVer; + + /* Guest properties */ + unsigned char uuid[VIR_UUID_BUFLEN]; + char *name; +}; + typedef struct _libxlMigrationDstArgs { virObject parent; @@ -55,6 +67,7 @@ typedef struct _libxlMigrationDstArgs { virConnectPtr conn; virDomainObjPtr vm; unsigned int flags; + libxlMigrationCookiePtr migcookie; /* for freeing listen sockets */ virNetSocketPtr *socks; @@ -63,11 +76,166 @@ typedef struct _libxlMigrationDstArgs { static virClassPtr libxlMigrationDstArgsClass; + +static void +libxlMigrationCookieFree(libxlMigrationCookiePtr mig) +{ + if (!mig) + return; + + VIR_FREE(mig->srcHostname); + VIR_FREE(mig->name); + VIR_FREE(mig); +} + +static libxlMigrationCookiePtr +libxlMigrationCookieNew(virDomainObjPtr dom) +{ + libxlMigrationCookiePtr mig = NULL; + + if (VIR_ALLOC(mig) < 0) + goto error; + + if (VIR_STRDUP(mig->name, dom->def->name) < 0) + goto error; + + memcpy(mig->uuid, dom->def->uuid, VIR_UUID_BUFLEN); + + if (!(mig->srcHostname = virGetHostname())) + goto error; + + mig->xenMigStreamVer = LIBXL_SAVE_VERSION; + + return mig; + + error: + libxlMigrationCookieFree(mig); + return NULL; +} + + +static int +libxlMigrationBakeCookie(libxlMigrationCookiePtr mig, + char **cookieout, + int *cookieoutlen) +{ + virBuffer buf = VIR_BUFFER_INITIALIZER; + char uuidstr[VIR_UUID_STRING_BUFLEN]; + + if (!cookieout || !cookieoutlen) + return 0; + + *cookieoutlen = 0; + virUUIDFormat(mig->uuid, uuidstr); + + virBufferAddLit(&buf, "<libxl-migration>\n"); + virBufferAdjustIndent(&buf, 2); + virBufferEscapeString(&buf, "<name>%s</name>\n", mig->name); + virBufferAsprintf(&buf, "<uuid>%s</uuid>\n", uuidstr); + virBufferEscapeString(&buf, "<hostname>%s</hostname>\n", mig->srcHostname); + virBufferAsprintf(&buf, "<migration-stream-version>%u</migration-stream-version>\n", mig->xenMigStreamVer); + virBufferAdjustIndent(&buf, -2); + virBufferAddLit(&buf, "</libxl-migration>\n"); + + if (virBufferCheckError(&buf) < 0) + return -1; + + *cookieout = virBufferContentAndReset(&buf); + *cookieoutlen = strlen(*cookieout) + 1; + + VIR_DEBUG("cookielen=%d cookie=%s", *cookieoutlen, *cookieout); + + return 0; +} + +static int +libxlMigrationEatCookie(const char *cookiein, + int cookieinlen, + libxlMigrationCookiePtr *migout) +{ + libxlMigrationCookiePtr mig = NULL; + xmlDocPtr doc = NULL; + xmlXPathContextPtr ctxt = NULL; + char *uuidstr = NULL; + int ret = -1; + + /* + * Assume a legacy (V1) migration stream if request came from a + * source host without cookie support, and hence no way to + * specify a stream version. + */ + if (!cookiein || !cookieinlen) { + if (VIR_ALLOC(mig) < 0) + return -1; + + mig->xenMigStreamVer = 1; + *migout = mig; + return 0; + } + + if (cookiein[cookieinlen-1] != '\0') { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Migration cookie was not NULL terminated")); + return -1; + } + + VIR_DEBUG("cookielen=%d cookie='%s'", cookieinlen, NULLSTR(cookiein)); + + if (VIR_ALLOC(mig) < 0) + return -1; + + if (!(doc = virXMLParseStringCtxt(cookiein, + _("(libxl_migration_cookie)"), + &ctxt))) + goto error; + + /* Extract domain name */ + if (!(mig->name = virXPathString("string(./name[1])", ctxt))) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing name element in migration data")); + goto error; + } + + /* Extract domain uuid */ + uuidstr = virXPathString("string(./uuid[1])", ctxt); + if (!uuidstr) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("missing uuid element in migration data")); + goto error; + } + if (virUUIDParse(uuidstr, mig->uuid) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + "%s", _("malformed uuid element")); + goto error; + } + + if (virXPathUInt("string(./migration-stream-version[1])", + ctxt, &mig->xenMigStreamVer) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing Xen migration stream version")); + goto error; + } + + *migout = mig; + ret = 0; + goto cleanup; + + error: + libxlMigrationCookieFree(mig); + + cleanup: + VIR_FREE(uuidstr); + xmlXPathFreeContext(ctxt); + xmlFreeDoc(doc); + return ret; +} + static void libxlMigrationDstArgsDispose(void *obj) { libxlMigrationDstArgs *args = obj; + libxlMigrationCookieFree(args->migcookie); VIR_FREE(args->socks); } @@ -106,7 +274,8 @@ libxlDoMigrateReceive(void *opaque) * Always start the domain paused. If needed, unpause in the * finish phase, after transfer of the domain is complete. */ - ret = libxlDomainStartRestore(driver, vm, true, recvfd, LIBXL_SAVE_VERSION); + ret = libxlDomainStartRestore(driver, vm, true, recvfd, + args->migcookie->xenMigStreamVer); if (ret < 0 && !vm->persistent) remove_dom = true; @@ -227,10 +396,13 @@ libxlDomainMigrationIsAllowed(virDomainD char * libxlDomainMigrationBegin(virConnectPtr conn, virDomainObjPtr vm, - const char *xmlin) + const char *xmlin, + char **cookieout, + int *cookieoutlen) { libxlDriverPrivatePtr driver = conn->privateData; libxlDriverConfigPtr cfg = libxlDriverConfigGet(driver); + libxlMigrationCookiePtr mig; virDomainDefPtr tmpdef = NULL; virDomainDefPtr def; char *xml = NULL; @@ -238,6 +410,12 @@ libxlDomainMigrationBegin(virConnectPtr if (libxlDomainObjBeginJob(driver, vm, LIBXL_JOB_MODIFY) < 0) goto cleanup; + if (!(mig = libxlMigrationCookieNew(vm))) + goto endjob; + + if (libxlMigrationBakeCookie(mig, cookieout, cookieoutlen) < 0) + goto endjob; + if (xmlin) { if (!(tmpdef = virDomainDefParseString(xmlin, cfg->caps, driver->xmlopt, @@ -308,9 +486,12 @@ libxlDomainMigrationPrepare(virConnectPt virDomainDefPtr *def, const char *uri_in, char **uri_out, + const char *cookiein, + int cookieinlen, unsigned int flags) { libxlDriverPrivatePtr driver = dconn->privateData; + libxlMigrationCookiePtr mig = NULL; virDomainObjPtr vm = NULL; char *hostname = NULL; unsigned short port; @@ -323,6 +504,16 @@ libxlDomainMigrationPrepare(virConnectPt size_t i; int ret = -1; + if (libxlMigrationEatCookie(cookiein, cookieinlen, &mig) < 0) + goto error; + + if (mig->xenMigStreamVer > LIBXL_SAVE_VERSION) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, + _("Xen migration stream version '%d' is not supported on this host"), + mig->xenMigStreamVer); + goto error; + } + if (!(vm = virDomainObjListAdd(driver->domains, *def, driver->xmlopt, VIR_DOMAIN_OBJ_LIST_ADD_LIVE | @@ -409,6 +600,7 @@ libxlDomainMigrationPrepare(virConnectPt args->flags = flags; args->socks = socks; args->nsocks = nsocks; + args->migcookie = mig; for (i = 0; i < nsocks; i++) { if (virNetSocketSetBlocking(socks[i], true) < 0) @@ -479,11 +671,14 @@ libxlDoMigrateP2P(libxlDriverPrivatePtr char *uri_out = NULL; char *dom_xml = NULL; unsigned long destflags; + char *cookieout = NULL; + int cookieoutlen; bool cancelled = true; virErrorPtr orig_err = NULL; int ret = -1; - dom_xml = libxlDomainMigrationBegin(sconn, vm, xmlin); + dom_xml = libxlDomainMigrationBegin(sconn, vm, xmlin, + &cookieout, &cookieoutlen); if (!dom_xml) goto cleanup; @@ -509,7 +704,7 @@ libxlDoMigrateP2P(libxlDriverPrivatePtr VIR_DEBUG("Prepare3"); virObjectUnlock(vm); ret = dconn->driver->domainMigratePrepare3Params - (dconn, params, nparams, NULL, 0, NULL, NULL, &uri_out, destflags); + (dconn, params, nparams, cookieout, cookieoutlen, NULL, NULL, &uri_out, destflags); virObjectLock(vm); if (ret == -1) @@ -580,6 +775,7 @@ libxlDoMigrateP2P(libxlDriverPrivatePtr virFreeError(orig_err); } + VIR_FREE(cookieout); VIR_FREE(dom_xml); VIR_FREE(uri_out); virTypedParamsFree(params, nparams); Index: libvirt-1.3.4/src/libxl/libxl_migration.h =================================================================== --- libvirt-1.3.4.orig/src/libxl/libxl_migration.h +++ libvirt-1.3.4/src/libxl/libxl_migration.h @@ -42,7 +42,9 @@ char * libxlDomainMigrationBegin(virConnectPtr conn, virDomainObjPtr vm, - const char *xmlin); + const char *xmlin, + char **cookieout, + int *cookieoutlen); virDomainDefPtr libxlDomainMigrationPrepareDef(libxlDriverPrivatePtr driver, @@ -54,6 +56,8 @@ libxlDomainMigrationPrepare(virConnectPt virDomainDefPtr *def, const char *uri_in, char **uri_out, + const char *cookiein, + int cookieinlen, unsigned int flags); int ++++++ fccf2725-libxl-API-4.4.patch ++++++ commit fccf27253cedd131c5c4720d31d96ecc68c20e59 Author: Jim Fehlig <jfeh...@suse.com> Date: Thu Apr 28 21:08:28 2016 -0600 libxl: switch to using libxl_domain_create_restore from v4.4 API In LIBXL_API_VERSION 0x040400, the libxl_domain_create_restore API gained a parameter for specifying restore parameters. Switch to using version 0x040400, which will be useful in a subsequent commit to specify the Xen migration stream version when restoring. Signed-off-by: Jim Fehlig <jfeh...@suse.com> Index: libvirt-1.3.4/configure.ac =================================================================== --- libvirt-1.3.4.orig/configure.ac +++ libvirt-1.3.4/configure.ac @@ -919,10 +919,11 @@ if test "$with_libxl" != "no" ; then fi fi -# Until there is a need to use enhancements of libxl APIs such as -# libxl_domain_create_restore and libxl_set_vcpuaffinity, stick with -# the APIs as defined in libxl API version 4.2.0. -LIBXL_CFLAGS="$LIBXL_CFLAGS -DLIBXL_API_VERSION=0x040200" +# LIBXL_API_VERSION 4.4.0 introduced a new parameter to +# libxl_domain_create_restore for specifying restore parameters. +# The libxl driver will make use of this new parameter for specifying +# the Xen migration stream version. +LIBXL_CFLAGS="$LIBXL_CFLAGS -DLIBXL_API_VERSION=0x040400" LIBS="$old_LIBS" CFLAGS="$old_CFLAGS" Index: libvirt-1.3.4/src/libxl/libxl_domain.c =================================================================== --- libvirt-1.3.4.orig/src/libxl/libxl_domain.c +++ libvirt-1.3.4/src/libxl/libxl_domain.c @@ -1028,6 +1028,7 @@ libxlDomainStart(libxlDriverPrivatePtr d libxlDriverConfigPtr cfg; virHostdevManagerPtr hostdev_mgr = driver->hostdevMgr; libxl_asyncprogress_how aop_console_how; + libxl_domain_restore_params params; libxl_domain_config_init(&d_config); @@ -1115,8 +1116,11 @@ libxlDomainStart(libxlDriverPrivatePtr d ret = libxl_domain_create_new(cfg->ctx, &d_config, &domid, NULL, &aop_console_how); } else { + libxl_domain_restore_params_init(¶ms); ret = libxl_domain_create_restore(cfg->ctx, &d_config, &domid, - restore_fd, NULL, &aop_console_how); + restore_fd, ¶ms, NULL, + &aop_console_how); + libxl_domain_restore_params_dispose(¶ms); } virObjectLock(vm); ++++++ libvirt-suse-netcontrol.patch ++++++ --- /var/tmp/diff_new_pack.8tjuew/_old 2016-05-23 16:38:56.000000000 +0200 +++ /var/tmp/diff_new_pack.8tjuew/_new 2016-05-23 16:38:56.000000000 +0200 @@ -10,7 +10,7 @@ LIBVIRT_CHECK_NUMACTL LIBVIRT_CHECK_OPENWSMAN LIBVIRT_CHECK_PCIACCESS -@@ -2470,11 +2471,12 @@ if test "$with_libvirtd" = "no" ; then +@@ -2471,11 +2472,12 @@ if test "$with_libvirtd" = "no" ; then with_interface=no fi @@ -26,7 +26,7 @@ esac if test "$with_interface" = "yes" ; then -@@ -2853,6 +2855,7 @@ LIBVIRT_RESULT_FUSE +@@ -2854,6 +2856,7 @@ LIBVIRT_RESULT_FUSE LIBVIRT_RESULT_GLUSTER LIBVIRT_RESULT_HAL LIBVIRT_RESULT_NETCF ++++++ libxl-support-block-script.patch ++++++ --- /var/tmp/diff_new_pack.8tjuew/_old 2016-05-23 16:38:56.000000000 +0200 +++ /var/tmp/diff_new_pack.8tjuew/_new 2016-05-23 16:38:56.000000000 +0200 @@ -37,7 +37,7 @@ #define LIBXL_QEMU_DM_STR "Options specific to the Xen version:" int -@@ -1052,6 +1071,7 @@ libxlMakeNetworkDiskSrc(virStorageSource +@@ -1055,6 +1074,7 @@ libxlMakeNetworkDiskSrc(virStorageSource int libxlMakeDisk(virDomainDiskDefPtr l_disk, libxl_device_disk *x_disk) { @@ -45,7 +45,7 @@ const char *driver; int format; int actual_type = virStorageSourceGetActualType(l_disk->src); -@@ -1062,7 +1082,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk +@@ -1065,7 +1085,7 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk if (libxlMakeNetworkDiskSrc(l_disk->src, &x_disk->pdev_path) < 0) return -1; } else { @@ -54,7 +54,7 @@ return -1; } -@@ -1171,6 +1191,9 @@ libxlMakeDisk(virDomainDiskDefPtr l_disk +@@ -1174,6 +1194,9 @@ 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;