On Tue, Mar 18, 2014 at 07:12:03AM +0000, qiaonuohan(a)cn.fujitsu.com wrote:
static int qemuDumpToFd(virQEMUDriverPtr driver, virDomainObjPtr
vm,
- int fd, enum qemuDomainAsyncJob asyncJob)
+ int fd, enum qemuDomainAsyncJob asyncJob,
+ const char *dumpformat)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret = -1;
@@ -3409,7 +3417,20 @@ static int qemuDumpToFd(virQEMUDriverPtr driver, virDomainObjPtr
vm,
if (qemuDomainObjEnterMonitorAsync(driver, vm, asyncJob) < 0)
return -1;
- ret = qemuMonitorDumpToFd(priv->mon, fd);
+ if (dumpformat) {
+ ret = qemuMonitorGetDumpGuestMemoryCapability(priv->mon, dumpformat);
What happens when we query support for VIR_DOMAIN_CORE_DUMP_FORMAT_RAW
but run on older QEMU which lacks this capability reporting. It looks
like this code will raise an error, but it should simply call the old
monitor code for this.
+
+ if (ret <= 0) {
+ virReportError(VIR_ERR_INVALID_ARG,
+ _("unsupported dumpformat '%s'"),
dumpformat);
+ ret = -1;
+ goto cleanup;
+ }
+ }
+
+ ret = qemuMonitorDumpToFd(priv->mon, fd, dumpformat);
+
+cleanup:
qemuDomainObjExitMonitor(driver, vm);
return ret;
@@ -3420,13 +3441,15 @@ doCoreDump(virQEMUDriverPtr driver,
virDomainObjPtr vm,
const char *path,
virQEMUSaveFormat compress,
- unsigned int dump_flags)
+ unsigned int dump_flags,
+ unsigned int dumpformat)
{
int fd = -1;
int ret = -1;
virFileWrapperFdPtr wrapperFd = NULL;
int directFlag = 0;
unsigned int flags = VIR_FILE_WRAPPER_NON_BLOCKING;
+ const char *memory_dump_format = NULL;
/* Create an empty file with appropriate ownership. */
if (dump_flags & VIR_DUMP_BYPASS_CACHE) {
@@ -3450,8 +3473,20 @@ doCoreDump(virQEMUDriverPtr driver,
goto cleanup;
if (dump_flags & VIR_DUMP_MEMORY_ONLY) {
- ret = qemuDumpToFd(driver, vm, fd, QEMU_ASYNC_JOB_DUMP);
+ 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_DOMAIN_CORE_DUMP_FORMAT_RAW) {
+ virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s",
+ _("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);
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 :|