Drop unused patches from incorrect import

This commit is contained in:
Jiri Denemark 2023-03-21 11:57:51 +01:00
parent 6746ebf0be
commit 54ad40a34a
32 changed files with 0 additions and 3151 deletions

View File

@ -1,62 +0,0 @@
From b5a226f307b01bb1b58a88c95d29da34c246757f Mon Sep 17 00:00:00 2001
Message-Id: <b5a226f307b01bb1b58a88c95d29da34c246757f@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 12 Jul 2022 16:10:08 +0200
Subject: [PATCH] docs: Document TPM portion of domcaps
Surprisingly, we don't document TPM part of domain capabilities.
Fortunately, the information exposed is pretty much self
explanatory, but we should document it regardless.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 6a00c565c4d0f0ec970e043ea2686bd30396ed79)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103119
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
docs/formatdomaincaps.rst | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst
index 933469b2a2..3c425a9a4a 100644
--- a/docs/formatdomaincaps.rst
+++ b/docs/formatdomaincaps.rst
@@ -494,6 +494,35 @@ instance:
``driverType``
Options for the ``type`` attribute of the <filesystem><driver> element.
+TPM device
+^^^^^^^^^^
+
+TPM device capabilities are exposed under the ``tpm`` element. For instance:
+
+::
+
+ <domainCapabilities>
+ ...
+ <devices>
+ <tpm supported='yes'>
+ <enum name='model'>
+ <value>tpm-tis</value>
+ <value>tpm-crb</value>
+ </enum>
+ <enum name='backendModel'>
+ <value>passthrough</value>
+ <value>emulator</value>
+ </enum>
+ </tpm>
+ ...
+ </devices>
+ </domainCapabilities>
+
+``model``
+ Options for the ``model`` attribute of the ``<tpm/>`` element.
+``backendModel``
+ Options for the ``type`` attribute of the ``<tpm><backend/>`` element.
+
Features
~~~~~~~~
--
2.35.1

View File

@ -1,96 +0,0 @@
From a39ce54007de67ce6909c1770a7759b09c41bfd6 Mon Sep 17 00:00:00 2001
Message-Id: <a39ce54007de67ce6909c1770a7759b09c41bfd6@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 7 Jul 2022 16:29:18 +0200
Subject: [PATCH] domain_conf: Format <defaultiothread/> more often
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The <defaultiothread/> element is formatted inside
virDomainDefaultIOThreadDefFormat() which is called only from
virDomainDefIOThreadsFormat() (so that IOThread related stuff is
formatted calling one function). However, when there are no
<iothreadids/> defined (or only autoallocated ones are present),
then the outer formatting function exits early never calling the
<defaultiothread/> formatter.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 24fa7004e47ce86b92bc23c1f2ef9c3d6152c3a8)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_conf.c | 46 ++++++++++++++++++++----------------------
1 file changed, 22 insertions(+), 24 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 709ca53790..207a45d9ae 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -27763,40 +27763,38 @@ static void
virDomainDefIOThreadsFormat(virBuffer *buf,
const virDomainDef *def)
{
- g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
- size_t i;
-
- if (def->niothreadids == 0)
- return;
+ if (def->niothreadids > 0) {
+ virBufferAsprintf(buf, "<iothreads>%zu</iothreads>\n",
+ def->niothreadids);
+ }
- virBufferAsprintf(buf, "<iothreads>%zu</iothreads>\n",
- def->niothreadids);
+ if (virDomainDefIothreadShouldFormat(def)) {
+ g_auto(virBuffer) childrenBuf = VIR_BUFFER_INIT_CHILD(buf);
+ size_t i;
- if (!virDomainDefIothreadShouldFormat(def))
- return;
+ for (i = 0; i < def->niothreadids; i++) {
+ virDomainIOThreadIDDef *iothread = def->iothreadids[i];
+ g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
- for (i = 0; i < def->niothreadids; i++) {
- virDomainIOThreadIDDef *iothread = def->iothreadids[i];
- g_auto(virBuffer) attrBuf = VIR_BUFFER_INITIALIZER;
+ virBufferAsprintf(&attrBuf, " id='%u'",
+ iothread->iothread_id);
- virBufferAsprintf(&attrBuf, " id='%u'",
- iothread->iothread_id);
+ if (iothread->thread_pool_min >= 0) {
+ virBufferAsprintf(&attrBuf, " thread_pool_min='%d'",
+ iothread->thread_pool_min);
+ }
- if (iothread->thread_pool_min >= 0) {
- virBufferAsprintf(&attrBuf, " thread_pool_min='%d'",
- iothread->thread_pool_min);
- }
+ if (iothread->thread_pool_max >= 0) {
+ virBufferAsprintf(&attrBuf, " thread_pool_max='%d'",
+ iothread->thread_pool_max);
+ }
- if (iothread->thread_pool_max >= 0) {
- virBufferAsprintf(&attrBuf, " thread_pool_max='%d'",
- iothread->thread_pool_max);
+ virXMLFormatElement(&childrenBuf, "iothread", &attrBuf, NULL);
}
- virXMLFormatElement(&childrenBuf, "iothread", &attrBuf, NULL);
+ virXMLFormatElement(buf, "iothreadids", NULL, &childrenBuf);
}
- virXMLFormatElement(buf, "iothreadids", NULL, &childrenBuf);
-
virDomainDefaultIOThreadDefFormat(buf, def);
}
--
2.35.1

View File

@ -1,61 +0,0 @@
From 711cf329b9847c4d42994389d89a7e7b83c71596 Mon Sep 17 00:00:00 2001
Message-Id: <711cf329b9847c4d42994389d89a7e7b83c71596@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 7 Jul 2022 16:29:33 +0200
Subject: [PATCH] domain_conf: Format iothread IDs more often
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
When formatting IOThreads (in virDomainDefIOThreadsFormat()), we
may only output the number of IOThreads, or the full list of IOThreads too:
<iothreads>4</iothreads>
<iothreadids>
<iothread id='1' thread_pool_max='10'/>
<iothread id='2' thread_pool_min='2' thread_pool_max='10'/>
<iothread id='3'/>
<iothread id='4'/>
</iothreadids>
Now, the deciding factor here is whether those individual
IOThreads were so called 'autofill-ed' or user provided. Well, we
need to take another factor in: if an IOThread has pool size
limit set, then we ought to format the full list.
But how can we get into a situation when a thread is autofilled
(i.e. not provided by user in the XML) and yet it has pool size
limit set? virDomainSetIOThreadParams() is the answer.
Sure, we could also unset the autofill flag whenever a pool size
limit is being set. But this approach allows us to not format
anything if the limits are reset (we don't lose the autofill
information).
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 5aa24958546c94a48fb8f8d6022213ca7c07c8a7)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/conf/domain_conf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 207a45d9ae..fbc285d981 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -27728,7 +27728,9 @@ virDomainDefIothreadShouldFormat(const virDomainDef *def)
size_t i;
for (i = 0; i < def->niothreadids; i++) {
- if (!def->iothreadids[i]->autofill)
+ if (!def->iothreadids[i]->autofill ||
+ def->iothreadids[i]->thread_pool_min >= 0 ||
+ def->iothreadids[i]->thread_pool_max >= 0)
return true;
}
--
2.35.1

View File

@ -1,74 +0,0 @@
From 266e8c9174249b4d5a53dc8a43a3d7d9481d8b1c Mon Sep 17 00:00:00 2001
Message-Id: <266e8c9174249b4d5a53dc8a43a3d7d9481d8b1c@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 12 Jul 2022 15:58:12 +0200
Subject: [PATCH] domcaps: Introduce TPM backendVersion
We accept TPM version in the domain XML. However, supported
version depends on the host (swtpm_setup binary) and thus it may
be tricky for users (or mgmt applications) chose a version.
Introduce machinery for reporting supported version in domain
capabilities.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 1277a9c884039e92765c977917420511f45e52e8)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103119
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
docs/formatdomaincaps.rst | 6 ++++++
src/conf/domain_capabilities.c | 1 +
src/conf/domain_capabilities.h | 1 +
3 files changed, 8 insertions(+)
diff --git a/docs/formatdomaincaps.rst b/docs/formatdomaincaps.rst
index 3c425a9a4a..70f46b972a 100644
--- a/docs/formatdomaincaps.rst
+++ b/docs/formatdomaincaps.rst
@@ -513,6 +513,10 @@ TPM device capabilities are exposed under the ``tpm`` element. For instance:
<value>passthrough</value>
<value>emulator</value>
</enum>
+ <enum name='backendVersion'>
+ <value>1.2</value>
+ <value>2.0</value>
+ </enum>
</tpm>
...
</devices>
@@ -522,6 +526,8 @@ TPM device capabilities are exposed under the ``tpm`` element. For instance:
Options for the ``model`` attribute of the ``<tpm/>`` element.
``backendModel``
Options for the ``type`` attribute of the ``<tpm><backend/>`` element.
+``backendVersion``
+ Options for the ``version`` attribute of the ``<tpm><backend/>`` element.
Features
~~~~~~~~
diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c
index 895e8d00e8..33570a51db 100644
--- a/src/conf/domain_capabilities.c
+++ b/src/conf/domain_capabilities.c
@@ -539,6 +539,7 @@ virDomainCapsDeviceTPMFormat(virBuffer *buf,
ENUM_PROCESS(tpm, model, virDomainTPMModelTypeToString);
ENUM_PROCESS(tpm, backendModel, virDomainTPMBackendTypeToString);
+ ENUM_PROCESS(tpm, backendVersion, virDomainTPMVersionTypeToString);
FORMAT_EPILOGUE(tpm);
}
diff --git a/src/conf/domain_capabilities.h b/src/conf/domain_capabilities.h
index f2eed80b15..a526969cda 100644
--- a/src/conf/domain_capabilities.h
+++ b/src/conf/domain_capabilities.h
@@ -127,6 +127,7 @@ struct _virDomainCapsDeviceTPM {
virTristateBool supported;
virDomainCapsEnum model; /* virDomainTPMModel */
virDomainCapsEnum backendModel; /* virDomainTPMBackendType */
+ virDomainCapsEnum backendVersion; /* virDomainTPMVersion */
};
STATIC_ASSERT_ENUM(VIR_DOMAIN_FS_DRIVER_TYPE_LAST);
--
2.35.1

View File

@ -1,183 +0,0 @@
From b020ddee84458afd8de70d9f296b91fa2b6a95fd Mon Sep 17 00:00:00 2001
Message-Id: <b020ddee84458afd8de70d9f296b91fa2b6a95fd@dist-git>
From: Peter Krempa <pkrempa@redhat.com>
Date: Fri, 15 Jul 2022 14:16:54 +0200
Subject: [PATCH] qemu: Always assume support for
QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE
The 'xbzrle-cache-size' parameter was added in qemu-2.11 thus all
supported qemu versions now use the new code path.
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 06e0ba3da71ec6c58024efe57d0f55d3d1352d60)
This commit is not strictly needed for fixing the following BZ, but it
removes a code which will be never executed in RHEL 9 and backporting it
avoids conflicts with the actual bug fix.
https://bugzilla.redhat.com/show_bug.cgi?id=2107892
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_driver.c | 56 +++++++++-----------------------
src/qemu/qemu_migration_params.c | 18 ----------
2 files changed, 16 insertions(+), 58 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 17e4c23199..256e126ae1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13172,10 +13172,8 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom,
{
virQEMUDriver *driver = dom->conn->privateData;
virDomainObj *vm;
- qemuDomainObjPrivate *priv;
g_autoptr(qemuMigrationParams) migParams = NULL;
int ret = -1;
- int rc;
virCheckFlags(0, -1);
@@ -13191,8 +13189,6 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom,
if (virDomainObjCheckActive(vm) < 0)
goto endjob;
- priv = vm->privateData;
-
if (!qemuMigrationCapsGet(vm, QEMU_MIGRATION_CAP_XBZRLE)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("Compressed migration is not supported by "
@@ -13200,22 +13196,14 @@ qemuDomainMigrateGetCompressionCache(virDomainPtr dom,
goto endjob;
}
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE)) {
- if (qemuMigrationParamsFetch(driver, vm, VIR_ASYNC_JOB_NONE,
- &migParams) < 0)
- goto endjob;
+ if (qemuMigrationParamsFetch(driver, vm, VIR_ASYNC_JOB_NONE,
+ &migParams) < 0)
+ goto endjob;
- if (qemuMigrationParamsGetULL(migParams,
- QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE,
- cacheSize) < 0)
- goto endjob;
- } else {
- qemuDomainObjEnterMonitor(driver, vm);
- rc = qemuMonitorGetMigrationCacheSize(priv->mon, cacheSize);
- qemuDomainObjExitMonitor(vm);
- if (rc < 0)
- goto endjob;
- }
+ if (qemuMigrationParamsGetULL(migParams,
+ QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE,
+ cacheSize) < 0)
+ goto endjob;
ret = 0;
@@ -13234,10 +13222,8 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom,
{
virQEMUDriver *driver = dom->conn->privateData;
virDomainObj *vm;
- qemuDomainObjPrivate *priv;
g_autoptr(qemuMigrationParams) migParams = NULL;
int ret = -1;
- int rc;
virCheckFlags(0, -1);
@@ -13253,8 +13239,6 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom,
if (virDomainObjCheckActive(vm) < 0)
goto endjob;
- priv = vm->privateData;
-
if (!qemuMigrationCapsGet(vm, QEMU_MIGRATION_CAP_XBZRLE)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("Compressed migration is not supported by "
@@ -13263,25 +13247,17 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom,
}
VIR_DEBUG("Setting compression cache to %llu B", cacheSize);
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE)) {
- if (!(migParams = qemuMigrationParamsNew()))
- goto endjob;
+ if (!(migParams = qemuMigrationParamsNew()))
+ goto endjob;
- if (qemuMigrationParamsSetULL(migParams,
- QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE,
- cacheSize) < 0)
- goto endjob;
+ if (qemuMigrationParamsSetULL(migParams,
+ QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE,
+ cacheSize) < 0)
+ goto endjob;
- if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE,
- migParams, 0) < 0)
- goto endjob;
- } else {
- qemuDomainObjEnterMonitor(driver, vm);
- rc = qemuMonitorSetMigrationCacheSize(priv->mon, cacheSize);
- qemuDomainObjExitMonitor(vm);
- if (rc < 0)
- goto endjob;
- }
+ if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE,
+ migParams, 0) < 0)
+ goto endjob;
ret = 0;
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 6ea0bde13a..0bce358ac3 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -886,10 +886,8 @@ qemuMigrationParamsApply(virQEMUDriver *driver,
unsigned long apiFlags)
{
qemuDomainObjPrivate *priv = vm->privateData;
- bool xbzrleCacheSize_old = false;
g_autoptr(virJSONValue) params = NULL;
g_autoptr(virJSONValue) caps = NULL;
- qemuMigrationParam xbzrle = QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE;
bool postcopyResume = !!(apiFlags & VIR_MIGRATE_POSTCOPY_RESUME);
int ret = -1;
@@ -917,19 +915,6 @@ qemuMigrationParamsApply(virQEMUDriver *driver,
}
}
- /* If QEMU is too old to support xbzrle-cache-size migration parameter,
- * we need to set it via migrate-set-cache-size and tell
- * qemuMonitorSetMigrationParams to ignore this parameter.
- */
- if (migParams->params[xbzrle].set &&
- !virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_PARAM_XBZRLE_CACHE_SIZE)) {
- if (qemuMonitorSetMigrationCacheSize(priv->mon,
- migParams->params[xbzrle].value.ull) < 0)
- goto cleanup;
- xbzrleCacheSize_old = true;
- migParams->params[xbzrle].set = false;
- }
-
if (!(params = qemuMigrationParamsToJSON(migParams, postcopyResume)))
goto cleanup;
@@ -942,9 +927,6 @@ qemuMigrationParamsApply(virQEMUDriver *driver,
cleanup:
qemuDomainObjExitMonitor(vm);
- if (xbzrleCacheSize_old)
- migParams->params[xbzrle].set = true;
-
return ret;
}
--
2.35.1

