diff --git a/libvirt-qemu-Don-t-leave-beingDestroyed-true-on-inactive-domain.patch b/libvirt-qemu-Don-t-leave-beingDestroyed-true-on-inactive-domain.patch new file mode 100644 index 0000000..a630ae1 --- /dev/null +++ b/libvirt-qemu-Don-t-leave-beingDestroyed-true-on-inactive-domain.patch @@ -0,0 +1,124 @@ +From 53b691e4d85f8a442f14ecf4b3bf0b17d607fb2b Mon Sep 17 00:00:00 2001 +Message-ID: <53b691e4d85f8a442f14ecf4b3bf0b17d607fb2b.1720800605.git.jdenemar@redhat.com> +From: Jiri Denemark +Date: Thu, 11 Jul 2024 13:49:09 +0200 +Subject: [PATCH] qemu: Don't leave beingDestroyed=true on inactive domain + +Recent commit v10.4.0-87-gd9935a5c4f made a reasonable change to only +reset beingDestroyed back to false when vm->def->id is reset to make +sure other code can detect a domain is (about to become) inactive. It +even added a comment saying any caller of qemuProcessBeginStopJob is +supposed to call qemuProcessStop to clear beingDestroyed. But not every +caller really does so because they first call qemuProcessBeginStopJob +and then check whether a domain is still running. If not the +qemuProcessStop call is skipped leaving beingDestroyed=true. In case of +a persistent domain this may block incoming migrations of such domain as +the migration code would think the domain died unexpectedly (even though +it's still running). + +The qemuProcessBeginStopJob function is a wrapper around +virDomainObjBeginJob, but virDomainObjEndJob was used directly for +cleanup. This patch introduces a new qemuProcessEndStopJob wrapper +around virDomainObjEndJob to properly undo everything +qemuProcessBeginStopJob did. + +https://issues.redhat.com/browse/RHEL-43309 + +Signed-off-by: Jiri Denemark +Reviewed-by: Peter Krempa +(cherry picked from commit bec903cae84c21850d47a1b4d3ab57ca81189519) +Signed-off-by: Jiri Denemark +--- + src/qemu/qemu_driver.c | 4 ++-- + src/qemu/qemu_process.c | 20 ++++++++++++++++---- + src/qemu/qemu_process.h | 1 + + 3 files changed, 19 insertions(+), 6 deletions(-) + +diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c +index fc1704f4fc..d9073b2154 100644 +--- a/src/qemu/qemu_driver.c ++++ b/src/qemu/qemu_driver.c +@@ -2115,7 +2115,7 @@ qemuDomainDestroyFlags(virDomainPtr dom, + endjob: + if (ret == 0) + qemuDomainRemoveInactive(driver, vm, 0, false); +- virDomainObjEndJob(vm); ++ qemuProcessEndStopJob(vm); + + cleanup: + virDomainObjEndAPI(&vm); +@@ -3901,7 +3901,7 @@ processMonitorEOFEvent(virQEMUDriver *driver, + + endjob: + qemuDomainRemoveInactive(driver, vm, 0, false); +- virDomainObjEndJob(vm); ++ qemuProcessEndStopJob(vm); + } + + +diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c +index b9b6ccf1de..bea42d38c6 100644 +--- a/src/qemu/qemu_process.c ++++ b/src/qemu/qemu_process.c +@@ -8422,7 +8422,8 @@ qemuProcessKill(virDomainObj *vm, unsigned int flags) + * qemuProcessBeginStopJob: + * + * Stop all current jobs by killing the domain and start a new one for +- * qemuProcessStop. ++ * qemuProcessStop. The caller has to make sure qemuProcessEndStopJob is ++ * called to properly cleanup the job. + */ + int + qemuProcessBeginStopJob(virDomainObj *vm, +@@ -8449,8 +8450,9 @@ qemuProcessBeginStopJob(virDomainObj *vm, + goto error; + + /* priv->beingDestroyed is deliberately left set to 'true' here. Caller +- * is supposed to call qemuProcessStop, which will reset it after +- * 'vm->def->id' is set to -1 */ ++ * is supposed to call qemuProcessStop (which will reset it after ++ * 'vm->def->id' is set to -1) and/or qemuProcessEndStopJob to do proper ++ * cleanup. */ + return 0; + + error: +@@ -8459,6 +8461,16 @@ qemuProcessBeginStopJob(virDomainObj *vm, + } + + ++void ++qemuProcessEndStopJob(virDomainObj *vm) ++{ ++ if (!virDomainObjIsActive(vm)) ++ QEMU_DOMAIN_PRIVATE(vm)->beingDestroyed = false; ++ ++ virDomainObjEndJob(vm); ++} ++ ++ + void qemuProcessStop(virQEMUDriver *driver, + virDomainObj *vm, + virDomainShutoffReason reason, +@@ -8801,7 +8813,7 @@ qemuProcessAutoDestroy(virDomainObj *dom, + + qemuDomainRemoveInactive(driver, dom, 0, false); + +- virDomainObjEndJob(dom); ++ qemuProcessEndStopJob(dom); + + virObjectEventStateQueue(driver->domainEventState, event); + } +diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h +index c1ea949215..cb67bfcd2d 100644 +--- a/src/qemu/qemu_process.h ++++ b/src/qemu/qemu_process.h +@@ -169,6 +169,7 @@ typedef enum { + int qemuProcessBeginStopJob(virDomainObj *vm, + virDomainJob job, + bool forceKill); ++void qemuProcessEndStopJob(virDomainObj *vm); + void qemuProcessStop(virQEMUDriver *driver, + virDomainObj *vm, + virDomainShutoffReason reason, +-- +2.45.2 diff --git a/libvirt-qemu-do-not-use-deprecated-options-for-new-virtiofsd.patch b/libvirt-qemu-do-not-use-deprecated-options-for-new-virtiofsd.patch new file mode 100644 index 0000000..269e75f --- /dev/null +++ b/libvirt-qemu-do-not-use-deprecated-options-for-new-virtiofsd.patch @@ -0,0 +1,128 @@ +From c30b3dd904c094c478c5b362de6b3580379edd8b Mon Sep 17 00:00:00 2001 +Message-ID: +From: =?UTF-8?q?J=C3=A1n=20Tomko?= +Date: Thu, 4 Jul 2024 15:54:29 +0200 +Subject: [PATCH] qemu: do not use deprecated options for new virtiofsd +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use the to-be-introduced virtiofsd capability to mark whether +new options are safe to use. + +Depends on: +https://gitlab.com/virtio-fs/virtiofsd/-/merge_requests/231 + +https://issues.redhat.com/browse/RHEL-7108 + +Signed-off-by: Ján Tomko +Reviewed-by: Michal Privoznik +(cherry picked from commit 8dc04cafecd2432c071c73366e4c6eb3b7bff495) + +https://issues.redhat.com/browse/RHEL-7108 + +Signed-off-by: Ján Tomko +--- + src/qemu/qemu_virtiofs.c | 83 +++++++++++++++++++++++++++------------- + 1 file changed, 57 insertions(+), 26 deletions(-) + +diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c +index 0df8d67b1b..0e3c7dbb58 100644 +--- a/src/qemu/qemu_virtiofs.c ++++ b/src/qemu/qemu_virtiofs.c +@@ -139,36 +139,67 @@ qemuVirtioFSBuildCommandLine(virQEMUDriverConfig *cfg, + virCommandPassFD(cmd, *fd, VIR_COMMAND_PASS_FD_CLOSE_PARENT); + *fd = -1; + +- virCommandAddArg(cmd, "-o"); +- virBufferAddLit(&opts, "source="); +- virQEMUBuildBufferEscapeComma(&opts, fs->src->path); +- if (fs->cache) +- virBufferAsprintf(&opts, ",cache=%s", virDomainFSCacheModeTypeToString(fs->cache)); +- if (fs->sandbox) +- virBufferAsprintf(&opts, ",sandbox=%s", virDomainFSSandboxModeTypeToString(fs->sandbox)); +- +- if (fs->xattr == VIR_TRISTATE_SWITCH_ON) +- virBufferAddLit(&opts, ",xattr"); +- else if (fs->xattr == VIR_TRISTATE_SWITCH_OFF) +- virBufferAddLit(&opts, ",no_xattr"); +- +- if (fs->flock == VIR_TRISTATE_SWITCH_ON) +- virBufferAddLit(&opts, ",flock"); +- else if (fs->flock == VIR_TRISTATE_SWITCH_OFF) +- virBufferAddLit(&opts, ",no_flock"); +- +- if (fs->posix_lock == VIR_TRISTATE_SWITCH_ON) +- virBufferAddLit(&opts, ",posix_lock"); +- else if (fs->posix_lock == VIR_TRISTATE_SWITCH_OFF) +- virBufferAddLit(&opts, ",no_posix_lock"); +- +- virCommandAddArgBuffer(cmd, &opts); ++ if (virBitmapIsBitSet(fs->caps, QEMU_VHOST_USER_FS_FEATURE_SEPARATE_OPTIONS)) { ++ /* Note that this option format is used by the Rust version of the daemon ++ * since v1.0.0, which is way longer than the capability existed. ++ * The -o style of options can be removed once we bump the minimal ++ * QEMU version to 8.0.0, which dropped the C virtiofsd daemon */ ++ virCommandAddArg(cmd, "--shared-dir"); ++ virCommandAddArg(cmd, fs->src->path); ++ ++ if (fs->cache) { ++ virCommandAddArg(cmd, "--cache"); ++ virCommandAddArg(cmd, virDomainFSCacheModeTypeToString(fs->cache)); ++ } ++ if (fs->sandbox) { ++ virCommandAddArg(cmd, "--sandbox"); ++ virCommandAddArg(cmd, virDomainFSSandboxModeTypeToString(fs->sandbox)); ++ } ++ ++ if (fs->xattr == VIR_TRISTATE_SWITCH_ON) ++ virCommandAddArg(cmd, "--xattr"); ++ ++ if (fs->posix_lock != VIR_TRISTATE_SWITCH_ABSENT || ++ fs->flock != VIR_TRISTATE_SWITCH_ABSENT) { ++ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("locking options are not supported by this virtiofsd")); ++ return NULL; ++ } ++ } else { ++ virCommandAddArg(cmd, "-o"); ++ virBufferAddLit(&opts, "source="); ++ virQEMUBuildBufferEscapeComma(&opts, fs->src->path); ++ if (fs->cache) ++ virBufferAsprintf(&opts, ",cache=%s", virDomainFSCacheModeTypeToString(fs->cache)); ++ if (fs->sandbox) ++ virBufferAsprintf(&opts, ",sandbox=%s", virDomainFSSandboxModeTypeToString(fs->sandbox)); ++ ++ if (fs->xattr == VIR_TRISTATE_SWITCH_ON) ++ virBufferAddLit(&opts, ",xattr"); ++ else if (fs->xattr == VIR_TRISTATE_SWITCH_OFF) ++ virBufferAddLit(&opts, ",no_xattr"); ++ ++ if (fs->flock == VIR_TRISTATE_SWITCH_ON) ++ virBufferAddLit(&opts, ",flock"); ++ else if (fs->flock == VIR_TRISTATE_SWITCH_OFF) ++ virBufferAddLit(&opts, ",no_flock"); ++ ++ if (fs->posix_lock == VIR_TRISTATE_SWITCH_ON) ++ virBufferAddLit(&opts, ",posix_lock"); ++ else if (fs->posix_lock == VIR_TRISTATE_SWITCH_OFF) ++ virBufferAddLit(&opts, ",no_posix_lock"); ++ ++ virCommandAddArgBuffer(cmd, &opts); ++ } + + if (fs->thread_pool_size >= 0) + virCommandAddArgFormat(cmd, "--thread-pool-size=%i", fs->thread_pool_size); + +- if (cfg->virtiofsdDebug) +- virCommandAddArg(cmd, "-d"); ++ if (cfg->virtiofsdDebug) { ++ if (virBitmapIsBitSet(fs->caps, QEMU_VHOST_USER_FS_FEATURE_SEPARATE_OPTIONS)) ++ virCommandAddArgList(cmd, "--log-level", "debug", NULL); ++ else ++ virCommandAddArg(cmd, "-d"); ++ } + + for (i = 0; i < fs->idmap.nuidmap; i++) { + virCommandAddArgFormat(cmd, "--uid-map=:%u:%u:%u:", +-- +2.45.2 diff --git a/libvirt-qemu-fill-capabilities-for-virtiofsd.patch b/libvirt-qemu-fill-capabilities-for-virtiofsd.patch new file mode 100644 index 0000000..915c1ab --- /dev/null +++ b/libvirt-qemu-fill-capabilities-for-virtiofsd.patch @@ -0,0 +1,208 @@ +From 26c0a729f2ae6dcd932a42bd437fc76da9e6b2cc Mon Sep 17 00:00:00 2001 +Message-ID: <26c0a729f2ae6dcd932a42bd437fc76da9e6b2cc.1720800605.git.jdenemar@redhat.com> +From: =?UTF-8?q?J=C3=A1n=20Tomko?= +Date: Thu, 4 Jul 2024 15:54:28 +0200 +Subject: [PATCH] qemu: fill capabilities for virtiofsd +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Run the daemon with --print-capabilities first, to see what it supports. + +Signed-off-by: Ján Tomko +Reviewed-by: Michal Privoznik +(cherry picked from commit 730eaafaace6b9202f9f694b732196299a0baec2) + +https://issues.redhat.com/browse/RHEL-7108 +https://issues.redhat.com/browse/RHEL-40135 + +Signed-off-by: Ján Tomko +--- + src/conf/domain_conf.c | 1 + + src/conf/domain_conf.h | 1 + + src/qemu/qemu_vhost_user.c | 58 +++++++++++++++++++ + src/qemu/qemu_vhost_user.h | 11 ++++ + src/qemu/qemu_virtiofs.c | 9 ++- + .../qemu/vhost-user/50-qemu-virtiofsd.json | 2 +- + tests/qemuxmlconftest.c | 2 + + 7 files changed, 81 insertions(+), 3 deletions(-) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index 8a3c63b1fc..1523341b34 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -2600,6 +2600,7 @@ void virDomainFSDefFree(virDomainFSDef *def) + g_free(def->sock); + g_free(def->idmap.uidmap); + g_free(def->idmap.gidmap); ++ virBitmapFree(def->caps); + + g_free(def); + } +diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h +index 2818a9f1f5..b3a0d26cde 100644 +--- a/src/conf/domain_conf.h ++++ b/src/conf/domain_conf.h +@@ -899,6 +899,7 @@ struct _virDomainFSDef { + virDomainIdMapDef idmap; + virDomainVirtioOptions *virtio; + virObject *privateData; ++ virBitmap *caps; + }; + + +diff --git a/src/qemu/qemu_vhost_user.c b/src/qemu/qemu_vhost_user.c +index 0294daab80..de3ef640a3 100644 +--- a/src/qemu/qemu_vhost_user.c ++++ b/src/qemu/qemu_vhost_user.c +@@ -22,6 +22,7 @@ + + #include "qemu_vhost_user.h" + #include "qemu_interop_config.h" ++#include "virbitmap.h" + #include "virjson.h" + #include "virlog.h" + #include "viralloc.h" +@@ -90,6 +91,12 @@ VIR_ENUM_IMPL(qemuVhostUserGPUFeature, + "render-node", + ); + ++VIR_ENUM_IMPL(qemuVhostUserFSFeature, ++ QEMU_VHOST_USER_FS_FEATURE_LAST, ++ "migrate-precopy", ++ "separate-options", ++); ++ + typedef struct _qemuVhostUserGPU qemuVhostUserGPU; + struct _qemuVhostUserGPU { + size_t nfeatures; +@@ -414,6 +421,52 @@ qemuVhostUserFillDomainGPU(virQEMUDriver *driver, + return ret; + } + ++int ++qemuVhostUserFillFSCapabilities(virBitmap **caps, ++ const char *binary) ++{ ++ g_autoptr(virJSONValue) doc = NULL; ++ g_autofree char *output = NULL; ++ g_autoptr(virCommand) cmd = NULL; ++ virJSONValue *featuresJSON; ++ size_t nfeatures; ++ size_t i; ++ g_autoptr(virBitmap) features = NULL; ++ ++ cmd = virCommandNewArgList(binary, "--print-capabilities", NULL); ++ virCommandSetOutputBuffer(cmd, &output); ++ if (virCommandRun(cmd, NULL) < 0) ++ return -2; ++ ++ if (!(doc = virJSONValueFromString(output))) { ++ virReportError(VIR_ERR_INTERNAL_ERROR, ++ _("unable to parse json capabilities '%1$s'"), ++ binary); ++ return -1; ++ } ++ ++ /* Older virtiofsd did not print any features */ ++ if (!(featuresJSON = virJSONValueObjectGetArray(doc, "features"))) ++ return 0; ++ ++ features = virBitmapNew(0); ++ nfeatures = virJSONValueArraySize(featuresJSON); ++ ++ for (i = 0; i < nfeatures; i++) { ++ virJSONValue *item = virJSONValueArrayGet(featuresJSON, i); ++ const char *tmpStr = virJSONValueGetString(item); ++ int tmp; ++ ++ if ((tmp = qemuVhostUserFSFeatureTypeFromString(tmpStr)) < 0) { ++ VIR_DEBUG("ignoring unknown virtiofs feature '%s'", tmpStr); ++ continue; ++ } ++ virBitmapSetBitExpand(features, tmp); ++ } ++ ++ *caps = g_steal_pointer(&features); ++ return 0; ++} + + int + qemuVhostUserFillDomainFS(virQEMUDriver *driver, +@@ -435,6 +488,11 @@ qemuVhostUserFillDomainFS(virQEMUDriver *driver, + continue; + + fs->binary = g_strdup(vu->binary); ++ ++ /* skip binaries that can't report their capabilities */ ++ if (qemuVhostUserFillFSCapabilities(&fs->caps, ++ vu->binary) == -1) ++ continue; + break; + } + +diff --git a/src/qemu/qemu_vhost_user.h b/src/qemu/qemu_vhost_user.h +index d1aa6ca189..c39fbfebe8 100644 +--- a/src/qemu/qemu_vhost_user.h ++++ b/src/qemu/qemu_vhost_user.h +@@ -46,3 +46,14 @@ qemuVhostUserFillDomainGPU(virQEMUDriver *driver, + int + qemuVhostUserFillDomainFS(virQEMUDriver *driver, + virDomainFSDef *fs); ++ ++int ++qemuVhostUserFillFSCapabilities(virBitmap **caps, ++ const char *binary); ++typedef enum { ++ QEMU_VHOST_USER_FS_FEATURE_MIGRATE_PRECOPY = 0, ++ QEMU_VHOST_USER_FS_FEATURE_SEPARATE_OPTIONS, ++ QEMU_VHOST_USER_FS_FEATURE_LAST ++} qemuVhostUserFSFeature; ++ ++VIR_ENUM_DECL(qemuVhostUserFSFeature); +diff --git a/src/qemu/qemu_virtiofs.c b/src/qemu/qemu_virtiofs.c +index 78897d8177..0df8d67b1b 100644 +--- a/src/qemu/qemu_virtiofs.c ++++ b/src/qemu/qemu_virtiofs.c +@@ -446,8 +446,13 @@ qemuVirtioFSPrepareDomain(virQEMUDriver *driver, + if (fs->sock) + return 0; + +- if (!fs->binary && qemuVhostUserFillDomainFS(driver, fs) < 0) +- return -1; ++ if (fs->binary) { ++ if (qemuVhostUserFillFSCapabilities(&fs->caps, fs->binary) < 0) ++ return -1; ++ } else { ++ if (qemuVhostUserFillDomainFS(driver, fs) < 0) ++ return -1; ++ } + + if (!driver->privileged && !fs->idmap.uidmap) { + if (qemuVirtioFSPrepareIdMap(fs) < 0) +diff --git a/tests/qemuvhostuserdata/usr/share/qemu/vhost-user/50-qemu-virtiofsd.json b/tests/qemuvhostuserdata/usr/share/qemu/vhost-user/50-qemu-virtiofsd.json +index b908bc6b30..5cf2c986f8 100644 +--- a/tests/qemuvhostuserdata/usr/share/qemu/vhost-user/50-qemu-virtiofsd.json ++++ b/tests/qemuvhostuserdata/usr/share/qemu/vhost-user/50-qemu-virtiofsd.json +@@ -1,5 +1,5 @@ + { + "description": "virtiofsd vhost-user-fs", + "type": "fs", +- "binary": "/usr/libexec/qemu/vhost-user/test-vhost-user-gpu" ++ "binary": "/usr/libexec/qemu/vhost-user/test-virtiofsd" + } +diff --git a/tests/qemuxmlconftest.c b/tests/qemuxmlconftest.c +index 8e0d47c6fd..a3a399e16c 100644 +--- a/tests/qemuxmlconftest.c ++++ b/tests/qemuxmlconftest.c +@@ -1079,6 +1079,8 @@ mymain(void) + + virFileWrapperAddPrefix("/usr/libexec/qemu/vhost-user", + abs_srcdir "/qemuvhostuserdata/usr/libexec/qemu/vhost-user"); ++ virFileWrapperAddPrefix("/usr/libexec/virtiofsd", ++ abs_srcdir "/qemuvhostuserdata/usr/libexec/qemu/vhost-user/test-virtiofsd"); + + if (!(conn = virGetConnect())) + return EXIT_FAILURE; +-- +2.45.2 diff --git a/libvirt-qemu-migration-allow-migration-for-virtiofs.patch b/libvirt-qemu-migration-allow-migration-for-virtiofs.patch new file mode 100644 index 0000000..d54da10 --- /dev/null +++ b/libvirt-qemu-migration-allow-migration-for-virtiofs.patch @@ -0,0 +1,52 @@ +From 5f73e98cc870b13a053fd99d4d2707fed50e57d0 Mon Sep 17 00:00:00 2001 +Message-ID: <5f73e98cc870b13a053fd99d4d2707fed50e57d0.1720800605.git.jdenemar@redhat.com> +From: =?UTF-8?q?J=C3=A1n=20Tomko?= +Date: Thu, 4 Jul 2024 15:54:30 +0200 +Subject: [PATCH] qemu: migration: allow migration for virtiofs +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Allow migration if the "migrate-precopy" capability is present or +libvirt is not the one running the virtiofs daemon. + +Signed-off-by: Ján Tomko +Reviewed-by: Michal Privoznik +(cherry picked from commit d94b31a68ab94f27f8a1d6d216817b49881c38ae) + +https://issues.redhat.com/browse/RHEL-40135 + +Signed-off-by: Ján Tomko +--- + src/qemu/qemu_migration.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c +index 26c082fc08..4fd7a0aafb 100644 +--- a/src/qemu/qemu_migration.c ++++ b/src/qemu/qemu_migration.c +@@ -39,6 +39,7 @@ + #include "qemu_slirp.h" + #include "qemu_block.h" + #include "qemu_tpm.h" ++#include "qemu_vhost_user.h" + + #include "domain_audit.h" + #include "virlog.h" +@@ -1576,8 +1577,12 @@ qemuMigrationSrcIsAllowed(virDomainObj *vm, + virDomainFSDef *fs = vm->def->fss[i]; + + if (fs->fsdriver == VIR_DOMAIN_FS_DRIVER_TYPE_VIRTIOFS) { +- virReportError(VIR_ERR_OPERATION_INVALID, "%s", +- _("migration with virtiofs device is not supported")); ++ if (fs->sock || ++ virBitmapIsBitSet(fs->caps, QEMU_VHOST_USER_FS_FEATURE_MIGRATE_PRECOPY)) ++ continue; ++ ++ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", ++ _("migration with this virtiofs device is not supported")); + return false; + } + } +-- +2.45.2 diff --git a/libvirt-tests-qemuxmlconf-adjust-test-case-to-new-virtiofsd.patch b/libvirt-tests-qemuxmlconf-adjust-test-case-to-new-virtiofsd.patch new file mode 100644 index 0000000..f986698 --- /dev/null +++ b/libvirt-tests-qemuxmlconf-adjust-test-case-to-new-virtiofsd.patch @@ -0,0 +1,46 @@ +From fa4a66a178829bcd66ae91732204540111fa9e7b Mon Sep 17 00:00:00 2001 +Message-ID: +From: =?UTF-8?q?J=C3=A1n=20Tomko?= +Date: Thu, 4 Jul 2024 15:54:27 +0200 +Subject: [PATCH] tests: qemuxmlconf: adjust test case to new virtiofsd +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Now that we have a fake virtiofsd json descriptor in our vhost-user +test data, we can remove the explicitly specified binary and our +mocking will ensure this test won't be affected by the host state. + +Also remove the locking options, since they were never supported +by the Rust version of virtiofsd. + +Signed-off-by: Ján Tomko +Reviewed-by: Michal Privoznik +(cherry picked from commit 132bf6d89b0eb744db6255e18494b493bd998d1d) + +https://issues.redhat.com/browse/RHEL-7108 +https://issues.redhat.com/browse/RHEL-40135 + +Signed-off-by: Ján Tomko +--- + tests/qemuxmlconfdata/vhost-user-fs-fd-memory.xml | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/tests/qemuxmlconfdata/vhost-user-fs-fd-memory.xml b/tests/qemuxmlconfdata/vhost-user-fs-fd-memory.xml +index 1d0bc26c46..b0b1b44081 100644 +--- a/tests/qemuxmlconfdata/vhost-user-fs-fd-memory.xml ++++ b/tests/qemuxmlconfdata/vhost-user-fs-fd-memory.xml +@@ -28,10 +28,9 @@ + + + +- ++ + + +- + + + +-- +2.45.2 diff --git a/libvirt-tests-vhostuser-add-virtiofsd-json-descriptor.patch b/libvirt-tests-vhostuser-add-virtiofsd-json-descriptor.patch new file mode 100644 index 0000000..82e489e --- /dev/null +++ b/libvirt-tests-vhostuser-add-virtiofsd-json-descriptor.patch @@ -0,0 +1,69 @@ +From d0bdafd019e0071149e5bc294389386c789a66bd Mon Sep 17 00:00:00 2001 +Message-ID: +From: =?UTF-8?q?J=C3=A1n=20Tomko?= +Date: Thu, 4 Jul 2024 15:54:26 +0200 +Subject: [PATCH] tests: vhostuser: add virtiofsd json descriptor +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Add the capabilities from the latest virtiofsd main branch and adjust +the order in the priority test accordingly. + +Signed-off-by: Ján Tomko +Reviewed-by: Michal Privoznik +(cherry picked from commit f64e658df04e9cf5b99fbe5c846ba3478e13d826) + +https://issues.redhat.com/browse/RHEL-7108 +https://issues.redhat.com/browse/RHEL-40135 + +Signed-off-by: Ján Tomko +--- + .../usr/libexec/qemu/vhost-user/test-virtiofsd | 10 ++++++++++ + .../usr/share/qemu/vhost-user/50-qemu-virtiofsd.json | 5 +++++ + tests/qemuvhostusertest.c | 1 + + 3 files changed, 16 insertions(+) + create mode 100755 tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/test-virtiofsd + create mode 100644 tests/qemuvhostuserdata/usr/share/qemu/vhost-user/50-qemu-virtiofsd.json + +diff --git a/tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/test-virtiofsd b/tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/test-virtiofsd +new file mode 100755 +index 0000000000..90b38187c9 +--- /dev/null ++++ b/tests/qemuvhostuserdata/usr/libexec/qemu/vhost-user/test-virtiofsd +@@ -0,0 +1,10 @@ ++#!/bin/sh ++ ++cat < +From: Michal Privoznik +Date: Thu, 11 Jul 2024 09:32:40 +0200 +Subject: [PATCH] virt-host-validate: Drop extra "PASS" +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +If virt-host-validate is ran on a SEV-SNP capable machine, an +extra "PASS" is printed out. This is because +virHostValidateAMDSev() prints "PASS" and then returns 1 +(indicating success) which in turn makes the caller +(virHostValidateSecureGuests()) print "PASS" again. Just drop the +extra printing in the caller and let virHostValidateAMDSev() do +all the printing. + +Fixes: 1a8f646f291775d2423ce4e4df62ad69f06ab827 +Resolves: https://issues.redhat.com/browse/RHEL-46868 +Signed-off-by: Michal Privoznik +Reviewed-by: Ján Tomko +(cherry picked from commit c9fa43c48cdb1b8505929e3287975445f3004f32) +Signed-off-by: Michal Privoznik +--- + tools/virt-host-validate-common.c | 6 +----- + 1 file changed, 1 insertion(+), 5 deletions(-) + +diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c +index a29a5b6d5f..591143c24d 100644 +--- a/tools/virt-host-validate-common.c ++++ b/tools/virt-host-validate-common.c +@@ -488,11 +488,7 @@ int virHostValidateSecureGuests(const char *hvname, + return VIR_VALIDATE_FAILURE(level); + } + } else if (hasAMDSev) { +- int rc = virHostValidateAMDSev(hvname, level); +- +- if (rc > 0) +- virValidatePass(); +- return rc; ++ return virHostValidateAMDSev(hvname, level); + } + + virValidateFail(level, +-- +2.45.2 diff --git a/libvirt-vmx-Do-not-require-all-ID-data-for-VMWare-Distributed-Switch.patch b/libvirt-vmx-Do-not-require-all-ID-data-for-VMWare-Distributed-Switch.patch new file mode 100644 index 0000000..b5ce654 --- /dev/null +++ b/libvirt-vmx-Do-not-require-all-ID-data-for-VMWare-Distributed-Switch.patch @@ -0,0 +1,171 @@ +From 945895b9af739a93690b1771e0e604b3a23fb7e0 Mon Sep 17 00:00:00 2001 +Message-ID: <945895b9af739a93690b1771e0e604b3a23fb7e0.1720800605.git.jdenemar@redhat.com> +From: Martin Kletzander +Date: Mon, 8 Jul 2024 13:04:13 +0200 +Subject: [PATCH] vmx: Do not require all ID data for VMWare Distributed Switch + +Similarly to commit 2482801608b8 we can safely ignore connectionId, +portId and portgroupId in both XML and VMX as they are only a blind +pass-through between XML and VMX and an ethernet without such parameters +was spotted in the wild. On top of that even our documentation says the +whole VMWare Distrubuted Switch configuration is a best-effort. + +Resolves: https://issues.redhat.com/browse/RHEL-46099 + +Signed-off-by: Martin Kletzander +Reviewed-by: Jiri Denemark +(cherry picked from commit db622081e0fa55b481da1fc7fb81279224a60f88) +Signed-off-by: Martin Kletzander +--- + src/conf/domain_conf.c | 11 ++++----- + src/conf/schemas/domaincommon.rng | 24 ++++++++++++------- + src/vmx/vmx.c | 24 ++++++++++++------- + ...-portid.vmx => ethernet-vds-no-params.vmx} | 2 -- + ...-portid.xml => ethernet-vds-no-params.xml} | 2 +- + 5 files changed, 37 insertions(+), 26 deletions(-) + rename tests/vmx2xmldata/{ethernet-vds-no-portid.vmx => ethernet-vds-no-params.vmx} (76%) + rename tests/vmx2xmldata/{ethernet-vds-no-portid.xml => ethernet-vds-no-params.xml} (82%) + +diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c +index cb1154b23f..8a3c63b1fc 100644 +--- a/src/conf/domain_conf.c ++++ b/src/conf/domain_conf.c +@@ -9576,15 +9576,14 @@ virDomainNetDefParseXML(virDomainXMLOption *xmlopt, + def->data.vds.switch_id) < 0) + return NULL; + +- if (virXMLPropLongLong(source_node, "portid", 0, VIR_XML_PROP_REQUIRED, +- &def->data.vds.port_id, def->data.vds.port_id) < 0) ++ if (virXMLPropLongLong(source_node, "portid", 0, VIR_XML_PROP_NONE, ++ &def->data.vds.port_id, 0) < 0) + return NULL; + +- if (!(def->data.vds.portgroup_id = virXMLPropStringRequired(source_node, "portgroupid"))) +- return NULL; ++ def->data.vds.portgroup_id = virXMLPropString(source_node, "portgroupid"); + +- if (virXMLPropLongLong(source_node, "connectionid", 0, VIR_XML_PROP_REQUIRED, +- &def->data.vds.connection_id, def->data.vds.connection_id) < 0) ++ if (virXMLPropLongLong(source_node, "connectionid", 0, VIR_XML_PROP_NONE, ++ &def->data.vds.connection_id, 0) < 0) + return NULL; + + break; +diff --git a/src/conf/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng +index 844a931deb..51572f3e70 100644 +--- a/src/conf/schemas/domaincommon.rng ++++ b/src/conf/schemas/domaincommon.rng +@@ -3684,15 +3684,21 @@ + + + +- +- +- +- +- +- +- +- +- ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ ++ + + + +diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c +index d082a07660..e5bc2d793c 100644 +--- a/src/vmx/vmx.c ++++ b/src/vmx/vmx.c +@@ -2896,7 +2896,7 @@ virVMXParseEthernet(virConf *conf, int controller, virDomainNetDef **def) + if (virVMXGetConfigString(conf, + portgroupId_name, + &(*def)->data.vds.portgroup_id, +- false) < 0 || ++ true) < 0 || + virVMXGetConfigLong(conf, + portId_name, + &(*def)->data.vds.port_id, +@@ -2906,7 +2906,7 @@ virVMXParseEthernet(virConf *conf, int controller, virDomainNetDef **def) + connectionId_name, + &(*def)->data.vds.connection_id, + 0, +- false) < 0) ++ true) < 0) + goto cleanup; + } else if (connectionType == NULL && networkName == NULL) { + (*def)->type = VIR_DOMAIN_NET_TYPE_NULL; +@@ -4038,14 +4038,22 @@ virVMXFormatEthernet(virDomainNetDef *def, int controller, + uuid[5], uuid[6], uuid[7], uuid[8], uuid[9], uuid[10], + uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]); + +- virBufferAsprintf(buffer, "ethernet%d.dvs.portId = \"%lld\"\n", +- controller, def->data.vds.port_id); ++ if (def->data.vds.port_id) { ++ virBufferAsprintf(buffer, "ethernet%d.dvs.portId = \"%lld\"\n", ++ controller, def->data.vds.port_id); ++ } ++ ++ if (def->data.vds.portgroup_id) { ++ virBufferAsprintf(buffer, "ethernet%d.dvs.", controller); ++ virBufferEscapeString(buffer, "portgroupId = \"%s\"\n", ++ def->data.vds.portgroup_id); ++ } + +- virBufferAsprintf(buffer, "ethernet%d.dvs.", controller); +- virBufferEscapeString(buffer, "portgroupId = \"%s\"\n", def->data.vds.portgroup_id); ++ if (def->data.vds.connection_id) { ++ virBufferAsprintf(buffer, "ethernet%d.dvs.connectionId = \"%lld\"\n", ++ controller, def->data.vds.connection_id); ++ } + +- virBufferAsprintf(buffer, "ethernet%d.dvs.connectionId = \"%lld\"\n", +- controller, def->data.vds.connection_id); + break; + } + +diff --git a/tests/vmx2xmldata/ethernet-vds-no-portid.vmx b/tests/vmx2xmldata/ethernet-vds-no-params.vmx +similarity index 76% +rename from tests/vmx2xmldata/ethernet-vds-no-portid.vmx +rename to tests/vmx2xmldata/ethernet-vds-no-params.vmx +index 7761accb3a..90afbdac30 100644 +--- a/tests/vmx2xmldata/ethernet-vds-no-portid.vmx ++++ b/tests/vmx2xmldata/ethernet-vds-no-params.vmx +@@ -5,6 +5,4 @@ ethernet0.virtualDev = "e1000e" + ethernet0.addressType = "vpx" + ethernet0.generatedAddress = "00:50:56:87:65:43" + ethernet0.dvs.switchId = "50 34 26 b2 94 e9 3b 16-1d 68 87 bf ff 4a 54 40" +-ethernet0.dvs.portgroupId = "dvportgroup-1285" +-ethernet0.dvs.connectionId = "408217997" + displayName = "test" +diff --git a/tests/vmx2xmldata/ethernet-vds-no-portid.xml b/tests/vmx2xmldata/ethernet-vds-no-params.xml +similarity index 82% +rename from tests/vmx2xmldata/ethernet-vds-no-portid.xml +rename to tests/vmx2xmldata/ethernet-vds-no-params.xml +index 60fd9c99fe..0011ba471a 100644 +--- a/tests/vmx2xmldata/ethernet-vds-no-portid.xml ++++ b/tests/vmx2xmldata/ethernet-vds-no-params.xml +@@ -14,7 +14,7 @@ + + + +- ++ + + +