Re: [libvirt] [PATCH v2 1/2] make qemu dump memory in kdump-compressed format

2014-02-26 Thread Qiao Nuohan

On 02/25/2014 06:56 PM, Jiri Denemark wrote:

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 Nuohanqiaonuo...@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.


Hello Jirka,

Thanks for pointing it out for me, I finally found it's libvirt's policy never
to change a committed public API. But driver handling methods are allowed to be
changed, am I right?

--
Regards
Qiao Nuohan

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 0/2] support dumping guest memory in compressed format

2014-02-25 Thread Qiao Nuohan

dumping guest's memroy is introduced without compression supported, and this is
a freature regression of 'virsh dump --memory-only'. This patchset is used to
add support in libvirt side to make qemu dump guest's memory in kdump-compressed
format and please refer the following address to see implementation of the qemu
side, the lastest version of qemu side is v9(ready for being queued).

http://lists.nongnu.org/archive/html/qemu-devel/2014-02/msg03016.html

ChangLog:
Changes from v1 to v2:
1. address Daniel P. Berrange's comment about using a new parameter to replace
   flags like VIR_DUMP_COMPRESS_ZLIB.

qiaonuohan (2):
  make qemu dump memory in kdump-compressed format
  add dump_memory_format in qemu.conf

 include/libvirt/libvirt.h.in   | 15 +-
 src/driver.h   |  3 +-
 src/libvirt.c  | 10 +--
 src/qemu/libvirtd_qemu.aug |  1 +
 src/qemu/qemu.conf | 13 +++-
 src/qemu/qemu_conf.c   |  3 ++
 src/qemu/qemu_conf.h   |  2 ++
 src/qemu/qemu_driver.c | 61 +-
 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/qemu/test_libvirtd_qemu.aug.in |  1 +
 src/remote/remote_protocol.x   |  1 +
 src/test/test_driver.c | 12 +++-
 tests/qemumonitorjsontest.c|  2 +-
 tools/virsh-domain.c   | 45 +++-
 17 files changed, 163 insertions(+), 22 deletions(-)

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v2 1/2] make qemu dump memory in kdump-compressed format

2014-02-25 Thread Qiao Nuohan

--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 qiaonuo...@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);


 /*
  * Screenshot of current domain console
diff --git a/src/driver.h b/src/driver.h
index 5f4cd8d..c228fd0 100644
--- a/src/driver.h
+++ b/src/driver.h
@@ -303,7 +303,8 @@ typedef int
 typedef int
 (*virDrvDomainCoreDump)(virDomainPtr domain,
 const char *to,
-unsigned int flags);
+unsigned int flags,
+const unsigned int memory_dump_format);

 typedef char *
 (*virDrvDomainScreenshot)(virDomainPtr domain,
diff --git a/src/libvirt.c b/src/libvirt.c
index 9cc5b1c..0659baf 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -2916,6 +2916,7 @@ error:
  * @domain: a domain object
  * @to: path for the core file
  * @flags: bitwise-OR of virDomainCoreDumpFlags
+ * @memory_dump_format: format of guest memory's dump
  *
  * This method will dump the core of a domain on a given file for analysis.
  * Note that for remote Xen Daemon the file path will be interpreted in
@@ -2934,10 +2935,14 @@ error:
  * or fail if it cannot do so for the given system; this can allow less
  * pressure on file system cache, but also risks slowing saves to NFS.
  *
+ * when @flags includes VIR_DUMP_MEMORY_ONLY and memory_dump_format is set,
+ * libvirt will ask qemu dump guest's memory in kdump-compressed format.
+ *
  * Returns 0 in case of success and -1 in case of failure.
  */
 int
-virDomainCoreDump(virDomainPtr domain, const char *to, unsigned int flags)
+virDomainCoreDump(virDomainPtr domain, const char *to, unsigned int flags,
+  const unsigned int memory_dump_format)
 {
 virConnectPtr conn;

@@ -2980,7 +2985,8 @@ virDomainCoreDump(virDomainPtr domain, const char *to, 
unsigned int flags)

 goto error;
 }

-ret = conn-driver-domainCoreDump(domain, absolute_to, flags);
+ret = conn-driver-domainCoreDump(domain, absolute_to, flags,
+   memory_dump_format);

 VIR_FREE(absolute_to);

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 59e018d..7b6fa43 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3383,7 +3383,8 @@ cleanup:
 }

 static int qemuDumpToFd(virQEMUDriverPtr driver, virDomainObjPtr vm,
-int fd, enum qemuDomainAsyncJob asyncJob)
+int fd, enum qemuDomainAsyncJob asyncJob

[libvirt] add dump_memory_format in qemu.conf

2014-02-25 Thread Qiao Nuohan

This patch is used to add dump_memory_format to qemu.conf and libvirt will use
it to specify the default format in which qemu dumps guest's memory. But when
--compress is specified with virsh dump --memory-only, the format configured
by dump_memory_format will be overrided. dump_memory_format can one of elf,
kdump-zlib, kdump-lzo and kdump-snappy. And elf is the default value.

Signed-off-by: Qiao Nuohan qiaonuo...@cn.fujitsu.com
---
 src/qemu/libvirtd_qemu.aug |  1 +
 src/qemu/qemu.conf | 13 -
 src/qemu/qemu_conf.c   |  3 +++
 src/qemu/qemu_conf.h   |  2 ++
 src/qemu/qemu_driver.c | 37 ++---
 src/qemu/test_libvirtd_qemu.aug.in |  1 +
 6 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index a9ff421..d3704fc 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -61,6 +61,7 @@ module Libvirtd_qemu =
let save_entry =  str_entry save_image_format
  | str_entry dump_image_format
  | str_entry snapshot_image_format
+ | str_entry dump_memory_format
  | str_entry auto_dump_path
  | bool_entry auto_dump_bypass_cache
  | bool_entry auto_start_bypass_cache
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index e436084..148a6bc 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -292,7 +292,8 @@
 # dump_image_format is used when you use 'virsh dump' at emergency
 # crashdump, and if the specified dump_image_format is not valid, or
 # the requested compression program can't be found, this falls
-# back to raw compression.
+# back to raw compression. Note, dump_image_format doesn't work when you use
+# virsh dump --memory-only.
 #
 # snapshot_image_format specifies the compression algorithm of the memory save
 # image when an external snapshot of a domain is taken. This does not apply
@@ -303,6 +304,16 @@
 #dump_image_format = raw
 #snapshot_image_format = raw

+# Qemu can dump guest's memory in elf format or in kdump-compressed format, and
+# the compression of kdump_compressed format can be zlib/lzo/snappy.
+#
+# dump_memory_format is used to specify the format in which qemu dumps guest's
+# memory. However, if --compress is specified with 'virsh dump 
--memory-only',
+# dump_memory_format will not work.
+# dump_memory_format can be elf, kdump-zlib, kdump-lzo and kdump-snappy.
+#
+#dump_memory_format = elf
+
 # When a domain is configured to be auto-dumped when libvirtd receives a
 # watchdog event from qemu guest, libvirtd will save dump files in directory
 # specified by auto_dump_path. Default value is /var/lib/libvirt/qemu/dump
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index ecaaf81..7d225da 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -296,6 +296,7 @@ static void virQEMUDriverConfigDispose(void *obj)

 VIR_FREE(cfg-saveImageFormat);
 VIR_FREE(cfg-dumpImageFormat);
+VIR_FREE(cfg-dumpMemoryFormat);
 VIR_FREE(cfg-autoDumpPath);

 virStringFreeList(cfg-securityDriverNames);
@@ -548,6 +549,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
 GET_VALUE_STR(dump_image_format, cfg-dumpImageFormat);
 GET_VALUE_STR(snapshot_image_format, cfg-snapshotImageFormat);

