migration: Add block-bitmap-mapping parameter

This migration parameter allows mapping block node names and bitmap
names to aliases for the purpose of block dirty bitmap migration.

This way, management tools can use different node and bitmap names on
the source and destination and pass the mapping of how bitmaps are to be
transferred to qemu (on the source, the destination, or even both with
arbitrary aliases in the migration stream).

While touching this code, fix a bug where bitmap names longer than 255
bytes would fail an assertion in qemu_put_counted_string().

Suggested-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <20200820150725.68687-2-mreitz@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Max Reitz 2020-08-20 17:07:23 +02:00 committed by Eric Blake
parent 76bbbb2d8b
commit 31e4c354b3
5 changed files with 523 additions and 58 deletions

View file

@ -469,6 +469,32 @@ void hmp_info_migrate_parameters(Monitor *mon, const QDict *qdict)
monitor_printf(mon, "%s: '%s'\n",
MigrationParameter_str(MIGRATION_PARAMETER_TLS_AUTHZ),
params->tls_authz);
if (params->has_block_bitmap_mapping) {
const BitmapMigrationNodeAliasList *bmnal;
monitor_printf(mon, "%s:\n",
MigrationParameter_str(
MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING));
for (bmnal = params->block_bitmap_mapping;
bmnal;
bmnal = bmnal->next)
{
const BitmapMigrationNodeAlias *bmna = bmnal->value;
const BitmapMigrationBitmapAliasList *bmbal;
monitor_printf(mon, " '%s' -> '%s'\n",
bmna->node_name, bmna->alias);
for (bmbal = bmna->bitmaps; bmbal; bmbal = bmbal->next) {
const BitmapMigrationBitmapAlias *bmba = bmbal->value;
monitor_printf(mon, " '%s' -> '%s'\n",
bmba->name, bmba->alias);
}
}
}
}
qapi_free_MigrationParameters(params);
@ -1384,6 +1410,10 @@ void hmp_migrate_set_parameter(Monitor *mon, const QDict *qdict)
p->has_announce_step = true;
visit_type_size(v, param, &p->announce_step, &err);
break;
case MIGRATION_PARAMETER_BLOCK_BITMAP_MAPPING:
error_setg(&err, "The block-bitmap-mapping parameter can only be set "
"through QMP");
break;
default:
assert(0);
}