Currently the code that adds a migration blocker does not check if the same
blocker already exists. Assert that the migration handler being added has
not been added already.
CC: Markus Armbruster <armbru@redhat.com>
CC: Peter Xu <peterx@redhat.com>
CC: Prasad Pandit <pjp@fedoraproject.org>
Reviewed-by: Peter Xu <peterx@redhat.com>
Signed-off-by: Ani Sinha <anisinha@redhat.com>
---
migration/migration.c | 2 ++
1 file changed, 2 insertions(+)
changelog:
v2: fix indentation
diff --git a/migration/migration.c b/migration/migration.c
index f949708629..4459d85ea5 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -1694,6 +1694,8 @@ static int add_blockers(Error **reasonp, unsigned modes, Error **errp)
{
for (MigMode mode = 0; mode < MIG_MODE__MAX; mode++) {
if (modes & BIT(mode)) {
+ assert(g_slist_index(migration_blockers[mode],
+ *reasonp) == -1);
migration_blockers[mode] = g_slist_prepend(migration_blockers[mode],
*reasonp);
}
--
2.52.0