public inbox for qemu-devel@nongnu.org
 help / color / mirror / Atom feed
* [PATCH v2 v2] plugins/api-system: Handle migrate_add_blocker() failure
  2026-03-12 12:16 [PATCH] " Trieu Huynh
@ 2026-03-17 13:47 ` Trieu Huynh
  2026-03-17 19:06   ` Pierrick Bouvier
  2026-03-18 17:19   ` Pierrick Bouvier
  0 siblings, 2 replies; 4+ messages in thread
From: Trieu Huynh @ 2026-03-17 13:47 UTC (permalink / raw)
  To: qemu-devel
  Cc: peter.maydell, pierrick.bouvier, alex.bennee, erdnaxe,
	ma.mandourr, Trieu Huynh

migrate_add_blocker() can fail (e.g. if migration is already in
progress), in which case it returns a negative value and populates
its errp argument with the reason.

The previous code ignored the return value. Pass &error_fatal so
that on failure QEMU exits cleanly with an informative error message
rather than continuing in an inconsistent state.

Resolves: CID 1645470
Signed-off-by: Trieu Huynh <vikingtc4@gmail.com>
---
v2:
- Pass &error_fatal instead of returning NULL: the plugin has no
  recovery path, QEMU should exit cleanly with an error message.
  (Peter Maydell, Pierrick Bouvier)
- Remove manual error_free(migration_blocker) + migration_blocker = NULL:
  migrate_add_blocker() already does this on failure. (Peter Maydell)
---
 plugins/api-system.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/api-system.c b/plugins/api-system.c
index 9a70b9caa6..fbf905cd63 100644
--- a/plugins/api-system.c
+++ b/plugins/api-system.c
@@ -108,7 +108,7 @@ const void *qemu_plugin_request_time_control(void)
         has_control = true;
         error_setg(&migration_blocker,
                    "TCG plugin time control does not support migration");
-        migrate_add_blocker(&migration_blocker, NULL);
+        migrate_add_blocker(&migration_blocker, &error_fatal);
         return &has_control;
     }
     return NULL;
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 v2] plugins/api-system: Handle migrate_add_blocker() failure
  2026-03-17 13:47 ` [PATCH v2 v2] " Trieu Huynh
@ 2026-03-17 19:06   ` Pierrick Bouvier
  2026-03-18 17:19   ` Pierrick Bouvier
  1 sibling, 0 replies; 4+ messages in thread
From: Pierrick Bouvier @ 2026-03-17 19:06 UTC (permalink / raw)
  To: Trieu Huynh, qemu-devel; +Cc: peter.maydell, alex.bennee, erdnaxe, ma.mandourr

On 3/17/26 6:47 AM, Trieu Huynh wrote:
> migrate_add_blocker() can fail (e.g. if migration is already in
> progress), in which case it returns a negative value and populates
> its errp argument with the reason.
> 
> The previous code ignored the return value. Pass &error_fatal so
> that on failure QEMU exits cleanly with an informative error message
> rather than continuing in an inconsistent state.
> 
> Resolves: CID 1645470
> Signed-off-by: Trieu Huynh <vikingtc4@gmail.com>
> ---
> v2:
> - Pass &error_fatal instead of returning NULL: the plugin has no
>    recovery path, QEMU should exit cleanly with an error message.
>    (Peter Maydell, Pierrick Bouvier)
> - Remove manual error_free(migration_blocker) + migration_blocker = NULL:
>    migrate_add_blocker() already does this on failure. (Peter Maydell)
> ---
>   plugins/api-system.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/plugins/api-system.c b/plugins/api-system.c
> index 9a70b9caa6..fbf905cd63 100644
> --- a/plugins/api-system.c
> +++ b/plugins/api-system.c
> @@ -108,7 +108,7 @@ const void *qemu_plugin_request_time_control(void)
>           has_control = true;
>           error_setg(&migration_blocker,
>                      "TCG plugin time control does not support migration");
> -        migrate_add_blocker(&migration_blocker, NULL);
> +        migrate_add_blocker(&migration_blocker, &error_fatal);
>           return &has_control;
>       }
>       return NULL;

This looks better.
Just a small process nit, new versions should be posted as a new thread, 
and not as a reply to your previous version. No need to repost though.

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>

On error, correctly prints:
qemu-system-aarch64: disallowing migration blocker (--only-migratable) 
for: TCG plugin time control does not support migration

