[libvirt] [PATCH v5 0/3] support dumping guest memory in compressed format

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 v4 to v5: 1. modify some restriction check Changes from v3 to v4: 1. dropping patch "add dump_memory_format in qemu.conf" 2. fix to follow some conventions Changes from v2 to v3: 1. address Jiri Denemark's comment about adding a new public API instead of changing an old one. 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 (3): add new virDomainCoreDumpWithFormat API add qemu support to virDomainCoreDumpWithFormat API allow "virsh dump --memory-only" specify dump format include/libvirt/libvirt.h.in | 31 ++++++++++++++ src/driver.h | 7 ++++ src/libvirt.c | 97 ++++++++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 5 +++ src/qemu/qemu_driver.c | 49 ++++++++++++++++++---- src/qemu/qemu_monitor.c | 7 ++-- src/qemu/qemu_monitor.h | 3 +- src/qemu/qemu_monitor_json.c | 4 +- src/qemu/qemu_monitor_json.h | 3 +- src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 15 ++++++- src/remote_protocol-structs | 7 ++++ src/test/test_driver.c | 20 +++++++-- tests/qemumonitorjsontest.c | 2 +- tools/virsh-domain.c | 45 +++++++++++++++++++- 15 files changed, 275 insertions(+), 21 deletions(-) -- 1.8.5.3

--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 adding new virDomainCoreDumpWithFormat API, so that the format in which qemu dump domain's memory can be specified. Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com> --- include/libvirt/libvirt.h.in | 31 ++++++++++++++ src/driver.h | 7 ++++ src/libvirt.c | 97 ++++++++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 5 +++ src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 15 ++++++- src/remote_protocol-structs | 7 ++++ src/test/test_driver.c | 20 +++++++-- 8 files changed, 179 insertions(+), 4 deletions(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 295d551..12d64ab 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -1180,6 +1180,29 @@ typedef enum { VIR_DUMP_MEMORY_ONLY = (1 << 4), /* use dump-guest-memory */ } virDomainCoreDumpFlags; +/** + * virDomainCoreDumpFormat: + * + * Values for specifying different formats of domain core dumps. + */ +typedef enum { + VIR_DUMP_FORMAT_RAW, /* dump guest memory in raw format */ + VIR_DUMP_FORMAT_KDUMP_ZLIB, /* dump guest memory in kdump-compressed + format, with zlib-compressed */ + VIR_DUMP_FORMAT_KDUMP_LZO, /* dump guest memory in kdump-compressed + format, with lzo-compressed */ + VIR_DUMP_FORMAT_KDUMP_SNAPPY, /* dump guest memory in kdump-compressed + format, with snappy-compressed */ +#ifdef VIR_ENUM_SENTINELS + VIR_DUMP_FORMAT_LAST + /* + * NB: this enum value will increase over time as new events are + * added to the libvirt API. It reflects the last state supported + * by this version of the libvirt API. + */ +#endif +} virDomainCoreDumpFormat; + /* Domain migration flags. */ typedef enum { VIR_MIGRATE_LIVE = (1 << 0), /* live migration */ @@ -1731,6 +1754,14 @@ int virDomainCoreDump (virDomainPtr domain, unsigned int flags); /* + * Domain core dump with format specified + */ +int virDomainCoreDumpWithFormat (virDomainPtr domain, + const char *to, + unsigned int dumpformat, + unsigned int flags); + +/* * Screenshot of current domain console */ char * virDomainScreenshot (virDomainPtr domain, diff --git a/src/driver.h b/src/driver.h index fbfaac4..d613f64 100644 --- a/src/driver.h +++ b/src/driver.h @@ -306,6 +306,12 @@ typedef int const char *to, unsigned int flags); +typedef int +(*virDrvDomainCoreDumpWithFormat)(virDomainPtr domain, + const char *to, + unsigned int dumpformat, + unsigned int flags); + typedef char * (*virDrvDomainScreenshot)(virDomainPtr domain, virStreamPtr stream, @@ -1200,6 +1206,7 @@ struct _virDriver { virDrvDomainSaveImageGetXMLDesc domainSaveImageGetXMLDesc; virDrvDomainSaveImageDefineXML domainSaveImageDefineXML; virDrvDomainCoreDump domainCoreDump; + virDrvDomainCoreDumpWithFormat domainCoreDumpWithFormat; virDrvDomainScreenshot domainScreenshot; virDrvDomainSetVcpus domainSetVcpus; virDrvDomainSetVcpusFlags domainSetVcpusFlags; diff --git a/src/libvirt.c b/src/libvirt.c index dcf6b53..77bf44f 100644 --- a/src/libvirt.c +++ b/src/libvirt.c @@ -2999,6 +2999,103 @@ error: return -1; } +/** + * virDomainCoreDumpWithFormat: + * @domain: a domain object + * @to: path for the core file + * @dumpformat: format of domain memory's dump + * @flags: bitwise-OR of virDomainCoreDumpFlags + * + * 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 + * the remote host. Hypervisors may require the user to manually ensure + * proper permissions on the file named by @to. + * + * If @flags includes VIR_DUMP_MEMORY_ONLY and dumpformat is set, libvirt + * will ask qemu dump domain's memory in kdump-compressed format. + * + * If @flags includes VIR_DUMP_CRASH, then leave the guest shut off with + * a crashed state after the dump completes. If @flags includes + * VIR_DUMP_LIVE, then make the core dump while continuing to allow + * the guest to run; otherwise, the guest is suspended during the dump. + * VIR_DUMP_RESET flag forces reset of the quest after dump. + * The above three flags are mutually exclusive. + * + * Additionally, if @flags includes VIR_DUMP_BYPASS_CACHE, then libvirt + * will attempt to bypass the file system cache while creating the file, + * 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. + * + * Returns 0 in case of success and -1 in case of failure. + */ +int +virDomainCoreDumpWithFormat(virDomainPtr domain, const char *to, unsigned int + dumpformat, unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(domain, "to=%s, flags=%x", to, flags); + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + conn = domain->conn; + + virCheckReadOnlyGoto(conn->flags, error); + virCheckNonNullArgGoto(to, error); + + if (dumpformat >= VIR_DUMP_FORMAT_LAST) { + virReportInvalidArg(flags, _("dumpformat '%d' is not supproted"), + dumpformat); + goto error; + } + + if ((flags & VIR_DUMP_CRASH) && (flags & VIR_DUMP_LIVE)) { + virReportInvalidArg(flags, "%s", + _("crash and live flags are mutually exclusive")); + goto error; + } + + if ((flags & VIR_DUMP_CRASH) && (flags & VIR_DUMP_RESET)) { + virReportInvalidArg(flags, "%s", + _("crash and reset flags are mutually exclusive")); + goto error; + } + + if ((flags & VIR_DUMP_LIVE) && (flags & VIR_DUMP_RESET)) { + virReportInvalidArg(flags, "%s", + _("live and reset flags are mutually exclusive")); + goto error; + } + + if (conn->driver->domainCoreDumpWithFormat) { + int ret; + char *absolute_to; + + /* We must absolutize the file path as the save is done out of process */ + if (virFileAbsPath(to, &absolute_to) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("could not build absolute core file path")); + goto error; + } + + ret = conn->driver->domainCoreDumpWithFormat(domain, absolute_to, + dumpformat, flags); + + VIR_FREE(absolute_to); + + if (ret < 0) + goto error; + return ret; + } + + virReportUnsupportedError(); + +error: + virDispatchError(domain->conn); + return -1; +} + /** * virDomainScreenshot: diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index 6ed6ce6..9ab0c92 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -645,5 +645,10 @@ LIBVIRT_1.2.1 { virConnectNetworkEventDeregisterAny; } LIBVIRT_1.1.3; +LIBVIRT_1.2.3 { + global: + virDomainCoreDumpWithFormat; +} LIBVIRT_1.2.1; + # .... define new API here using predicted next version number .... diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 955465a..0a15267 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -7516,6 +7516,7 @@ static virDriver remote_driver = { .domainSaveImageGetXMLDesc = remoteDomainSaveImageGetXMLDesc, /* 0.9.4 */ .domainSaveImageDefineXML = remoteDomainSaveImageDefineXML, /* 0.9.4 */ .domainCoreDump = remoteDomainCoreDump, /* 0.3.0 */ + .domainCoreDumpWithFormat = remoteDomainCoreDumpWithFormat, /* 1.2.3 */ .domainScreenshot = remoteDomainScreenshot, /* 0.9.2 */ .domainSetVcpus = remoteDomainSetVcpus, /* 0.3.0 */ .domainSetVcpusFlags = remoteDomainSetVcpusFlags, /* 0.8.5 */ diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index f1f2359..6c445cc 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -904,6 +904,13 @@ struct remote_domain_core_dump_args { unsigned int flags; }; +struct remote_domain_core_dump_with_format_args { + remote_nonnull_domain dom; + remote_nonnull_string to; + unsigned int dumpformat; + unsigned int flags; +}; + struct remote_domain_screenshot_args { remote_nonnull_domain dom; unsigned int screen; @@ -5262,5 +5269,11 @@ enum remote_procedure { * @generate: both * @acl: none */ - REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVED = 333 + REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVED = 333, + + /** + * @generate: both + * @acl: domain:core_dump + */ + REMOTE_PROC_DOMAIN_CORE_DUMP_WITH_FORMAT = 334 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 5636d55..0e2101c 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -557,6 +557,12 @@ struct remote_domain_core_dump_args { remote_nonnull_string to; u_int flags; }; +struct remote_domain_core_dump_with_format_args { + remote_nonnull_domain dom; + remote_nonnull_string to; + u_int dompformat; + u_int flags; +}; struct remote_domain_screenshot_args { remote_nonnull_domain dom; u_int screen; @@ -2755,4 +2761,5 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_EVENT_CALLBACK_BALLOON_CHANGE = 331, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_PMSUSPEND_DISK = 332, REMOTE_PROC_DOMAIN_EVENT_CALLBACK_DEVICE_REMOVED = 333, + REMOTE_PROC_DOMAIN_CORE_DUMP_WITH_FORMAT = 334, }; diff --git a/src/test/test_driver.c b/src/test/test_driver.c index b724f82..d465df1 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -2427,9 +2427,10 @@ testDomainRestore(virConnectPtr conn, return testDomainRestoreFlags(conn, path, NULL, 0); } -static int testDomainCoreDump(virDomainPtr domain, - const char *to, - unsigned int flags) +static int testDomainCoreDumpWithFormat(virDomainPtr domain, + const char *to, + unsigned int dumpformat, + unsigned int flags) { testConnPtr privconn = domain->conn->privateData; int fd = -1; @@ -2479,6 +2480,13 @@ static int testDomainCoreDump(virDomainPtr domain, } } + /* dump the core of "domain" to file "to" */ + if (dumpformat != VIR_DUMP_FORMAT_RAW) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("kdump-compressed format is not supported here")); + goto cleanup; + } + ret = 0; cleanup: VIR_FORCE_CLOSE(fd); @@ -2490,6 +2498,12 @@ cleanup: return ret; } +static int testDomainCoreDump(virDomainPtr domain, + const char *to, + unsigned int flags) { + return testDomainCoreDumpWithFormat(domain, to, VIR_DUMP_FORMAT_RAW, flags); +} + static char *testDomainGetOSType(virDomainPtr dom ATTRIBUTE_UNUSED) { char *ret; -- 1.8.5.3

