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