plugins/api-system: Handle migrate_add_blocker() failure
PATCH v2 1/1 plugins/api-system: Handle migrate_add_blocker() failure
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 <[email protected]>
Tested-by Pierrick Bouvier <[email protected]>
Signed-off-by Trieu Huynh <[email protected]>
---
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(-)
plugins/api-system.c +1 -1
@@ -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 ;
Signature · 1 line
2.43.0