Peter Xu <pet...@redhat.com> wrote:
> On Tue, Apr 25, 2017 at 12:17:57PM +0200, Juan Quintela wrote:
>> The function is only used once, and nothing else in migration knows
>> about objects.  Create the function vmstate_device_is_migratable() in
>> savem.c that really do the bit that is related with migration.
>> 
>> Signed-off-by: Juan Quintela <quint...@redhat.com>

>
> Here the name vmstate_device_is_migratable() let me think of "return
> true if the device can migrate, false otherwise". However what it
> actually does is mixed with "--only-migratable" parameter, say, when
> without that parameter, all device will be getting "true" here, even
> unmigratable devices...
>
> Not sure whether it'll be nicer we do this:
>
> bool vmstate_device_is_migratable(const VMStateDescription *vmsd)
> {
>     return !(vmsd & vmsd->unmigratable);
> }
>
> Then we can define check_migratable() as:
>
> static int check_migratable(Object *obj, Error **err)
> {
>     DeviceClass *dc = DEVICE_GET_CLASS(obj);
>
>     /* no check needed if --only-migratable not specified */
>     if (!only_migratable) {
>        return true;
>     }
>
>     if (!vmstate_device_is_migratable(dc->vmsd)) {
>         error_setg(err, "Device %s is not migratable, but "
>                    "--only-migratable was specified",
>                    object_get_typename(obj));
>         return -1;
>     }
>
>     return 0;
> }
>
> Thanks,

I see your point.  We have to teach things about migrate to qdev.c or
things about objects to migration.

Will change.

Thanks, Juan.

Reply via email to