1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

Improve debugging of QEMU start/stop

Include reference of the VM object pointer and name in debug
logs for QEMU start/stop functions. Also make sure we log the
PID that we started, since it isn't available elsewhere in the
logs.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
Daniel P. Berrange 2013-10-31 11:28:46 +00:00
parent dddc57a339
commit 4b9862775c

View File

@ -3499,6 +3499,10 @@ int qemuProcessStart(virConnectPtr conn,
virQEMUDriverConfigPtr cfg; virQEMUDriverConfigPtr cfg;
virCapsPtr caps = NULL; virCapsPtr caps = NULL;
VIR_DEBUG("vm=%p name=%s id=%d pid=%llu",
vm, vm->def->name, vm->def->id,
(unsigned long long)vm->pid);
/* Okay, these are just internal flags, /* Okay, these are just internal flags,
* but doesn't hurt to check */ * but doesn't hurt to check */
virCheckFlags(VIR_QEMU_PROCESS_START_COLD | virCheckFlags(VIR_QEMU_PROCESS_START_COLD |
@ -3845,23 +3849,11 @@ int qemuProcessStart(virConnectPtr conn,
_("Domain %s didn't show up"), vm->def->name); _("Domain %s didn't show up"), vm->def->name);
ret = -1; ret = -1;
} }
#if 0 VIR_DEBUG("QEMU vm=%p name=%s running with pid=%llu",
} else if (ret == -2) { vm, vm->def->name, (unsigned long long)vm->pid);
/* } else {
* XXX this is bogus. It isn't safe to set vm->pid = child VIR_DEBUG("QEMU vm=%p name=%s failed to spawn",
* because the child no longer exists. vm, vm->def->name);
*/
/* The virCommand process that launches the daemon failed. Pending on
* when it failed (we can't determine for sure), there may be
* extra info in the domain log (if the hook failed for example).
*
* Pretend like things succeeded, and let 'WaitForMonitor' report
* the log contents for us.
*/
vm->pid = child;
ret = 0;
#endif
} }
VIR_DEBUG("Writing early domain status to disk"); VIR_DEBUG("Writing early domain status to disk");
@ -4085,8 +4077,9 @@ qemuProcessKill(virDomainObjPtr vm, unsigned int flags)
{ {
int ret; int ret;
VIR_DEBUG("vm=%s pid=%d flags=%x", VIR_DEBUG("vm=%p name=%s pid=%llu flags=%x",
vm->def->name, vm->pid, flags); vm, vm->def->name,
(unsigned long long)vm->pid, flags);
if (!(flags & VIR_QEMU_PROCESS_KILL_NOCHECK)) { if (!(flags & VIR_QEMU_PROCESS_KILL_NOCHECK)) {
if (!virDomainObjIsActive(vm)) { if (!virDomainObjIsActive(vm)) {
@ -4126,8 +4119,9 @@ void qemuProcessStop(virQEMUDriverPtr driver,
char ebuf[1024]; char ebuf[1024];
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver); virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
VIR_DEBUG("Shutting down VM '%s' pid=%d flags=%x", VIR_DEBUG("Shutting down vm=%p name=%s id=%d pid=%llu flags=%x",
vm->def->name, vm->pid, flags); vm, vm->def->name, vm->def->id,
(unsigned long long)vm->pid, flags);
if (!virDomainObjIsActive(vm)) { if (!virDomainObjIsActive(vm)) {
VIR_DEBUG("VM '%s' not active", vm->def->name); VIR_DEBUG("VM '%s' not active", vm->def->name);