[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC v2] migration: Add migrate-set-bitmap-node-mapping
From: |
Dr. David Alan Gilbert |
Subject: |
Re: [RFC v2] migration: Add migrate-set-bitmap-node-mapping |
Date: |
Thu, 14 May 2020 09:42:42 +0100 |
User-agent: |
Mutt/1.13.4 (2020-02-15) |
* Max Reitz (address@hidden) wrote:
<snip>
> +void qmp_migrate_set_bitmap_node_mapping(MigrationBlockNodeMappingList
> *mapping,
> + Error **errp)
> +{
> + QDict *in_mapping = qdict_new();
> + QDict *out_mapping = qdict_new();
> +
> + for (; mapping; mapping = mapping->next) {
> + MigrationBlockNodeMapping *entry = mapping->value;
> +
> + if (qdict_haskey(out_mapping, entry->node_name)) {
> + error_setg(errp, "Cannot map node name '%s' twice",
> + entry->node_name);
> + goto fail;
> + }
I'm not too clear exactly which case this is protecting against;
I think that's protecting against mapping
'src1'->'dst1' and 'src1'->'dst2'
which is a good check.s (or maybe it's checking against dst2 twice?)
What about cases where there is no mapping - e.g. imagine
that we have b1/b2 on the source and b2/b3 on the dest; now
if we add just a mapping:
b1->b2
then we end up with:
b1 -> b2
b2 -> b2 (non-mapped)
b3
so we have a clash there - are we protected against that?
Dave
> + if (qdict_haskey(in_mapping, entry->alias)) {
> + error_setg(errp, "Cannot use alias '%s' twice",
> + entry->alias);
> + goto fail;
> + }
> +
> + qdict_put_str(in_mapping, entry->alias, entry->node_name);
> + qdict_put_str(out_mapping, entry->node_name, entry->alias);
> + }
> +
> + qobject_unref(dirty_bitmap_mig_state.node_in_mapping);
> + qobject_unref(dirty_bitmap_mig_state.node_out_mapping);
> +
> + dirty_bitmap_mig_state.node_in_mapping = in_mapping;
> + dirty_bitmap_mig_state.node_out_mapping = out_mapping;
> +
> + return;
> +
> +fail:
> + qobject_unref(in_mapping);
> + qobject_unref(out_mapping);
> +}
> +
> static SaveVMHandlers savevm_dirty_bitmap_handlers = {
> .save_setup = dirty_bitmap_save_setup,
> .save_live_complete_postcopy = dirty_bitmap_save_complete,
> --
> 2.26.2
>
--
Dr. David Alan Gilbert / address@hidden / Manchester, UK