[PATCH] qemu: Fix error when migration with shared TPM storage is unsupported

Jiri Denemark via Devel posted 1 patch 3 months, 1 week ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/8f955d42df45cbc3e1a06762e6ab1e7e03e25f5f.1748431979.git.jdenemar@redhat.com
src/qemu/qemu_migration.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] qemu: Fix error when migration with shared TPM storage is unsupported
Posted by Jiri Denemark via Devel 3 months, 1 week ago
From: Jiri Denemark <jdenemar@redhat.com>

The VIR_ERR_NO_SUPPORT error is supposed to be used for unsupported
driver APIs. It is incorrectly used when swtpm does not support
migration with shared storage resulting in a rather strange error
message:

    this function is not supported by the connection driver: the running
    swtpm does not support migration with shared storage

The correct VIR_ERR_OPERATION_UNSUPPORTED error code provides a much
better message:

    Operation not supported: the running swtpm does not support
    migration with shared storage

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
---
 src/qemu/qemu_migration.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 1f91ad1117..2400750ee4 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1723,7 +1723,7 @@ qemuMigrationSrcIsAllowed(virDomainObj *vm,
 
         if (qemuTPMHasSharedStorage(driver, vm->def) &&
             !qemuTPMCanMigrateSharedStorage(vm->def)) {
-            virReportError(VIR_ERR_NO_SUPPORT, "%s",
+            virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
                            _("the running swtpm does not support migration with shared storage"));
             return false;
         }
-- 
2.49.0
Re: [PATCH] qemu: Fix error when migration with shared TPM storage is unsupported
Posted by Ján Tomko via Devel 3 months, 1 week ago
On a Wednesday in 2025, Jiri Denemark via Devel wrote:
>From: Jiri Denemark <jdenemar@redhat.com>
>
>The VIR_ERR_NO_SUPPORT error is supposed to be used for unsupported
>driver APIs. It is incorrectly used when swtpm does not support
>migration with shared storage resulting in a rather strange error
>message:
>
>    this function is not supported by the connection driver: the running
>    swtpm does not support migration with shared storage
>
>The correct VIR_ERR_OPERATION_UNSUPPORTED error code provides a much
>better message:
>
>    Operation not supported: the running swtpm does not support
>    migration with shared storage
>
>Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
>---
> src/qemu/qemu_migration.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano