Patchwork [v2,05/12] savevm: add error parameter to qemu_savevm_state_complete()

login
register
mail settings
Submitter Pavel Hrdina
Date March 22, 2013, 1:16 p.m.
Message ID <06467fc6c06628d760de026055644d339a65d7b5.1363957855.git.phrdina@redhat.com>
Download mbox | patch
Permalink /patch/230008/
State New
Headers show

Comments

Pavel Hrdina - March 22, 2013, 1:16 p.m.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
---
 include/sysemu/sysemu.h | 2 +-
 migration.c             | 2 +-
 savevm.c                | 5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)
Eric Blake - March 26, 2013, 7:41 p.m.
On 03/22/2013 07:16 AM, Pavel Hrdina wrote:
> Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
> ---
>  include/sysemu/sysemu.h | 2 +-
>  migration.c             | 2 +-
>  savevm.c                | 5 +++--
>  3 files changed, 5 insertions(+), 4 deletions(-)
> 

> @@ -1734,6 +1734,7 @@ void qemu_savevm_state_complete(QEMUFile *f)
>          trace_savevm_section_end(se->section_id);
>          if (ret < 0) {
>              qemu_file_set_error(f, ret);
> +            error_setg(errp, "Failed to complete vmstate save.");

I know I said I wouldn't keep mentioning error message conventions...

therefore, I'm okay if you fix things, and add:

Reviewed-by: Eric Blake <eblake@redhat.com>

Patch

diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index af4f699..9e6a4a9 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -77,7 +77,7 @@  void qemu_savevm_state_begin(QEMUFile *f,
                              const MigrationParams *params,
                              Error **errp);
 int qemu_savevm_state_iterate(QEMUFile *f, Error **errp);
-void qemu_savevm_state_complete(QEMUFile *f);
+void qemu_savevm_state_complete(QEMUFile *f, Error **errp);
 void qemu_savevm_state_cancel(void);
 uint64_t qemu_savevm_state_pending(QEMUFile *f, uint64_t max_size);
 int qemu_loadvm_state(QEMUFile *f);
diff --git a/migration.c b/migration.c
index c2bf531..c8fdfc0 100644
--- a/migration.c
+++ b/migration.c
@@ -524,7 +524,7 @@  static void *migration_thread(void *opaque)
                 old_vm_running = runstate_is_running();
                 vm_stop_force_state(RUN_STATE_FINISH_MIGRATE);
                 qemu_file_set_rate_limit(s->file, INT_MAX);
-                qemu_savevm_state_complete(s->file);
+                qemu_savevm_state_complete(s->file, NULL);
                 qemu_mutex_unlock_iothread();
                 if (!qemu_file_get_error(s->file)) {
                     migrate_finish_set_state(s, MIG_STATE_COMPLETED);
diff --git a/savevm.c b/savevm.c
index c5ac701..76af390 100644
--- a/savevm.c
+++ b/savevm.c
@@ -1709,7 +1709,7 @@  int qemu_savevm_state_iterate(QEMUFile *f, Error **errp)
     return ret;
 }
 
-void qemu_savevm_state_complete(QEMUFile *f)
+void qemu_savevm_state_complete(QEMUFile *f, Error **errp)
 {
     SaveStateEntry *se;
     int ret;
@@ -1734,6 +1734,7 @@  void qemu_savevm_state_complete(QEMUFile *f)
         trace_savevm_section_end(se->section_id);
         if (ret < 0) {
             qemu_file_set_error(f, ret);
+            error_setg(errp, "Failed to complete vmstate save.");
             return;
         }
     }
@@ -1819,7 +1820,7 @@  static int qemu_savevm_state(QEMUFile *f)
 
     ret = qemu_file_get_error(f);
     if (ret == 0) {
-        qemu_savevm_state_complete(f);
+        qemu_savevm_state_complete(f, NULL);
         ret = qemu_file_get_error(f);
     }
     if (ret != 0) {