diff mbox

savevm: check vmsd for migratability status (v2)

Message ID 20140430003903.GA23414@amt.cnet
State New
Headers show

Commit Message

Marcelo Tosatti April 30, 2014, 12:39 a.m. UTC
Check vmsd for unmigratable field, allowing migratibility status
to be modified after vmstate_register.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Comments

Eduardo Habkost April 30, 2014, 3:47 p.m. UTC | #1
(CCing Juan)

On Tue, Apr 29, 2014 at 09:39:03PM -0300, Marcelo Tosatti wrote:
> Check vmsd for unmigratable field, allowing migratibility status
> to be modified after vmstate_register.
> 
> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>

> 
> diff --git a/savevm.c b/savevm.c
> index da8aa24..c578e42 100644
> --- a/savevm.c
> +++ b/savevm.c
> @@ -232,7 +232,6 @@ typedef struct SaveStateEntry {
>      const VMStateDescription *vmsd;
>      void *opaque;
>      CompatEntry *compat;
> -    int no_migrate;
>      int is_ram;
>  } SaveStateEntry;
>  
> @@ -292,7 +291,6 @@ int register_savevm_live(DeviceState *dev,
>      se->ops = ops;
>      se->opaque = opaque;
>      se->vmsd = NULL;
> -    se->no_migrate = 0;
>      /* if this is a live_savem then set is_ram */
>      if (ops->save_live_setup != NULL) {
>          se->is_ram = 1;
> @@ -383,7 +381,6 @@ 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->unmigratable;
>  
>      if (dev) {
>          char *id = qdev_get_dev_path(dev);
> @@ -452,7 +449,7 @@ bool qemu_savevm_state_blocked(Error **errp)
>      SaveStateEntry *se;
>  
>      QTAILQ_FOREACH(se, &savevm_handlers, entry) {
> -        if (se->no_migrate) {
> +        if (se->vmsd && se->vmsd->unmigratable) {
>              error_setg(errp, "State blocked by non-migratable device '%s'",
>                         se->idstr);
>              return true;
>
diff mbox

Patch

diff --git a/savevm.c b/savevm.c
index da8aa24..c578e42 100644
--- a/savevm.c
+++ b/savevm.c
@@ -232,7 +232,6 @@  typedef struct SaveStateEntry {
     const VMStateDescription *vmsd;
     void *opaque;
     CompatEntry *compat;
-    int no_migrate;
     int is_ram;
 } SaveStateEntry;
 
@@ -292,7 +291,6 @@  int register_savevm_live(DeviceState *dev,
     se->ops = ops;
     se->opaque = opaque;
     se->vmsd = NULL;
-    se->no_migrate = 0;
     /* if this is a live_savem then set is_ram */
     if (ops->save_live_setup != NULL) {
         se->is_ram = 1;
@@ -383,7 +381,6 @@  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->unmigratable;
 
     if (dev) {
         char *id = qdev_get_dev_path(dev);
@@ -452,7 +449,7 @@  bool qemu_savevm_state_blocked(Error **errp)
     SaveStateEntry *se;
 
     QTAILQ_FOREACH(se, &savevm_handlers, entry) {
-        if (se->no_migrate) {
+        if (se->vmsd && se->vmsd->unmigratable) {
             error_setg(errp, "State blocked by non-migratable device '%s'",
                        se->idstr);
             return true;