Regards,
Pierrick


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 v2] plugins/api-system: Handle migrate_add_blocker() failure
@ 2026-03-18 13:56 Trieu Huynh
  0 siblings, 0 replies; 4+ messages in thread
From: Trieu Huynh @ 2026-03-18 13:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Trieu Huynh, Pierrick Bouvier, Alex Bennée, Alexandre Iooss,
	Mahmoud Mandour

migrate_add_blocker() can fail (e.g. if migration is already in
progress), in which case it returns a negative value and populates
its errp argument with the reason.

The previous code ignored the return value. Pass &error_fatal so
that on failure QEMU exits cleanly with an informative error message
rather than continuing in an inconsistent state.

Resolves: CID 1645470
Reviewed-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Tested-by: Pierrick Bouvier <pierrick.bouvier@linaro.org>
Signed-off-by: Trieu Huynh <vikingtc4@gmail.com>
---
v2:
- Pass &error_fatal instead of returning NULL: the plugin has no
  recovery path, QEMU should exit cleanly with an error message.
  (Peter Maydell, Pierrick Bouvier)
- Remove manual error_free(migration_blocker) + migration_blocker = NULL:
  migrate_add_blocker() already does this on failure. (Peter Maydell)
---
 plugins/api-system.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/api-system.c b/plugins/api-system.c
index 9a70b9caa6..fbf905cd63 100644
--- a/plugins/api-system.c
+++ b/plugins/api-system.c
@@ -108,7 +108,7 @@ const void *qemu_plugin_request_time_control(void)
         has_control = true;
         error_setg(&migration_blocker,
                    "TCG plugin time control does not support migration");
-        migrate_add_blocker(&migration_blocker, NULL);
+        migrate_add_blocker(&migration_blocker, &error_fatal);
         return &has_control;
     }
     return NULL;
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 v2] plugins/api-system: Handle migrate_add_blocker() failure
  2026-03-17 13:47 ` [PATCH v2 v2] " Trieu Huynh
  2026-03-17 19:06   ` Pierrick Bouvier
@ 2026-03-18 17:19   ` Pierrick Bouvier
  1 sibling, 0 replies; 4+ messages in thread
From: Pierrick Bouvier @ 2026-03-18 17:19 UTC (permalink / raw)
  To: Trieu Huynh, qemu-devel; +Cc: peter.maydell, alex.bennee, erdnaxe, ma.mandourr

On 3/17/26 6:47 AM, Trieu Huynh wrote:
> migrate_add_blocker() can fail (e.g. if migration is already in
> progress), in which case it returns a negative value and populates
> its errp argument with the reason.
> 
> The previous code ignored the return value. Pass &error_fatal so
> that on failure QEMU exits cleanly with an informative error message
> rather than continuing in an inconsistent state.
> 
> Resolves: CID 1645470
> Signed-off-by: Trieu Huynh <vikingtc4@gmail.com>
> ---
> v2:
> - Pass &error_fatal instead of returning NULL: the plugin has no
>    recovery path, QEMU should exit cleanly with an error message.
>    (Peter Maydell, Pierrick Bouvier)
> - Remove manual error_free(migration_blocker) + migration_blocker = NULL:
>    migrate_add_blocker() already does this on failure. (Peter Maydell)
> ---
>   plugins/api-system.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/plugins/api-system.c b/plugins/api-system.c
> index 9a70b9caa6..fbf905cd63 100644
> --- a/plugins/api-system.c
> +++ b/plugins/api-system.c
> @@ -108,7 +108,7 @@ const void *qemu_plugin_request_time_control(void)
>           has_control = true;
>           error_setg(&migration_blocker,
>                      "TCG plugin time control does not support migration");
> -        migrate_add_blocker(&migration_blocker, NULL);
> +        migrate_add_blocker(&migration_blocker, &error_fatal);
>           return &has_control;
>       }
>       return NULL;

This was merged into master (aed38fe5206d848a8366181bfab96835fcd5643b).
Thank you for your contribution!

Regards,
Pierrick


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-18 17:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18 13:56 [PATCH v2 v2] plugins/api-system: Handle migrate_add_blocker() failure Trieu Huynh
  -- strict thread matches above, loose matches on Subject: below --
2026-03-12 12:16 [PATCH] " Trieu Huynh
2026-03-17 13:47 ` [PATCH v2 v2] " Trieu Huynh
2026-03-17 19:06   ` Pierrick Bouvier
2026-03-18 17:19   ` Pierrick Bouvier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox