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 > diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c > index a2769db..bcb457f 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) The '*' should associate with the variable name, not the data type. > diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h > index eabf000..a6fc8ee 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); Same comment about '*' whitespace 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 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list