qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 0/3] add "core dump"-like capability


From: Paolo Bonzini
Subject: [Qemu-devel] [PATCH 0/3] add "core dump"-like capability
Date: Thu, 9 Jul 2009 13:47:36 +0200

Unlike for example xen, KVM virtualized guests do not have a method to
generate something like a core file.  While kdump could help in the
case of a crash, it does not cater for non-Linux operating systems
and does not help with dumping the state live, while the machine is
running.

The existing savevm stuff (besides not being supported by libvirt)
does not perform the dump live; it stops the virtual machine before
saving.  One way to do this could be to start migrating to "exec:dd
of=OUT-FILE-NAME" and somehow restart the machine as soon as the migration
ends.  This (except the restarting part) is similar to how libvirt
implements VM snapshotting.  However this has several disadvantages:

1) it is not possible when the terminal does not support synchronous
migration;

2) I'm not sure how easy it would be to "script" it from libvirt -- I
have not tried;

3) last but not least, filename completion would not work from the
QEMU monitor itself. :-)

For this reason I instead opted for a new monitor command, "dump"
(suggestions for a different name are welcome).  The command is
still based on the migration mechanism, the only differences are the
destination, which is a file rather than a URI, and the fact that the
VM is restarted after its state (actually the parts that cannot be saved
live) is saved.

This approach is somewhat obvious and packs a lot of functionality in
a relatively small patch set (e.g. "info migrate" and "migrate_cancel"
will work for dumps too).  Still it does not come without disadvantages:

1) it is impossible to dump and migrate at the same time, though
this is mostly due to limitations of the monitor interface;

2) it is somewhat unintuitive that migrate commands (migrate_cancel in
particular) affect dumps as well.

The patch set is structured as follows.

Patch 1 is a cleanup to move some of the migration logic from
FdMigrationState to MigrationState.  In particular the
active/completed/cancelled/error "state machine" becomes part
of MigrationState.

Patch 2 adds a new state to this state machine, COMPLETING, which is when
the data is not completely written but the VM is stopped.  The new design
simplifies the implementation of live dumping, but arguably this patch
also fixes rare bugs that I found by inspection (see the patch itself).
I'm selling this as a point in favor of the patch.

Patch 3 finally introduces the new command.  The patch is by far
the simplest of the three.

 migration-exec.c |   56 ++++++++++++++++++++++-----
 migration-tcp.c  |    8 +---
 migration.c      |  111 ++++++++++++++++++++++++++++++++++++++---------------
 migration.h      |   26 +++++++++---
 qemu-monitor.hx  |    8 ++++
 5 files changed, 153 insertions(+), 56 deletions(-)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]