+GET_VALUE_STR(dump_memory_format, cfg-dumpMemoryFormat);
+
 GET_VALUE_STR(auto_dump_path, cfg-autoDumpPath);
 GET_VALUE_BOOL(auto_dump_bypass_cache, cfg-autoDumpBypassCache);
 GET_VALUE_BOOL(auto_start_bypass_cache, cfg-autoStartBypassCache);
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 1f44a76..97b0f67 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -149,6 +149,8 @@ struct _virQEMUDriverConfig {
 char *dumpImageFormat;
 char *snapshotImageFormat;

+char *dumpMemoryFormat;
+
 char *autoDumpPath;
 bool autoDumpBypassCache;
 bool autoStartBypassCache;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 7b6fa43..99df954 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3410,6 +3410,21 @@ static int qemuDumpToFd(virQEMUDriverPtr driver, 
virDomainObjPtr vm,

 return ret;
 }

+typedef enum {
+QEMU_DUMP_MEMORY_FORMAT_ELF = 0,
+QEMU_DUMP_MEMORY_FORMAT_KDUMP_ZLIB = 1,
+QEMU_DUMP_MEMORY_FORMAT_KDUMP_LZO = 2,
+QEMU_DUMP_MEMORY_FORMAT_KDUMP_SNAPPY = 3,
+QEMU_DUMP_MEMORY_FORMAT_LAST
+} virQEMUDumpMemoryFormat;
+
+VIR_ENUM_DECL(qemuDumpMemoryFormat)
+VIR_ENUM_IMPL(qemuDumpMemoryFormat, QEMU_DUMP_MEMORY_FORMAT_LAST,
+  elf,
+  kdump-zlib,
+  kdump-lzo,
+  kdump-snappy)
+
 static int
 doCoreDump(virQEMUDriverPtr driver,
virDomainObjPtr vm,
@@ -3423,7 +3438,9 @@ doCoreDump(virQEMUDriverPtr driver,
 virFileWrapperFdPtr wrapperFd = NULL;
 int directFlag = 0;
 unsigned int flags

Re: [libvirt] add dump_memory_format in qemu.conf

2014-02-25 Thread Qiao Nuohan

On 02/25/2014 05:55 PM, Qiao Nuohan wrote:

This patch is used to add dump_memory_format to qemu.conf and libvirt will use
it to specify the default format in which qemu dumps guest's memory. But when
--compress is specified with virsh dump --memory-only, the format configured
by dump_memory_format will be overrided. dump_memory_format can one of elf,
kdump-zlib, kdump-lzo and kdump-snappy. And elf is the default value.

Signed-off-by: Qiao Nuohan qiaonuo...@cn.fujitsu.com


Sorry, the title should be

[PATCH v2 2/2] add dump_memory_format in qemu.conf

--
Regards
Qiao Nuohan

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v1 1/2] make qemu dump memory in kdump-compressed format

2014-02-24 Thread Qiao Nuohan

On 02/24/2014 06:30 PM, Daniel P. Berrange wrote:

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 Nuohanqiaonuo...@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.


I thought flag would be better, but now I know adding new parameter is
preferred. Thanks for point it out.



Regards,
Daniel



--
Regards
Qiao Nuohan

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH v1 0/2] support dumping guest memory in compressed format

2014-02-23 Thread Qiao Nuohan

ping...

On 02/20/2014 10:28 AM, Qiao Nuohan wrote:

dumping guest's memroy is introduced without compression supported, and this is
a freature regression of 'virsh dump --memory-only'. This patchset is used to
add support in libvirt side to make qemu dump guest's memory in kdump-compressed
format and please refer the following address to see implementation of the qemu
side, the lastest version of qemu side is v9(ready for being queued).

http://lists.nongnu.org/archive/html/qemu-devel/2014-02/msg03016.html

qiaonuohan (2):
make qemu dump memory in kdump-compressed format
add dump_memory_format in qemu.conf

include/libvirt/libvirt.h.in | 19 ++
src/qemu/libvirtd_qemu.aug | 1 +
src/qemu/qemu.conf | 13 +-
src/qemu/qemu_conf.c | 3 +++
src/qemu/qemu_conf.h | 2 ++
src/qemu/qemu_driver.c | 51 +++---
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/qemu/test_libvirtd_qemu.aug.in | 1 +
tests/qemumonitorjsontest.c | 2 +-
tools/virsh-domain.c | 42 +++
13 files changed, 133 insertions(+), 17 deletions(-)





--
Regards
Qiao Nuohan

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v1 0/2] support dumping guest memory in compressed format

2014-02-19 Thread Qiao Nuohan

dumping guest's memroy is introduced without compression supported, and this is
a freature regression of 'virsh dump --memory-only'. This patchset is used to
add support in libvirt side to make qemu dump guest's memory in kdump-compressed
format and please refer the following address to see implementation of the qemu
side, the lastest version of qemu side is v9(ready for being queued).

http://lists.nongnu.org/archive/html/qemu-devel/2014-02/msg03016.html

qiaonuohan (2):
  make qemu dump memory in kdump-compressed format
  add dump_memory_format in qemu.conf

 include/libvirt/libvirt.h.in   | 19 ++
 src/qemu/libvirtd_qemu.aug |  1 +
 src/qemu/qemu.conf | 13 +-
 src/qemu/qemu_conf.c   |  3 +++
 src/qemu/qemu_conf.h   |  2 ++
 src/qemu/qemu_driver.c | 51 +++---
 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/qemu/test_libvirtd_qemu.aug.in |  1 +
 tests/qemumonitorjsontest.c|  2 +-
 tools/virsh-domain.c   | 42 +++
 13 files changed, 133 insertions(+), 17 deletions(-)

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH v1 1/2] make qemu dump memory in kdump-compressed format

2014-02-19 Thread Qiao Nuohan

