diff --git a/libvirt-Don-t-require-secdrivers-to-implement-.domainMoveIma.patch b/libvirt-Don-t-require-secdrivers-to-implement-.domainMoveIma.patch new file mode 100644 index 0000000000000000000000000000000000000000..579fbc72fa6e23c58a8f67fa2c7e35bb58d0aab7 --- /dev/null +++ b/libvirt-Don-t-require-secdrivers-to-implement-.domainMoveIma.patch @@ -0,0 +1,42 @@ +From 19845de491a3102df4256a3457c7d5669bccda63 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Mon, 18 May 2020 10:07:30 +0200 +Subject: [PATCH] Don't require secdrivers to implement + .domainMoveImageMetadata + +The AppArmor secdriver does not use labels to grant access to +resources. Therefore, it doesn't use XATTRs and hence it lacks +implementation of .domainMoveImageMetadata callback. This leads +to a harmless but needless error message appearing in the logs: + + virSecurityManagerMoveImageMetadata:476 : this function is not + supported by the connection driver: virSecurityManagerMoveImageMetadata + +Closes: https://gitlab.com/libvirt/libvirt/-/issues/25 + +cherry-pick from commit: cc8c297e473afd55e5d8e35e18345d8df176059d + +Signed-off-by: Michal Privoznik +Reviewed-by: Erik Skultety +Signed-off-by: Jin Yan +--- + src/security/security_manager.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/security/security_manager.c b/src/security/security_manager.c +index fe03274..1445291 100644 +--- a/src/security/security_manager.c ++++ b/src/security/security_manager.c +@@ -473,8 +473,7 @@ virSecurityManagerMoveImageMetadata(virSecurityManagerPtr mgr, + return ret; + } + +- virReportUnsupportedError(); +- return -1; ++ return 0; + } + + +-- +1.8.3.1 + diff --git a/libvirt-Fix-some-wrong-usage-of-ATTRIBUTE_NONNULL.patch b/libvirt-Fix-some-wrong-usage-of-ATTRIBUTE_NONNULL.patch new file mode 100644 index 0000000000000000000000000000000000000000..240f77e1af2ced57bd99827764296dd3be2ae26c --- /dev/null +++ b/libvirt-Fix-some-wrong-usage-of-ATTRIBUTE_NONNULL.patch @@ -0,0 +1,56 @@ +From 42e4b74e1bbd08aad3afa46d741e46c40a8af73d Mon Sep 17 00:00:00 2001 +From: Bihong Yu +Date: Sat, 6 Jun 2020 18:52:35 +0800 +Subject: [PATCH] Fix some wrong usage of ATTRIBUTE_NONNULL() + +The virStateInitialize() function has ATTRIBUTE_NONNULL() +referring to @root argument (incorrectly anyway) but in +daemonRunStateInit() NULL is passed in anyway. + +Then there is virCommandAddArgPair() which also has +ATTRIBUTE_NONNULL() for one of its arguments and then checks the +argument for being NULL anyways. + +cherry-pick from commit: 2a372a5ad5fab3bf26fb9bea019d38fa04ba8b34 + +Signed-off-by:Bihong Yu +Reviewed-by:Chuan Zheng +Signed-off-by: Michal Privoznik +Reviewed-by: Michal Privoznik +Signed-off-by: Jin Yan +--- + src/libvirt_internal.h | 3 +-- + src/util/vircommand.h | 3 +-- + 2 files changed, 2 insertions(+), 4 deletions(-) + +diff --git a/src/libvirt_internal.h b/src/libvirt_internal.h +index 00ef7aa..72c6127 100644 +--- a/src/libvirt_internal.h ++++ b/src/libvirt_internal.h +@@ -33,8 +33,7 @@ int virStateInitialize(bool privileged, + bool mandatory, + const char *root, + virStateInhibitCallback inhibit, +- void *opaque) +- ATTRIBUTE_NONNULL(2); ++ void *opaque); + int virStateCleanup(void); + int virStateReload(void); + int virStateStop(void); +diff --git a/src/util/vircommand.h b/src/util/vircommand.h +index 9086f9a..4e6cb0a 100644 +--- a/src/util/vircommand.h ++++ b/src/util/vircommand.h +@@ -128,8 +128,7 @@ void virCommandAddArgFormat(virCommandPtr cmd, + + void virCommandAddArgPair(virCommandPtr cmd, + const char *name, +- const char *val) +- ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); ++ const char *val); + + void virCommandAddArgSet(virCommandPtr cmd, + const char *const*vals) ATTRIBUTE_NONNULL(2); +-- +1.8.3.1 + diff --git a/libvirt-conf-Increase-cpuset-length-limit-for-CPU-pinning.patch b/libvirt-conf-Increase-cpuset-length-limit-for-CPU-pinning.patch new file mode 100644 index 0000000000000000000000000000000000000000..7c09892a7c438355f68f21dc3364060fdec39916 --- /dev/null +++ b/libvirt-conf-Increase-cpuset-length-limit-for-CPU-pinning.patch @@ -0,0 +1,33 @@ +From fc8c41dbb52eb9ce3ee36680ecb53a41f4146610 Mon Sep 17 00:00:00 2001 +From: Jiri Denemark +Date: Thu, 11 Jun 2020 13:53:27 +0200 +Subject: [PATCH] conf: Increase cpuset length limit for CPU pinning + +Domains are now allowed to be pinned to host CPUs with IDs up to 16383. +The new limit is as arbitrary as the old one. It's just bigger. + +cherry-pick from commit: e728ffba5119cfb1488aa7363fef596940449f50 + +Signed-off-by: Jiri Denemark +Reviewed-by: Michal Privoznik +Signed-off-by: Jin Yan +--- + src/conf/domain_conf.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index a40773a..16e6253 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -2241,7 +2241,7 @@ struct _virDomainHugePage { + unsigned long long size; /* hugepage size in KiB */ + }; + +-#define VIR_DOMAIN_CPUMASK_LEN 1024 ++#define VIR_DOMAIN_CPUMASK_LEN 16384 + + struct _virDomainIOThreadIDDef { + bool autofill; +-- +1.8.3.1 + diff --git a/libvirt-conf-vmx-check-for-OOM-after-calling-xmlBufferCreate.patch b/libvirt-conf-vmx-check-for-OOM-after-calling-xmlBufferCreate.patch new file mode 100644 index 0000000000000000000000000000000000000000..e822e9ddb78451b755d26f67e4e7e877c78791d3 --- /dev/null +++ b/libvirt-conf-vmx-check-for-OOM-after-calling-xmlBufferCreate.patch @@ -0,0 +1,100 @@ +From 657c7f5d79fe43823ffb4d46e244bea15a65baf6 Mon Sep 17 00:00:00 2001 +From: Laine Stump +Date: Thu, 18 Jun 2020 12:49:09 -0400 +Subject: [PATCH 1/6] conf, vmx: check for OOM after calling xmlBufferCreate() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Although libvirt itself uses g_malloc0() and friends, which exit when +there isn't enouogh memory, libxml2 uses standard malloc(), which just +returns NULL on OOM - this means we must check for NULL on return from +any libxml2 functions that allocate memory. + +xmlBufferCreate(), for example, might return NULL, and we don't always +check for it. This patch adds checks where it isn't already done. + +(NB: Although libxml2 has a provision for changing behavior on OOM (by +calling xmlMemSetup() to change what functions are used to +allocating/freeing memory), we can't use that, since parts of libvirt +code end up in libvirt.so, which is linked and called directly by +applications that may themselves use libxml2 (and may have already set +their own alternate malloc()), e.g. drivers like esx which live totally +in the library rather than a separate process.) + +cherry pick from: b7a92bce070fd57844a59bf8b1c30cb4ef4f3acd + +Signed-off-by: Laine Stump +Reviewed-by: Ján Tomko +--- + src/conf/domain_conf.c | 6 +++++- + src/conf/network_conf.c | 6 +++++- + src/vmx/vmx.c | 11 +++++++---- + 3 files changed, 17 insertions(+), 6 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 914e03c..37c785a 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -29022,7 +29022,11 @@ virDomainDefFormatInternalSetRootName(virDomainDefPtr def, + * Thankfully, libxml maps what looks like globals into + * thread-local uses, so we are thread-safe. */ + xmlIndentTreeOutput = 1; +- xmlbuf = xmlBufferCreate(); ++ if (!(xmlbuf = xmlBufferCreate())) { ++ virReportOOMError(); ++ goto error; ++ } ++ + if (xmlNodeDump(xmlbuf, def->metadata->doc, def->metadata, + virBufferGetIndent(buf) / 2, 1) < 0) { + xmlBufferFree(xmlbuf); +diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c +index 819b645..c379042 100644 +--- a/src/conf/network_conf.c ++++ b/src/conf/network_conf.c +@@ -2478,7 +2478,11 @@ virNetworkDefFormatBuf(virBufferPtr buf, + * Thankfully, libxml maps what looks like globals into + * thread-local uses, so we are thread-safe. */ + xmlIndentTreeOutput = 1; +- xmlbuf = xmlBufferCreate(); ++ if (!(xmlbuf = xmlBufferCreate())) { ++ virReportOOMError(); ++ return -1; ++ } ++ + if (xmlNodeDump(xmlbuf, def->metadata->doc, def->metadata, + virBufferGetIndent(buf) / 2, 1) < 0) { + xmlBufferFree(xmlbuf); +diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c +index b1fd118..fbc8366 100644 +--- a/src/vmx/vmx.c ++++ b/src/vmx/vmx.c +@@ -697,8 +697,8 @@ virVMXConvertToUTF8(const char *encoding, const char *string) + { + char *result = NULL; + xmlCharEncodingHandlerPtr handler; +- xmlBufferPtr input; +- xmlBufferPtr utf8; ++ xmlBufferPtr input = NULL; ++ xmlBufferPtr utf8 = NULL; + + handler = xmlFindCharEncodingHandler(encoding); + +@@ -708,8 +708,11 @@ virVMXConvertToUTF8(const char *encoding, const char *string) + return NULL; + } + +- input = xmlBufferCreateStatic((char *)string, strlen(string)); +- utf8 = xmlBufferCreate(); ++ if (!(input = xmlBufferCreateStatic((char *)string, strlen(string))) || ++ !(utf8 = xmlBufferCreate())) { ++ virReportOOMError(); ++ goto cleanup; ++ } + + if (xmlCharEncInFunc(handler, utf8, input) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, +-- +1.8.3.1 + diff --git a/libvirt-leaseshelper-Report-more-errors.patch b/libvirt-leaseshelper-Report-more-errors.patch new file mode 100644 index 0000000000000000000000000000000000000000..b6dce6f73d1c0a520009e87c2fe0b2a5cd55e674 --- /dev/null +++ b/libvirt-leaseshelper-Report-more-errors.patch @@ -0,0 +1,66 @@ +From cc842aa3030697b1a454e15ccfb2a201e57d5602 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Mon, 15 Jun 2020 12:53:48 +0200 +Subject: [PATCH 3/6] leaseshelper: Report more errors +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Some functions or code paths that may fail don't report error +(e.g. when acquiring PID file fails) leading to a silent quit +of the leaseshelper. This makes it super hard for us and users +to debug what is happening. Fortunately, dnsmasq captures both +stdout and stderr so we can write an error message there. + +cherry pick from: 9ed345ac1a035c8cf1de37431de638f4bac41de3 + +Signed-off-by: Michal Privoznik +Reviewed-by: Daniel P. Berrangé +--- + src/network/leaseshelper.c | 18 ++++++++++++++---- + 1 file changed, 14 insertions(+), 4 deletions(-) + +diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c +index 86c847d..2b5fc0f 100644 +--- a/src/network/leaseshelper.c ++++ b/src/network/leaseshelper.c +@@ -131,8 +131,10 @@ main(int argc, char **argv) + * events for expired leases. So, libvirtd sets another env var for this + * purpose */ + if (!interface && +- !(interface = getenv("VIR_BRIDGE_NAME"))) +- goto cleanup; ++ !(interface = getenv("VIR_BRIDGE_NAME"))) { ++ fprintf(stderr, _("interface not set\n")); ++ exit(EXIT_FAILURE); ++ } + + ip = argv[3]; + mac = argv[2]; +@@ -160,13 +162,21 @@ main(int argc, char **argv) + pid_file = g_strdup(RUNSTATEDIR "/leaseshelper.pid"); + + /* Try to claim the pidfile, exiting if we can't */ +- if ((pid_file_fd = virPidFileAcquirePath(pid_file, true, getpid())) < 0) ++ if ((pid_file_fd = virPidFileAcquirePath(pid_file, true, getpid())) < 0) { ++ fprintf(stderr, ++ _("Unable to acquire PID file: %s\n errno=%d"), ++ pid_file, errno); + goto cleanup; ++ } + + /* Since interfaces can be hot plugged, we need to make sure that the + * corresponding custom lease file exists. If not, 'touch' it */ +- if (virFileTouch(custom_lease_file, 0644) < 0) ++ if (virFileTouch(custom_lease_file, 0644) < 0) { ++ fprintf(stderr, ++ _("Unable to create: %s\n errno=%d"), ++ custom_lease_file, errno); + goto cleanup; ++ } + + switch ((enum virLeaseActionFlags) action) { + case VIR_LEASE_ACTION_ADD: +-- +1.8.3.1 + diff --git a/libvirt-leaseshelper-Wait-to-acquire-PID-file.patch b/libvirt-leaseshelper-Wait-to-acquire-PID-file.patch new file mode 100644 index 0000000000000000000000000000000000000000..4cbdd02a1d08b4eebd0f836b2d2413ded35d9868 --- /dev/null +++ b/libvirt-leaseshelper-Wait-to-acquire-PID-file.patch @@ -0,0 +1,45 @@ +From 173b80e8f8103f26438d344e9b97335d4e5036b4 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Thu, 11 Jun 2020 16:43:22 +0200 +Subject: [PATCH 2/6] leaseshelper: Wait to acquire PID file +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On a DHCP transaction, dnsmasq runs our leases helper which +updates corresponding JSON files. While one dnsmasq won't run the +leaseshelper in parallel, two dnsmasqs (from two distinct +networks) might. To avoid corrupting JSON file, the leaseshelper +acquires PID file first. Well, the way it's acquiring it is not +ideal - it calls virPidFileAcquirePath(wait = false); which +means, that either it acquires the PID file instantly or returns +an error and does not touch the JSON at all. This in turn means +that there might be a leases record missing. With wait = true, +this won't happen. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1840307 + +cherry pick from: 876211ef4a192df1603b45715044ec14567d7e9f + +Signed-off-by: Michal Privoznik +Reviewed-by: Daniel P. Berrangé +--- + src/network/leaseshelper.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/network/leaseshelper.c b/src/network/leaseshelper.c +index a1780ca..86c847d 100644 +--- a/src/network/leaseshelper.c ++++ b/src/network/leaseshelper.c +@@ -160,7 +160,7 @@ main(int argc, char **argv) + pid_file = g_strdup(RUNSTATEDIR "/leaseshelper.pid"); + + /* Try to claim the pidfile, exiting if we can't */ +- if ((pid_file_fd = virPidFileAcquirePath(pid_file, false, getpid())) < 0) ++ if ((pid_file_fd = virPidFileAcquirePath(pid_file, true, getpid())) < 0) + goto cleanup; + + /* Since interfaces can be hot plugged, we need to make sure that the +-- +1.8.3.1 + diff --git a/libvirt-libxl-fix-crash-when-initializing-driver.patch b/libvirt-libxl-fix-crash-when-initializing-driver.patch new file mode 100644 index 0000000000000000000000000000000000000000..4d295c0435c4896aeda3057a0ec96123d11f745a --- /dev/null +++ b/libvirt-libxl-fix-crash-when-initializing-driver.patch @@ -0,0 +1,48 @@ +From 0e95f7b912055cf254b71b0b02dcb0acf7da3870 Mon Sep 17 00:00:00 2001 +From: Jim Fehlig +Date: Fri, 3 Apr 2020 15:51:48 -0600 +Subject: [PATCH 1/8] libxl: fix crash when initializing driver +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Commit 54a401af478 split out DriverConfigInit from DriverConfigNew, but +then called it a bit late from libxlStateInitialize. The cfg is used in +libxlDriverConfigLoadFile and when uninitialized results in a crash. +Calling DriverConfigInit immediately after DriverConfigNew fixes the +crash. + +Signed-off-by: Jim Fehlig +Reviewed-by: Erik Skultety +Reviewed-by: Ján Tomko +(cherry-picked from commit 88011ed2) +Signed-off-by: AlexChen +--- + src/libxl/libxl_driver.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c +index 7ec4fcc3d1..980984b199 100644 +--- a/src/libxl/libxl_driver.c ++++ b/src/libxl/libxl_driver.c +@@ -702,14 +702,14 @@ libxlStateInitialize(bool privileged, + if (!(cfg = libxlDriverConfigNew())) + goto error; + ++ if (libxlDriverConfigInit(cfg) < 0) ++ goto error; ++ + driverConf = g_strdup_printf("%s/libxl.conf", cfg->configBaseDir); + + if (libxlDriverConfigLoadFile(cfg, driverConf) < 0) + goto error; + +- if (libxlDriverConfigInit(cfg) < 0) +- goto error; +- + /* Register the callbacks providing access to libvirt's event loop */ + libxl_osevent_register_hooks(cfg->ctx, &libxl_osevent_callbacks, cfg->ctx); + +-- +2.23.0 + diff --git a/libvirt-qemu-Revoke-access-to-mirror-on-failed-blockcopy.patch b/libvirt-qemu-Revoke-access-to-mirror-on-failed-blockcopy.patch new file mode 100644 index 0000000000000000000000000000000000000000..2fadfadfc941a2478530240e7f49c876d8025efe --- /dev/null +++ b/libvirt-qemu-Revoke-access-to-mirror-on-failed-blockcopy.patch @@ -0,0 +1,72 @@ +From 19d06bcb3c64662d5c131a035146d2caa8c5a437 Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Tue, 14 Apr 2020 11:18:02 +0200 +Subject: [PATCH 4/8] qemu: Revoke access to mirror on failed blockcopy + +When preparing to do a blockcopy, the mirror image is modified so +that QEMU can access it. For instance, the mirror has seclabels +set, if it is a NVMe disk it is detached from the host and so on. +And usually, the restore is done upon successful finish of the +blockcopy operation. But, if something fails then we need to +explicitly revoke the access to the mirror image (and thus +reattach NVMe disk back to the host). + +Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1822538 + +Signed-off-by: Michal Privoznik +Reviewed-by: Pavel Mores +(cherry-picked from commit 67e19fc9) +Signed-off-by: AlexChen +--- + src/qemu/qemu_driver.c | 21 +++++++++++++-------- + 1 file changed, 13 insertions(+), 8 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index 8bc5368b2f..7162875492 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -17972,6 +17972,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, + virDomainDiskDefPtr disk = NULL; + int ret = -1; + bool need_unlink = false; ++ bool need_revoke = false; + g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver); + const char *format = NULL; + bool mirror_reuse = !!(flags & VIR_DOMAIN_BLOCK_COPY_REUSE_EXT); +@@ -18146,6 +18147,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, + + if (qemuDomainStorageSourceChainAccessAllow(driver, vm, mirror) < 0) + goto endjob; ++ need_revoke = true; + + if (blockdev) { + if (mirror_reuse) { +@@ -18254,14 +18256,17 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, + + endjob: + if (ret < 0 && +- virDomainObjIsActive(vm) && +- (data || crdata)) { +- qemuDomainObjEnterMonitor(driver, vm); +- if (data) +- qemuBlockStorageSourceChainDetach(priv->mon, data); +- if (crdata) +- qemuBlockStorageSourceAttachRollback(priv->mon, crdata->srcdata[0]); +- ignore_value(qemuDomainObjExitMonitor(driver, vm)); ++ virDomainObjIsActive(vm)) { ++ if (data || crdata) { ++ qemuDomainObjEnterMonitor(driver, vm); ++ if (data) ++ qemuBlockStorageSourceChainDetach(priv->mon, data); ++ if (crdata) ++ qemuBlockStorageSourceAttachRollback(priv->mon, crdata->srcdata[0]); ++ ignore_value(qemuDomainObjExitMonitor(driver, vm)); ++ } ++ if (need_revoke) ++ qemuDomainStorageSourceChainAccessRevoke(driver, vm, mirror); + } + if (need_unlink && virStorageFileUnlink(mirror) < 0) + VIR_WARN("%s", _("unable to remove just-created copy target")); +-- +2.23.0 + diff --git a/libvirt-qemu-Skip-pre-creation-of-NVMe-disks.patch b/libvirt-qemu-Skip-pre-creation-of-NVMe-disks.patch new file mode 100644 index 0000000000000000000000000000000000000000..d1c07be670ee1ba74f9a4429d4fcbf92dbdd5074 --- /dev/null +++ b/libvirt-qemu-Skip-pre-creation-of-NVMe-disks.patch @@ -0,0 +1,53 @@ +From a7f7d8f7513af2b98d01259480f63167cf44cced Mon Sep 17 00:00:00 2001 +From: Michal Privoznik +Date: Tue, 26 May 2020 16:26:25 +0200 +Subject: [PATCH] qemu: Skip pre-creation of NVMe disks +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upon migration with disks, libvirt determines if each disk exists +on the destination and tries to pre-create missing ones. Well, +NVMe disks can't be pre-created, but they can be checked for +presence. + +Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1823639 + +cherry-pick from commit: a5a297f387fee9e9aa4cbc2df6788c330fd33ad1 + +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +Signed-off-by: Jin Yan +--- + src/qemu/qemu_migration.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c +index 65b47ec..3f4627b 100644 +--- a/src/qemu/qemu_migration.c ++++ b/src/qemu/qemu_migration.c +@@ -315,6 +315,7 @@ qemuMigrationDstPrecreateStorage(virDomainObjPtr vm, + for (i = 0; i < nbd->ndisks; i++) { + virDomainDiskDefPtr disk; + const char *diskSrcPath; ++ g_autofree char *nvmePath = NULL; + + VIR_DEBUG("Looking up disk target '%s' (capacity=%llu)", + nbd->disks[i].target, nbd->disks[i].capacity); +@@ -326,7 +327,12 @@ qemuMigrationDstPrecreateStorage(virDomainObjPtr vm, + goto cleanup; + } + +- diskSrcPath = virDomainDiskGetSource(disk); ++ if (disk->src->type == VIR_STORAGE_TYPE_NVME) { ++ virPCIDeviceAddressGetSysfsFile(&disk->src->nvme->pciAddr, &nvmePath); ++ diskSrcPath = nvmePath; ++ } else { ++ diskSrcPath = virDomainDiskGetSource(disk); ++ } + + /* Skip disks we don't want to migrate and already existing disks. */ + if (!qemuMigrationAnyCopyDisk(disk, nmigrate_disks, migrate_disks) || +-- +1.8.3.1 + diff --git a/libvirt-qemu-do-not-add-model-when-actual-iface-type-is-host.patch b/libvirt-qemu-do-not-add-model-when-actual-iface-type-is-host.patch new file mode 100644 index 0000000000000000000000000000000000000000..c3b82555cceaaba775c32c44cd4d49afd634949e --- /dev/null +++ b/libvirt-qemu-do-not-add-model-when-actual-iface-type-is-host.patch @@ -0,0 +1,34 @@ +From c8a043dcdf4f04288bcfc34c25054dcef571a6a7 Mon Sep 17 00:00:00 2001 +From: Paulo de Rezende Pinatti +Date: Tue, 16 Jun 2020 16:32:10 +0200 +Subject: [PATCH] qemu: do not add model when actual iface type is hostdev + +No default model should be added to the interface +entry at post parse when its actual network type is hostdev +as doing so might cause a mismatch between the interface +definition and its actual device type. + +cherry-pick from commit: bdb8f2e41867ae5dbcc040909b1b8c20fd864a40 + +Signed-off-by: Paulo de Rezende Pinatti +Reviewed-by: Laine Stump +Signed-off-by: Jin Yan +--- + src/qemu/qemu_domain.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c +index 91c1a49..cfada81 100644 +--- a/src/qemu/qemu_domain.c ++++ b/src/qemu/qemu_domain.c +@@ -9334,6 +9334,7 @@ qemuDomainDeviceNetDefPostParse(virDomainNetDefPtr net, + virQEMUCapsPtr qemuCaps) + { + if (net->type != VIR_DOMAIN_NET_TYPE_HOSTDEV && ++ virDomainNetResolveActualType(net) != VIR_DOMAIN_NET_TYPE_HOSTDEV && + !virDomainNetGetModelString(net)) + net->model = qemuDomainDefaultNetModel(def, qemuCaps); + +-- +1.8.3.1 + diff --git a/libvirt-qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch b/libvirt-qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch new file mode 100644 index 0000000000000000000000000000000000000000..5905cf7e4b592b275230d86aa2f05fe23d90eeca --- /dev/null +++ b/libvirt-qemu-fix-hang-in-p2p-xbzrle-compression-parallel-mig.patch @@ -0,0 +1,48 @@ +From f15935ea3b510bf0633dc2219a132412a7a8e96c Mon Sep 17 00:00:00 2001 +From: Lin Ma +Date: Thu, 16 Apr 2020 12:44:51 +0800 +Subject: [PATCH 3/8] qemu: fix hang in p2p + xbzrle compression + parallel + migration + +When we do parallel migration, The multifd-channels migration parameter +needs to be set on the destination side as well before incoming migration +URI, unless we accept the default number of connections(2). + +Usually, This can be correctly handled by libvirtd. But in this case if +we use p2p + xbzrle compression without parameter '--comp-xbzrle-cache', +qemuMigrationParamsDump returns too early, The corresponding migration +parameter will not be set on the destination side, It results QEMU hangs. + +Reproducer: +virsh migrate --live --p2p --comp-methods xbzrle \ +--parallel --parallel-connections 3 GUEST qemu+ssh://dsthost/system + +or + +virsh migrate --live --p2p --compressed \ +--parallel --parallel-connections 3 GUEST qemu+ssh://dsthost/system + +Signed-off-by: Lin Ma +Message-Id: <20200416044451.21134-1-lma@suse.com> +Reviewed-by: Jiri Denemark +(cherry-picked from commit 93b15ba0) +Signed-off-by: AlexChen +--- + src/qemu/qemu_migration_params.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c +index dd5e2ce1b6..810199370f 100644 +--- a/src/qemu/qemu_migration_params.c ++++ b/src/qemu/qemu_migration_params.c +@@ -630,7 +630,6 @@ qemuMigrationParamsDump(qemuMigrationParamsPtr migParams, + if (migParams->compMethods == 1ULL << QEMU_MIGRATION_COMPRESS_XBZRLE && + !migParams->params[QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE].set) { + *flags |= VIR_MIGRATE_COMPRESSED; +- return 0; + } + + for (i = 0; i < QEMU_MIGRATION_COMPRESS_LAST; ++i) { +-- +2.23.0 + diff --git a/libvirt-qemu-format-ramfb-attribute-for-mediated-devices.patch b/libvirt-qemu-format-ramfb-attribute-for-mediated-devices.patch new file mode 100644 index 0000000000000000000000000000000000000000..0cbf3a46ebf2259adaf92c51d4ceaaa545fba683 --- /dev/null +++ b/libvirt-qemu-format-ramfb-attribute-for-mediated-devices.patch @@ -0,0 +1,107 @@ +From e017f95c7d833c0e9a463a1613d01fe93020606b Mon Sep 17 00:00:00 2001 +From: Jonathon Jongsma +Date: Tue, 23 Jun 2020 13:29:56 -0500 +Subject: [PATCH 5/6] qemu: format 'ramfb' attribute for mediated devices +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +It's possible to use ramfb as the boot display of an assigned vgpu +device. This was introduced in 4b95738c, but unfortunately the attribute +was not formatted into the xml output for such a device. This patch +fixes that oversight and adds a xml2xml test to verify proper behavior. + +https://bugzilla.redhat.com/show_bug.cgi?id=1847791 + +cherry pick from: c5815b31976f3982d18c7f6c1367ab6e403eb7eb + +Signed-off-by: Jonathon Jongsma +Reviewed-by: Daniel Henrique Barboza +Signed-off-by: Ján Tomko +Reviewed-by: Ján Tomko +--- + src/conf/domain_conf.c | 3 ++ + .../hostdev-mdev-display-ramfb.x86_64-latest.xml | 44 ++++++++++++++++++++++ + tests/qemuxml2xmltest.c | 1 + + 3 files changed, 48 insertions(+) + create mode 100644 tests/qemuxml2xmloutdata/hostdev-mdev-display-ramfb.x86_64-latest.xml + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 37c785a..93e78a0 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -27849,6 +27849,9 @@ virDomainHostdevDefFormat(virBufferPtr buf, + if (mdevsrc->display != VIR_TRISTATE_SWITCH_ABSENT) + virBufferAsprintf(buf, " display='%s'", + virTristateSwitchTypeToString(mdevsrc->display)); ++ if (mdevsrc->ramfb != VIR_TRISTATE_SWITCH_ABSENT) ++ virBufferAsprintf(buf, " ramfb='%s'", ++ virTristateSwitchTypeToString(mdevsrc->ramfb)); + } + + } +diff --git a/tests/qemuxml2xmloutdata/hostdev-mdev-display-ramfb.x86_64-latest.xml b/tests/qemuxml2xmloutdata/hostdev-mdev-display-ramfb.x86_64-latest.xml +new file mode 100644 +index 0000000..c134400 +--- /dev/null ++++ b/tests/qemuxml2xmloutdata/hostdev-mdev-display-ramfb.x86_64-latest.xml +@@ -0,0 +1,44 @@ ++ ++ QEMUGuest2 ++ c7a5fdbd-edaf-9455-926a-d65c16db1809 ++ 219136 ++ 219136 ++ 1 ++ ++ hvm ++ ++ ++ ++ qemu64 ++ ++ ++ destroy ++ restart ++ destroy ++ ++ /usr/bin/qemu-system-i386 ++ ++
++ ++ ++ ++
++ ++ ++ ++ ++ ++ ++