Patchwork [1/3] vmstate: add no_migrate flag to VMStateDescription

login
register
mail settings
Submitter Gerd Hoffmann
Date July 8, 2011, 8:53 a.m.
Message ID <1310115239-19288-2-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/103787/
State New
Headers show

Comments

Gerd Hoffmann - July 8, 2011, 8:53 a.m.
This allows to easily tag devices as non-migratable,
so any attempt to migrate a virtual machine with the
device in question active will make migration fail.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/hw.h  |    1 +
 savevm.c |    1 +
 2 files changed, 2 insertions(+), 0 deletions(-)
Anthony Liguori - July 8, 2011, 2:26 p.m.
On 07/08/2011 03:53 AM, Gerd Hoffmann wrote:
> This allows to easily tag devices as non-migratable,
> so any attempt to migrate a virtual machine with the
> device in question active will make migration fail.
>
> Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>

register_device_unmigratable()?

Regards,

Anthony Liguori

> ---
>   hw/hw.h  |    1 +
>   savevm.c |    1 +
>   2 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/hw/hw.h b/hw/hw.h
> index 9dd7096..1eb3486 100644
> --- a/hw/hw.h
> +++ b/hw/hw.h
> @@ -324,6 +324,7 @@ typedef struct VMStateSubsection {
>
>   struct VMStateDescription {
>       const char *name;
> +    int no_migrate;
>       int version_id;
>       int minimum_version_id;
>       int minimum_version_id_old;
> diff --git a/savevm.c b/savevm.c
> index 8139bc7..fa2da3e 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -1234,6 +1234,7 @@ int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,
>       se->opaque = opaque;
>       se->vmsd = vmsd;
>       se->alias_id = alias_id;
> +    se->no_migrate = vmsd->no_migrate;
>
>       if (dev&&  dev->parent_bus&&  dev->parent_bus->info->get_dev_path) {
>           char *id = dev->parent_bus->info->get_dev_path(dev);
Gerd Hoffmann - July 8, 2011, 3:44 p.m.
On 07/08/11 16:26, Anthony Liguori wrote:
> On 07/08/2011 03:53 AM, Gerd Hoffmann wrote:
>> This allows to easily tag devices as non-migratable,
>> so any attempt to migrate a virtual machine with the
>> device in question active will make migration fail.
>>
>> Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>
>
> register_device_unmigratable()?

That is just a more complicated way to do the same ;)
Wanna have a patch to zap it?

cheers,
   Gerd
Gerd Hoffmann - July 8, 2011, 4:04 p.m.
On 07/08/11 17:44, Gerd Hoffmann wrote:
> On 07/08/11 16:26, Anthony Liguori wrote:
>> register_device_unmigratable()?
>
> Wanna have a patch to zap it?

Ah, no, we can't, for ivshmem this isn't fixed but depends on the 
configuration, so a static flag in the VMStateDescription doesn't cut it.

cheers,
   Gerd
Anthony Liguori - July 8, 2011, 5:07 p.m.
On 07/08/2011 11:04 AM, Gerd Hoffmann wrote:
> On 07/08/11 17:44, Gerd Hoffmann wrote:
>> On 07/08/11 16:26, Anthony Liguori wrote:
>>> register_device_unmigratable()?
>>
>> Wanna have a patch to zap it?
>
> Ah, no, we can't, for ivshmem this isn't fixed but depends on the
> configuration, so a static flag in the VMStateDescription doesn't cut it.

Right, but can we have some continuity at least between the two interfaces?

At least make the vmstate flag 'unmigratable' or rename the function to 
qdev_set_no_migrate().

BTW, should this be a vmstate flag or a qdev flag?

Regards,

Anthony Liguori

>
> cheers,
> Gerd
>
Gerd Hoffmann - July 11, 2011, 6:29 a.m.
>>>> register_device_unmigratable()?

> Right, but can we have some continuity at least between the two interfaces?
>
> At least make the vmstate flag 'unmigratable' or rename the function to
> qdev_set_no_migrate().

Will rename the flag.

> BTW, should this be a vmstate flag or a qdev flag?

vmstate.  savevm.c doesn't look at the qdev tree.

cheers,
   Gerd

Patch

diff --git a/hw/hw.h b/hw/hw.h
index 9dd7096..1eb3486 100644
--- a/hw/hw.h
+++ b/hw/hw.h
@@ -324,6 +324,7 @@  typedef struct VMStateSubsection {
 
 struct VMStateDescription {
     const char *name;
+    int no_migrate;
     int version_id;
     int minimum_version_id;
     int minimum_version_id_old;
diff --git a/savevm.c b/savevm.c
index 8139bc7..fa2da3e 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1234,6 +1234,7 @@  int vmstate_register_with_alias_id(DeviceState *dev, int instance_id,
     se->opaque = opaque;
     se->vmsd = vmsd;
     se->alias_id = alias_id;
+    se->no_migrate = vmsd->no_migrate;
 
     if (dev && dev->parent_bus && dev->parent_bus->info->get_dev_path) {
         char *id = dev->parent_bus->info->get_dev_path(dev);