On Mon, Nov 30, 2009 at 10:11:10AM +0100, Paolo Bonzini wrote:
This patch adds the --crash option (already present in "xm
dump-core")
to "virsh dump". virDomainCoreDump already has a flags argument, so
the API/ABI is untouched.
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 92d4629..8e80144 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3543,6 +3543,7 @@ static int qemudDomainCoreDump(virDomainPtr dom,
virDomainObjPtr vm;
int resume = 0, paused = 0;
int ret = -1, fd = -1;
+ virDomainEventPtr event = NULL;
const char *args[] = {
"cat",
NULL,
@@ -3633,10 +3634,17 @@ static int qemudDomainCoreDump(virDomainPtr dom,
goto endjob;
endjob:
+ if ((ret == 0) && (flags & VIR_DUMP_CRASH)) {
+ qemudShutdownVMDaemon(dom->conn, driver, vm);
+ event = virDomainEventNewFromObj(vm,
+ VIR_DOMAIN_EVENT_STOPPED,
+ VIR_DOMAIN_EVENT_STOPPED_CRASHED);
+ }
+
Shouldn't we be setting 'resume=0' here otherwise....
/* Since the monitor is always attached to a pty for libvirt,
it
will support synchronous operations so we always get here after
the migration is complete. */
- if (resume && paused) {
+ else if (resume && paused) {
qemuDomainObjEnterMonitor(vm);
if (qemuMonitorStartCPUs(priv->mon, dom->conn) < 0) {
if (virGetLastError() == NULL)
....this will try to resume CPUs on a guest we just shutdown
@@ -3647,12 +3655,19 @@ endjob:
}
qemuDomainObjEndJob(vm);
+ if ((ret == 0) && (flags & VIR_DUMP_CRASH) &&
!vm->persistent) {
+ virDomainRemoveInactive(&driver->domains,
+ vm);
+ vm = NULL;
+ }
cleanup:
if (ret != 0)
unlink(path);
if (vm)
virDomainObjUnlock(vm);
+ if (event)
+ qemuDomainEventQueue(driver, event);
return ret;
}
Regards,
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://ovirt.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|