diff mbox

[2/2] migration: Report values for comparisons

Message ID 1475002565-30170-3-git-send-email-dgilbert@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Dr. David Alan Gilbert Sept. 27, 2016, 6:56 p.m. UTC
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

Report the values when a comparison fails; together with
the previous patch that prints the device and field names
this should give a good idea of why loading the migration failed.

Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
 migration/vmstate.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Juan Quintela Oct. 5, 2016, 8:49 a.m. UTC | #1
"Dr. David Alan Gilbert (git)" <dgilbert@redhat.com> wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> Report the values when a comparison fails; together with
> the previous patch that prints the device and field names
> this should give a good idea of why loading the migration failed.
>
> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> ---
>  migration/vmstate.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/migration/vmstate.c b/migration/vmstate.c
> index 1d637b2..0bc9f35 100644
> --- a/migration/vmstate.c
> +++ b/migration/vmstate.c
> @@ -557,6 +557,7 @@ static int get_int32_equal(QEMUFile *f, void *pv, size_t size)
>      if (*v == v2) {
>          return 0;
>      }
> +    error_report("%" PRIx32 " != %" PRIx32, *v, v2);
>      return -EINVAL;
>  }
>  
> @@ -580,6 +581,9 @@ static int get_int32_le(QEMUFile *f, void *pv, size_t size)
>          *cur = loaded;
>          return 0;
>      }
> +    error_report("Invalid value %" PRId32
> +                 " expecting positive value <= %" PRId32,
> +                 loaded, *cur);
>      return -EINVAL;
>  }
>  
> @@ -685,6 +689,7 @@ static int get_uint32_equal(QEMUFile *f, void *pv, size_t size)
>      if (*v == v2) {
>          return 0;
>      }
> +    error_report("%" PRIx32 " != %" PRIx32, *v, v2);
>      return -EINVAL;
>  }
>  
> @@ -727,6 +732,7 @@ static int get_uint64_equal(QEMUFile *f, void *pv, size_t size)
>      if (*v == v2) {
>          return 0;
>      }
> +    error_report("%" PRIx64 " != %" PRIx64, *v, v2);
>      return -EINVAL;
>  }
>  
> @@ -748,6 +754,7 @@ static int get_uint8_equal(QEMUFile *f, void *pv, size_t size)
>      if (*v == v2) {
>          return 0;
>      }
> +    error_report("%x != %x", *v, v2);
>      return -EINVAL;
>  }
>  
> @@ -769,6 +776,7 @@ static int get_uint16_equal(QEMUFile *f, void *pv, size_t size)
>      if (*v == v2) {
>          return 0;
>      }
> +    error_report("%x != %x", *v, v2);
>      return -EINVAL;
>  }

Applied, thanks.
diff mbox

Patch

diff --git a/migration/vmstate.c b/migration/vmstate.c
index 1d637b2..0bc9f35 100644
--- a/migration/vmstate.c
+++ b/migration/vmstate.c
@@ -557,6 +557,7 @@  static int get_int32_equal(QEMUFile *f, void *pv, size_t size)
     if (*v == v2) {
         return 0;
     }
+    error_report("%" PRIx32 " != %" PRIx32, *v, v2);
     return -EINVAL;
 }
 
@@ -580,6 +581,9 @@  static int get_int32_le(QEMUFile *f, void *pv, size_t size)
         *cur = loaded;
         return 0;
     }
+    error_report("Invalid value %" PRId32
+                 " expecting positive value <= %" PRId32,
+                 loaded, *cur);
     return -EINVAL;
 }
 
@@ -685,6 +689,7 @@  static int get_uint32_equal(QEMUFile *f, void *pv, size_t size)
     if (*v == v2) {
         return 0;
     }
+    error_report("%" PRIx32 " != %" PRIx32, *v, v2);
     return -EINVAL;
 }
 
@@ -727,6 +732,7 @@  static int get_uint64_equal(QEMUFile *f, void *pv, size_t size)
     if (*v == v2) {
         return 0;
     }
+    error_report("%" PRIx64 " != %" PRIx64, *v, v2);
     return -EINVAL;
 }
 
@@ -748,6 +754,7 @@  static int get_uint8_equal(QEMUFile *f, void *pv, size_t size)
     if (*v == v2) {
         return 0;
     }
+    error_report("%x != %x", *v, v2);
     return -EINVAL;
 }
 
@@ -769,6 +776,7 @@  static int get_uint16_equal(QEMUFile *f, void *pv, size_t size)
     if (*v == v2) {
         return 0;
     }
+    error_report("%x != %x", *v, v2);
     return -EINVAL;
 }