View File

@ -1,195 +0,0 @@
From 5853ac5261b2934ca300b24a7bd78cc4b377c90c Mon Sep 17 00:00:00 2001
Message-Id: <5853ac5261b2934ca300b24a7bd78cc4b377c90c@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 7 Jul 2022 17:37:46 +0200
Subject: [PATCH] qemu: Make IOThread changing more robust
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
There are three APIs that allow changing IOThreads:
virDomainAddIOThread()
virDomainDelIOThread()
virDomainSetIOThreadParams()
In case of QEMU driver these are handled by
qemuDomainChgIOThread() which attempts to be versatile enough to
work on both inactive and live domain definitions at the same
time. However, it's a bit clumsy - when a change to live
definition succeeds but fails in inactive definition then there's
no rollback. And somewhat rightfully so - changes to live
definition are in general harder to roll back. Therefore, do what
we do elsewhere (qemuDomainAttachDeviceLiveAndConfig(),
qemuDomainDetachDeviceAliasLiveAndConfig(), ...):
1) do the change to inactive XML first,
2) in fact, do the change to a copy of inactive XML,
3) swap inactive XML and its copy only after everything
succeeded.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 6db9c95a45d4e24cdcd5c009b7fe5da3745b5d59)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_driver.c | 74 ++++++++++++++++++++++++------------------
1 file changed, 43 insertions(+), 31 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 3b5c3db67c..2c627396f1 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5594,6 +5594,7 @@ qemuDomainChgIOThread(virQEMUDriver *driver,
{
g_autoptr(virQEMUDriverConfig) cfg = NULL;
qemuDomainObjPrivate *priv;
+ g_autoptr(virDomainDef) defcopy = NULL;
virDomainDef *def;
virDomainDef *persistentDef;
virDomainIOThreadIDDef *iothreaddef = NULL;
@@ -5609,34 +5610,34 @@ qemuDomainChgIOThread(virQEMUDriver *driver,
if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0)
goto endjob;
- if (def) {
- if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("IOThreads not supported with this binary"));
- goto endjob;
- }
+ if (persistentDef) {
+ /* Make a copy of persistent definition and do all the changes there.
+ * Swap the definitions only after changes to live definition
+ * succeeded. */
+ if (!(defcopy = virDomainObjCopyPersistentDef(vm, driver->xmlopt,
+ priv->qemuCaps)))
+ return -1;
switch (action) {
case VIR_DOMAIN_IOTHREAD_ACTION_ADD:
- if (virDomainDriverAddIOThreadCheck(def, iothread.iothread_id) < 0)
+ if (virDomainDriverAddIOThreadCheck(defcopy, iothread.iothread_id) < 0)
goto endjob;
- if (qemuDomainHotplugAddIOThread(driver, vm, iothread.iothread_id) < 0)
+ if (!virDomainIOThreadIDAdd(defcopy, iothread.iothread_id))
goto endjob;
break;
case VIR_DOMAIN_IOTHREAD_ACTION_DEL:
- if (virDomainDriverDelIOThreadCheck(def, iothread.iothread_id) < 0)
+ if (virDomainDriverDelIOThreadCheck(defcopy, iothread.iothread_id) < 0)
goto endjob;
- if (qemuDomainHotplugDelIOThread(driver, vm, iothread.iothread_id) < 0)
- goto endjob;
+ virDomainIOThreadIDDel(defcopy, iothread.iothread_id);
break;
case VIR_DOMAIN_IOTHREAD_ACTION_MOD:
- iothreaddef = virDomainIOThreadIDFind(def, iothread.iothread_id);
+ iothreaddef = virDomainIOThreadIDFind(defcopy, iothread.iothread_id);
if (!iothreaddef) {
virReportError(VIR_ERR_INVALID_ARG,
@@ -5645,41 +5646,47 @@ qemuDomainChgIOThread(virQEMUDriver *driver,
goto endjob;
}
- if (qemuDomainIOThreadValidate(iothreaddef, iothread, true) < 0)
+ if (qemuDomainIOThreadValidate(iothreaddef, iothread, false) < 0)
goto endjob;
- if (qemuDomainHotplugModIOThread(driver, vm, iothread) < 0)
+ if (qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread) < 0) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("configuring persistent polling values is not supported"));
goto endjob;
+ }
- qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread);
break;
-
}
-
- qemuDomainSaveStatus(vm);
}
- if (persistentDef) {
+ if (def) {
+ if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_OBJECT_IOTHREAD)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("IOThreads not supported with this binary"));
+ goto endjob;
+ }
+
switch (action) {
case VIR_DOMAIN_IOTHREAD_ACTION_ADD:
- if (virDomainDriverAddIOThreadCheck(persistentDef, iothread.iothread_id) < 0)
+ if (virDomainDriverAddIOThreadCheck(def, iothread.iothread_id) < 0)
goto endjob;
- if (!virDomainIOThreadIDAdd(persistentDef, iothread.iothread_id))
+ if (qemuDomainHotplugAddIOThread(driver, vm, iothread.iothread_id) < 0)
goto endjob;
break;
case VIR_DOMAIN_IOTHREAD_ACTION_DEL:
- if (virDomainDriverDelIOThreadCheck(persistentDef, iothread.iothread_id) < 0)
+ if (virDomainDriverDelIOThreadCheck(def, iothread.iothread_id) < 0)
goto endjob;
- virDomainIOThreadIDDel(persistentDef, iothread.iothread_id);
+ if (qemuDomainHotplugDelIOThread(driver, vm, iothread.iothread_id) < 0)
+ goto endjob;
break;
case VIR_DOMAIN_IOTHREAD_ACTION_MOD:
- iothreaddef = virDomainIOThreadIDFind(persistentDef, iothread.iothread_id);
+ iothreaddef = virDomainIOThreadIDFind(def, iothread.iothread_id);
if (!iothreaddef) {
virReportError(VIR_ERR_INVALID_ARG,
@@ -5688,21 +5695,26 @@ qemuDomainChgIOThread(virQEMUDriver *driver,
goto endjob;
}
- if (qemuDomainIOThreadValidate(iothreaddef, iothread, false) < 0)
+ if (qemuDomainIOThreadValidate(iothreaddef, iothread, true) < 0)
goto endjob;
- if (qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread) < 0) {
- virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
- _("configuring persistent polling values is not supported"));
+ if (qemuDomainHotplugModIOThread(driver, vm, iothread) < 0)
goto endjob;
- }
+ qemuDomainHotplugModIOThreadIDDef(iothreaddef, iothread);
break;
+
}
- if (virDomainDefSave(persistentDef, driver->xmlopt,
- cfg->configDir) < 0)
+ qemuDomainSaveStatus(vm);
+ }
+
+ /* Finally, if no error until here, we can save config. */
+ if (defcopy) {
+ if (virDomainDefSave(defcopy, driver->xmlopt, cfg->configDir) < 0)
goto endjob;
+
+ virDomainObjAssignDef(vm, &defcopy, false, NULL);
}
ret = 0;
--
2.35.1

View File