On Thu, Mar 06, 2014 at 09:35:47AM +0000, qiaonuohan@cn.fujitsu.com wrote:
--memory-only option is introduced without compression supported. Therefore, this is a freature regression of virsh dump. Now qemu has support dumping memory
s/freature/feature/ but I would not use the word "regression" since that never worked. Also it would help mentioning the commit ID or a version it got included in qemu. On that note, is there a possibility of of introspection of that feature, so we can gracefully error out in case older qemu is used?
in kdump-compressed format. This patch is adding new virDomainCoreDumpWithFormat API, so that the format in which qemu dump domain's memory can be specified.
s/dump/dumps/ Looking at the rest, I rather fixed what I wanted to change in my repo and here's the diff I'd squash in. Let me know if you're OK with that. I'll still want an ACK from someone in order to push that, though. And feel free to ask about that changes as well. Martin diff --git c/include/libvirt/libvirt.h.in i/include/libvirt/libvirt.h.in index 12d64ab..41cd28c 100644 --- c/include/libvirt/libvirt.h.in +++ i/include/libvirt/libvirt.h.in @@ -1186,15 +1186,15 @@ typedef enum { * Values for specifying different formats of domain core dumps. */ typedef enum { - VIR_DUMP_FORMAT_RAW, /* dump guest memory in raw format */ - VIR_DUMP_FORMAT_KDUMP_ZLIB, /* dump guest memory in kdump-compressed - format, with zlib-compressed */ - VIR_DUMP_FORMAT_KDUMP_LZO, /* dump guest memory in kdump-compressed - format, with lzo-compressed */ - VIR_DUMP_FORMAT_KDUMP_SNAPPY, /* dump guest memory in kdump-compressed - format, with snappy-compressed */ + VIR_DOMAIN_CORE_DUMP_FORMAT_RAW, /* dump guest memory in raw format */ + VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB, /* kdump-compressed format, with + * zlib compression */ + VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO, /* kdump-compressed format, with + * lzo compression */ + VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY, /* kdump-compressed format, with + * snappy compression */ #ifdef VIR_ENUM_SENTINELS - VIR_DUMP_FORMAT_LAST + VIR_DOMAIN_CORE_DUMP_FORMAT_LAST /* * NB: this enum value will increase over time as new events are * added to the libvirt API. It reflects the last state supported @@ -1756,10 +1756,10 @@ int virDomainCoreDump (virDomainPtr domain, /* * Domain core dump with format specified */ -int virDomainCoreDumpWithFormat (virDomainPtr domain, - const char *to, - unsigned int dumpformat, - unsigned int flags); +int virDomainCoreDumpWithFormat (virDomainPtr domain, + const char *to, + unsigned int dumpformat, + unsigned int flags); /* * Screenshot of current domain console diff --git c/src/libvirt.c i/src/libvirt.c index cb8f0d2..a4787a8 100644 --- c/src/libvirt.c +++ i/src/libvirt.c @@ -3032,7 +3032,7 @@ virDomainCoreDumpWithFormat(virDomainPtr domain, const char *to, unsigned int { virConnectPtr conn; - VIR_DOMAIN_DEBUG(domain, "to=%s, flags=%x", to, flags); + VIR_DOMAIN_DEBUG(domain, "to=%s, dumpformat=%u, flags=%x", to, dumpformat, flags); virResetLastError(); @@ -3042,7 +3042,7 @@ virDomainCoreDumpWithFormat(virDomainPtr domain, const char *to, unsigned int virCheckReadOnlyGoto(conn->flags, error); virCheckNonNullArgGoto(to, error); - if (dumpformat >= VIR_DUMP_FORMAT_LAST) { + if (dumpformat >= VIR_DOMAIN_CORE_DUMP_FORMAT_LAST) { virReportInvalidArg(flags, _("dumpformat '%d' is not supproted"), dumpformat); goto error; @@ -3056,7 +3056,7 @@ virDomainCoreDumpWithFormat(virDomainPtr domain, const char *to, unsigned int if ((flags & VIR_DUMP_CRASH) && (flags & VIR_DUMP_RESET)) { virReportInvalidArg(flags, "%s", - _("crash and reset flags are mutually exclusive")); + _("crash and reset flags are mutually exclusive")); goto error; } diff --git c/src/remote_protocol-structs i/src/remote_protocol-structs index 0e2101c..456d0da 100644 --- c/src/remote_protocol-structs +++ i/src/remote_protocol-structs @@ -560,7 +560,7 @@ struct remote_domain_core_dump_args { struct remote_domain_core_dump_with_format_args { remote_nonnull_domain dom; remote_nonnull_string to; - u_int dompformat; + u_int dumpformat; u_int flags; }; struct remote_domain_screenshot_args { diff --git c/src/test/test_driver.c i/src/test/test_driver.c index 39b3066..20f7bb3 100644 --- c/src/test/test_driver.c +++ i/src/test/test_driver.c @@ -2436,6 +2436,13 @@ static int testDomainCoreDumpWithFormat(virDomainPtr domain, virCheckFlags(VIR_DUMP_CRASH, -1); + /* we don't support non-raw formats in test driver */ + if (dumpformat != VIR_DOMAIN_CORE_DUMP_FORMAT_RAW) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("kdump-compressed format is not supported here")); + goto cleanup; + } + testDriverLock(privconn); privdom = virDomainObjListFindByName(privconn->domains, domain->name); @@ -2476,13 +2483,6 @@ static int testDomainCoreDumpWithFormat(virDomainPtr domain, } } - /* dump the core of "domain" to file "to" */ - if (dumpformat != VIR_DUMP_FORMAT_RAW) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("kdump-compressed format is not supported here")); - goto cleanup; - } - ret = 0; cleanup: VIR_FORCE_CLOSE(fd); @@ -2497,7 +2497,8 @@ cleanup: static int testDomainCoreDump(virDomainPtr domain, const char *to, unsigned int flags) { - return testDomainCoreDumpWithFormat(domain, to, VIR_DUMP_FORMAT_RAW, flags); + return testDomainCoreDumpWithFormat(domain, to, + VIR_DOMAIN_CORE_DUMP_FORMAT_RAW, flags); } static char *testDomainGetOSType(virDomainPtr dom ATTRIBUTE_UNUSED) { @@ -7350,6 +7351,7 @@ static virDriver testDriver = { .domainRestore = testDomainRestore, /* 0.3.2 */ .domainRestoreFlags = testDomainRestoreFlags, /* 0.9.4 */ .domainCoreDump = testDomainCoreDump, /* 0.3.2 */ + .domainCoreDumpWithFormat = testDomainCoreDumpWithFormat, /* 1.2.3 */ .domainSetVcpus = testDomainSetVcpus, /* 0.1.4 */ .domainSetVcpusFlags = testDomainSetVcpusFlags, /* 0.8.5 */ .domainGetVcpusFlags = testDomainGetVcpusFlags, /* 0.8.5 */ --

On 03/12/2014 09:04 AM, Martin Kletzander wrote:
On Thu, Mar 06, 2014 at 09:35:47AM +0000, qiaonuohan@cn.fujitsu.com wrote:
--memory-only option is introduced without compression supported. Therefore, this is a freature regression of virsh dump. Now qemu has support dumping memory
s/freature/feature/
but I would not use the word "regression" since that never worked. Also it would help mentioning the commit ID or a version it got included in qemu. On that note, is there a possibility of of introspection of that feature, so we can gracefully error out in case older qemu is used?
Yes - qemu 2.0 is adding 'query-dump-guest-memory-capability', which can be used for two purposes: 1. if this command exists, 'dump-guest-memory' supports the new optional 'format' argument; and 2. calling this command will return a list of WHICH formats are supported by the given qemu binary (since configure-time choices can disable some of the formats from actually working). So you need to have a patch that modifies src/qemu/qemu_capabilities.[ch] to do the probing and set capability bits, so that we can gracefully error out when talking to a too-old qemu, or requesting a format that was not compiled in to a new qemu.
Looking at the rest, I rather fixed what I wanted to change in my repo and here's the diff I'd squash in. Let me know if you're OK with that. I'll still want an ACK from someone in order to push that, though. And feel free to ask about that changes as well.
I suppose the capability detection could be done as an add-on patch, but I'm personally thinking it's better to hold off on this series until ALL the work is done, so we don't forget to do the capability detection work. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On Wed, Mar 12, 2014 at 09:29:55AM -0600, Eric Blake wrote:
On 03/12/2014 09:04 AM, Martin Kletzander wrote:
On Thu, Mar 06, 2014 at 09:35:47AM +0000, qiaonuohan@cn.fujitsu.com wrote:
--memory-only option is introduced without compression supported. Therefore, this is a freature regression of virsh dump. Now qemu has support dumping memory
s/freature/feature/
but I would not use the word "regression" since that never worked. Also it would help mentioning the commit ID or a version it got included in qemu. On that note, is there a possibility of of introspection of that feature, so we can gracefully error out in case older qemu is used?
Yes - qemu 2.0 is adding 'query-dump-guest-memory-capability', which can be used for two purposes: 1. if this command exists, 'dump-guest-memory' supports the new optional 'format' argument; and 2. calling this command will return a list of WHICH formats are supported by the given qemu binary (since configure-time choices can disable some of the formats from actually working). So you need to have a patch that modifies src/qemu/qemu_capabilities.[ch] to do the probing and set capability bits, so that we can gracefully error out when talking to a too-old qemu, or requesting a format that was not compiled in to a new qemu.
Great. Could we have the compression parameter just as an arbitrary string then (properly checked for, etc.) so there is no need to adapt our code to qemu format additions?
Looking at the rest, I rather fixed what I wanted to change in my repo and here's the diff I'd squash in. Let me know if you're OK with that. I'll still want an ACK from someone in order to push that, though. And feel free to ask about that changes as well.
I suppose the capability detection could be done as an add-on patch, but I'm personally thinking it's better to hold off on this series until ALL the work is done, so we don't forget to do the capability detection work.
Definitely, I just asked this question in the wrong patch, the detection and use of the capability should be in 2/3 or in separate one. Martin

On 03/13/2014 03:42 PM, Martin Kletzander wrote:
On Wed, Mar 12, 2014 at 09:29:55AM -0600, Eric Blake wrote:
On 03/12/2014 09:04 AM, Martin Kletzander wrote:
On Thu, Mar 06, 2014 at 09:35:47AM +0000, qiaonuohan@cn.fujitsu.com wrote:
--memory-only option is introduced without compression supported. Therefore, this is a freature regression of virsh dump. Now qemu has support dumping memory
s/freature/feature/
but I would not use the word "regression" since that never worked. Also it would help mentioning the commit ID or a version it got included in qemu. On that note, is there a possibility of of introspection of that feature, so we can gracefully error out in case older qemu is used?
Yes - qemu 2.0 is adding 'query-dump-guest-memory-capability', which can be used for two purposes: 1. if this command exists, 'dump-guest-memory' supports the new optional 'format' argument; and 2. calling this command will return a list of WHICH formats are supported by the given qemu binary (since configure-time choices can disable some of the formats from actually working). So you need to have a patch that modifies src/qemu/qemu_capabilities.[ch] to do the probing and set capability bits, so that we can gracefully error out when talking to a too-old qemu, or requesting a format that was not compiled in to a new qemu.
Great. Could we have the compression parameter just as an arbitrary string then (properly checked for, etc.) so there is no need to adapt our code to qemu format additions?
Looking at the rest, I rather fixed what I wanted to change in my repo and here's the diff I'd squash in. Let me know if you're OK with that. I'll still want an ACK from someone in order to push that, though. And feel free to ask about that changes as well.
I suppose the capability detection could be done as an add-on patch, but I'm personally thinking it's better to hold off on this series until ALL the work is done, so we don't forget to do the capability detection work.
Definitely, I just asked this question in the wrong patch, the detection and use of the capability should be in 2/3 or in separate one.
Martin
Now, I am trying to find out how to do the probing and it will reflect on v6. Thanks for point it out. -- Regards Qiao Nuohan

On 03/13/2014 03:42 PM, Martin Kletzander wrote:
On Wed, Mar 12, 2014 at 09:29:55AM -0600, Eric Blake wrote:
On 03/12/2014 09:04 AM, Martin Kletzander wrote:
On Thu, Mar 06, 2014 at 09:35:47AM +0000,qiaonuohan@cn.fujitsu.com wrote:
> --memory-only option is introduced without compression supported. Therefore, > this is a freature regression of virsh dump. Now qemu has support dumping memory
s/freature/feature/
but I would not use the word "regression" since that never worked. Also it would help mentioning the commit ID or a version it got included in qemu. On that note, is there a possibility of of introspection of that feature, so we can gracefully error out in case older qemu is used?
Yes - qemu 2.0 is adding 'query-dump-guest-memory-capability', which can be used for two purposes: 1. if this command exists, 'dump-guest-memory' supports the new optional 'format' argument; and 2. calling this command will return a list of WHICH formats are supported by the given qemu binary (since configure-time choices can disable some of the formats from actually working). So you need to have a patch that modifies src/qemu/qemu_capabilities.[ch] to do the probing and set capability bits, so that we can gracefully error out when talking to a too-old qemu, or requesting a format that was not compiled in to a new qemu.
Great. Could we have the compression parameter just as an arbitrary string then (properly checked for, etc.) so there is no need to adapt our code to qemu format additions?
Hello, Sorry about the late of this reply. I just added a patch using 'query-dump-guest-memory-capability' to check the string of 'dumpformat' to see if the format is supported, so src/qemu /qemu_capabilities.[ch] is not touched. And this is reflected in v6, please check. -- Regards Qiao Nuohan

On Thu, Mar 13, 2014 at 08:42:40AM +0100, Martin Kletzander wrote:
On Wed, Mar 12, 2014 at 09:29:55AM -0600, Eric Blake wrote:
On 03/12/2014 09:04 AM, Martin Kletzander wrote:
On Thu, Mar 06, 2014 at 09:35:47AM +0000, qiaonuohan@cn.fujitsu.com wrote:
--memory-only option is introduced without compression supported. Therefore, this is a freature regression of virsh dump. Now qemu has support dumping memory
s/freature/feature/
but I would not use the word "regression" since that never worked. Also it would help mentioning the commit ID or a version it got included in qemu. On that note, is there a possibility of of introspection of that feature, so we can gracefully error out in case older qemu is used?
Yes - qemu 2.0 is adding 'query-dump-guest-memory-capability', which can be used for two purposes: 1. if this command exists, 'dump-guest-memory' supports the new optional 'format' argument; and 2. calling this command will return a list of WHICH formats are supported by the given qemu binary (since configure-time choices can disable some of the formats from actually working). So you need to have a patch that modifies src/qemu/qemu_capabilities.[ch] to do the probing and set capability bits, so that we can gracefully error out when talking to a too-old qemu, or requesting a format that was not compiled in to a new qemu.
Great. Could we have the compression parameter just as an arbitrary string then (properly checked for, etc.) so there is no need to adapt our code to qemu format additions?
I rather prefer it as an enum. Just doing a plain string passthrough from the API means that the API ends up exposing impl details of QEMU. This has caused us pain the past - eg nic model XML used to just be a free-form string, instead of an enum parsed string. The result was the same NIC model ended up with different names across different hypervisors. Using an enum / int is good for the API, even if it means we need to make changes if QEMU adds more formats 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 :|

On Mon, Mar 17, 2014 at 09:37:46AM +0000, Daniel P. Berrange wrote:
On Thu, Mar 13, 2014 at 08:42:40AM +0100, Martin Kletzander wrote:
On Wed, Mar 12, 2014 at 09:29:55AM -0600, Eric Blake wrote:
On 03/12/2014 09:04 AM, Martin Kletzander wrote:
On Thu, Mar 06, 2014 at 09:35:47AM +0000, qiaonuohan@cn.fujitsu.com wrote:
--memory-only option is introduced without compression supported. Therefore, this is a freature regression of virsh dump. Now qemu has support dumping memory
s/freature/feature/
but I would not use the word "regression" since that never worked. Also it would help mentioning the commit ID or a version it got included in qemu. On that note, is there a possibility of of introspection of that feature, so we can gracefully error out in case older qemu is used?
Yes - qemu 2.0 is adding 'query-dump-guest-memory-capability', which can be used for two purposes: 1. if this command exists, 'dump-guest-memory' supports the new optional 'format' argument; and 2. calling this command will return a list of WHICH formats are supported by the given qemu binary (since configure-time choices can disable some of the formats from actually working). So you need to have a patch that modifies src/qemu/qemu_capabilities.[ch] to do the probing and set capability bits, so that we can gracefully error out when talking to a too-old qemu, or requesting a format that was not compiled in to a new qemu.
Great. Could we have the compression parameter just as an arbitrary string then (properly checked for, etc.) so there is no need to adapt our code to qemu format additions?
I rather prefer it as an enum. Just doing a plain string passthrough from the API means that the API ends up exposing impl details of QEMU. This has caused us pain the past - eg nic model XML used to just be a free-form string, instead of an enum parsed string. The result was the same NIC model ended up with different names across different hypervisors. Using an enum / int is good for the API, even if it means we need to make changes if QEMU adds more formats
That makes sense, thanks for the explanation. That's why I was asking. Martin
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 :|

On 03/12/2014 11:04 PM, Martin Kletzander wrote:
diff --git c/src/test/test_driver.c i/src/test/test_driver.c index 39b3066..20f7bb3 100644 --- c/src/test/test_driver.c +++ i/src/test/test_driver.c @@ -2436,6 +2436,13 @@ static int testDomainCoreDumpWithFormat(virDomainPtr domain,
virCheckFlags(VIR_DUMP_CRASH, -1);
+ /* we don't support non-raw formats in test driver */ + if (dumpformat != VIR_DOMAIN_CORE_DUMP_FORMAT_RAW) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("kdump-compressed format is not supported here")); + goto cleanup; + } +
Moving the check for dumpformat here may jump to cleanup before privdom is initialize. So is it suitable moving this check before the check of flags? like <cut> @@ -2467,6 +2468,13 @@ static int testDomainCoreDump(virDomainPtr domain, goto cleanup; } + /* we don't support non-raw formats in test driver */ + if (dumpformat != VIR_DOMAIN_CORE_DUMP_FORMAT_RAW) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("kdump-compressed format is not supported here")); + goto cleanup; + } + if (flags & VIR_DUMP_CRASH) { testDomainShutdownState(domain, privdom, VIR_DOMAIN_SHUTOFF_CRASHED); event = virDomainEventLifecycleNewFromObj(privdom, <cut>
testDriverLock(privconn); privdom = virDomainObjListFindByName(privconn->domains, domain->name); @@ -2476,13 +2483,6 @@ static int testDomainCoreDumpWithFormat(virDomainPtr domain, } }
- /* dump the core of "domain" to file "to" */ - if (dumpformat != VIR_DUMP_FORMAT_RAW) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("kdump-compressed format is not supported here")); - goto cleanup; - } - ret = 0; cleanup: VIR_FORCE_CLOSE(fd); @@ -2497,7 +2497,8 @@ cleanup: static int testDomainCoreDump(virDomainPtr domain, const char *to, unsigned int flags) { - return testDomainCoreDumpWithFormat(domain, to, VIR_DUMP_FORMAT_RAW, flags); + return testDomainCoreDumpWithFormat(domain, to, + VIR_DOMAIN_CORE_DUMP_FORMAT_RAW, flags); }
static char *testDomainGetOSType(virDomainPtr dom ATTRIBUTE_UNUSED) { @@ -7350,6 +7351,7 @@ static virDriver testDriver = { .domainRestore = testDomainRestore, /* 0.3.2 */ .domainRestoreFlags = testDomainRestoreFlags, /* 0.9.4 */ .domainCoreDump = testDomainCoreDump, /* 0.3.2 */ + .domainCoreDumpWithFormat = testDomainCoreDumpWithFormat, /* 1.2.3 */ .domainSetVcpus = testDomainSetVcpus, /* 0.1.4 */ .domainSetVcpusFlags = testDomainSetVcpusFlags, /* 0.8.5 */ .domainGetVcpusFlags = testDomainGetVcpusFlags, /* 0.8.5 */
-- Regards Qiao Nuohan

On Thu, Mar 13, 2014 at 09:20:09AM +0000, qiaonuohan@cn.fujitsu.com wrote:
On 03/12/2014 11:04 PM, Martin Kletzander wrote:
diff --git c/src/test/test_driver.c i/src/test/test_driver.c index 39b3066..20f7bb3 100644 --- c/src/test/test_driver.c +++ i/src/test/test_driver.c @@ -2436,6 +2436,13 @@ static int testDomainCoreDumpWithFormat(virDomainPtr domain,
virCheckFlags(VIR_DUMP_CRASH, -1);
+ /* we don't support non-raw formats in test driver */ + if (dumpformat != VIR_DOMAIN_CORE_DUMP_FORMAT_RAW) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("kdump-compressed format is not supported here")); + goto cleanup; + } +
Moving the check for dumpformat here may jump to cleanup before privdom is initialize. So is it suitable moving this check before the check of flags? like
I just wanted to check and error out properly before doing the work and not after that, so that's ok, yes. Martin
<cut> @@ -2467,6 +2468,13 @@ static int testDomainCoreDump(virDomainPtr domain, goto cleanup; }
+ /* we don't support non-raw formats in test driver */ + if (dumpformat != VIR_DOMAIN_CORE_DUMP_FORMAT_RAW) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("kdump-compressed format is not supported here")); + goto cleanup; + } + if (flags & VIR_DUMP_CRASH) { testDomainShutdownState(domain, privdom, VIR_DOMAIN_SHUTOFF_CRASHED); event = virDomainEventLifecycleNewFromObj(privdom,
<cut>
testDriverLock(privconn); privdom = virDomainObjListFindByName(privconn->domains, domain->name); @@ -2476,13 +2483,6 @@ static int testDomainCoreDumpWithFormat(virDomainPtr domain, } }
- /* dump the core of "domain" to file "to" */ - if (dumpformat != VIR_DUMP_FORMAT_RAW) { - virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("kdump-compressed format is not supported here")); - goto cleanup; - } - ret = 0; cleanup: VIR_FORCE_CLOSE(fd); @@ -2497,7 +2497,8 @@ cleanup: static int testDomainCoreDump(virDomainPtr domain, const char *to, unsigned int flags) { - return testDomainCoreDumpWithFormat(domain, to, VIR_DUMP_FORMAT_RAW, flags); + return testDomainCoreDumpWithFormat(domain, to, + VIR_DOMAIN_CORE_DUMP_FORMAT_RAW, flags); }
static char *testDomainGetOSType(virDomainPtr dom ATTRIBUTE_UNUSED) { @@ -7350,6 +7351,7 @@ static virDriver testDriver = { .domainRestore = testDomainRestore, /* 0.3.2 */ .domainRestoreFlags = testDomainRestoreFlags, /* 0.9.4 */ .domainCoreDump = testDomainCoreDump, /* 0.3.2 */ + .domainCoreDumpWithFormat = testDomainCoreDumpWithFormat, /* 1.2.3 */ .domainSetVcpus = testDomainSetVcpus, /* 0.1.4 */ .domainSetVcpusFlags = testDomainSetVcpusFlags, /* 0.8.5 */ .domainGetVcpusFlags = testDomainGetVcpusFlags, /* 0.8.5 */
-- Regards Qiao Nuohan

On Thu, Mar 06, 2014 at 09:35:47AM +0000, qiaonuohan@cn.fujitsu.com 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 adding new virDomainCoreDumpWithFormat API, so that the format in which qemu dump domain's memory can be specified.
+int +virDomainCoreDumpWithFormat(virDomainPtr domain, const char *to, unsigned int + dumpformat, unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(domain, "to=%s, flags=%x", to, flags); + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + conn = domain->conn; + + virCheckReadOnlyGoto(conn->flags, error); + virCheckNonNullArgGoto(to, error); + + if (dumpformat >= VIR_DUMP_FORMAT_LAST) { + virReportInvalidArg(flags, _("dumpformat '%d' is not supproted"),
s/supproted/supported/ 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 :|

This patch is used to add "--compress" and "[--compression-format] <string>" to "virsh dump --memory-only". And "virsh dump --memory-only" is going be implemented by new virDomainCoreDumpWithFormat API. Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com> --- tools/virsh-domain.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 2e3f0ed..70613e5 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4486,6 +4486,14 @@ static const vshCmdOptDef opts_dump[] = { .type = VSH_OT_BOOL, .help = N_("dump domain's memory only") }, + {.name = "compress", + .type = VSH_OT_BOOL, + .help = N_("make qemu dump domain's memory in kdump-compressed format") + }, + {.name = "compression-format", + .type = VSH_OT_DATA, + .help = N_("specify the compression format of kdump-compressed format") + }, {.name = NULL} }; @@ -4501,6 +4509,9 @@ doDump(void *opaque) const char *name = NULL; const char *to = NULL; unsigned int flags = 0; + bool optCompress; + const char *compression_format = NULL; + unsigned int memory_dump_format = VIR_DUMP_FORMAT_RAW; sigemptyset(&sigmask); sigaddset(&sigmask, SIGINT); @@ -4524,7 +4535,39 @@ doDump(void *opaque) if (vshCommandOptBool(cmd, "memory-only")) flags |= VIR_DUMP_MEMORY_ONLY; - if (virDomainCoreDump(dom, to, flags) < 0) { + optCompress = vshCommandOptBool(cmd, "compress"); + if (optCompress && !(flags & VIR_DUMP_MEMORY_ONLY)) { + vshError(ctl, "%s", + _("compress flag cannot be set without memory-only flag")); + goto out; + } + + if (vshCommandOptString(cmd, "compression-format", &compression_format)) { + if (!optCompress) { + vshError(ctl, "%s", + _("compression-format cannot be set without compress " + "flag")); + goto out; + } + + if (STREQ(compression_format, "zlib")) + memory_dump_format = VIR_DUMP_FORMAT_KDUMP_ZLIB; + else if (STREQ(compression_format, "lzo")) + memory_dump_format = VIR_DUMP_FORMAT_KDUMP_LZO; + else if (STREQ(compression_format, "snappy")) + memory_dump_format = VIR_DUMP_FORMAT_KDUMP_SNAPPY; + else { + vshError(ctl, _("compression format '%s' is not supported, " + "expecting 'zlib', 'lzo' or 'snappy'."), + compression_format); + goto out; + } + } else { + if (optCompress) + memory_dump_format = VIR_DUMP_FORMAT_KDUMP_ZLIB; + } + + if (virDomainCoreDumpWithFormat(dom, to, memory_dump_format, flags) < 0) { vshError(ctl, _("Failed to core dump domain %s to %s"), name, to); goto out; } -- 1.8.5.3

On Thu, Mar 06, 2014 at 09:35:47AM +0000, qiaonuohan@cn.fujitsu.com wrote:
This patch is used to add "--compress" and "[--compression-format] <string>" to
s/is used to add/adds/
"virsh dump --memory-only". And "virsh dump --memory-only" is going be implemented by new virDomainCoreDumpWithFormat API.
How about rewording it like this: ... to "virsh dump --memory-only", which is changed to use the new virDomainCoreDumpWithFormat API. The same about the following diff as with the first patch applies. Martin diff --git c/tools/virsh-domain.c w/tools/virsh-domain.c index f8e8e57..51881ef 100644 --- c/tools/virsh-domain.c +++ w/tools/virsh-domain.c @@ -4487,8 +4487,8 @@ static const vshCmdOptDef opts_dump[] = { .help = N_("dump domain's memory only") }, {.name = "compress", - .type = VSH_OT_BOOL, - .help = N_("make qemu dump domain's memory in kdump-compressed format") + .type = VSH_OT_ALIAS, + .help = "compression-format=zlib", }, {.name = "compression-format", .type = VSH_OT_DATA, @@ -4509,9 +4509,8 @@ doDump(void *opaque) const char *name = NULL; const char *to = NULL; unsigned int flags = 0; - bool optCompress; const char *compression_format = NULL; - unsigned int memory_dump_format = VIR_DUMP_FORMAT_RAW; + unsigned int memory_dump_format = VIR_DOMAIN_CORE_DUMP_FORMAT_RAW; sigemptyset(&sigmask); sigaddset(&sigmask, SIGINT); @@ -4535,36 +4534,26 @@ doDump(void *opaque) if (vshCommandOptBool(cmd, "memory-only")) flags |= VIR_DUMP_MEMORY_ONLY; - optCompress = vshCommandOptBool(cmd, "compress"); - if (optCompress && !(flags & VIR_DUMP_MEMORY_ONLY)) { + if (vshCommandOptBool(cmd, "compression-format") && + !(flags & VIR_DUMP_MEMORY_ONLY)) { vshError(ctl, "%s", _("compress flag cannot be set without memory-only flag")); goto out; } if (vshCommandOptString(cmd, "compression-format", &compression_format)) { - if (!optCompress) { - vshError(ctl, "%s", - _("compression-format cannot be set without compress " - "flag")); - goto out; - } - if (STREQ(compression_format, "zlib")) - memory_dump_format = VIR_DUMP_FORMAT_KDUMP_ZLIB; + memory_dump_format = VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB; else if (STREQ(compression_format, "lzo")) - memory_dump_format = VIR_DUMP_FORMAT_KDUMP_LZO; + memory_dump_format = VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO; else if (STREQ(compression_format, "snappy")) - memory_dump_format = VIR_DUMP_FORMAT_KDUMP_SNAPPY; + memory_dump_format = VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY; else { vshError(ctl, _("compression format '%s' is not supported, " "expecting 'zlib', 'lzo' or 'snappy'."), compression_format); goto out; } - } else { - if (optCompress) - memory_dump_format = VIR_DUMP_FORMAT_KDUMP_ZLIB; } if (virDomainCoreDumpWithFormat(dom, to, memory_dump_format, flags) < 0) { diff --git c/tools/virsh.pod w/tools/virsh.pod index cefce1b..0eb7ac6 100644 --- c/tools/virsh.pod +++ w/tools/virsh.pod @@ -995,6 +995,7 @@ I<format> argument may be B<xen-xm> or B<xen-sxpr>. =item B<dump> I<domain> I<corefilepath> [I<--bypass-cache>] { [I<--live>] | [I<--crash>] | [I<--reset>] } [I<--verbose>] [I<--memory-only>] +[I<--compression-format> I<string>] Dumps the core of a domain to a file for analysis. If I<--live> is specified, the domain continues to run until the core @@ -1008,6 +1009,10 @@ cache, although this may slow down the operation. If I<--memory-only> is specified, the file is elf file, and will only include domain's memory and cpu common register value. It is very useful if the domain uses host devices directly. +I<--compression-format> I<string> can be used to specify that the +output file should be in kdump-compressed format using the specified +compression; zlib, lzo, snappy. +I<--compress> is an alias for I<--compression-format> I<lzo>. The progress may be monitored using B<domjobinfo> virsh command and canceled with B<domjobabort> command (sent by another virsh instance). Another option --

On Thu, Mar 06, 2014 at 09:35:47AM +0000, qiaonuohan@cn.fujitsu.com wrote:
This patch is used to add "--compress" and "[--compression-format] <string>" to "virsh dump --memory-only". And "virsh dump --memory-only" is going be implemented by new virDomainCoreDumpWithFormat API.
Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com> --- tools/virsh-domain.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 2e3f0ed..70613e5 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4486,6 +4486,14 @@ static const vshCmdOptDef opts_dump[] = { .type = VSH_OT_BOOL, .help = N_("dump domain's memory only") }, + {.name = "compress", + .type = VSH_OT_BOOL, + .help = N_("make qemu dump domain's memory in kdump-compressed format") + }, + {.name = "compression-format", + .type = VSH_OT_DATA, + .help = N_("specify the compression format of kdump-compressed format") + },
As before, IMHO having two args here is silly. Just have a single '--compress format' arg.
@@ -4524,7 +4535,39 @@ doDump(void *opaque) if (vshCommandOptBool(cmd, "memory-only")) flags |= VIR_DUMP_MEMORY_ONLY;
- if (virDomainCoreDump(dom, to, flags) < 0) {
[snip]
+ if (virDomainCoreDumpWithFormat(dom, to, memory_dump_format, flags) < 0) {
This breaks virsh dump if used against an older libvirtd. We must *only* invoke virDomainCoreDumpWithFormat if the user has specified a 'memory_dump_format' value 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 :|

On Wed, Mar 12, 2014 at 05:18:22PM +0000, Daniel P. Berrange wrote:
On Thu, Mar 06, 2014 at 09:35:47AM +0000, qiaonuohan@cn.fujitsu.com wrote:
This patch is used to add "--compress" and "[--compression-format] <string>" to "virsh dump --memory-only". And "virsh dump --memory-only" is going be implemented by new virDomainCoreDumpWithFormat API.
Signed-off-by: Qiao Nuohan <qiaonuohan@cn.fujitsu.com> --- tools/virsh-domain.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 2e3f0ed..70613e5 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4486,6 +4486,14 @@ static const vshCmdOptDef opts_dump[] = { .type = VSH_OT_BOOL, .help = N_("dump domain's memory only") }, + {.name = "compress", + .type = VSH_OT_BOOL, + .help = N_("make qemu dump domain's memory in kdump-compressed format") + }, + {.name = "compression-format", + .type = VSH_OT_DATA, + .help = N_("specify the compression format of kdump-compressed format") + },
As before, IMHO having two args here is silly. Just have a single '--compress format' arg.
I'm fine with having one param only, I don't know about the author, though. I also proposed '--compress' as an alias which should be good compromise IMHO.
@@ -4524,7 +4535,39 @@ doDump(void *opaque) if (vshCommandOptBool(cmd, "memory-only")) flags |= VIR_DUMP_MEMORY_ONLY;
- if (virDomainCoreDump(dom, to, flags) < 0) {
[snip]
+ if (virDomainCoreDumpWithFormat(dom, to, memory_dump_format, flags) < 0) {
This breaks virsh dump if used against an older libvirtd.
We must *only* invoke virDomainCoreDumpWithFormat if the user has specified a 'memory_dump_format' value
That's right, I forgot that. That should be definitely checked for and it must properly error out. Martin
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 :|

On 03/13/2014 03:40 PM, Martin Kletzander wrote:
On Thu, Mar 06, 2014 at 09:35:47AM +0000,qiaonuohan@cn.fujitsu.com wrote:
This patch is used to add "--compress" and "[--compression-format]<string>" to "virsh dump --memory-only". And "virsh dump --memory-only" is going be implemented by new virDomainCoreDumpWithFormat API.
Signed-off-by: Qiao Nuohan<qiaonuohan@cn.fujitsu.com> --- tools/virsh-domain.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 2e3f0ed..70613e5 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4486,6 +4486,14 @@ static const vshCmdOptDef opts_dump[] = { .type = VSH_OT_BOOL, .help = N_("dump domain's memory only") }, + {.name = "compress", + .type = VSH_OT_BOOL, + .help = N_("make qemu dump domain's memory in kdump-compressed format") + }, + {.name = "compression-format", + .type = VSH_OT_DATA, + .help = N_("specify the compression format of kdump-compressed format") + },
As before, IMHO having two args here is silly. Just have a single '--compress format' arg.
I'm fine with having one param only, I don't know about the author,
On Wed, Mar 12, 2014 at 05:18:22PM +0000, Daniel P. Berrange wrote: though. I also proposed '--compress' as an alias which should be good compromise IMHO.
I would prefer Martin's suggestion, for zlib is used more frequently, an alias can save typing. -- Regards Qiao Nuohan

On Thu, Mar 13, 2014 at 09:22:30AM +0000, qiaonuohan@cn.fujitsu.com wrote:
On 03/13/2014 03:40 PM, Martin Kletzander wrote:
On Thu, Mar 06, 2014 at 09:35:47AM +0000,qiaonuohan@cn.fujitsu.com wrote:
This patch is used to add "--compress" and "[--compression-format]<string>" to "virsh dump --memory-only". And "virsh dump --memory-only" is going be implemented by new virDomainCoreDumpWithFormat API.
Signed-off-by: Qiao Nuohan<qiaonuohan@cn.fujitsu.com> --- tools/virsh-domain.c | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-)
diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 2e3f0ed..70613e5 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4486,6 +4486,14 @@ static const vshCmdOptDef opts_dump[] = { .type = VSH_OT_BOOL, .help = N_("dump domain's memory only") }, + {.name = "compress", + .type = VSH_OT_BOOL, + .help = N_("make qemu dump domain's memory in kdump-compressed format") + }, + {.name = "compression-format", + .type = VSH_OT_DATA, + .help = N_("specify the compression format of kdump-compressed format") + },
As before, IMHO having two args here is silly. Just have a single '--compress format' arg.
I'm fine with having one param only, I don't know about the author,
On Wed, Mar 12, 2014 at 05:18:22PM +0000, Daniel P. Berrange wrote: though. I also proposed '--compress' as an alias which should be good compromise IMHO.
I would prefer Martin's suggestion, for zlib is used more frequently, an alias can save typing.
Although one might suggest an alias or a wrapper if you want to save typing... Martin

This patch makes qemu driver supprot virDomainCoreDumpWithFormat API. --- src/qemu/qemu_driver.c | 49 ++++++++++++++++++++++++++++++++++++-------- src/qemu/qemu_monitor.c | 7 ++++--- src/qemu/qemu_monitor.h | 3 ++- src/qemu/qemu_monitor_json.c | 4 +++- src/qemu/qemu_monitor_json.h | 3 ++- tests/qemumonitorjsontest.c | 2 +- 6 files changed, 52 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c9a865e..2a56157 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3391,7 +3391,8 @@ cleanup: } static int qemuDumpToFd(virQEMUDriverPtr driver, virDomainObjPtr vm, - int fd, enum qemuDomainAsyncJob asyncJob) + int fd, enum qemuDomainAsyncJob asyncJob, + const char *memory_dump_format) { qemuDomainObjPrivatePtr priv = vm->privateData; int ret = -1; @@ -3411,7 +3412,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, memory_dump_format); qemuDomainObjExitMonitor(driver, vm); return ret; @@ -3422,13 +3423,15 @@ doCoreDump(virQEMUDriverPtr driver, virDomainObjPtr vm, const char *path, virQEMUSaveFormat compress, - unsigned int dump_flags) + unsigned int dump_flags, + unsigned int dumpformat) { int fd = -1; int ret = -1; virFileWrapperFdPtr wrapperFd = NULL; int directFlag = 0; unsigned int flags = VIR_FILE_WRAPPER_NON_BLOCKING; + const char *memory_dump_format = NULL; /* Create an empty file with appropriate ownership. */ if (dump_flags & VIR_DUMP_BYPASS_CACHE) { @@ -3452,8 +3455,25 @@ doCoreDump(virQEMUDriverPtr driver, goto cleanup; if (dump_flags & VIR_DUMP_MEMORY_ONLY) { - ret = qemuDumpToFd(driver, vm, fd, QEMU_ASYNC_JOB_DUMP); + if (dumpformat == VIR_DUMP_FORMAT_RAW) + memory_dump_format = "elf"; + else if (dumpformat == VIR_DUMP_FORMAT_KDUMP_ZLIB) + memory_dump_format = "kdump-zlib"; + else if (dumpformat == VIR_DUMP_FORMAT_KDUMP_LZO) + memory_dump_format = "kdump-lzo"; + else if (dumpformat == VIR_DUMP_FORMAT_KDUMP_SNAPPY) + memory_dump_format = "kdump-snappy"; + else { + virReportError(VIR_ERR_INVALID_ARG, + _("unknown dumpformat '%d'"), dumpformat); + } + ret = qemuDumpToFd(driver, vm, fd, QEMU_ASYNC_JOB_DUMP, + memory_dump_format); } else { + if (dumpformat != VIR_DUMP_FORMAT_RAW) + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("kdump-compressed format is only work with guest " + "memory dump")); ret = qemuMigrationToFile(driver, vm, fd, 0, path, qemuCompressProgramName(compress), false, QEMU_ASYNC_JOB_DUMP); @@ -3515,8 +3535,9 @@ cleanup: return ret; } -static int qemuDomainCoreDump(virDomainPtr dom, +static int qemuDomainCoreDumpWithFormat(virDomainPtr dom, const char *path, + unsigned int dumpformat, unsigned int flags) { virQEMUDriverPtr driver = dom->conn->privateData; @@ -3533,7 +3554,7 @@ static int qemuDomainCoreDump(virDomainPtr dom, if (!(vm = qemuDomObjFromDomain(dom))) return -1; - if (virDomainCoreDumpEnsureACL(dom->conn, vm->def) < 0) + if (virDomainCoreDumpWithFormatEnsureACL(dom->conn, vm->def) < 0) goto cleanup; if (qemuDomainObjBeginAsyncJob(driver, vm, @@ -3565,7 +3586,8 @@ static int qemuDomainCoreDump(virDomainPtr dom, } } - ret = doCoreDump(driver, vm, path, getCompressionType(driver), flags); + ret = doCoreDump(driver, vm, path, getCompressionType(driver), flags, + dumpformat); if (ret < 0) goto endjob; @@ -3619,6 +3641,13 @@ cleanup: return ret; } +static int qemuDomainCoreDump(virDomainPtr dom, + const char *path, + unsigned int flags) +{ + return qemuDomainCoreDumpWithFormat(dom, path, VIR_DUMP_FORMAT_RAW, flags); +} + static char * qemuDomainScreenshot(virDomainPtr dom, virStreamPtr st, @@ -3742,7 +3771,8 @@ static void processWatchdogEvent(virQEMUDriverPtr driver, virDomainObjPtr vm, in flags |= cfg->autoDumpBypassCache ? VIR_DUMP_BYPASS_CACHE: 0; ret = doCoreDump(driver, vm, dumpfile, - getCompressionType(driver), flags); + getCompressionType(driver), flags, + VIR_DUMP_FORMAT_RAW); if (ret < 0) virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("Dump failed")); @@ -3806,7 +3836,7 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver, flags |= cfg->autoDumpBypassCache ? VIR_DUMP_BYPASS_CACHE: 0; ret = doCoreDump(driver, vm, dumpfile, - getCompressionType(driver), flags); + getCompressionType(driver), flags, VIR_DUMP_FORMAT_RAW); if (ret < 0) virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("Dump failed")); @@ -16610,6 +16640,7 @@ static virDriver qemuDriver = { .domainSaveImageGetXMLDesc = qemuDomainSaveImageGetXMLDesc, /* 0.9.4 */ .domainSaveImageDefineXML = qemuDomainSaveImageDefineXML, /* 0.9.4 */ .domainCoreDump = qemuDomainCoreDump, /* 0.7.0 */ + .domainCoreDumpWithFormat = qemuDomainCoreDumpWithFormat, /* 1.2.3 */ .domainScreenshot = qemuDomainScreenshot, /* 0.9.2 */ .domainSetVcpus = qemuDomainSetVcpus, /* 0.4.4 */ .domainSetVcpusFlags = qemuDomainSetVcpusFlags, /* 0.8.5 */ diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index a2769db..c891a7a 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2345,10 +2345,11 @@ int qemuMonitorMigrateCancel(qemuMonitorPtr mon) } int -qemuMonitorDumpToFd(qemuMonitorPtr mon, int fd) +qemuMonitorDumpToFd(qemuMonitorPtr mon, int fd, const char *memory_dump_format) { int ret; - VIR_DEBUG("mon=%p fd=%d", mon, fd); + VIR_DEBUG("mon=%p fd=%d memory_dump_format=%s", mon, fd, + memory_dump_format); if (!mon) { virReportError(VIR_ERR_INVALID_ARG, "%s", @@ -2368,7 +2369,7 @@ qemuMonitorDumpToFd(qemuMonitorPtr mon, int fd) if (qemuMonitorSendFileHandle(mon, "dump", fd) < 0) return -1; - ret = qemuMonitorJSONDump(mon, "fd:dump"); + ret = qemuMonitorJSONDump(mon, "fd:dump", memory_dump_format); if (ret < 0) { if (qemuMonitorCloseFileHandle(mon, "dump") < 0) diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index eabf000..53c90df 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -495,7 +495,8 @@ int qemuMonitorMigrateToUnix(qemuMonitorPtr mon, int qemuMonitorMigrateCancel(qemuMonitorPtr mon); int qemuMonitorDumpToFd(qemuMonitorPtr mon, - int fd); + int fd, + const char *memory_dump_format); int qemuMonitorGraphicsRelocate(qemuMonitorPtr mon, int type, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index 5e825ac..f77b35a 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2636,7 +2636,8 @@ int qemuMonitorJSONMigrateCancel(qemuMonitorPtr mon) int qemuMonitorJSONDump(qemuMonitorPtr mon, - const char *protocol) + const char *protocol, + const char *memory_dump_format) { int ret; virJSONValuePtr cmd = NULL; @@ -2645,6 +2646,7 @@ qemuMonitorJSONDump(qemuMonitorPtr mon, cmd = qemuMonitorJSONMakeCommand("dump-guest-memory", "b:paging", false, "s:protocol", protocol, + "s:format", memory_dump_format, NULL); if (!cmd) return -1; diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index a93c51e..af6f666 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -148,7 +148,8 @@ int qemuMonitorJSONGetSpiceMigrationStatus(qemuMonitorPtr mon, int qemuMonitorJSONMigrateCancel(qemuMonitorPtr mon); int qemuMonitorJSONDump(qemuMonitorPtr mon, - const char *protocol); + const char *protocol, + const char *memory_dump_format); int qemuMonitorJSONGraphicsRelocate(qemuMonitorPtr mon, int type, diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index d7da5a8..f21de84 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -1154,7 +1154,7 @@ GEN_TEST_FUNC(qemuMonitorJSONSetMigrationDowntime, 1) GEN_TEST_FUNC(qemuMonitorJSONMigrate, QEMU_MONITOR_MIGRATE_BACKGROUND | QEMU_MONITOR_MIGRATE_NON_SHARED_DISK | QEMU_MONITOR_MIGRATE_NON_SHARED_INC, "tcp:localhost:12345") -GEN_TEST_FUNC(qemuMonitorJSONDump, "dummy_protocol") +GEN_TEST_FUNC(qemuMonitorJSONDump, "dummy_protocol", "dummy_memory_dump_format") GEN_TEST_FUNC(qemuMonitorJSONGraphicsRelocate, VIR_DOMAIN_GRAPHICS_TYPE_SPICE, "localhost", 12345, 12346, NULL) GEN_TEST_FUNC(qemuMonitorJSONAddNetdev, "some_dummy_netdevstr") -- 1.8.5.3

On Thu, Mar 06, 2014 at 09:35:47AM +0000, qiaonuohan@cn.fujitsu.com wrote: s/to/for/ in the $SUBJ or you can rephrase it to: qemu: add support for virDomainCoreDumpWithFormat API
This patch makes qemu driver supprot virDomainCoreDumpWithFormat API.
s/supprot/support/ And again like with previous patch, here's a diff of what I'd change. For this one I'm still missing the detection of kdump-compressed dump capability in qemu. Martin diff --git c/src/qemu/qemu_driver.c i/src/qemu/qemu_driver.c index 995cae0..ee8fcf9 100644 --- c/src/qemu/qemu_driver.c +++ i/src/qemu/qemu_driver.c @@ -2676,6 +2676,13 @@ VIR_ENUM_IMPL(qemuSaveCompression, QEMU_SAVE_FORMAT_LAST, "xz", "lzop") +VIR_ENUM_DECL(qemuDumpFormat) +VIR_ENUM_IMPL(qemuDumpFormat, VIR_DOMAIN_CORE_DUMP_FORMAT_LAST, + "elf", + "kdump-zlib", + "kdump-lzo", + "kdump-snappy") + typedef struct _virQEMUSaveHeader virQEMUSaveHeader; typedef virQEMUSaveHeader *virQEMUSaveHeaderPtr; struct _virQEMUSaveHeader { @@ -3453,25 +3460,20 @@ doCoreDump(virQEMUDriverPtr driver, goto cleanup; if (dump_flags & VIR_DUMP_MEMORY_ONLY) { - if (dumpformat == VIR_DUMP_FORMAT_RAW) - memory_dump_format = "elf"; - else if (dumpformat == VIR_DUMP_FORMAT_KDUMP_ZLIB) - memory_dump_format = "kdump-zlib"; - else if (dumpformat == VIR_DUMP_FORMAT_KDUMP_LZO) - memory_dump_format = "kdump-lzo"; - else if (dumpformat == VIR_DUMP_FORMAT_KDUMP_SNAPPY) - memory_dump_format = "kdump-snappy"; - else { + if (!(memory_dump_format = qemuDumpFormatTypeToString(dumpformat))) { virReportError(VIR_ERR_INVALID_ARG, _("unknown dumpformat '%d'"), dumpformat); + goto cleanup; } ret = qemuDumpToFd(driver, vm, fd, QEMU_ASYNC_JOB_DUMP, memory_dump_format); } else { - if (dumpformat != VIR_DUMP_FORMAT_RAW) + if (dumpformat != VIR_DOMAIN_CORE_DUMP_FORMAT_RAW) { virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", - _("kdump-compressed format is only work with guest " - "memory dump")); + _("kdump-compressed format is only supported with " + "memory-only dump")); + goto cleanup; + } ret = qemuMigrationToFile(driver, vm, fd, 0, path, qemuCompressProgramName(compress), false, QEMU_ASYNC_JOB_DUMP); @@ -3643,7 +3645,8 @@ static int qemuDomainCoreDump(virDomainPtr dom, const char *path, unsigned int flags) { - return qemuDomainCoreDumpWithFormat(dom, path, VIR_DUMP_FORMAT_RAW, flags); + return qemuDomainCoreDumpWithFormat(dom, path, + VIR_DOMAIN_CORE_DUMP_FORMAT_RAW, flags); } static char * @@ -3770,7 +3773,7 @@ static void processWatchdogEvent(virQEMUDriverPtr driver, virDomainObjPtr vm, in flags |= cfg->autoDumpBypassCache ? VIR_DUMP_BYPASS_CACHE: 0; ret = doCoreDump(driver, vm, dumpfile, getCompressionType(driver), flags, - VIR_DUMP_FORMAT_RAW); + VIR_DOMAIN_CORE_DUMP_FORMAT_RAW); if (ret < 0) virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("Dump failed")); @@ -3834,7 +3837,8 @@ doCoreDumpToAutoDumpPath(virQEMUDriverPtr driver, flags |= cfg->autoDumpBypassCache ? VIR_DUMP_BYPASS_CACHE: 0; ret = doCoreDump(driver, vm, dumpfile, - getCompressionType(driver), flags, VIR_DUMP_FORMAT_RAW); + getCompressionType(driver), flags, + VIR_DOMAIN_CORE_DUMP_FORMAT_RAW); if (ret < 0) virReportError(VIR_ERR_OPERATION_FAILED, "%s", _("Dump failed")); --

Hello, Do you have any comments? On 03/06/2014 05:35 PM, 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
ChangLog: Changes from v4 to v5: 1. modify some restriction check
Changes from v3 to v4: 1. dropping patch "add dump_memory_format in qemu.conf" 2. fix to follow some conventions
Changes from v2 to v3: 1. address Jiri Denemark's comment about adding a new public API instead of changing an old one.
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 (3): add new virDomainCoreDumpWithFormat API add qemu support to virDomainCoreDumpWithFormat API allow "virsh dump --memory-only" specify dump format
include/libvirt/libvirt.h.in | 31 ++++++++++++++ src/driver.h | 7 ++++ src/libvirt.c | 97 ++++++++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 5 +++ src/qemu/qemu_driver.c | 49 ++++++++++++++++++---- src/qemu/qemu_monitor.c | 7 ++-- src/qemu/qemu_monitor.h | 3 +- src/qemu/qemu_monitor_json.c | 4 +- src/qemu/qemu_monitor_json.h | 3 +- src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 15 ++++++- src/remote_protocol-structs | 7 ++++ src/test/test_driver.c | 20 +++++++-- tests/qemumonitorjsontest.c | 2 +- tools/virsh-domain.c | 45 +++++++++++++++++++- 15 files changed, 275 insertions(+), 21 deletions(-)
-- Regards Qiao Nuohan

ping... On 03/06/2014 05:35 PM, 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
ChangLog: Changes from v4 to v5: 1. modify some restriction check
Changes from v3 to v4: 1. dropping patch "add dump_memory_format in qemu.conf" 2. fix to follow some conventions
Changes from v2 to v3: 1. address Jiri Denemark's comment about adding a new public API instead of changing an old one.
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 (3): add new virDomainCoreDumpWithFormat API add qemu support to virDomainCoreDumpWithFormat API allow "virsh dump --memory-only" specify dump format
include/libvirt/libvirt.h.in | 31 ++++++++++++++ src/driver.h | 7 ++++ src/libvirt.c | 97 ++++++++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 5 +++ src/qemu/qemu_driver.c | 49 ++++++++++++++++++---- src/qemu/qemu_monitor.c | 7 ++-- src/qemu/qemu_monitor.h | 3 +- src/qemu/qemu_monitor_json.c | 4 +- src/qemu/qemu_monitor_json.h | 3 +- src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 15 ++++++- src/remote_protocol-structs | 7 ++++ src/test/test_driver.c | 20 +++++++-- tests/qemumonitorjsontest.c | 2 +- tools/virsh-domain.c | 45 +++++++++++++++++++- 15 files changed, 275 insertions(+), 21 deletions(-)
-- Regards Qiao Nuohan

[off-list] Hello, We have just added 'Comment 3' in bugzilla. On 03/06/2014 05:35 PM, 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
ChangLog: Changes from v4 to v5: 1. modify some restriction check
Changes from v3 to v4: 1. dropping patch "add dump_memory_format in qemu.conf" 2. fix to follow some conventions
Changes from v2 to v3: 1. address Jiri Denemark's comment about adding a new public API instead of changing an old one.
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 (3): add new virDomainCoreDumpWithFormat API add qemu support to virDomainCoreDumpWithFormat API allow "virsh dump --memory-only" specify dump format
include/libvirt/libvirt.h.in | 31 ++++++++++++++ src/driver.h | 7 ++++ src/libvirt.c | 97 ++++++++++++++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 5 +++ src/qemu/qemu_driver.c | 49 ++++++++++++++++++---- src/qemu/qemu_monitor.c | 7 ++-- src/qemu/qemu_monitor.h | 3 +- src/qemu/qemu_monitor_json.c | 4 +- src/qemu/qemu_monitor_json.h | 3 +- src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 15 ++++++- src/remote_protocol-structs | 7 ++++ src/test/test_driver.c | 20 +++++++-- tests/qemumonitorjsontest.c | 2 +- tools/virsh-domain.c | 45 +++++++++++++++++++- 15 files changed, 275 insertions(+), 21 deletions(-)
-- Regards Qiao Nuohan
participants (4)
-
Daniel P. Berrange
-
Eric Blake
-
Martin Kletzander
-
qiaonuohan@cn.fujitsu.com