On Thu, Mar 06, 2014 at 09:35:47AM +0000, qiaonuohan(a)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 */
--