
On Tue, Feb 25, 2014 at 17:54:30 +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 | 15 ++++++++++++++- src/driver.h | 3 ++- src/libvirt.c | 10 ++++++++-- src/qemu/qemu_driver.c | 30 +++++++++++++++++++++-------- 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 ++- src/remote/remote_protocol.x | 1 + src/test/test_driver.c | 12 +++++++++++- tests/qemumonitorjsontest.c | 2 +- tools/virsh-domain.c | 45 +++++++++++++++++++++++++++++++++++++++++++- 12 files changed, 113 insertions(+), 21 deletions(-)
diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 295d551..aae3c49 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -1180,6 +1180,18 @@ typedef enum { VIR_DUMP_MEMORY_ONLY = (1 << 4), /* use dump-guest-memory */ } virDomainCoreDumpFlags;
+typedef enum { + VIR_MEMORY_DUMP_COMPRESS_ZLIB = 1, /* dump guest memory in + kdump-compressed format, with + zlib-compressed */ + VIR_MEMORY_DUMP_COMPRESS_LZO = 2, /* dump guest memory in + kdump-compressed format, with + lzo-compressed */ + VIR_MEMORY_DUMP_COMPRESS_SNAPPY = 3, /* dump guest memory in + kdump-compressed format, with + snappy-compressed */ +} virMemoryDumpFormat; + /* Domain migration flags. */ typedef enum { VIR_MIGRATE_LIVE = (1 << 0), /* live migration */ @@ -1728,7 +1740,8 @@ int virDomainManagedSaveRemove(virDomainPtr dom, */ int virDomainCoreDump (virDomainPtr domain, const char *to, - unsigned int flags); + unsigned int flags, + const unsigned int memory_dump_format);
This is not allowed and I believe "make syntax-check" should fail on the corresponding change to remote_protocol.x. If you want to add a new parameter to an existing API, you have keep the API as is and instead create a new API with a different name that will have all the parameters you need. Jirka