--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 qiaonuo...@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;

 /* Domain migration flags. */
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 59e018d..19b4dd2 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3383,7 +3383,8 @@ cleanup:
 }

 static int qemuDumpToFd(virQEMUDriverPtr driver, virDomainObjPtr vm,
-int fd, enum qemuDomainAsyncJob asyncJob)
+int fd, enum qemuDomainAsyncJob asyncJob,
+const char* dump_format)
 {
 qemuDomainObjPrivatePtr priv = vm-privateData;
 int ret = -1;
@@ -3403,7 +3404,7 @@ static int qemuDumpToFd(virQEMUDriverPtr driver, 
virDomainObjPtr vm,

 if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob)  0)
 return -1;

-ret = qemuMonitorDumpToFd(priv-mon, fd);
+ret = qemuMonitorDumpToFd(priv-mon, fd, dump_format);
 qemuDomainObjExitMonitor(driver, vm);

 return ret;
@@ -3421,6 +3422,7 @@ doCoreDump(virQEMUDriverPtr driver,
 virFileWrapperFdPtr wrapperFd = NULL;
 int directFlag = 0;
 unsigned int flags = VIR_FILE_WRAPPER_NON_BLOCKING;
+const char *dump_format;

 /* Create an empty file with appropriate ownership.  */
 if (dump_flags  VIR_DUMP_BYPASS_CACHE) {
@@ -3444,7 +3446,16 @@ doCoreDump(virQEMUDriverPtr driver,
 goto cleanup;

 if (dump_flags  VIR_DUMP_MEMORY_ONLY) {
-ret = qemuDumpToFd(driver, vm, fd, QEMU_ASYNC_JOB_DUMP);
+if (dump_flags  VIR_DUMP_COMPRESS_ZLIB)
+dump_format = kdump-zlib;
+else if (dump_flags  VIR_DUMP_COMPRESS_LZO)
+dump_format = kdump-lzo;
+else if (dump_flags  VIR_DUMP_COMPRESS_SNAPPY)
+dump_format = kdump-snappy;
+else
+dump_format = elf;
+ret = qemuDumpToFd(driver, vm, fd, QEMU_ASYNC_JOB_DUMP,
+   dump_format);
 } else {
 ret = qemuMigrationToFile(driver, vm, fd, 0, path,
   qemuCompressProgramName(compress), false,
@@ -3520,7 +3531,8 @@ static int qemuDomainCoreDump(virDomainPtr dom,

 virCheckFlags(VIR_DUMP_LIVE | VIR_DUMP_CRASH |
   VIR_DUMP_BYPASS_CACHE | VIR_DUMP_RESET |
-  VIR_DUMP_MEMORY_ONLY, -1);
+  VIR_DUMP_MEMORY_ONLY | VIR_DUMP_COMPRESS_ZLIB |
+  VIR_DUMP_COMPRESS_LZO | VIR_DUMP_COMPRESS_SNAPPY, -1);

 if (!(vm = qemuDomObjFromDomain(dom)))
 return -1;
diff --git a/src/qemu/qemu_monitor.c b/src/qemu

[libvirt] [PATCH v1 2/2] add dump_memory_format in qemu.conf

2014-02-19 Thread Qiao Nuohan

This patch is used to add dump_memory_format to qemu.conf and libvirt will use
it to specify the default format in which qemu dumps guest's memory. But when
--compress is specified with virsh dump --memory-only, the format configured
by dump_memory_format will be overrided. dump_memory_format can one of elf,
kdump-zlib, kdump-lzo and kdump-snappy. And elf is the default value.

Signed-off-by: Qiao Nuohan qiaonuo...@cn.fujitsu.com
---
 src/qemu/libvirtd_qemu.aug |  1 +
 src/qemu/qemu.conf | 13 -
 src/qemu/qemu_conf.c   |  3 +++
 src/qemu/qemu_conf.h   |  2 ++
 src/qemu/qemu_driver.c | 37 ++---
 src/qemu/test_libvirtd_qemu.aug.in |  1 +
 6 files changed, 53 insertions(+), 4 deletions(-)

diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index a9ff421..d3704fc 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -61,6 +61,7 @@ module Libvirtd_qemu =
let save_entry =  str_entry save_image_format
  | str_entry dump_image_format
  | str_entry snapshot_image_format
+ | str_entry dump_memory_format
  | str_entry auto_dump_path
  | bool_entry auto_dump_bypass_cache
  | bool_entry auto_start_bypass_cache
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index e436084..148a6bc 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -292,7 +292,8 @@
 # dump_image_format is used when you use 'virsh dump' at emergency
 # crashdump, and if the specified dump_image_format is not valid, or
 # the requested compression program can't be found, this falls
-# back to raw compression.
+# back to raw compression. Note, dump_image_format doesn't work when you use
+# virsh dump --memory-only.
 #
 # snapshot_image_format specifies the compression algorithm of the memory save
 # image when an external snapshot of a domain is taken. This does not apply
@@ -303,6 +304,16 @@
 #dump_image_format = raw
 #snapshot_image_format = raw

+# Qemu can dump guest's memory in elf format or in kdump-compressed format, and
+# the compression of kdump_compressed format can be zlib/lzo/snappy.
+#
+# dump_memory_format is used to specify the format in which qemu dumps guest's
+# memory. However, if --compress is specified with 'virsh dump 
--memory-only',
+# dump_memory_format will not work.
+# dump_memory_format can be elf, kdump-zlib, kdump-lzo and kdump-snappy.
+#
+#dump_memory_format = elf
+
 # When a domain is configured to be auto-dumped when libvirtd receives a
 # watchdog event from qemu guest, libvirtd will save dump files in directory
 # specified by auto_dump_path. Default value is /var/lib/libvirt/qemu/dump
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index ecaaf81..7d225da 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -296,6 +296,7 @@ static void virQEMUDriverConfigDispose(void *obj)

 VIR_FREE(cfg-saveImageFormat);
 VIR_FREE(cfg-dumpImageFormat);
+VIR_FREE(cfg-dumpMemoryFormat);
 VIR_FREE(cfg-autoDumpPath);

 virStringFreeList(cfg-securityDriverNames);
@@ -548,6 +549,8 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,
 GET_VALUE_STR(dump_image_format, cfg-dumpImageFormat);
 GET_VALUE_STR(snapshot_image_format, cfg-snapshotImageFormat);

+GET_VALUE_STR(dump_memory_format, cfg-dumpMemoryFormat);
+
 GET_VALUE_STR(auto_dump_path, cfg-autoDumpPath);
 GET_VALUE_BOOL(auto_dump_bypass_cache, cfg-autoDumpBypassCache);
 GET_VALUE_BOOL(auto_start_bypass_cache, cfg-autoStartBypassCache);
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 1f44a76..97b0f67 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -149,6 +149,8 @@ struct _virQEMUDriverConfig {
 char *dumpImageFormat;
 char *snapshotImageFormat;

+char *dumpMemoryFormat;
+
 char *autoDumpPath;
 bool autoDumpBypassCache;
 bool autoStartBypassCache;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 19b4dd2..c6f8ae9 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3410,6 +3410,21 @@ static int qemuDumpToFd(virQEMUDriverPtr driver, 
virDomainObjPtr vm,

 return ret;
 }

+typedef enum {
+QEMU_DUMP_MEMORY_FORMAT_ELF = 0,
+QEMU_DUMP_MEMORY_FORMAT_KDUMP_ZLIB = 1,
+QEMU_DUMP_MEMORY_FORMAT_KDUMP_LZO = 2,
+QEMU_DUMP_MEMORY_FORMAT_KDUMP_SNAPPY = 3,
+QEMU_DUMP_MEMORY_FORMAT_LAST
+} virQEMUDumpMemoryFormat;
+
+VIR_ENUM_DECL(qemuDumpMemoryFormat)
+VIR_ENUM_IMPL(qemuDumpMemoryFormat, QEMU_DUMP_MEMORY_FORMAT_LAST,
+  elf,
+  kdump-zlib,
+  kdump-lzo,
+  kdump-snappy)
+
 static int
 doCoreDump(virQEMUDriverPtr driver,
virDomainObjPtr vm,
@@ -3422,7 +3437,9 @@ doCoreDump(virQEMUDriverPtr driver,
 virFileWrapperFdPtr wrapperFd = NULL;
 int directFlag = 0;
 unsigned int flags

Re: [libvirt] [PATCH RFC 0/2] support compression with dumping guest memory

2014-02-12 Thread Qiao Nuohan

On 01/29/2014 10:04 AM, qiaonuohan wrote:

--memory-only option is introduced without compression supported. Therefore,
this is a freature regression of virsh dump. This patchset is used to add
compression support in libvirt side and please refer the following address to
see the qemu side, the lastest version of qemu side v7(ready for comment now).

http://lists.gnu.org/archive/html/qemu-devel/2014-01/msg03669.html

qiaonuohan (2):
   support compression when --memory-only option is specified
   support configuring the format of dumping memory in qemu.conf

  include/libvirt/libvirt.h.in   | 18 +
  src/libvirt.c  | 15 +++
  src/qemu/libvirtd_qemu.aug |  1 +
  src/qemu/qemu.conf |  6 +
  src/qemu/qemu_conf.c   |  2 ++
  src/qemu/qemu_conf.h   |  1 +
  src/qemu/qemu_driver.c | 52 +++---
  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/qemu/test_libvirtd_qemu.aug.in |  1 +
  tests/qemumonitorjsontest.c|  2 +-
  tools/virsh-domain.c   | 29 +
  14 files changed, 127 insertions(+), 16 deletions(-)



Hello

Do you have some comments on my patches?

--
Regards
Qiao Nuohan

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH RFC 2/2] support configuring the format of dumping memory in qemu.conf

2014-02-10 Thread Qiao Nuohan

On 01/29/2014 07:52 PM, Daniel P. Berrange wrote:

On Wed, Jan 29, 2014 at 10:15:36AM +0800, Qiao Nuohan wrote:

  This patch is used to add dump_memory_format to qemu.conf and make the
  specified format as the default dump format of 'virsh dump --memory-only'.
  But when --compress is specified with dump command, the format configured
  by dump_memory_format will be overrided. dump_memory_format can one of elf,
  kdump-zlib, kdump-lzo and kdump-snappy. And elf is the default value.

I think it is pretty horribly misleading to applications if they
leave out the VIR_DUMP_COMPRESS flag when invoking the API but
libvirt then asks for compression anyway. If an application is
only able to cope with uncompressed format then they are screwed
by the host level setting which they can't see.


Setting in qemu.conf can also be uncompressed format. The problem is when
qemu.conf is set to compressed format, but application can only deal with
uncompressed format, then virsh dump *need an option* to make qemu dump an
uncompressed core.

Maybe I misunderstand your comments, please correct me. Thanks!



Daniel



--
Regards
Qiao Nuohan

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH RFC 0/2] support compression with dumping guest memory

2014-01-28 Thread Qiao Nuohan

--memory-only option is introduced without compression supported. Therefore,
this is a freature regression of virsh dump. This patchset is used to add
compression support in libvirt side and please refer the following address to
see the qemu side, the lastest version of qemu side v7(ready for comment now).

http://lists.gnu.org/archive/html/qemu-devel/2014-01/msg03669.html

qiaonuohan (2):
  support compression when --memory-only option is specified
  support configuring the format of dumping memory in qemu.conf

 include/libvirt/libvirt.h.in   | 18 +
 src/libvirt.c  | 15 +++
 src/qemu/libvirtd_qemu.aug |  1 +
 src/qemu/qemu.conf |  6 +
 src/qemu/qemu_conf.c   |  2 ++
 src/qemu/qemu_conf.h   |  1 +
 src/qemu/qemu_driver.c | 52 +++---
 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/qemu/test_libvirtd_qemu.aug.in |  1 +
 tests/qemumonitorjsontest.c|  2 +-
 tools/virsh-domain.c   | 29 +
 14 files changed, 127 insertions(+), 16 deletions(-)

--
1.8.3.1


--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

[libvirt] [PATCH RFC 1/2] support compression when --memory-only option is specified

2014-01-28 Thread Qiao Nuohan

--memory-only option is introduced without compression supported. Therefore,
this is a freature regression of virsh dump. This patch is used to add
--compress and [--compression-format] string to the command
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 qiaonuo...@cn.fujitsu.com
---
 include/libvirt/libvirt.h.in | 18 +-
 src/libvirt.c| 15 +++
 src/qemu/qemu_driver.c   | 21 +
 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 | 29 +
 9 files changed, 85 insertions(+), 16 deletions(-)

diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in
index a448411..cb8989e 100644
--- a/include/libvirt/libvirt.h.in
+++ b/include/libvirt/libvirt.h.in
@@ -1165,11 +1165,19 @@ 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= (1  5), /* dump guest memory in
+kdump-compressed format */
+VIR_DUMP_COMPRESS_ZLIB   = (1  6), /* kdump-compressed format, with
+   zlib-compressed */
+VIR_DUMP_COMPRESS_LZO= (1  7), /* kdump-compressed format, with
+   lzo-compressed */
+VIR_DUMP_COMPRESS_SNAPPY = (1  8), /* kdump-compressed format, with
+   snappy-compressed */
 } virDomainCoreDumpFlags;

 /* Domain migration flags. */
diff --git a/src/libvirt.c b/src/libvirt.c
index 666526e..318296e 100644
--- a/src/libvirt.c
+++ b/src/libvirt.c
@@ -2969,6 +2969,21 @@ virDomainCoreDump(virDomainPtr domain, const char *to, 
unsigned int flags)

 goto error;
 }

+if ((flags  VIR_DUMP_COMPRESS)  !(flags  VIR_DUMP_MEMORY_ONLY)) {
+virReportInvalidArg(flags, %s,
+_(compress flag cannot be set without memory-only 

+  flag));
+goto error;
+}
+
+if ((flags  (VIR_DUMP_COMPRESS_ZLIB | VIR_DUMP_COMPRESS_LZO |
+  VIR_DUMP_COMPRESS_SNAPPY))  !(flags  VIR_DUMP_COMPRESS)) {
+virReportInvalidArg(flags, %s,
+_(compression-format cannot be set without 
+  compress flag));
+goto error;
+}
+
 if (conn-driver-domainCoreDump) {
 int ret;
 char *absolute_to;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index df4f5b5..c4e1aef 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3380,7 +3380,8 @@ cleanup:
 }

 static int qemuDumpToFd(virQEMUDriverPtr driver, virDomainObjPtr vm,
-int fd, enum qemuDomainAsyncJob asyncJob)
+int fd, enum qemuDomainAsyncJob asyncJob,
+const char* dump_format)
 {
 qemuDomainObjPrivatePtr priv = vm-privateData;
 int ret = -1;
@@ -3400,7 +3401,7 @@ static int qemuDumpToFd(virQEMUDriverPtr driver, 
virDomainObjPtr vm,

 if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob)  0)
 return -1;

-ret = qemuMonitorDumpToFd(priv-mon, fd);
+ret = qemuMonitorDumpToFd(priv-mon, fd, dump_format);
 qemuDomainObjExitMonitor(driver, vm);

 return ret;
@@ -3418,6 +3419,7 @@ doCoreDump(virQEMUDriverPtr driver,
 virFileWrapperFdPtr wrapperFd = NULL;
 int directFlag = 0;
 unsigned int flags = VIR_FILE_WRAPPER_NON_BLOCKING;
+const char *dump_format;

 /* Create an empty file with appropriate ownership.  */
 if (dump_flags  VIR_DUMP_BYPASS_CACHE) {
@@ -3441,7 +3443,16 @@ doCoreDump(virQEMUDriverPtr driver,
 goto cleanup;

 if (dump_flags  VIR_DUMP_MEMORY_ONLY) {
-ret = qemuDumpToFd(driver, vm, fd, QEMU_ASYNC_JOB_DUMP);
+if (dump_flags  VIR_DUMP_COMPRESS_ZLIB)
+dump_format = kdump-zlib;
+else if (dump_flags  VIR_DUMP_COMPRESS_LZO)
+dump_format = kdump-lzo;
+else if (dump_flags

[libvirt] [PATCH RFC 2/2] support configuring the format of dumping memory in qemu.conf

2014-01-28 Thread Qiao Nuohan

This patch is used to add dump_memory_format to qemu.conf and make the
specified format as the default dump format of 'virsh dump --memory-only'.
But when --compress is specified with dump command, the format configured
by dump_memory_format will be overrided. dump_memory_format can one of elf,
kdump-zlib, kdump-lzo and kdump-snappy. And elf is the default value.

Signed-off-by: Qiao Nuohan qiaonuo...@cn.fujitsu.com
---
 src/qemu/libvirtd_qemu.aug |  1 +
 src/qemu/qemu.conf |  6 ++
 src/qemu/qemu_conf.c   |  2 ++
 src/qemu/qemu_conf.h   |  1 +
 src/qemu/qemu_driver.c | 37 ++---
 src/qemu/test_libvirtd_qemu.aug.in |  1 +
 6 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/src/qemu/libvirtd_qemu.aug b/src/qemu/libvirtd_qemu.aug
index a9ff421..25737e8 100644
--- a/src/qemu/libvirtd_qemu.aug
+++ b/src/qemu/libvirtd_qemu.aug
@@ -60,6 +60,7 @@ module Libvirtd_qemu =

let save_entry =  str_entry save_image_format
  | str_entry dump_image_format
+ | str_entry dump_memory_format
  | str_entry snapshot_image_format
  | str_entry auto_dump_path
  | bool_entry auto_dump_bypass_cache
diff --git a/src/qemu/qemu.conf b/src/qemu/qemu.conf
index 17f1b10..8dc9d29 100644
--- a/src/qemu/qemu.conf
+++ b/src/qemu/qemu.conf
@@ -294,6 +294,11 @@
 # the requested compression program can't be found, this falls
 # back to raw compression.
 #
+# dump_memory_format is used when you use 'virsh dump --memory-only' to dump
+# guest memory, and if specifing format with 'virsh dump --memory-only',
+# dump_memory_format will not work. dump_memory_format can be elf, kdump-zlib,
+# kdump-lzo and kdump-snappy.
+#
 # snapshot_image_format specifies the compression algorithm of the memory save
 # image when an external snapshot of a domain is taken. This does not apply
 # on disk image format. It is an error if the specified format isn't valid,
@@ -301,6 +306,7 @@
 #
 #save_image_format = raw
 #dump_image_format = raw
+#dump_memory_format = elf
 #snapshot_image_format = raw

 # When a domain is configured to be auto-dumped when libvirtd receives a
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 4378791..7893e31 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -296,6 +296,7 @@ static void virQEMUDriverConfigDispose(void *obj)

 VIR_FREE(cfg-saveImageFormat);
 VIR_FREE(cfg-dumpImageFormat);
+VIR_FREE(cfg-dumpMemoryFormat);
 VIR_FREE(cfg-autoDumpPath);

 virStringFreeList(cfg-securityDriverNames);
@@ -546,6 +547,7 @@ int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg,

 GET_VALUE_STR(save_image_format, cfg-saveImageFormat);
 GET_VALUE_STR(dump_image_format, cfg-dumpImageFormat);
+GET_VALUE_STR(dump_memory_format, cfg-dumpMemoryFormat);
 GET_VALUE_STR(snapshot_image_format, cfg-snapshotImageFormat);

 GET_VALUE_STR(auto_dump_path, cfg-autoDumpPath);
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index 1f44a76..3bb1935 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -147,6 +147,7 @@ struct _virQEMUDriverConfig {

 char *saveImageFormat;
 char *dumpImageFormat;
+char *dumpMemoryFormat;
 char *snapshotImageFormat;

 char *autoDumpPath;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index c4e1aef..06f39c0 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3407,6 +3407,21 @@ static int qemuDumpToFd(virQEMUDriverPtr driver, 
virDomainObjPtr vm,

 return ret;
 }

+typedef enum {
+QEMU_DUMP_MEMORY_FORMAT_ELF = 0,
+QEMU_DUMP_MEMORY_FORMAT_KDUMP_ZLIB = 1,
+QEMU_DUMP_MEMORY_FORMAT_KDUMP_LZO = 2,
+QEMU_DUMP_MEMORY_FORMAT_KDUMP_SNAPPY = 3,
+QEMU_DUMP_MEMORY_FORMAT_LAST
+} virQEMUDumpMemoryFormat;
+
+VIR_ENUM_DECL(qemuDumpMemoryCompression)
+VIR_ENUM_IMPL(qemuDumpMemoryCompression, QEMU_DUMP_MEMORY_FORMAT_LAST,
+  elf,
+  kdump-zlib,
+  kdump-lzo,
+  kdump-snappy)
+
 static int
 doCoreDump(virQEMUDriverPtr driver,
virDomainObjPtr vm,
@@ -3419,7 +3434,9 @@ doCoreDump(virQEMUDriverPtr driver,
 virFileWrapperFdPtr wrapperFd = NULL;
 int directFlag = 0;
 unsigned int flags = VIR_FILE_WRAPPER_NON_BLOCKING;
-const char *dump_format;
+const char *dump_format = elf;
+virQEMUDriverConfigPtr cfg = NULL;
+int dump_memory_format;

 /* Create an empty file with appropriate ownership.  */
 if (dump_flags  VIR_DUMP_BYPASS_CACHE) {
@@ -3449,8 +3466,22 @@ doCoreDump(virQEMUDriverPtr driver,
 dump_format = kdump-lzo;
 else if (dump_flags  VIR_DUMP_COMPRESS_SNAPPY)
 dump_format = kdump-snappy;
-else
-dump_format = elf;
+else {
+/* when --compress option is specified, qemu.conf will not work */
+cfg = virQEMUDriverGetConfig(driver

Re: [libvirt] [PATCH 0/2] support compression with dumping guest memory

2014-01-27 Thread Qiao Nuohan

Hello,

Do you have some comments on this?

On 01/21/2014 05:43 PM, qiaonuohan wrote:

--memory-only option is introduced without compression supported. Therefore,
this is a freature regression of virsh dump. This patchset is used to add
compression support in libvirt side and please refer the following address to
see the qemu side, the lastest version of qemu side v7(ready for comment now).

http://lists.gnu.org/archive/html/qemu-devel/2014-01/msg02139.html

qiaonuohan (2):
   support compression when --memory-only option is specified
   support configuring the format of dumping memory in qemu.conf

  include/libvirt/libvirt.h.in   | 18 +
  src/libvirt.c  | 15 +++
  src/qemu/libvirtd_qemu.aug |  1 +
  src/qemu/qemu.conf |  6 +
  src/qemu/qemu_conf.c   |  2 ++
  src/qemu/qemu_conf.h   |  1 +
  src/qemu/qemu_driver.c | 52 +++---
  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/qemu/test_libvirtd_qemu.aug.in |  1 +
  tests/qemumonitorjsontest.c|  2 +-
  tools/virsh-domain.c   | 29 +
  14 files changed, 127 insertions(+), 16 deletions(-)




--
Regards
Qiao Nuohan

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list