qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/2] migration: Move check_migratable() into qde


From: Juan Quintela
Subject: Re: [Qemu-devel] [PATCH 1/2] migration: Move check_migratable() into qdev.c
Date: Wed, 26 Apr 2017 12:31:32 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)

Peter Xu <address@hidden> 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 <address@hidden>

>
> 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

[Prev in Thread] Current Thread [Next in Thread]