migration: add_bitmaps_to_list: check disk name once

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Andrey Shinkevich <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Message-Id: <[email protected]>
[eblake: shorter subject line]
Signed-off-by: Eric Blake <[email protected]>
This commit is contained in:
Vladimir Sementsov-Ogievskiy authored and Eric Blake committed 2020-05-28 13:15:22 -05:00
1 parent ae00aa2398
commit 82640edb88
1 file changed
+11 -6
+11 -6
View File
@@ -274,17 +274,22 @@ static int add_bitmaps_to_list(BlockDriverState *bs, const char *bs_name)
DirtyBitmapMigBitmapState *dbms;
Error *local_err = NULL;
bitmap = bdrv_dirty_bitmap_first(bs);
if (!bitmap) {
return 0;
}
if (!bs_name || strcmp(bs_name, "") == 0) {
error_report("Bitmap '%s' in unnamed node can't be migrated",
bdrv_dirty_bitmap_name(bitmap));
return -1;
}
FOR_EACH_DIRTY_BITMAP(bs, bitmap) {
if (!bdrv_dirty_bitmap_name(bitmap)) {
continue;
}
if (!bs_name || strcmp(bs_name, "") == 0) {
error_report("Found bitmap '%s' in unnamed node %p. It can't "
"be migrated", bdrv_dirty_bitmap_name(bitmap), bs);
return -1;
}
if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_DEFAULT, &local_err)) {
error_report_err(local_err);
return -1;