On 05/02/2018 15:58, Jianfeng Tan wrote:
> Here are some options to fix this:
>
> 1. When we do ram name comparison, we truncate the prefix as this patch shows.
> It cannot cover the corner case: the source VM could have two ram blocks
> with name of "pc.ram" and "/object/pc.ram".
That shouldn't happen ("pc.ram" exists even in the "-numa
node,memdev=..." case, but it has no RAM block).
> RAMBLOCK_FOREACH(block) {
> - if (!strcmp(name, block->idstr)) {
> + name2 = strdup(block->idstr);
> + id2 = basename(name2);
> + if (!strcmp(id1, id2)) {
> + free(name1);
> + free(name2);
> return block;
> }
> + free(name2);
Instead of this, perhaps just skip "/object/" in both id1 and
block->idstr? This also removes the need for strdup/free.
However, note that
-m xG -numa node,memdev=pc.ram \
-object memory-backend-file,id=pc.ram,...
works for both vhost-kernel and vhost-user, so I'd rather consider this
a configuration problem and not do anything.
Thanks,
Paolo
> }
>
> + free(name1);
> return NULL;
> }
>
>