From: "Michael R. Hines" <mrhi...@us.ibm.com> During micro-checkpointing, the VCPUs get repeatedly paused and resumed. We need to not freak out when the VM begins micro-checkpointing.
Signed-off-by: Michael R. Hines <mrhi...@us.ibm.com> --- arch_init.c | 2 +- cpus.c | 9 ++++++++- include/migration/migration.h | 2 ++ qapi-schema.json | 4 +++- vl.c | 6 ++++++ 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/arch_init.c b/arch_init.c index 4a71311..b139512 100644 --- a/arch_init.c +++ b/arch_init.c @@ -199,7 +199,7 @@ typedef struct AccountingInfo { static AccountingInfo acct_info; -static void acct_clear(void) +void acct_clear(void) { memset(&acct_info, 0, sizeof(acct_info)); } diff --git a/cpus.c b/cpus.c index 398229e..d090c2c 100644 --- a/cpus.c +++ b/cpus.c @@ -530,7 +530,14 @@ static int do_vm_stop(RunState state) pause_all_vcpus(); runstate_set(state); vm_state_notify(0, state); - monitor_protocol_event(QEVENT_STOP, NULL); + /* + * If MC is enabled, libvirt gets confused + * because it thinks the VM is stopped when + * its just being micro-checkpointed. + */ + if(state != RUN_STATE_CHECKPOINT_VM) { + monitor_protocol_event(QEVENT_STOP, NULL); + } } bdrv_drain_all(); diff --git a/include/migration/migration.h b/include/migration/migration.h index 3ffc433..3ad06c5 100644 --- a/include/migration/migration.h +++ b/include/migration/migration.h @@ -119,6 +119,8 @@ uint64_t xbzrle_mig_bytes_transferred(void); uint64_t xbzrle_mig_pages_transferred(void); uint64_t xbzrle_mig_pages_overflow(void); uint64_t xbzrle_mig_pages_cache_miss(void); +void acct_clear(void); + void *migration_bitmap_worker(void *opaque); void migration_bitmap_worker_start(MigrationState *s); void migration_bitmap_worker_stop(MigrationState *s); diff --git a/qapi-schema.json b/qapi-schema.json index aac0894..8e72bcf 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -169,6 +169,8 @@ # # @save-vm: guest is paused to save the VM state # +# @checkpoint-vm: guest is paused to checkpoint the VM state +# # @shutdown: guest is shut down (and -no-shutdown is in use) # # @suspended: guest is suspended (ACPI S3) @@ -181,7 +183,7 @@ 'data': [ 'debug', 'inmigrate', 'internal-error', 'io-error', 'paused', 'postmigrate', 'prelaunch', 'finish-migrate', 'restore-vm', 'running', 'save-vm', 'shutdown', 'suspended', 'watchdog', - 'guest-panicked' ] } + 'guest-panicked', 'checkpoint-vm' ] } ## # @SnapshotInfo diff --git a/vl.c b/vl.c index e2ba2e8..74d52ab 100644 --- a/vl.c +++ b/vl.c @@ -611,14 +611,18 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_FINISH_MIGRATE, RUN_STATE_RUNNING }, { RUN_STATE_FINISH_MIGRATE, RUN_STATE_POSTMIGRATE }, + { RUN_STATE_FINISH_MIGRATE, RUN_STATE_CHECKPOINT_VM }, { RUN_STATE_RESTORE_VM, RUN_STATE_RUNNING }, + { RUN_STATE_CHECKPOINT_VM, RUN_STATE_RUNNING }, + { RUN_STATE_RUNNING, RUN_STATE_DEBUG }, { RUN_STATE_RUNNING, RUN_STATE_INTERNAL_ERROR }, { RUN_STATE_RUNNING, RUN_STATE_IO_ERROR }, { RUN_STATE_RUNNING, RUN_STATE_PAUSED }, { RUN_STATE_RUNNING, RUN_STATE_FINISH_MIGRATE }, + { RUN_STATE_RUNNING, RUN_STATE_CHECKPOINT_VM }, { RUN_STATE_RUNNING, RUN_STATE_RESTORE_VM }, { RUN_STATE_RUNNING, RUN_STATE_SAVE_VM }, { RUN_STATE_RUNNING, RUN_STATE_SHUTDOWN }, @@ -634,9 +638,11 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_RUNNING, RUN_STATE_SUSPENDED }, { RUN_STATE_SUSPENDED, RUN_STATE_RUNNING }, { RUN_STATE_SUSPENDED, RUN_STATE_FINISH_MIGRATE }, + { RUN_STATE_SUSPENDED, RUN_STATE_CHECKPOINT_VM }, { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING }, { RUN_STATE_WATCHDOG, RUN_STATE_FINISH_MIGRATE }, + { RUN_STATE_WATCHDOG, RUN_STATE_CHECKPOINT_VM }, { RUN_STATE_GUEST_PANICKED, RUN_STATE_PAUSED }, { RUN_STATE_GUEST_PANICKED, RUN_STATE_FINISH_MIGRATE }, -- 1.8.1.2