diff mbox

[QEMU,v14,4/4] migration: add error_report

Message ID 1479923640-8423-5-git-send-email-duanj@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jianjun Duan Nov. 23, 2016, 5:54 p.m. UTC
Added error_report where version_ids do not match in vmstate_load_state.

Signed-off-by: Jianjun Duan <duanj@linux.vnet.ibm.com>
---
 migration/vmstate.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Dr. David Alan Gilbert Dec. 7, 2016, 7:51 p.m. UTC | #1
* Jianjun Duan (duanj@linux.vnet.ibm.com) wrote:
> Added error_report where version_ids do not match in vmstate_load_state.
> 
> Signed-off-by: Jianjun Duan <duanj@linux.vnet.ibm.com>

Yes, but the error message would be better if it printed
the two version numbers so you could see what went wrong.

Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>

> ---
>  migration/vmstate.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/migration/vmstate.c b/migration/vmstate.c
> index 2f9d4ba..0e6fce4 100644
> --- a/migration/vmstate.c
> +++ b/migration/vmstate.c
> @@ -85,6 +85,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
>  
>      trace_vmstate_load_state(vmsd->name, version_id);
>      if (version_id > vmsd->version_id) {
> +        error_report("%s %s",  vmsd->name, "too new");
>          trace_vmstate_load_state_end(vmsd->name, "too new", -EINVAL);
>          return -EINVAL;
>      }
> @@ -95,6 +96,7 @@ int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
>              trace_vmstate_load_state_end(vmsd->name, "old path", ret);
>              return ret;
>          }
> +        error_report("%s %s",  vmsd->name, "too old");
>          trace_vmstate_load_state_end(vmsd->name, "too old", -EINVAL);
>          return -EINVAL;
>      }
> -- 
> 1.9.1
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
diff mbox

Patch

diff --git a/migration/vmstate.c b/migration/vmstate.c
index 2f9d4ba..0e6fce4 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -85,6 +85,7 @@  int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
 
     trace_vmstate_load_state(vmsd->name, version_id);
     if (version_id > vmsd->version_id) {
+        error_report("%s %s",  vmsd->name, "too new");
         trace_vmstate_load_state_end(vmsd->name, "too new", -EINVAL);
         return -EINVAL;
     }
@@ -95,6 +96,7 @@  int vmstate_load_state(QEMUFile *f, const VMStateDescription *vmsd,
             trace_vmstate_load_state_end(vmsd->name, "old path", ret);
             return ret;
         }
+        error_report("%s %s",  vmsd->name, "too old");
         trace_vmstate_load_state_end(vmsd->name, "too old", -EINVAL);
         return -EINVAL;
     }