On Thu, Mar 06, 2014 at 09:35:47AM +0000, qiaonuohan@xxxxxxxxxxxxxx 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")); --
Attachment:
signature.asc
Description: Digital signature
-- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list