
On Thu, Feb 20, 2014 at 10:30:31AM +0800, Qiao Nuohan wrote:
--memory-only option is introduced without compression supported. Therefore, this is a freature regression of virsh dump. Now qemu has support dumping memory in kdump-compressed format. This patch is used to add "--compress" and "[--compression-format] <string>" to "virsh dump --memory-only" and send dump-guest-memory command to qemu with dump format specified to one of elf, kdump-zlib, kdump-lzo and kdump-snappy.
Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com> --- include/libvirt/libvirt.h.in | 19 ++++++++++++++----- src/qemu/qemu_driver.c | 20 ++++++++++++++++---- src/qemu/qemu_monitor.c | 6 +++--- src/qemu/qemu_monitor.h | 3 ++- src/qemu/qemu_monitor_json.c | 4 +++- src/qemu/qemu_monitor_json.h | 3 ++- tests/qemumonitorjsontest.c | 2 +- tools/virsh-domain.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 83 insertions(+), 16 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 295d551..df62918 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -1173,11 +1173,20 @@ typedef virDomainMemoryStatStruct *virDomainMemoryStatPtr;
/* Domain core dump flags. */ typedef enum { - VIR_DUMP_CRASH = (1 << 0), /* crash after dump */ - VIR_DUMP_LIVE = (1 << 1), /* live dump */ - VIR_DUMP_BYPASS_CACHE = (1 << 2), /* avoid file system cache pollution */ - VIR_DUMP_RESET = (1 << 3), /* reset domain after dump finishes */ - VIR_DUMP_MEMORY_ONLY = (1 << 4), /* use dump-guest-memory */ + VIR_DUMP_CRASH = (1 << 0), /* crash after dump */ + VIR_DUMP_LIVE = (1 << 1), /* live dump */ + VIR_DUMP_BYPASS_CACHE = (1 << 2), /* avoid file system cache pollution */ + VIR_DUMP_RESET = (1 << 3), /* reset domain after dump finishes */ + VIR_DUMP_MEMORY_ONLY = (1 << 4), /* use dump-guest-memory */ + VIR_DUMP_COMPRESS_ZLIB = (1 << 5), /* dump guest memory in + kdump-compressed format, with + zlib-compressed */ + VIR_DUMP_COMPRESS_LZO = (1 << 6), /* dump guest memory in + kdump-compressed format, with + lzo-compressed */ + VIR_DUMP_COMPRESS_SNAPPY = (1 << 7), /* dump guest memory in + kdump-compressed format, with + snappy-compressed */ } virDomainCoreDumpFlags;
I'm not really a fan of using flags for this, since all these new flags are mutually exclusive. This is a strong indication that they should not be flags, and instead be a separate parametere. So IMHO if we wnat to be able to specify a dump format we should have an explicit 'int dumpformat' parameter for it. Yes, I know this would involve a new API. Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|