@ -1,148 +0,0 @@
From 4c906acec14efe3893491d749465ed7e285a825c Mon Sep 17 00:00:00 2001
Message-Id: <4c906acec14efe3893491d749465ed7e285a825c@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Wed, 29 Jun 2022 12:00:03 +0200
Subject: [PATCH] qemu: Pass migration flags to qemuMigrationParamsApply
The flags will later be used to determine which parameters should
actually be applied.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 0eae541257cd4f01c9d90db62056ad8d03c5af23)
https://bugzilla.redhat.com/show_bug.cgi?id=2111070
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_driver.c | 6 +++---
src/qemu/qemu_migration.c | 8 ++++----
src/qemu/qemu_migration_params.c | 11 ++++++++---
src/qemu/qemu_migration_params.h | 3 ++-
4 files changed, 17 insertions(+), 11 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 847c96639d..17e4c23199 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13091,7 +13091,7 @@ qemuDomainMigrateSetMaxDowntime(virDomainPtr dom,
goto endjob;
if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE,
- migParams) < 0)
+ migParams, 0) < 0)
goto endjob;
} else {
qemuDomainObjEnterMonitor(driver, vm);
@@ -13273,7 +13273,7 @@ qemuDomainMigrateSetCompressionCache(virDomainPtr dom,
goto endjob;
if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE,
- migParams) < 0)
+ migParams, 0) < 0)
goto endjob;
} else {
qemuDomainObjEnterMonitor(driver, vm);
@@ -13360,7 +13360,7 @@ qemuDomainMigrateSetMaxSpeed(virDomainPtr dom,
goto endjob;
if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_NONE,
- migParams) < 0)
+ migParams, 0) < 0)
goto endjob;
} else {
int rc;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 76903d612b..8cbd73a809 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3259,7 +3259,7 @@ qemuMigrationDstPrepareActive(virQEMUDriver *driver,
}
if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_MIGRATION_IN,
- migParams) < 0)
+ migParams, flags) < 0)
goto error;
if (mig->nbd &&
@@ -4847,7 +4847,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
goto error;
if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT,
- migParams) < 0)
+ migParams, flags) < 0)
goto error;
if (flags & VIR_MIGRATE_ZEROCOPY) {
@@ -6941,7 +6941,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm,
QEMU_DOMAIN_MIG_BANDWIDTH_MAX * 1024 * 1024) < 0)
return -1;
- if (qemuMigrationParamsApply(driver, vm, asyncJob, migParams) < 0)
+ if (qemuMigrationParamsApply(driver, vm, asyncJob, migParams, 0) < 0)
return -1;
priv->migMaxBandwidth = QEMU_DOMAIN_MIG_BANDWIDTH_MAX;
@@ -7037,7 +7037,7 @@ qemuMigrationSrcToFile(virQEMUDriver *driver, virDomainObj *vm,
QEMU_MIGRATION_PARAM_MAX_BANDWIDTH,
saveMigBandwidth * 1024 * 1024) == 0)
ignore_value(qemuMigrationParamsApply(driver, vm, asyncJob,
- migParams));
+ migParams, 0));
} else {
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) == 0) {
qemuMonitorSetMigrationSpeed(priv->mon, saveMigBandwidth);
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index cc66ed8229..398c07efd0 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -833,8 +833,10 @@ qemuMigrationCapsToJSON(virBitmap *caps,
* @vm: domain object
* @asyncJob: migration job
* @migParams: migration parameters to send to QEMU
+ * @apiFlags: migration flags, some of them may affect which parameters are applied
*
- * Send all parameters stored in @migParams to QEMU.
+ * Send parameters stored in @migParams to QEMU. If @apiFlags is non-zero, some
+ * parameters that do not make sense for the enabled flags will be ignored.
*
* Returns 0 on success, -1 on failure.
*/
@@ -842,7 +844,8 @@ int
qemuMigrationParamsApply(virQEMUDriver *driver,
virDomainObj *vm,
int asyncJob,
- qemuMigrationParams *migParams)
+ qemuMigrationParams *migParams,
+ unsigned long apiFlags G_GNUC_UNUSED)
{
qemuDomainObjPrivate *priv = vm->privateData;
bool xbzrleCacheSize_old = false;
@@ -1245,7 +1248,9 @@ qemuMigrationParamsReset(virQEMUDriver *driver,
if (!virDomainObjIsActive(vm) || !origParams)
goto cleanup;
- if (qemuMigrationParamsApply(driver, vm, asyncJob, origParams) < 0)
+ /* Do not pass apiFlags to qemuMigrationParamsApply here to make sure all
+ * parameters and capabilities are reset. */
+ if (qemuMigrationParamsApply(driver, vm, asyncJob, origParams, 0) < 0)
goto cleanup;
qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiFlags);
diff --git a/src/qemu/qemu_migration_params.h b/src/qemu/qemu_migration_params.h
index d1184acded..9e990e09bd 100644
--- a/src/qemu/qemu_migration_params.h
+++ b/src/qemu/qemu_migration_params.h
@@ -98,7 +98,8 @@ int
qemuMigrationParamsApply(virQEMUDriver *driver,
virDomainObj *vm,
int asyncJob,
- qemuMigrationParams *migParams);
+ qemuMigrationParams *migParams,
+ unsigned long apiFlags);
int
qemuMigrationParamsEnableTLS(virQEMUDriver *driver,
--
2.35.1

View File

@ -1,38 +0,0 @@
From b35eb8dd4800be4dba22eb0a38da4d4d1c54521f Mon Sep 17 00:00:00 2001
Message-Id: <b35eb8dd4800be4dba22eb0a38da4d4d1c54521f@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Wed, 27 Jul 2022 15:40:12 +0200
Subject: [PATCH] qemu: Properly release job in qemuDomainSaveInternal
The function would fail to release the job in case
qemuMigrationSrcIsAllowed failed.
Fixes v8.5.0-157-g69e0e33873
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
(cherry picked from commit 9c3d398df11024ef6c00a50c98fcc0f1f66c16a1)
https://bugzilla.redhat.com/show_bug.cgi?id=1497907
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_driver.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 256e126ae1..ebd6365f52 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2655,7 +2655,7 @@ qemuDomainSaveInternal(virQEMUDriver *driver,
goto cleanup;
if (!qemuMigrationSrcIsAllowed(driver, vm, false, VIR_ASYNC_JOB_SAVE, 0))
- goto cleanup;
+ goto endjob;
if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
--
2.35.1

View File

@ -1,49 +0,0 @@
From b3d2dae261768c00b5d92203351ff6dd7cde468e Mon Sep 17 00:00:00 2001
Message-Id: <b3d2dae261768c00b5d92203351ff6dd7cde468e@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 12 Jul 2022 15:58:17 +0200
Subject: [PATCH] qemu: Report supported TPM version in domcaps
Now that we have everything prepared, we can start detecting
supported TPM versions and setting corresponding values in
backendModel struct.
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/340
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103119
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 430ab88ab17727ac9774ee5b47f09f69c57add73)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_capabilities.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 2c3be3ecec..8586930266 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -6368,9 +6368,18 @@ virQEMUCapsFillDomainDeviceTPMCaps(virQEMUCaps *qemuCaps,
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_PASSTHROUGH))
VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendModel, VIR_DOMAIN_TPM_TYPE_PASSTHROUGH);
- if (virTPMHasSwtpm() &&
- virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_EMULATOR))
- VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendModel, VIR_DOMAIN_TPM_TYPE_EMULATOR);
+ if (virTPMHasSwtpm()) {
+ if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_TPM_EMULATOR))
+ VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendModel, VIR_DOMAIN_TPM_TYPE_EMULATOR);
+ if (virTPMSwtpmSetupCapsGet(VIR_TPM_SWTPM_SETUP_FEATURE_TPM_1_2)) {
+ VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendVersion, VIR_DOMAIN_TPM_VERSION_1_2);
+ tpm->backendVersion.report = true;
+ }
+ if (virTPMSwtpmSetupCapsGet(VIR_TPM_SWTPM_SETUP_FEATURE_TPM_2_0)) {
+ VIR_DOMAIN_CAPS_ENUM_SET(tpm->backendVersion, VIR_DOMAIN_TPM_VERSION_2_0);
+ tpm->backendVersion.report = true;
+ }
+ }
/*
* Need at least one frontend if it is to be usable by applications
--
2.35.1

View File

@ -1,85 +0,0 @@
From a1d825e5dcb8cbe0854fa852d25e5997a52d57cd Mon Sep 17 00:00:00 2001
Message-Id: <a1d825e5dcb8cbe0854fa852d25e5997a52d57cd@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Wed, 27 Jul 2022 14:33:23 +0200
Subject: [PATCH] qemu: Restore original memory locking limit on reconnect
Commit v8.4.0-287-gd4d3bb8130 tried to make sure the original
pre-migration memory locking limit is restored at the end of migration,
but it missed the case when libvirt daemon is restarted during
migration which needs to be aborted on reconnect.
And if this was not enough, I forgot to actually save the status XML
after setting the field in priv (in the commit mentioned above and also
in v8.4.0-291-gd375993ab3).
https://bugzilla.redhat.com/show_bug.cgi?id=2107424
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit bb9badb9168ad0d40bca86b6463ef504624f096d)
Conflicts:
src/qemu/qemu_migration.c
- commit v8.5.0-2-gf9dcc01a0f not backported
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_migration.c | 13 +++++++++----
src/qemu/qemu_process.c | 2 ++
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 9289df81eb..61fcaf4258 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -4672,10 +4672,12 @@ qemuMigrationSrcStart(virDomainObj *vm,
switch (spec->destType) {
case MIGRATION_DEST_HOST:
if (STREQ(spec->dest.host.protocol, "rdma") &&
- vm->def->mem.hard_limit > 0 &&
- qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10,
- &priv->preMigrationMemlock) < 0) {
- return -1;
+ vm->def->mem.hard_limit > 0) {
+ if (qemuDomainSetMaxMemLock(vm, vm->def->mem.hard_limit << 10,
+ &priv->preMigrationMemlock) < 0)
+ return -1;
+ /* Store the original memory locking limit */
+ qemuDomainSaveStatus(vm);
}
return qemuMonitorMigrateToHost(priv->mon, migrateFlags,
spec->dest.host.protocol,
@@ -4870,6 +4872,9 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
if (qemuDomainSetMaxMemLock(vm, limit << 10, &priv->preMigrationMemlock) < 0)
goto error;
+
+ /* Store the original memory locking limit */
+ qemuDomainSaveStatus(vm);
}
if (storageMigration) {
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 771a623ef7..1c28d4b102 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -3677,6 +3677,7 @@ qemuProcessRecoverMigration(virQEMUDriver *driver,
{
virDomainJobStatus migStatus = VIR_DOMAIN_JOB_STATUS_NONE;
qemuDomainJobPrivate *jobPriv = job->privateData;
+ qemuDomainObjPrivate *priv = vm->privateData;
virDomainState state;
int reason;
int rc;
@@ -3726,6 +3727,7 @@ qemuProcessRecoverMigration(virQEMUDriver *driver,
qemuMigrationParamsReset(driver, vm, VIR_ASYNC_JOB_NONE,
jobPriv->migParams, job->apiFlags);
+ qemuDomainSetMaxMemLock(vm, 0, &priv->preMigrationMemlock);
return 0;
}
--
2.35.1

View File

@ -1,61 +0,0 @@
From d51e6092ed7977daf662ed1def0f6cd5cc6ba33d Mon Sep 17 00:00:00 2001
Message-Id: <d51e6092ed7977daf662ed1def0f6cd5cc6ba33d@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Wed, 27 Jul 2022 12:14:10 -0400
Subject: [PATCH] qemu: don't call qemuMigrationSrcIsAllowedHostdev() from
qemuMigrationDstPrepareFresh()
This call to qemuMigrationSrcIsAllowedHostdev() (which does a
hardcoded fail of the migration if there is any PCI or mdev hostdev
device in the domain) while doing the destination side of migration
prep was found once the call to that same function was removed from
the source side migration prep (commit 25883cd5).
According to jdenemar, for the V2 migration protocol, prep of the
destination is the first step, so this *was* the proper place to do
the check, but for V3 migration this is in a way redundant (since we
will have already done the check on the source side (updated by
25883cd5 to query QEMU rather than do a hardcoded fail)).
Of course it's possible that the source could support migration of a
particular VFIO device, but the destination doesn't. But the current
check on the destination side is worthless even in that case, since it
is just *always* failing rather than querying QEMU; and QEMU can't be
queried at the point where the destination check is happening, since
it isn't yet running.
Anyway QEMU should complain when it's started if it's going to fail,
so removing this check should just move the failure to happen a bit
later. So the best solution to this problem is to simply remove the
hardcoded check/fail from qemuMigrationDstPrepareFresh() and rely on
QEMU to fail if it needs to.
Fixes: 25883cd5f0b188f2417f294b7d219a77b219f7c2
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 640d185f01858b7a8db401235c929ac4798592d0)
https://bugzilla.redhat.com/show_bug.cgi?id=1497907
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_migration.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 61fcaf4258..e3ba4c3f78 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3382,9 +3382,6 @@ qemuMigrationDstPrepareFresh(virQEMUDriver *driver,
QEMU_MIGRATION_COOKIE_CAPS;
}
- if (!qemuMigrationSrcIsAllowedHostdev(*def))
- goto cleanup;
-
/* Let migration hook filter domain XML */
if (virHookPresent(VIR_HOOK_DRIVER_QEMU)) {
g_autofree char *xml = NULL;
--
2.35.1

View File

@ -1,87 +0,0 @@
From 80ac99d0f947f5e2fe4ff7fe9fb63b6dc6cbc1bb Mon Sep 17 00:00:00 2001
Message-Id: <80ac99d0f947f5e2fe4ff7fe9fb63b6dc6cbc1bb@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Thu, 21 Jul 2022 01:56:11 -0400
Subject: [PATCH] qemu: don't try to query QEMU about migration blockers during
offline migration
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The new code that queries QEMU about migration blockers was put at the
top of qemuMigrationSrcIsAllowed(), but that function can also be
called in the case of offline migration (ie when the domain is
inactive / QEMU isn't running). This check should have been put inside
the "if (!(flags & VIR_MIGRATE_OFFLINE))" conditional, so let's move
it there.
Fixes: 156e99f686690855be4e45d9b8b3194191a8bc31
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 2dd5587f1dc8e2cf4e6e0a4e4cf576b8183b33cd)
Resolves: https://bugzilla.redhat.com/2092833
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
src/qemu/qemu_migration.c | 39 +++++++++++++++++++++------------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 735eb02673..96c4c0f1da 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1458,24 +1458,6 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
int nsnapshots;
int pauseReason;
size_t i;
- bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
- QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
-
- /* Ask qemu if it has a migration blocker */
- if (blockedReasonsCap) {
- g_auto(GStrv) blockers = NULL;
- if (qemuDomainGetMigrationBlockers(driver, vm,
- VIR_ASYNC_JOB_MIGRATION_OUT,
- &blockers) < 0)
- return false;
-
- if (blockers && blockers[0]) {
- g_autofree char *reasons = g_strjoinv("; ", blockers);
- virReportError(VIR_ERR_OPERATION_INVALID,
- _("cannot migrate domain: %s"), reasons);
- return false;
- }
- }
/* perform these checks only when migrating to remote hosts */
if (remote) {
@@ -1493,6 +1475,27 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
/* following checks don't make sense for offline migration */
if (!(flags & VIR_MIGRATE_OFFLINE)) {
+ bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
+ QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
+
+ /* Ask qemu if it has a migration blocker */
+ if (blockedReasonsCap) {
+ g_auto(GStrv) blockers = NULL;
+
+ if (qemuDomainGetMigrationBlockers(driver, vm,
+ VIR_ASYNC_JOB_MIGRATION_OUT,
+ &blockers) < 0) {
+ return false;
+ }
+
+ if (blockers && blockers[0]) {
+ g_autofree char *reasons = g_strjoinv("; ", blockers);
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("cannot migrate domain: %s"), reasons);
+ return false;
+ }
+ }
+
if (remote) {
/* cancel migration if disk I/O error is emitted while migrating */
if (flags & VIR_MIGRATE_ABORT_ON_ERROR &&
--
2.35.1

View File

@ -1,206 +0,0 @@
From 81f8b07ed1e4e485ded7f366739c110351120785 Mon Sep 17 00:00:00 2001
Message-Id: <81f8b07ed1e4e485ded7f366739c110351120785@dist-git>
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
Date: Thu, 21 Jul 2022 19:29:05 +0200
Subject: [PATCH] qemu: introduce capability
QEMU_CAPS_MIGRATION_BLOCKED_REASONS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
since qemu 6.0, if migration is blocked for some reason, 'query-migrate'
will return an array of error strings describing the migration blockers.
This can be used to check whether there are any devices blocking
migration, etc.
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
(cherry picked from commit 1e9d84d9f9513a73572842db30e3d1445e892291)
Resolves: https://bugzilla.redhat.com/2092833
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
src/qemu/qemu_capabilities.c | 2 ++
src/qemu/qemu_capabilities.h | 1 +
tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml | 1 +
13 files changed, 14 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 8586930266..48002f3b58 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -671,6 +671,7 @@ VIR_ENUM_IMPL(virQEMUCaps,
"chardev.qemu-vdagent", /* QEMU_CAPS_CHARDEV_QEMU_VDAGENT */
"display-dbus", /* QEMU_CAPS_DISPLAY_DBUS */
"iothread.thread-pool-max", /* QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX */
+ "migration.blocked-reasons", /* QEMU_CAPS_MIGRATION_BLOCKED_REASONS */
);
@@ -1623,6 +1624,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsQMPSchemaQueries[] = {
{ "chardev-add/arg-type/backend/+qemu-vdagent", QEMU_CAPS_CHARDEV_QEMU_VDAGENT },
{ "query-display-options/ret-type/+dbus", QEMU_CAPS_DISPLAY_DBUS },
{ "object-add/arg-type/+iothread/thread-pool-max", QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX },
+ { "query-migrate/ret-type/blocked-reasons", QEMU_CAPS_MIGRATION_BLOCKED_REASONS },
};
typedef struct _virQEMUCapsObjectTypeProps virQEMUCapsObjectTypeProps;
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 6f35ba1485..570e43292d 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -650,6 +650,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_CHARDEV_QEMU_VDAGENT, /* -chardev qemu-vdagent */
QEMU_CAPS_DISPLAY_DBUS, /* -display dbus */
QEMU_CAPS_IOTHREAD_THREAD_POOL_MAX, /* -object iothread.thread-pool-max */
+ QEMU_CAPS_MIGRATION_BLOCKED_REASONS, /* query-migrate returns 'blocked-reasons */
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml
index 4b4cc2d3aa..3e48d17811 100644
--- a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml
@@ -189,6 +189,7 @@
<flag name='memory-backend-file.prealloc-threads'/>
<flag name='virtio-iommu-pci'/>
<flag name='virtio-net.rss'/>
+ <flag name='migration.blocked-reasons'/>
<version>6000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>61700242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml
index 06543071aa..790b7221d4 100644
--- a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml
@@ -147,6 +147,7 @@
<flag name='memory-backend-file.prealloc-threads'/>
<flag name='virtio-iommu-pci'/>
<flag name='virtio-net.rss'/>
+ <flag name='migration.blocked-reasons'/>
<version>6000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>39100242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
index 8c61bf8a84..86c3732c72 100644
--- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
@@ -231,6 +231,7 @@
<flag name='memory-backend-file.prealloc-threads'/>
<flag name='virtio-iommu-pci'/>
<flag name='virtio-net.rss'/>
+ <flag name='migration.blocked-reasons'/>
<version>6000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml
index afd8f606eb..bd76a7a398 100644
--- a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml
@@ -236,6 +236,7 @@
<flag name='virtio-iommu-pci'/>
<flag name='virtio-net.rss'/>
<flag name='chardev.qemu-vdagent'/>
+ <flag name='migration.blocked-reasons'/>
<version>6001000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
index 86fc46918f..6ed51ec796 100644
--- a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
@@ -201,6 +201,7 @@
<flag name='virtio-iommu-pci'/>
<flag name='virtio-net.rss'/>
<flag name='chardev.qemu-vdagent'/>
+ <flag name='migration.blocked-reasons'/>
<version>6001050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>61700244</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
index 983b54430d..1a98fe122e 100644
--- a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
@@ -196,6 +196,7 @@
<flag name='memory-backend-file.prealloc-threads'/>
<flag name='virtio-iommu-pci'/>
<flag name='virtio-net.rss'/>
+ <flag name='migration.blocked-reasons'/>
<version>6002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900244</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
index 19605d93ae..a77efaaa37 100644
--- a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
@@ -238,6 +238,7 @@
<flag name='virtio-iommu-pci'/>
<flag name='virtio-net.rss'/>
<flag name='chardev.qemu-vdagent'/>
+ <flag name='migration.blocked-reasons'/>
<version>6002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100244</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml
index e24e2235fb..6848a075a8 100644
--- a/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_7.0.0.aarch64.xml
@@ -209,6 +209,7 @@
<flag name='virtio-iommu.boot-bypass'/>
<flag name='virtio-net.rss'/>
<flag name='chardev.qemu-vdagent'/>
+ <flag name='migration.blocked-reasons'/>
<version>6002092</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>61700243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
index 83e0f50e3a..cf4286b78b 100644
--- a/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
@@ -213,6 +213,7 @@
<flag name='virtio-iommu.boot-bypass'/>
<flag name='virtio-net.rss'/>
<flag name='chardev.qemu-vdagent'/>
+ <flag name='migration.blocked-reasons'/>
<version>7000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml
index 05f844fd5b..8e2c1652f9 100644
--- a/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml
@@ -243,6 +243,7 @@
<flag name='virtio-net.rss'/>
<flag name='chardev.qemu-vdagent'/>
<flag name='display-dbus'/>
+ <flag name='migration.blocked-reasons'/>
<version>7000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml
index 3707d9b7c9..9bdb207c4e 100644
--- a/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_7.1.0.x86_64.xml
@@ -244,6 +244,7 @@
<flag name='chardev.qemu-vdagent'/>
<flag name='display-dbus'/>
<flag name='iothread.thread-pool-max'/>
+ <flag name='migration.blocked-reasons'/>
<version>7000050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100244</microcodeVersion>
--
2.35.1

View File

@ -1,140 +0,0 @@
From 90d326f60706a990db3ed49ba338d911471578c0 Mon Sep 17 00:00:00 2001
Message-Id: <90d326f60706a990db3ed49ba338d911471578c0@dist-git>
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
Date: Thu, 21 Jul 2022 19:29:10 +0200
Subject: [PATCH] qemu: new function to retrieve migration blocker reasons from
QEMU
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since QEMU 6.0, if migration is blocked for some reason,
'query-migrate' will return an array of error strings describing the
migration blockers. This can be used to check whether there are any
devices, or other conditions, that would cause migration to fail.
This patch adds a function that sends this query via a QMP command and
returns the resulting array of reasons. qemuMigrationSrcIsAllowed()
will be able to use the new function to ask QEMU for migration
blockers, instead of the hardcoded guesses that libvirt currently has.
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
(cherry picked from commit 7e52c4839fabac2d19c6f22c99142e992e3d898e)
Resolves: https://bugzilla.redhat.com/2092833
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
src/qemu/qemu_monitor.c | 12 ++++++++++
src/qemu/qemu_monitor.h | 4 ++++
src/qemu/qemu_monitor_json.c | 46 ++++++++++++++++++++++++++++++++++++
src/qemu/qemu_monitor_json.h | 3 +++
4 files changed, 65 insertions(+)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index fda5d2f368..865a3e69ed 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -4541,3 +4541,15 @@ qemuMonitorMigrateRecover(qemuMonitor *mon,
return qemuMonitorJSONMigrateRecover(mon, uri);
}
+
+
+int
+qemuMonitorGetMigrationBlockers(qemuMonitor *mon,
+ char ***blockers)
+{
+ VIR_DEBUG("blockers=%p", blockers);
+
+ QEMU_CHECK_MONITOR(mon);
+
+ return qemuMonitorJSONGetMigrationBlockers(mon, blockers);
+}
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 95267ec6c7..0c3f023419 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -1554,3 +1554,7 @@ qemuMonitorChangeMemoryRequestedSize(qemuMonitor *mon,
int
qemuMonitorMigrateRecover(qemuMonitor *mon,
const char *uri);
+
+int
+qemuMonitorGetMigrationBlockers(qemuMonitor *mon,
+ char ***blockers);
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 3aad2ab212..84f4589c42 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -3434,6 +3434,52 @@ int qemuMonitorJSONMigrate(qemuMonitor *mon,
return 0;
}
+
+/*
+ * Get the exposed migration blockers.
+ *
+ * This function assume qemu has the capability of request them.
+ *
+ * It returns a NULL terminated array on blockers if there are any, or it set
+ * it to NULL otherwise.
+ */
+int
+qemuMonitorJSONGetMigrationBlockers(qemuMonitor *mon,
+ char ***blockers)
+{
+ g_autoptr(virJSONValue) cmd = NULL;
+ g_autoptr(virJSONValue) reply = NULL;
+ virJSONValue *data;
+ virJSONValue *jblockers;
+ size_t i;
+
+ *blockers = NULL;
+ if (!(cmd = qemuMonitorJSONMakeCommand("query-migrate", NULL)))
+ return -1;
+
+ if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
+ return -1;
+
+ if (qemuMonitorJSONCheckReply(cmd, reply, VIR_JSON_TYPE_OBJECT) < 0)
+ return -1;
+
+ data = virJSONValueObjectGetObject(reply, "return");
+
+ if (!(jblockers = virJSONValueObjectGetArray(data, "blocked-reasons")))
+ return 0;
+
+ *blockers = g_new0(char *, virJSONValueArraySize(jblockers) + 1);
+ for (i = 0; i < virJSONValueArraySize(jblockers); i++) {
+ virJSONValue *jblocker = virJSONValueArrayGet(jblockers, i);
+ const char *blocker = virJSONValueGetString(jblocker);
+
+ (*blockers)[i] = g_strdup(blocker);
+ }
+
+ return 0;
+}
+
+
int qemuMonitorJSONMigrateCancel(qemuMonitor *mon)
{
g_autoptr(virJSONValue) cmd = qemuMonitorJSONMakeCommand("migrate_cancel", NULL);
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index ad3853ae69..4e7d6a1a8d 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -199,6 +199,9 @@ qemuMonitorJSONMigrate(qemuMonitor *mon,
unsigned int flags,
const char *uri);
int
+qemuMonitorJSONGetMigrationBlockers(qemuMonitor *mon,
+ char ***blockers);
+int
qemuMonitorJSONGetSpiceMigrationStatus(qemuMonitor *mon,
bool *spice_migrated);
--
2.35.1

View File

@ -1,80 +0,0 @@
From 9764a6c484d4f3586b0e0be33e8c53de63b11edd Mon Sep 17 00:00:00 2001
Message-Id: <9764a6c484d4f3586b0e0be33e8c53de63b11edd@dist-git>
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
Date: Thu, 21 Jul 2022 19:29:13 +0200
Subject: [PATCH] qemu: query QEMU for migration blockers before our own
harcoded checks
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Since QEMU 6.0, if QEMU knows that a migration would fail,
'query-migrate' will return an array of error strings describing the
migration blockers. This can be used to check whether there are any
devices/conditions blocking migration.
This patch adds a call to this query at the top of
qemuMigrationSrcIsAllowed().
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
(cherry picked from commit 156e99f686690855be4e45d9b8b3194191a8bc31)
Resolves: https://bugzilla.redhat.com/2092833
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
src/qemu/qemu_migration.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 2a6b7b7819..cfb7626bb0 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1415,6 +1415,22 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def)
}
+static int
+qemuDomainGetMigrationBlockers(virQEMUDriver *driver,
+ virDomainObj *vm,
+ char ***blockers)
+{
+ qemuDomainObjPrivate *priv = vm->privateData;
+ int rc;
+
+ qemuDomainObjEnterMonitor(driver, vm);
+ rc = qemuMonitorGetMigrationBlockers(priv->mon, blockers);
+ qemuDomainObjExitMonitor(vm);
+
+ return rc;
+}
+
+
/**
* qemuMigrationSrcIsAllowed:
* @driver: qemu driver struct
@@ -1440,6 +1456,20 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
int pauseReason;
size_t i;
+ /* Ask qemu if it has a migration blocker */
+ if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_BLOCKED_REASONS)) {
+ g_auto(GStrv) blockers = NULL;
+ if (qemuDomainGetMigrationBlockers(driver, vm, &blockers) < 0)
+ return false;
+
+ if (blockers && blockers[0]) {
+ g_autofree char *reasons = g_strjoinv("; ", blockers);
+ virReportError(VIR_ERR_OPERATION_INVALID,
+ _("cannot migrate domain: %s"), reasons);
+ return false;
+ }
+ }
+
/* perform these checks only when migrating to remote hosts */
if (remote) {
nsnapshots = virDomainSnapshotObjListNum(vm->snapshots, NULL, 0);
--
2.35.1

View File

@ -1,58 +0,0 @@
From 0ba11af2300d0aaf80456575e03848f843ae29de Mon Sep 17 00:00:00 2001
Message-Id: <0ba11af2300d0aaf80456575e03848f843ae29de@dist-git>
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
Date: Thu, 21 Jul 2022 19:29:15 +0200
Subject: [PATCH] qemu: remove hardcoded migration fail for vDPA devices if we
can ask QEMU
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
vDPA devices will be migratable soon, so we shouldn't unconditionally
block migration of any domain with a vDPA device. Instead, we should
rely on QEMU to make the decision when that info is available from the
query-migrate QMP command (QEMU versions too old to have that info in
the results of query-migrate don't support migration of vDPA devices,
so in that case we will continue to unconditionally block migration).
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
(cherry picked from commit 2103807e330487952f423d86f541a7a28e003e95)
Resolves: https://bugzilla.redhat.com/2092833
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
src/qemu/qemu_migration.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index cfb7626bb0..2f77e45abf 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1455,9 +1455,11 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
int nsnapshots;
int pauseReason;
size_t i;
+ bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
+ QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
- /* Ask qemu if it has a migration blocker */
- if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATION_BLOCKED_REASONS)) {
+ /* Ask qemu if it have a migration blocker */
+ if (blockedReasonsCap) {
g_auto(GStrv) blockers = NULL;
if (qemuDomainGetMigrationBlockers(driver, vm, &blockers) < 0)
return false;
@@ -1576,7 +1578,7 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
virDomainNetDef *net = vm->def->nets[i];
qemuSlirp *slirp;
- if (net->type == VIR_DOMAIN_NET_TYPE_VDPA) {
+ if (!blockedReasonsCap && net->type == VIR_DOMAIN_NET_TYPE_VDPA) {
virReportError(VIR_ERR_OPERATION_INVALID, "%s",
_("vDPA devices cannot be migrated"));
return false;
--
2.35.1

View File

@ -1,62 +0,0 @@
From 8f2cd77dc208cfa90b37faa18b092ca4a76a0716 Mon Sep 17 00:00:00 2001
Message-Id: <8f2cd77dc208cfa90b37faa18b092ca4a76a0716@dist-git>
From: Laine Stump <laine@redhat.com>
Date: Thu, 21 Jul 2022 02:03:49 -0400
Subject: [PATCH] qemu: skip hardcoded hostdev migration check if QEMU can do
it for us
libvirt currently will block migration for any vfio-assigned device
unless it is a network device that is associated with a virtio-net
failover device (ie. if the hostdev object has a teaming->type ==
VIR_DOMAIN_NET_TEAMING_TYPE_TRANSIENT).
In the future there will be other vfio devices that can be migrated,
so we don't want to rely on this hardcoded block. QEMU 6.0+ will
anyway inform us of any devices that will block migration (as a part
of qemuDomainGetMigrationBlockers()), so we only need to do the
hardcoded check in the case of old QEMU that can't provide that
information.
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 25883cd5f0b188f2417f294b7d219a77b219f7c2)
https://bugzilla.redhat.com/show_bug.cgi?id=1497907
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_migration.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index f571c9eb27..76903d612b 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1495,6 +1495,14 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
_("cannot migrate domain: %s"), reasons);
return false;
}
+ } else {
+ /* checks here are for anything that doesn't need to be
+ * checked by libvirt if running QEMU that can be queried
+ * about migration blockers.
+ */
+
+ if (!qemuMigrationSrcIsAllowedHostdev(vm->def))
+ return false;
}
if (remote) {
@@ -1521,9 +1529,6 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
return false;
}
- if (!qemuMigrationSrcIsAllowedHostdev(vm->def))
- return false;
-
if (vm->def->cpu) {
/* QEMU blocks migration and save with invariant TSC enabled
* unless TSC frequency is explicitly set.
--
2.35.1

View File

@ -1,41 +0,0 @@
From 9b00b5666a014999a3bc9e2e8a6a844ca7a4326f Mon Sep 17 00:00:00 2001
Message-Id: <9b00b5666a014999a3bc9e2e8a6a844ca7a4326f@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 8 Jul 2022 09:35:39 +0200
Subject: [PATCH] qemuDomainSetIOThreadParams: Accept VIR_DOMAIN_AFFECT_CONFIG
flag
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It was always possible to modify the inactive XML, because
VIR_DOMAIN_AFFECT_CURRENT (= 0) is accepted implicitly. But now
that the logic when changing both config and live XMLs is more
robust we can accept VIR_DOMAIN_AFFECT_CONFIG flag too.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 3096965ce78923b099fa39e4950279b2f21ab60a)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_driver.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 2c627396f1..654b5d65e5 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -5818,7 +5818,8 @@ qemuDomainSetIOThreadParams(virDomainPtr dom,
qemuMonitorIOThreadInfo iothread = {0};
int ret = -1;
- virCheckFlags(VIR_DOMAIN_AFFECT_LIVE, -1);
+ virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
+ VIR_DOMAIN_AFFECT_CONFIG, -1);
if (iothread_id == 0) {
virReportError(VIR_ERR_INVALID_ARG, "%s",
--
2.35.1

View File

@ -1,132 +0,0 @@
From d4c4660b097695916244307d1125a17c30c0c9ef Mon Sep 17 00:00:00 2001
Message-Id: <d4c4660b097695916244307d1125a17c30c0c9ef@dist-git>
From: Martin Kletzander <mkletzan@redhat.com>
Date: Fri, 22 Jul 2022 12:20:04 +0200
Subject: [PATCH] qemu_migration: Acquire correct job in
qemuMigrationSrcIsAllowed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commit 62627524607f added the acquiring of a job, but it is not always
VIR_ASYNC_JOB_MIGRATION_OUT, so the code fails when doing save or anything else.
Correct the async job by passing it from the caller as another parameter.
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
(cherry picked from commit 69e0e33873f1aec55df77f12fb0197d50dca3319)
Resolves: https://bugzilla.redhat.com/2092833
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
src/qemu/qemu_driver.c | 8 ++++----
src/qemu/qemu_migration.c | 7 ++++---
src/qemu/qemu_migration.h | 1 +
src/qemu/qemu_snapshot.c | 4 ++--
4 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 654b5d65e5..847c96639d 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -2650,13 +2650,13 @@ qemuDomainSaveInternal(virQEMUDriver *driver,
virQEMUSaveData *data = NULL;
g_autoptr(qemuDomainSaveCookie) cookie = NULL;
- if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
- goto cleanup;
-
if (qemuDomainObjBeginAsyncJob(driver, vm, VIR_ASYNC_JOB_SAVE,
VIR_DOMAIN_JOB_OPERATION_SAVE, flags) < 0)
goto cleanup;
+ if (!qemuMigrationSrcIsAllowed(driver, vm, false, VIR_ASYNC_JOB_SAVE, 0))
+ goto cleanup;
+
if (!virDomainObjIsActive(vm)) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("guest unexpectedly quit"));
@@ -3176,7 +3176,7 @@ doCoreDump(virQEMUDriver *driver,
goto cleanup;
}
- if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, false, VIR_ASYNC_JOB_DUMP, 0))
goto cleanup;
if (qemuMigrationSrcToFile(driver, vm, fd, compressor,
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 96c4c0f1da..f571c9eb27 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1452,6 +1452,7 @@ bool
qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
virDomainObj *vm,
bool remote,
+ int asyncJob,
unsigned int flags)
{
qemuDomainObjPrivate *priv = vm->privateData;
@@ -1483,7 +1484,7 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
g_auto(GStrv) blockers = NULL;
if (qemuDomainGetMigrationBlockers(driver, vm,
- VIR_ASYNC_JOB_MIGRATION_OUT,
+ asyncJob,
&blockers) < 0) {
return false;
}
@@ -2632,7 +2633,7 @@ qemuMigrationSrcBeginPhase(virQEMUDriver *driver,
qemuMigrationJobStartPhase(vm, QEMU_MIGRATION_PHASE_BEGIN3) < 0)
return NULL;
- if (!qemuMigrationSrcIsAllowed(driver, vm, true, flags))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, true, priv->job.asyncJob, flags))
return NULL;
if (!(flags & (VIR_MIGRATE_UNSAFE | VIR_MIGRATE_OFFLINE)) &&
@@ -6033,7 +6034,7 @@ qemuMigrationSrcPerformJob(virQEMUDriver *driver,
if (!(flags & VIR_MIGRATE_OFFLINE) && virDomainObjCheckActive(vm) < 0)
goto endjob;
- if (!qemuMigrationSrcIsAllowed(driver, vm, true, flags))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, true, VIR_ASYNC_JOB_MIGRATION_OUT, flags))
goto endjob;
if (!(flags & (VIR_MIGRATE_UNSAFE | VIR_MIGRATE_OFFLINE)) &&
diff --git a/src/qemu/qemu_migration.h b/src/qemu/qemu_migration.h
index 81cc1e91c0..61d12d6eb1 100644
--- a/src/qemu/qemu_migration.h
+++ b/src/qemu/qemu_migration.h
@@ -229,6 +229,7 @@ bool
qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
virDomainObj *vm,
bool remote,
+ int asyncJob,
unsigned int flags);
int
diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c
index 833f880252..0733d44faa 100644
--- a/src/qemu/qemu_snapshot.c
+++ b/src/qemu/qemu_snapshot.c
@@ -291,7 +291,7 @@ qemuSnapshotCreateActiveInternal(virQEMUDriver *driver,
virDomainSnapshotDef *snapdef = virDomainSnapshotObjGetDef(snap);
int ret = -1;
- if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, false, VIR_ASYNC_JOB_SNAPSHOT, 0))
goto cleanup;
if (virDomainObjGetState(vm, NULL) == VIR_DOMAIN_RUNNING) {
@@ -1422,7 +1422,7 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *driver,
/* do the memory snapshot if necessary */
if (memory) {
/* check if migration is possible */
- if (!qemuMigrationSrcIsAllowed(driver, vm, false, 0))
+ if (!qemuMigrationSrcIsAllowed(driver, vm, false, VIR_ASYNC_JOB_SNAPSHOT, 0))
goto cleanup;
qemuDomainJobSetStatsType(priv->job.current,
--
2.35.1

View File

@ -1,229 +0,0 @@
From b8c791a3fc2767e6d899e3e0c590a93cb0ee7e03 Mon Sep 17 00:00:00 2001
Message-Id: <b8c791a3fc2767e6d899e3e0c590a93cb0ee7e03@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 30 Jun 2022 12:52:38 +0200
Subject: [PATCH] qemu_migration: Apply max-postcopy-bandwidth on post-copy
resume
When resuming post-copy migration users may want to limit the bandwidth
used by the migration and use a value that is different from the one
specified when the migration was originally started.
Resolves: https://gitlab.com/libvirt/libvirt/-/issues/333
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 766abdc291ba606379a7d197bff477fef25fb508)
https://bugzilla.redhat.com/show_bug.cgi?id=2111070
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_migration.c | 12 ++++++--
src/qemu/qemu_migration_params.c | 45 ++++++++++++++++++----------
src/qemu/qemu_migration_paramspriv.h | 3 +-
tests/qemumigparamstest.c | 2 +-
tests/qemumigrationcookiexmltest.c | 2 +-
5 files changed, 42 insertions(+), 22 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 285a49c5ff..8a2f5b09a1 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -5097,12 +5097,13 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
static int
qemuMigrationSrcResume(virDomainObj *vm,
- qemuMigrationParams *migParams G_GNUC_UNUSED,
+ qemuMigrationParams *migParams,
const char *cookiein,
int cookieinlen,
char **cookieout,
int *cookieoutlen,
- qemuMigrationSpec *spec)
+ qemuMigrationSpec *spec,
+ unsigned long flags)
{
qemuDomainObjPrivate *priv = vm->privateData;
virQEMUDriver *driver = priv->driver;
@@ -5119,6 +5120,10 @@ qemuMigrationSrcResume(virDomainObj *vm,
if (!mig)
return -1;
+ if (qemuMigrationParamsApply(driver, vm, VIR_ASYNC_JOB_MIGRATION_OUT,
+ migParams, flags) < 0)
+ return -1;
+
if (qemuDomainObjEnterMonitorAsync(driver, vm,
VIR_ASYNC_JOB_MIGRATION_OUT) < 0)
return -1;
@@ -5200,6 +5205,7 @@ qemuMigrationSrcPerformNative(virQEMUDriver *driver,
if (STREQ(uribits->scheme, "unix")) {
if ((flags & VIR_MIGRATE_TLS) &&
+ !(flags & VIR_MIGRATE_POSTCOPY_RESUME) &&
!qemuMigrationParamsTLSHostnameIsSet(migParams)) {
virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
_("Explicit destination hostname is required "
@@ -5231,7 +5237,7 @@ qemuMigrationSrcPerformNative(virQEMUDriver *driver,
if (flags & VIR_MIGRATE_POSTCOPY_RESUME) {
ret = qemuMigrationSrcResume(vm, migParams, cookiein, cookieinlen,
- cookieout, cookieoutlen, &spec);
+ cookieout, cookieoutlen, &spec, flags);
} else {
ret = qemuMigrationSrcRun(driver, vm, persist_xml, cookiein, cookieinlen,
cookieout, cookieoutlen, flags, resource,
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index a68aed9aa4..6ea0bde13a 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -141,6 +141,7 @@ struct _qemuMigrationParamsTPMapItem {
typedef struct _qemuMigrationParamInfoItem qemuMigrationParamInfoItem;
struct _qemuMigrationParamInfoItem {
qemuMigrationParamType type;
+ bool applyOnPostcopyResume;
};
/* Migration capabilities which should always be enabled as long as they
@@ -265,6 +266,7 @@ static const qemuMigrationParamInfoItem qemuMigrationParamInfo[] = {
},
[QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH] = {
.type = QEMU_MIGRATION_PARAM_TYPE_ULL,
+ .applyOnPostcopyResume = true,
},
[QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS] = {
.type = QEMU_MIGRATION_PARAM_TYPE_INT,
@@ -782,7 +784,8 @@ qemuMigrationParamsFromJSON(virJSONValue *params)
virJSONValue *
-qemuMigrationParamsToJSON(qemuMigrationParams *migParams)
+qemuMigrationParamsToJSON(qemuMigrationParams *migParams,
+ bool postcopyResume)
{
g_autoptr(virJSONValue) params = virJSONValueNewObject();
size_t i;
@@ -795,6 +798,9 @@ qemuMigrationParamsToJSON(qemuMigrationParams *migParams)
if (!pv->set)
continue;
+ if (postcopyResume && !qemuMigrationParamInfo[i].applyOnPostcopyResume)
+ continue;
+
switch (qemuMigrationParamInfo[i].type) {
case QEMU_MIGRATION_PARAM_TYPE_INT:
rc = virJSONValueObjectAppendNumberInt(params, name, pv->value.i);
@@ -868,6 +874,7 @@ qemuMigrationCapsToJSON(virBitmap *caps,
*
* Send parameters stored in @migParams to QEMU. If @apiFlags is non-zero, some
* parameters that do not make sense for the enabled flags will be ignored.
+ * VIR_MIGRATE_POSTCOPY_RESUME is the only flag checked currently.
*
* Returns 0 on success, -1 on failure.
*/
@@ -876,32 +883,38 @@ qemuMigrationParamsApply(virQEMUDriver *driver,
virDomainObj *vm,
int asyncJob,
qemuMigrationParams *migParams,
- unsigned long apiFlags G_GNUC_UNUSED)
+ unsigned long apiFlags)
{
qemuDomainObjPrivate *priv = vm->privateData;
bool xbzrleCacheSize_old = false;
g_autoptr(virJSONValue) params = NULL;
g_autoptr(virJSONValue) caps = NULL;
qemuMigrationParam xbzrle = QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE;
+ bool postcopyResume = !!(apiFlags & VIR_MIGRATE_POSTCOPY_RESUME);
int ret = -1;
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1;
- if (asyncJob == VIR_ASYNC_JOB_NONE) {
- if (!virBitmapIsAllClear(migParams->caps)) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("Migration capabilities can only be set by "
- "a migration job"));
- goto cleanup;
- }
- } else {
- if (!(caps = qemuMigrationCapsToJSON(priv->migrationCaps, migParams->caps)))
- goto cleanup;
+ /* Changing capabilities is only allowed before migration starts, we need
+ * to skip them when resuming post-copy migration.
+ */
+ if (!postcopyResume) {
+ if (asyncJob == VIR_ASYNC_JOB_NONE) {
+ if (!virBitmapIsAllClear(migParams->caps)) {
+ virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+ _("Migration capabilities can only be set by "
+ "a migration job"));
+ goto cleanup;
+ }
+ } else {
+ if (!(caps = qemuMigrationCapsToJSON(priv->migrationCaps, migParams->caps)))
+ goto cleanup;
- if (virJSONValueArraySize(caps) > 0 &&
- qemuMonitorSetMigrationCapabilities(priv->mon, &caps) < 0)
- goto cleanup;
+ if (virJSONValueArraySize(caps) > 0 &&
+ qemuMonitorSetMigrationCapabilities(priv->mon, &caps) < 0)
+ goto cleanup;
+ }
}
/* If QEMU is too old to support xbzrle-cache-size migration parameter,
@@ -917,7 +930,7 @@ qemuMigrationParamsApply(virQEMUDriver *driver,
migParams->params[xbzrle].set = false;
}
- if (!(params = qemuMigrationParamsToJSON(migParams)))
+ if (!(params = qemuMigrationParamsToJSON(migParams, postcopyResume)))
goto cleanup;
if (virJSONValueObjectKeysNumber(params) > 0 &&
diff --git a/src/qemu/qemu_migration_paramspriv.h b/src/qemu/qemu_migration_paramspriv.h
index f7e0f51fbd..34d51231ff 100644
--- a/src/qemu/qemu_migration_paramspriv.h
+++ b/src/qemu/qemu_migration_paramspriv.h
@@ -26,7 +26,8 @@
#pragma once
virJSONValue *
-qemuMigrationParamsToJSON(qemuMigrationParams *migParams);
+qemuMigrationParamsToJSON(qemuMigrationParams *migParams,
+ bool postcopyResume);
qemuMigrationParams *
qemuMigrationParamsFromJSON(virJSONValue *params);
diff --git a/tests/qemumigparamstest.c b/tests/qemumigparamstest.c
index bcdee5f32b..5d45a9dd58 100644
--- a/tests/qemumigparamstest.c
+++ b/tests/qemumigparamstest.c
@@ -155,7 +155,7 @@ qemuMigParamsTestJSON(const void *opaque)
if (!(migParams = qemuMigrationParamsFromJSON(paramsIn)))
return -1;
- if (!(paramsOut = qemuMigrationParamsToJSON(migParams)) ||
+ if (!(paramsOut = qemuMigrationParamsToJSON(migParams, false)) ||
!(actualJSON = virJSONValueToString(paramsOut, true)))
return -1;
diff --git a/tests/qemumigrationcookiexmltest.c b/tests/qemumigrationcookiexmltest.c
index 316bfedd15..9731348b53 100644
--- a/tests/qemumigrationcookiexmltest.c
+++ b/tests/qemumigrationcookiexmltest.c
@@ -333,7 +333,7 @@ testQemuMigrationCookieBlockDirtyBitmaps(const void *opaque)
qemuMigrationParamsSetBlockDirtyBitmapMapping(migParams, &migParamsBitmaps);
- if (!(paramsOut = qemuMigrationParamsToJSON(migParams)) ||
+ if (!(paramsOut = qemuMigrationParamsToJSON(migParams, false)) ||
!(actualJSON = virJSONValueToString(paramsOut, true)))
return -1;
--
2.35.1

View File

@ -1,70 +0,0 @@
From d24586ede83472f850d1a0c520d482ac5f908696 Mon Sep 17 00:00:00 2001
Message-Id: <d24586ede83472f850d1a0c520d482ac5f908696@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 30 Jun 2022 12:51:55 +0200
Subject: [PATCH] qemu_migration: Pass migParams to qemuMigrationSrcResume
So the we can apply selected migration parameters even when resuming
post-copy migration.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 8c335b5530194dbcef719a4d88c89b8723b831a5)
https://bugzilla.redhat.com/show_bug.cgi?id=2111070
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_migration.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 8cbd73a809..285a49c5ff 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -5097,6 +5097,7 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
static int
qemuMigrationSrcResume(virDomainObj *vm,
+ qemuMigrationParams *migParams G_GNUC_UNUSED,
const char *cookiein,
int cookieinlen,
char **cookieout,
@@ -5229,7 +5230,7 @@ qemuMigrationSrcPerformNative(virQEMUDriver *driver,
spec.fwdType = MIGRATION_FWD_DIRECT;
if (flags & VIR_MIGRATE_POSTCOPY_RESUME) {
- ret = qemuMigrationSrcResume(vm, cookiein, cookieinlen,
+ ret = qemuMigrationSrcResume(vm, migParams, cookiein, cookieinlen,
cookieout, cookieoutlen, &spec);
} else {
ret = qemuMigrationSrcRun(driver, vm, persist_xml, cookiein, cookieinlen,
@@ -6124,6 +6125,7 @@ qemuMigrationSrcPerformResume(virQEMUDriver *driver,
virConnectPtr conn,
virDomainObj *vm,
const char *uri,
+ qemuMigrationParams *migParams,
const char *cookiein,
int cookieinlen,
char **cookieout,
@@ -6148,7 +6150,7 @@ qemuMigrationSrcPerformResume(virQEMUDriver *driver,
ret = qemuMigrationSrcPerformNative(driver, vm, NULL, uri,
cookiein, cookieinlen,
cookieout, cookieoutlen, flags,
- 0, NULL, NULL, 0, NULL, NULL, NULL);
+ 0, NULL, NULL, 0, NULL, migParams, NULL);
if (virCloseCallbacksSet(driver->closeCallbacks, vm, conn,
qemuMigrationAnyConnectionClosed) < 0)
@@ -6188,7 +6190,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriver *driver,
int ret = -1;
if (flags & VIR_MIGRATE_POSTCOPY_RESUME) {
- return qemuMigrationSrcPerformResume(driver, conn, vm, uri,
+ return qemuMigrationSrcPerformResume(driver, conn, vm, uri, migParams,
cookiein, cookieinlen,
cookieout, cookieoutlen, flags);
}
--
2.35.1

View File

@ -1,51 +0,0 @@
From c50cae68f0d083ad0c5ffcf85908cc62eeaa866d Mon Sep 17 00:00:00 2001
Message-Id: <c50cae68f0d083ad0c5ffcf85908cc62eeaa866d@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Tue, 19 Jul 2022 13:48:44 +0200
Subject: [PATCH] qemu_migration: Store original migration params in status XML
We keep original values of migration parameters so that we can restore
them at the end of migration to make sure later migration does not use
some random values. However, this does not really work when libvirt
daemon is restarted on the source host because we failed to explicitly
save the status XML after getting the migration parameters from QEMU.
Actually it might work if the status XML is written later for some other
reason such as domain state change, but that's not how it should work.
https://bugzilla.redhat.com/show_bug.cgi?id=2107892
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit c7238941357f0d2e94524cf8c5ad7d9c82dcf2f9)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_migration.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 8a2f5b09a1..9289df81eb 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3245,6 +3245,9 @@ qemuMigrationDstPrepareActive(virQEMUDriver *driver,
migParams, mig->caps->automatic) < 0)
goto error;
+ /* Save original migration parameters */
+ qemuDomainSaveStatus(vm);
+
/* Migrations using TLS need to add the "tls-creds-x509" object and
* set the migration TLS parameters */
if (flags & VIR_MIGRATE_TLS) {
@@ -4822,6 +4825,9 @@ qemuMigrationSrcRun(virQEMUDriver *driver,
migParams, mig->caps->automatic) < 0)
goto error;
+ /* Save original migration parameters */
+ qemuDomainSaveStatus(vm);
+
if (flags & VIR_MIGRATE_TLS) {
const char *hostname = NULL;
--
2.35.1

View File

@ -1,64 +0,0 @@
From 25fe3cf8990b654fd568f580b8885102b3f92789 Mon Sep 17 00:00:00 2001
Message-Id: <25fe3cf8990b654fd568f580b8885102b3f92789@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 21 Jul 2022 15:00:28 +0200
Subject: [PATCH] qemu_migration: Use EnterMonitorAsync in
qemuDomainGetMigrationBlockers
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The code is run with an async job and thus needs to make sure a nested
job is acquired before entering the monitor.
While touching the code in qemuMigrationSrcIsAllowed I also fixed the
grammar which was accidentally broken by v8.5.0-140-g2103807e33.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 62627524607f214e724a48fcac575737f49a271c)
Resolves: https://bugzilla.redhat.com/2092833
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
---
src/qemu/qemu_migration.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 2f77e45abf..735eb02673 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1418,12 +1418,15 @@ qemuMigrationSrcIsAllowedHostdev(const virDomainDef *def)
static int
qemuDomainGetMigrationBlockers(virQEMUDriver *driver,
virDomainObj *vm,
+ int asyncJob,
char ***blockers)
{
qemuDomainObjPrivate *priv = vm->privateData;
int rc;
- qemuDomainObjEnterMonitor(driver, vm);
+ if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
+ return -1;
+
rc = qemuMonitorGetMigrationBlockers(priv->mon, blockers);
qemuDomainObjExitMonitor(vm);
@@ -1458,10 +1461,12 @@ qemuMigrationSrcIsAllowed(virQEMUDriver *driver,
bool blockedReasonsCap = virQEMUCapsGet(priv->qemuCaps,
QEMU_CAPS_MIGRATION_BLOCKED_REASONS);
- /* Ask qemu if it have a migration blocker */
+ /* Ask qemu if it has a migration blocker */
if (blockedReasonsCap) {
g_auto(GStrv) blockers = NULL;
- if (qemuDomainGetMigrationBlockers(driver, vm, &blockers) < 0)
+ if (qemuDomainGetMigrationBlockers(driver, vm,
+ VIR_ASYNC_JOB_MIGRATION_OUT,
+ &blockers) < 0)
return false;
if (blockers && blockers[0]) {
--
2.35.1

View File

@ -1,62 +0,0 @@
From 0022c9aef2ecf60e9091e6df57e56065b14b67c5 Mon Sep 17 00:00:00 2001
Message-Id: <0022c9aef2ecf60e9091e6df57e56065b14b67c5@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 28 Jul 2022 15:35:45 +0200
Subject: [PATCH] qemu_migration_params: Avoid deadlock in
qemuMigrationParamsReset
In my recent comnmit v8.5.0-188-gc47f1abb81 I accidentally moved
qemuMigrationParamsResetTLS after qemuDomainObjEnterMonitorAsync not
noticing qemuMigrationParamsResetTLS will try to enter the monitor
again. The second call will time out and return with a domain object
locked. But we're still in monitor section and the object should be
unlocked which means qemuDomainObjExitMonitor will deadlock trying to
lock it again.
Fixes: c47f1abb81194461377a0c608a7ecd87f9ce9146
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 8cb19a9b9a56ab6ebefc1f913c545e0bb86d4364)
https://bugzilla.redhat.com/show_bug.cgi?id=2107892
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_migration_params.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 4a824ff5e1..4766d16e64 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -1291,6 +1291,7 @@ qemuMigrationParamsReset(virQEMUDriver *driver,
{
virErrorPtr err;
g_autoptr(virBitmap) clearCaps = NULL;
+ int rc;
virErrorPreserveLast(&err);
@@ -1305,11 +1306,16 @@ qemuMigrationParamsReset(virQEMUDriver *driver,
clearCaps = virBitmapNew(0);
- if (qemuMigrationParamsApplyCaps(vm, clearCaps) == 0 &&
- qemuMigrationParamsApplyValues(vm, origParams, false) == 0)
- qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiFlags);
+ rc = 0;
+ if (qemuMigrationParamsApplyCaps(vm, clearCaps) < 0 ||
+ qemuMigrationParamsApplyValues(vm, origParams, false) < 0)
+ rc = -1;
qemuDomainObjExitMonitor(vm);
+ if (rc < 0)
+ goto cleanup;
+
+ qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiFlags);
cleanup:
virErrorRestore(&err);
--
2.35.1

View File

@ -1,107 +0,0 @@
From 852927ea725deae6d4ef8a87383a78d9b0b1cd83 Mon Sep 17 00:00:00 2001
Message-Id: <852927ea725deae6d4ef8a87383a78d9b0b1cd83@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 21 Jul 2022 15:59:51 +0200
Subject: [PATCH] qemu_migration_params: Refactor qemuMigrationParamsApply
qemuMigrationParamsApply restricts when capabilities can be set, but
this is not useful in all cases. Let's create new helpers for setting
migration capabilities and parameters which can be reused in more places
without the restriction.
https://bugzilla.redhat.com/show_bug.cgi?id=2107892
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit c0824fd03802085db698c10fe62c98cc95a57941)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_migration_params.c | 55 +++++++++++++++++++++++---------
1 file changed, 40 insertions(+), 15 deletions(-)
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 0bce358ac3..7b9e5453f6 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -864,6 +864,43 @@ qemuMigrationCapsToJSON(virBitmap *caps,
}
+static int
+qemuMigrationParamsApplyCaps(virDomainObj *vm,
+ virBitmap *states)
+{
+ qemuDomainObjPrivate *priv = vm->privateData;
+ g_autoptr(virJSONValue) json = NULL;
+
+ if (!(json = qemuMigrationCapsToJSON(priv->migrationCaps, states)))
+ return -1;
+
+ if (virJSONValueArraySize(json) > 0 &&
+ qemuMonitorSetMigrationCapabilities(priv->mon, &json) < 0)
+ return -1;
+
+ return 0;
+}
+
+
+static int
+qemuMigrationParamsApplyValues(virDomainObj *vm,
+ qemuMigrationParams *params,
+ bool postcopyResume)
+{
+ qemuDomainObjPrivate *priv = vm->privateData;
+ g_autoptr(virJSONValue) json = NULL;
+
+ if (!(json = qemuMigrationParamsToJSON(params, postcopyResume)))
+ return -1;
+
+ if (virJSONValueObjectKeysNumber(json) > 0 &&
+ qemuMonitorSetMigrationParams(priv->mon, &json) < 0)
+ return -1;
+
+ return 0;
+}
+
+
/**
* qemuMigrationParamsApply
* @driver: qemu driver
@@ -885,9 +922,6 @@ qemuMigrationParamsApply(virQEMUDriver *driver,
qemuMigrationParams *migParams,
unsigned long apiFlags)
{
- qemuDomainObjPrivate *priv = vm->privateData;
- g_autoptr(virJSONValue) params = NULL;
- g_autoptr(virJSONValue) caps = NULL;
bool postcopyResume = !!(apiFlags & VIR_MIGRATE_POSTCOPY_RESUME);
int ret = -1;
@@ -905,21 +939,12 @@ qemuMigrationParamsApply(virQEMUDriver *driver,
"a migration job"));
goto cleanup;
}
- } else {
- if (!(caps = qemuMigrationCapsToJSON(priv->migrationCaps, migParams->caps)))
- goto cleanup;
-
- if (virJSONValueArraySize(caps) > 0 &&
- qemuMonitorSetMigrationCapabilities(priv->mon, &caps) < 0)
- goto cleanup;
+ } else if (qemuMigrationParamsApplyCaps(vm, migParams->caps) < 0) {
+ goto cleanup;
}
}
- if (!(params = qemuMigrationParamsToJSON(migParams, postcopyResume)))
- goto cleanup;
-
- if (virJSONValueObjectKeysNumber(params) > 0 &&
- qemuMonitorSetMigrationParams(priv->mon, &params) < 0)
+ if (qemuMigrationParamsApplyValues(vm, migParams, postcopyResume) < 0)
goto cleanup;
ret = 0;
--
2.35.1

View File

@ -1,63 +0,0 @@
From 2a05454cd2d6ba283c128158f44d84d65832ebf7 Mon Sep 17 00:00:00 2001
Message-Id: <2a05454cd2d6ba283c128158f44d84d65832ebf7@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Thu, 21 Jul 2022 16:49:09 +0200
Subject: [PATCH] qemu_migration_params: Refactor qemuMigrationParamsReset
Because qemuMigrationParamsReset used to call qemuMigrationParamsApply
for resetting migration capabilities and parameters, it did not work
well since commit v5.1.0-83-ga1dec315c9 which only allowed capabilities
to be set from an async job. However, when reconnecting to running
domains after daemon restart we do not have an async job. Thus the
capabilities were not properly reset in case the daemon was restarted
during an ongoing migration. We need to avoid calling
qemuMigrationParamsApply to make sure both parameters and capabilities
can be reset by a normal job.
https://bugzilla.redhat.com/show_bug.cgi?id=2107892
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit c47f1abb81194461377a0c608a7ecd87f9ce9146)
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_migration_params.c | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 7b9e5453f6..4a824ff5e1 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -1290,6 +1290,7 @@ qemuMigrationParamsReset(virQEMUDriver *driver,
unsigned long apiFlags)
{
virErrorPtr err;
+ g_autoptr(virBitmap) clearCaps = NULL;
virErrorPreserveLast(&err);
@@ -1299,13 +1300,16 @@ qemuMigrationParamsReset(virQEMUDriver *driver,
if (!virDomainObjIsActive(vm) || !origParams)
goto cleanup;
- /* Do not pass apiFlags to qemuMigrationParamsApply here to make sure all
- * parameters and capabilities are reset. */
- if (qemuMigrationParamsApply(driver, vm, asyncJob, origParams, 0) < 0)
+ if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
goto cleanup;
- qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiFlags);
- /* We don't reset 'block-bitmap-mapping' as it can't be unset */
+ clearCaps = virBitmapNew(0);
+
+ if (qemuMigrationParamsApplyCaps(vm, clearCaps) == 0 &&
+ qemuMigrationParamsApplyValues(vm, origParams, false) == 0)
+ qemuMigrationParamsResetTLS(driver, vm, asyncJob, origParams, apiFlags);
+
+ qemuDomainObjExitMonitor(vm);
cleanup:
virErrorRestore(&err);
--
2.35.1

View File

@ -1,176 +0,0 @@
From aa4b6b4877d60218c24d4ae713786f5ee37ac6dc Mon Sep 17 00:00:00 2001
Message-Id: <aa4b6b4877d60218c24d4ae713786f5ee37ac6dc@dist-git>
From: Jiri Denemark <jdenemar@redhat.com>
Date: Wed, 29 Jun 2022 15:12:20 +0200
Subject: [PATCH] qemu_migration_params: Replace qemuMigrationParamTypes array
We will need to annotate individual parameters a bit more than just
noting their type. Let's introduce qemuMigrationParamInfo replacing
simple qemuMigrationParamTypes with an array of structs.
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 184749691f27f30a39f6f6c77828ffb951af0255)
https://bugzilla.redhat.com/show_bug.cgi?id=2111070
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
src/qemu/qemu_migration_params.c | 77 ++++++++++++++++++++++----------
1 file changed, 54 insertions(+), 23 deletions(-)
diff --git a/src/qemu/qemu_migration_params.c b/src/qemu/qemu_migration_params.c
index 398c07efd0..a68aed9aa4 100644
--- a/src/qemu/qemu_migration_params.c
+++ b/src/qemu/qemu_migration_params.c
@@ -138,6 +138,11 @@ struct _qemuMigrationParamsTPMapItem {
int party; /* bit-wise OR of qemuMigrationParty */
};
+typedef struct _qemuMigrationParamInfoItem qemuMigrationParamInfoItem;
+struct _qemuMigrationParamInfoItem {
+ qemuMigrationParamType type;
+};
+
/* Migration capabilities which should always be enabled as long as they
* are supported by QEMU. If the capability is supposed to be enabled on both
* sides of migration, it won't be enabled unless both sides support it.
@@ -224,22 +229,48 @@ static const qemuMigrationParamsTPMapItem qemuMigrationParamsTPMap[] = {
.party = QEMU_MIGRATION_SOURCE},
};
-static const qemuMigrationParamType qemuMigrationParamTypes[] = {
- [QEMU_MIGRATION_PARAM_COMPRESS_LEVEL] = QEMU_MIGRATION_PARAM_TYPE_INT,
- [QEMU_MIGRATION_PARAM_COMPRESS_THREADS] = QEMU_MIGRATION_PARAM_TYPE_INT,
- [QEMU_MIGRATION_PARAM_DECOMPRESS_THREADS] = QEMU_MIGRATION_PARAM_TYPE_INT,
- [QEMU_MIGRATION_PARAM_THROTTLE_INITIAL] = QEMU_MIGRATION_PARAM_TYPE_INT,
- [QEMU_MIGRATION_PARAM_THROTTLE_INCREMENT] = QEMU_MIGRATION_PARAM_TYPE_INT,
- [QEMU_MIGRATION_PARAM_TLS_CREDS] = QEMU_MIGRATION_PARAM_TYPE_STRING,
- [QEMU_MIGRATION_PARAM_TLS_HOSTNAME] = QEMU_MIGRATION_PARAM_TYPE_STRING,
- [QEMU_MIGRATION_PARAM_MAX_BANDWIDTH] = QEMU_MIGRATION_PARAM_TYPE_ULL,
- [QEMU_MIGRATION_PARAM_DOWNTIME_LIMIT] = QEMU_MIGRATION_PARAM_TYPE_ULL,
- [QEMU_MIGRATION_PARAM_BLOCK_INCREMENTAL] = QEMU_MIGRATION_PARAM_TYPE_BOOL,
- [QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE] = QEMU_MIGRATION_PARAM_TYPE_ULL,
- [QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH] = QEMU_MIGRATION_PARAM_TYPE_ULL,
- [QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS] = QEMU_MIGRATION_PARAM_TYPE_INT,
+static const qemuMigrationParamInfoItem qemuMigrationParamInfo[] = {
+ [QEMU_MIGRATION_PARAM_COMPRESS_LEVEL] = {
+ .type = QEMU_MIGRATION_PARAM_TYPE_INT,
+ },
+ [QEMU_MIGRATION_PARAM_COMPRESS_THREADS] = {
+ .type = QEMU_MIGRATION_PARAM_TYPE_INT,
+ },
+ [QEMU_MIGRATION_PARAM_DECOMPRESS_THREADS] = {
+ .type = QEMU_MIGRATION_PARAM_TYPE_INT,
+ },
+ [QEMU_MIGRATION_PARAM_THROTTLE_INITIAL] = {
+ .type = QEMU_MIGRATION_PARAM_TYPE_INT,
+ },
+ [QEMU_MIGRATION_PARAM_THROTTLE_INCREMENT] = {
+ .type = QEMU_MIGRATION_PARAM_TYPE_INT,
+ },
+ [QEMU_MIGRATION_PARAM_TLS_CREDS] = {
+ .type = QEMU_MIGRATION_PARAM_TYPE_STRING,
+ },
+ [QEMU_MIGRATION_PARAM_TLS_HOSTNAME] = {
+ .type = QEMU_MIGRATION_PARAM_TYPE_STRING,
+ },
+ [QEMU_MIGRATION_PARAM_MAX_BANDWIDTH] = {
+ .type = QEMU_MIGRATION_PARAM_TYPE_ULL,
+ },
+ [QEMU_MIGRATION_PARAM_DOWNTIME_LIMIT] = {
+ .type = QEMU_MIGRATION_PARAM_TYPE_ULL,
+ },
+ [QEMU_MIGRATION_PARAM_BLOCK_INCREMENTAL] = {
+ .type = QEMU_MIGRATION_PARAM_TYPE_BOOL,
+ },
+ [QEMU_MIGRATION_PARAM_XBZRLE_CACHE_SIZE] = {
+ .type = QEMU_MIGRATION_PARAM_TYPE_ULL,
+ },
+ [QEMU_MIGRATION_PARAM_MAX_POSTCOPY_BANDWIDTH] = {
+ .type = QEMU_MIGRATION_PARAM_TYPE_ULL,
+ },
+ [QEMU_MIGRATION_PARAM_MULTIFD_CHANNELS] = {
+ .type = QEMU_MIGRATION_PARAM_TYPE_INT,
+ },
};
-G_STATIC_ASSERT(G_N_ELEMENTS(qemuMigrationParamTypes) == QEMU_MIGRATION_PARAM_LAST);
+G_STATIC_ASSERT(G_N_ELEMENTS(qemuMigrationParamInfo) == QEMU_MIGRATION_PARAM_LAST);
virBitmap *
@@ -281,7 +312,7 @@ qemuMigrationParamsFree(qemuMigrationParams *migParams)
return;
for (i = 0; i < QEMU_MIGRATION_PARAM_LAST; i++) {
- if (qemuMigrationParamTypes[i] == QEMU_MIGRATION_PARAM_TYPE_STRING)
+ if (qemuMigrationParamInfo[i].type == QEMU_MIGRATION_PARAM_TYPE_STRING)
g_free(migParams->params[i].value.s);
}
@@ -295,7 +326,7 @@ static int
qemuMigrationParamsCheckType(qemuMigrationParam param,
qemuMigrationParamType type)
{
- if (qemuMigrationParamTypes[param] != type) {
+ if (qemuMigrationParamInfo[param].type != type) {
virReportError(VIR_ERR_INTERNAL_ERROR,
_("Type mismatch for '%s' migration parameter"),
qemuMigrationParamTypeToString(param));
@@ -595,7 +626,7 @@ qemuMigrationParamsFromFlags(virTypedParameterPtr params,
VIR_DEBUG("Setting migration parameter '%s' from '%s'",
qemuMigrationParamTypeToString(item->param), item->typedParam);
- switch (qemuMigrationParamTypes[item->param]) {
+ switch (qemuMigrationParamInfo[item->param].type) {
case QEMU_MIGRATION_PARAM_TYPE_INT:
if (qemuMigrationParamsGetTPInt(migParams, item->param, params,
nparams, item->typedParam,
@@ -671,7 +702,7 @@ qemuMigrationParamsDump(qemuMigrationParams *migParams,
if (!(item->party & QEMU_MIGRATION_DESTINATION))
continue;
- switch (qemuMigrationParamTypes[item->param]) {
+ switch (qemuMigrationParamInfo[item->param].type) {
case QEMU_MIGRATION_PARAM_TYPE_INT:
if (qemuMigrationParamsSetTPInt(migParams, item->param,
params, nparams, maxparams,
@@ -721,7 +752,7 @@ qemuMigrationParamsFromJSON(virJSONValue *params)
name = qemuMigrationParamTypeToString(i);
pv = &migParams->params[i];
- switch (qemuMigrationParamTypes[i]) {
+ switch (qemuMigrationParamInfo[i].type) {
case QEMU_MIGRATION_PARAM_TYPE_INT:
if (virJSONValueObjectGetNumberInt(params, name, &pv->value.i) == 0)
pv->set = true;
@@ -764,7 +795,7 @@ qemuMigrationParamsToJSON(qemuMigrationParams *migParams)
if (!pv->set)
continue;
- switch (qemuMigrationParamTypes[i]) {
+ switch (qemuMigrationParamInfo[i].type) {
case QEMU_MIGRATION_PARAM_TYPE_INT:
rc = virJSONValueObjectAppendNumberInt(params, name, pv->value.i);
break;
@@ -1280,7 +1311,7 @@ qemuMigrationParamsFormat(virBuffer *buf,
virBufferAsprintf(buf, "<param name='%s' ",
qemuMigrationParamTypeToString(i));
- switch (qemuMigrationParamTypes[i]) {
+ switch (qemuMigrationParamInfo[i].type) {
case QEMU_MIGRATION_PARAM_TYPE_INT:
virBufferAsprintf(buf, "value='%d'", pv->value.i);
break;
@@ -1357,7 +1388,7 @@ qemuMigrationParamsParse(xmlXPathContextPtr ctxt,
}
rc = 0;
- switch (qemuMigrationParamTypes[param]) {
+ switch (qemuMigrationParamInfo[param].type) {
case QEMU_MIGRATION_PARAM_TYPE_INT:
rc = virStrToLong_i(value, NULL, 10, &pv->value.i);
break;
--
2.35.1

View File

@ -1,82 +0,0 @@
From c6ea67c481a2f447951449bd9b2746cfaaf385fd Mon Sep 17 00:00:00 2001
Message-Id: <c6ea67c481a2f447951449bd9b2746cfaaf385fd@dist-git>
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Mon, 25 Jul 2022 14:09:39 +0100
Subject: [PATCH] rpc: Pass OPENSSL_CONF through to ssh invocations
It's no longer possible for libvirt to connect over the ssh transport
from RHEL 9 to RHEL 5. This is because SHA1 signatures have been
effectively banned in RHEL 9 at the openssl level. They are required
to check the RHEL 5 host key. Note this is a separate issue from
openssh requiring additional configuration in order to connect to
older servers.
Connecting from a RHEL 9 client to RHEL 5 server:
$ cat ~/.ssh/config
Host 192.168.0.91
KexAlgorithms +diffie-hellman-group14-sha1
MACs +hmac-sha1
HostKeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
$ virsh -c 'qemu+ssh://root@192.168.0.91/system' list
error: failed to connect to the hypervisor
error: Cannot recv data: ssh_dispatch_run_fatal: Connection to 192.168.0.91 port 22: error in libcrypto: Connection reset by peer
"error in libcrypto: Connection reset by peer" is the characteristic
error of openssl having been modified to disable SHA1 by default.
(You will not see this on non-RHEL-derived distros.)
You could enable the legacy crypto policy which downgrades security on
the entire host, but a more fine-grained way to do this is to create
an alternate openssl configuration file that enables the "forbidden"
signatures. However this requires passing the OPENSSL_CONF
environment variable through to ssh to specify the alternate
configuration. Libvirt filters out this environment variable, but
this commit allows it through. With this commit:
$ cat /var/tmp/openssl.cnf
.include /etc/ssl/openssl.cnf
[openssl_init]
alg_section = evp_properties
[evp_properties]
rh-allow-sha1-signatures = yes
$ OPENSSL_CONF=/var/tmp/openssl.cnf ./run virsh -c 'qemu+ssh://root@192.168.0.91/system' list
root@192.168.0.91's password:
Id Name State
--------------------
Essentially my argument here is that OPENSSL_CONF is sufficiently
similar in nature to KRB5CCNAME, SSH* and XAUTHORITY that we should
permit it to be passed through.
virt-v2v bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2062360
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
(cherry picked from commit 45912ac399abd9d4eba21fa3f15cb7587351f959)
Libvirt BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2112348
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/rpc/virnetsocket.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 32f506d2d4..8280bda007 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -855,6 +855,7 @@ int virNetSocketNewConnectSSH(const char *nodename,
virCommandAddEnvPass(cmd, "KRB5CCNAME");
virCommandAddEnvPass(cmd, "SSH_AUTH_SOCK");
virCommandAddEnvPass(cmd, "SSH_ASKPASS");
+ virCommandAddEnvPass(cmd, "OPENSSL_CONF");
virCommandAddEnvPass(cmd, "DISPLAY");
virCommandAddEnvPass(cmd, "XAUTHORITY");
virCommandClearCaps(cmd);
--
2.35.1

View File

@ -1,64 +0,0 @@
From e13ab5c97f266eb688bc22e1124291563770370d Mon Sep 17 00:00:00 2001
Message-Id: <e13ab5c97f266eb688bc22e1124291563770370d@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 8 Jul 2022 14:29:32 +0200
Subject: [PATCH] vircpi: Add PCIe 5.0 and 6.0 link speeds
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
The PCIe 5.0 and PCIe 6.0 standards define new link speeds:
32GT/s and 64GT/s, respectively. Update our internal enum to
include these new speeds. Otherwise we format incorrect XML:
<pci-express>
<link validity='cap' port='0' speed='(null)' width='16'/>
<link validity='sta' speed='16' width='16'/>
</pci-express>
Like all "good" specifications, these are also locked behind a
login portal. But we can look at pciutils' source code: [1] and
[2].
1: https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/commit/ls-caps.c?id=caca31a0eea41c7b051705704c1158fddc02fbd2
2: https://git.kernel.org/pub/scm/utils/pciutils/pciutils.git/commit/ls-caps.c?id=5bdf63b6b1bc35b59c4b3f47f7ca83ca1868155b
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2105231
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit d33c2a9e2f933b31f8e96e9938c237bdffe27f84)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/util/virpci.c | 2 +-
src/util/virpci.h | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/util/virpci.c b/src/util/virpci.c
index 03d1d7b074..7800966963 100644
--- a/src/util/virpci.c
+++ b/src/util/virpci.c
@@ -45,7 +45,7 @@ VIR_LOG_INIT("util.pci");
VIR_ENUM_IMPL(virPCIELinkSpeed,
VIR_PCIE_LINK_SPEED_LAST,
- "", "2.5", "5", "8", "16",
+ "", "2.5", "5", "8", "16", "32", "64"
);
VIR_ENUM_IMPL(virPCIStubDriver,
diff --git a/src/util/virpci.h b/src/util/virpci.h
index b9b9cd7b34..4d9193f24e 100644
--- a/src/util/virpci.h
+++ b/src/util/virpci.h
@@ -83,6 +83,8 @@ typedef enum {
VIR_PCIE_LINK_SPEED_5,
VIR_PCIE_LINK_SPEED_8,
VIR_PCIE_LINK_SPEED_16,
+ VIR_PCIE_LINK_SPEED_32,
+ VIR_PCIE_LINK_SPEED_64,
VIR_PCIE_LINK_SPEED_LAST
} virPCIELinkSpeed;
--
2.35.1

View File

@ -1,62 +0,0 @@
From 02ebd15a48da7a53560bbea5e530a5b9c929daee Mon Sep 17 00:00:00 2001
Message-Id: <02ebd15a48da7a53560bbea5e530a5b9c929daee@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Thu, 7 Jul 2022 17:44:32 +0200
Subject: [PATCH] virsh: Implement --config for iothreadset
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Our man page already documents that iothreadset has --config
argument. Well, it doesn't really. Normally, I'd just fix the man
page, but with recent work on the API it's possible to tweak
values for inactive XML too. Therefore, implement the --config
argument for the command.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
(cherry picked from commit 3ff558c1c171f66da84b10c81937c1a6895ec6fb)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2059511
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
tools/virsh-domain.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index 43034f2f81..da63cc95ff 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -7831,6 +7831,7 @@ static const vshCmdOptDef opts_iothreadset[] = {
.type = VSH_OT_INT,
.help = N_("upper boundary for worker thread pool")
},
+ VIRSH_COMMON_OPT_DOMAIN_CONFIG,
VIRSH_COMMON_OPT_DOMAIN_LIVE,
VIRSH_COMMON_OPT_DOMAIN_CURRENT,
{.name = NULL}
@@ -7842,6 +7843,8 @@ cmdIOThreadSet(vshControl *ctl, const vshCmd *cmd)
g_autoptr(virshDomain) dom = NULL;
int id = 0;
bool ret = false;
+ bool current = vshCommandOptBool(cmd, "current");
+ bool config = vshCommandOptBool(cmd, "config");
bool live = vshCommandOptBool(cmd, "live");
unsigned int flags = VIR_DOMAIN_AFFECT_CURRENT;
virTypedParameterPtr params = NULL;
@@ -7852,8 +7855,13 @@ cmdIOThreadSet(vshControl *ctl, const vshCmd *cmd)
int thread_val;
int rc;
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, live);
+ VSH_EXCLUSIVE_OPTIONS_VAR(current, config);
+
if (live)
flags |= VIR_DOMAIN_AFFECT_LIVE;
+ if (config)
+ flags |= VIR_DOMAIN_AFFECT_CONFIG;
if (!(dom = virshCommandOptDomain(ctl, cmd, NULL)))
return false;
--
2.35.1

View File

@ -1,215 +0,0 @@
From 045c3fbdc6f4a5b98013a00fcaefcd3481c1df39 Mon Sep 17 00:00:00 2001
Message-Id: <045c3fbdc6f4a5b98013a00fcaefcd3481c1df39@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Fri, 8 Jul 2022 12:45:42 +0200
Subject: [PATCH] virsh: Require --xpath for *dumpxml
Historically, the dumpxml command reject any unknown arguments,
for instance:
virsh dumpxml fedora xxx
However, after v8.5.0-rc1~31 the second argument ('xxx') is
treated as an XPath, but it's not that clearly visible.
Therefore, require the --xpath switch, like this:
virsh dumpxml fedora --xpath xxx
Yes, this breaks already released virsh, but I think we can argue
that the pool of users of this particular function is very small.
We also document the argument being mandatory:
dumpxml [--inactive] [--security-info] [--update-cpu] [--migratable]
[--xpath EXPRESSION] [--wrap] domain
The sooner we do this change, the better.
The same applies for other *dumpxml functions (net-dumpxml,
pool-dumpxml, vol-dumpxl to name a few).
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103524
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit e90d48ae6e22eaf1650f920abc0a6b87d2daa82b)
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
tools/virsh-backup.c | 1 +
tools/virsh-checkpoint.c | 1 +
tools/virsh-domain.c | 3 +++
tools/virsh-interface.c | 1 +
tools/virsh-network.c | 2 ++
tools/virsh-nodedev.c | 1 +
tools/virsh-nwfilter.c | 2 ++
tools/virsh-pool.c | 1 +
tools/virsh-secret.c | 1 +
tools/virsh-snapshot.c | 1 +
tools/virsh-volume.c | 1 +
11 files changed, 15 insertions(+)
diff --git a/tools/virsh-backup.c b/tools/virsh-backup.c
index db122abc09..1bb2c63113 100644
--- a/tools/virsh-backup.c
+++ b/tools/virsh-backup.c
@@ -117,6 +117,7 @@ static const vshCmdOptDef opts_backup_dumpxml[] = {
VIRSH_COMMON_OPT_DOMAIN_FULL(VIR_CONNECT_LIST_DOMAINS_ACTIVE),
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
diff --git a/tools/virsh-checkpoint.c b/tools/virsh-checkpoint.c
index a7ef39849d..9605c893af 100644
--- a/tools/virsh-checkpoint.c
+++ b/tools/virsh-checkpoint.c
@@ -854,6 +854,7 @@ static const vshCmdOptDef opts_checkpoint_dumpxml[] = {
},
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c
index da63cc95ff..76d12d2b70 100644
--- a/tools/virsh-domain.c
+++ b/tools/virsh-domain.c
@@ -4529,6 +4529,7 @@ static const vshCmdOptDef opts_save_image_dumpxml[] = {
},
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
@@ -4961,6 +4962,7 @@ static const vshCmdOptDef opts_managed_save_dumpxml[] = {
},
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
@@ -10469,6 +10471,7 @@ static const vshCmdOptDef opts_dumpxml[] = {
},
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
diff --git a/tools/virsh-interface.c b/tools/virsh-interface.c
index b29ffc9bef..39ea53ec9d 100644
--- a/tools/virsh-interface.c
+++ b/tools/virsh-interface.c
@@ -472,6 +472,7 @@ static const vshCmdOptDef opts_interface_dumpxml[] = {
},
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
diff --git a/tools/virsh-network.c b/tools/virsh-network.c
index 99ced6ccc6..004719dad6 100644
--- a/tools/virsh-network.c
+++ b/tools/virsh-network.c
@@ -351,6 +351,7 @@ static const vshCmdOptDef opts_network_dumpxml[] = {
},
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
@@ -1556,6 +1557,7 @@ static const vshCmdOptDef opts_network_port_dumpxml[] = {
VIRSH_COMMON_OPT_NETWORK_PORT(0),
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c
index 37e361c701..2adcad9c10 100644
--- a/tools/virsh-nodedev.c
+++ b/tools/virsh-nodedev.c
@@ -567,6 +567,7 @@ static const vshCmdOptDef opts_node_device_dumpxml[] = {
},
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c
index ff7f6f4026..d4112c8620 100644
--- a/tools/virsh-nwfilter.c
+++ b/tools/virsh-nwfilter.c
@@ -188,6 +188,7 @@ static const vshCmdOptDef opts_nwfilter_dumpxml[] = {
},
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
@@ -610,6 +611,7 @@ static const vshCmdOptDef opts_nwfilter_binding_dumpxml[] = {
},
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c
index 820a61f889..8a98c6ae40 100644
--- a/tools/virsh-pool.c
+++ b/tools/virsh-pool.c
@@ -777,6 +777,7 @@ static const vshCmdOptDef opts_pool_dumpxml[] = {
},
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c
index 79fa3faf5a..17d2bbd88d 100644
--- a/tools/virsh-secret.c
+++ b/tools/virsh-secret.c
@@ -140,6 +140,7 @@ static const vshCmdOptDef opts_secret_dumpxml[] = {
},
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c
index 83fdfb9616..8fa64ba903 100644
--- a/tools/virsh-snapshot.c
+++ b/tools/virsh-snapshot.c
@@ -1609,6 +1609,7 @@ static const vshCmdOptDef opts_snapshot_dumpxml[] = {
},
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c
index bf72d8135f..300a0aa8e5 100644
--- a/tools/virsh-volume.c
+++ b/tools/virsh-volume.c
@@ -1161,6 +1161,7 @@ static const vshCmdOptDef opts_vol_dumpxml[] = {
VIRSH_COMMON_OPT_POOL_OPTIONAL,
{.name = "xpath",
.type = VSH_OT_STRING,
+ .flags = VSH_OFLAG_REQ_OPT,
.completer = virshCompleteEmpty,
.help = N_("xpath expression to filter the XML document")
},
--
2.35.1

View File

@ -1,48 +0,0 @@
From 6d21624edd73edb9b59e5dac0d98d0812e9bf0ad Mon Sep 17 00:00:00 2001
Message-Id: <6d21624edd73edb9b59e5dac0d98d0812e9bf0ad@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Tue, 12 Jul 2022 15:46:50 +0200
Subject: [PATCH] virtpm: Introduce TPM-1.2 and TPM-2.0 capabilieis
These new capabilities will be used only to track whether
swtpm_setup is capable of TPM-1.2 and/or TPM-2.0.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
(cherry picked from commit 7b37763278c44887789e80a6058ee27953c0e5e6)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2103119
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/util/virtpm.c | 2 ++
src/util/virtpm.h | 2 ++
2 files changed, 4 insertions(+)
diff --git a/src/util/virtpm.c b/src/util/virtpm.c
index b898f3a6db..3c961c11cb 100644
--- a/src/util/virtpm.c
+++ b/src/util/virtpm.c
@@ -47,6 +47,8 @@ VIR_ENUM_IMPL(virTPMSwtpmSetupFeature,
"cmdarg-create-config-files",
"tpm12-not-need-root",
"cmdarg-reconfigure-pcr-banks",
+ "tpm-1.2",
+ "tpm-2.0",
);
/**
diff --git a/src/util/virtpm.h b/src/util/virtpm.h
index 0a82a03b69..bbf379a54a 100644
--- a/src/util/virtpm.h
+++ b/src/util/virtpm.h
@@ -42,6 +42,8 @@ typedef enum {
VIR_TPM_SWTPM_SETUP_FEATURE_CMDARG_CREATE_CONFIG_FILES,
VIR_TPM_SWTPM_SETUP_FEATURE_TPM12_NOT_NEED_ROOT,
VIR_TPM_SWTPM_SETUP_FEATURE_CMDARG_RECONFIGURE_PCR_BANKS,
+ VIR_TPM_SWTPM_SETUP_FEATURE_TPM_1_2,
+ VIR_TPM_SWTPM_SETUP_FEATURE_TPM_2_0,
VIR_TPM_SWTPM_SETUP_FEATURE_LAST
} virTPMSwtpmSetupFeature;
--
2.35.1