diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2009-11-30 18:21:21 +0100 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2009-12-03 10:48:53 -0600 |
commit | f327aa0c608b4bae3c93f0fbd0afcfdd9c9635bc (patch) | |
tree | c8a24861d58587a3b2107cb22fda348b2d746e00 /savevm.c | |
parent | 82801d8f4f3fa7413647495d9823fb3144c31ddc (diff) |
live migration: Propagate output monitor to callback handler
In order to allow proper progress reporting to the monitor that
initiated the migration, forward the monitor reference through the
migration layer down to SaveLiveStateHandler.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'savevm.c')
-rw-r--r-- | savevm.c | 31 |
1 files changed, 16 insertions, 15 deletions
@@ -1264,7 +1264,8 @@ static void vmstate_save(QEMUFile *f, SaveStateEntry *se) #define QEMU_VM_SECTION_END 0x03 #define QEMU_VM_SECTION_FULL 0x04 -int qemu_savevm_state_begin(QEMUFile *f, int blk_enable, int shared) +int qemu_savevm_state_begin(Monitor *mon, QEMUFile *f, int blk_enable, + int shared) { SaveStateEntry *se; @@ -1296,18 +1297,18 @@ int qemu_savevm_state_begin(QEMUFile *f, int blk_enable, int shared) qemu_put_be32(f, se->instance_id); qemu_put_be32(f, se->version_id); - se->save_live_state(f, QEMU_VM_SECTION_START, se->opaque); + se->save_live_state(mon, f, QEMU_VM_SECTION_START, se->opaque); } if (qemu_file_has_error(f)) { - qemu_savevm_state_cancel(f); + qemu_savevm_state_cancel(mon, f); return -EIO; } return 0; } -int qemu_savevm_state_iterate(QEMUFile *f) +int qemu_savevm_state_iterate(Monitor *mon, QEMUFile *f) { SaveStateEntry *se; int ret = 1; @@ -1320,21 +1321,21 @@ int qemu_savevm_state_iterate(QEMUFile *f) qemu_put_byte(f, QEMU_VM_SECTION_PART); qemu_put_be32(f, se->section_id); - ret &= !!se->save_live_state(f, QEMU_VM_SECTION_PART, se->opaque); + ret &= !!se->save_live_state(mon, f, QEMU_VM_SECTION_PART, se->opaque); } if (ret) return 1; if (qemu_file_has_error(f)) { - qemu_savevm_state_cancel(f); + qemu_savevm_state_cancel(mon, f); return -EIO; } return 0; } -int qemu_savevm_state_complete(QEMUFile *f) +int qemu_savevm_state_complete(Monitor *mon, QEMUFile *f) { SaveStateEntry *se; @@ -1346,7 +1347,7 @@ int qemu_savevm_state_complete(QEMUFile *f) qemu_put_byte(f, QEMU_VM_SECTION_END); qemu_put_be32(f, se->section_id); - se->save_live_state(f, QEMU_VM_SECTION_END, se->opaque); + se->save_live_state(mon, f, QEMU_VM_SECTION_END, se->opaque); } QTAILQ_FOREACH(se, &savevm_handlers, entry) { @@ -1378,18 +1379,18 @@ int qemu_savevm_state_complete(QEMUFile *f) return 0; } -void qemu_savevm_state_cancel(QEMUFile *f) +void qemu_savevm_state_cancel(Monitor *mon, QEMUFile *f) { SaveStateEntry *se; QTAILQ_FOREACH(se, &savevm_handlers, entry) { if (se->save_live_state) { - se->save_live_state(f, -1, se->opaque); + se->save_live_state(mon, f, -1, se->opaque); } } } -int qemu_savevm_state(QEMUFile *f) +static int qemu_savevm_state(Monitor *mon, QEMUFile *f) { int saved_vm_running; int ret; @@ -1399,17 +1400,17 @@ int qemu_savevm_state(QEMUFile *f) bdrv_flush_all(); - ret = qemu_savevm_state_begin(f, 0, 0); + ret = qemu_savevm_state_begin(mon, f, 0, 0); if (ret < 0) goto out; do { - ret = qemu_savevm_state_iterate(f); + ret = qemu_savevm_state_iterate(mon, f); if (ret < 0) goto out; } while (ret == 0); - ret = qemu_savevm_state_complete(f); + ret = qemu_savevm_state_complete(mon, f); out: if (qemu_file_has_error(f)) @@ -1698,7 +1699,7 @@ void do_savevm(Monitor *mon, const QDict *qdict) monitor_printf(mon, "Could not open VM state file\n"); goto the_end; } - ret = qemu_savevm_state(f); + ret = qemu_savevm_state(mon, f); vm_state_size = qemu_ftell(f); qemu_fclose(f); if (ret < 0) { |