
On 03/04/2014 07:44 PM, Daniel P. Berrange wrote:
On Mon, Mar 03, 2014 at 10:27:25AM +0800, qiaonuohan wrote:
This patch makes qemu driver supprot virDomainCoreDumpWithFormat API. --- src/qemu/qemu_driver.c | 45 +++++++++++++++++++++++++++++++++++--------- 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, 48 insertions(+), 16 deletions(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c9a865e..f373f7c 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -3452,7 +3455,20 @@ 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 { ret = qemuMigrationToFile(driver, vm, fd, 0, path, qemuCompressProgramName(compress), false, The else branch here should raise VIR_ERR_OPERATION_UNSUPPORTED if dumpformat != VIR_DUMP_FORMAT_RAW
So here is the place I should do the "implmentation restriction"(mentioned in your last mail), then VIR_DUMP_FORMAT_RAW is the only choice when VIR_DUMP_MEMORY_ONLY is not specified. -- Regards Qiao Nuohan