From 0437e75291d4a1ebb1279989fef1a3f78995c5d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Guido=20G=C3=BCnther?= Date: Sat, 7 Feb 2009 21:36:06 +0000 Subject: [PATCH] Don't ignore errors to save domain status --- ChangeLog | 7 +++++++ src/qemu_driver.c | 23 ++++++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index f49e8c21a9..416de6f9fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sat Feb 7 21:46:06 CET 2009 Guido Günther + + * src/qemu_driver.c (qemudStartVMDaemon, qemudDomainSuspend, + qemudDomainResume, qemudDomainAttachDevice, qemudDomainDetachDevice): + Don't ignore errors to save domain status. + (qemudShutdownVMDaemon): Warn if we fail to remove the status file. + Fri Feb 6 14:43:10 GMT 2009 Daniel P. Berrange Fix 100% CPU bound loop when libvirtd --timeout is used diff --git a/src/qemu_driver.c b/src/qemu_driver.c index a32248608a..4bec4823e7 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -1251,12 +1251,12 @@ static int qemudStartVMDaemon(virConnectPtr conn, if ((qemudWaitForMonitor(conn, driver, vm, pos) < 0) || (qemudDetectVcpuPIDs(conn, vm) < 0) || (qemudInitCpus(conn, vm, migrateFrom) < 0) || - (qemudInitPasswords(conn, driver, vm) < 0)) { + (qemudInitPasswords(conn, driver, vm) < 0) || + (qemudSaveDomainStatus(conn, qemu_driver, vm) < 0)) { qemudShutdownVMDaemon(conn, driver, vm); return -1; } } - qemudSaveDomainStatus(conn, qemu_driver, vm); return ret; } @@ -1294,7 +1294,10 @@ static void qemudShutdownVMDaemon(virConnectPtr conn ATTRIBUTE_UNUSED, /* shut it off for sure */ virKillProcess(vm->pid, SIGKILL); - qemudRemoveDomainStatus(conn, driver, vm); + if (qemudRemoveDomainStatus(conn, driver, vm) < 0) { + qemudLog(QEMUD_WARN, _("Failed to remove domain status for %s"), + vm->def->name); + } vm->pid = -1; vm->def->id = -1; vm->state = VIR_DOMAIN_SHUTOFF; @@ -1951,7 +1954,8 @@ static int qemudDomainSuspend(virDomainPtr dom) { VIR_DOMAIN_EVENT_SUSPENDED_PAUSED); VIR_FREE(info); } - qemudSaveDomainStatus(dom->conn, driver, vm); + if (qemudSaveDomainStatus(dom->conn, driver, vm) < 0) + goto cleanup; ret = 0; cleanup: @@ -2001,7 +2005,8 @@ static int qemudDomainResume(virDomainPtr dom) { VIR_DOMAIN_EVENT_RESUMED_UNPAUSED); VIR_FREE(info); } - qemudSaveDomainStatus(dom->conn, driver, vm); + if (qemudSaveDomainStatus(dom->conn, driver, vm) < 0) + goto cleanup; ret = 0; cleanup: @@ -3435,7 +3440,9 @@ static int qemudDomainAttachDevice(virDomainPtr dom, goto cleanup; } - qemudSaveDomainStatus(dom->conn, driver, vm); + if (!ret && qemudSaveDomainStatus(dom->conn, driver, vm) < 0) + ret = -1; + cleanup: if (ret < 0) virDomainDeviceDefFree(dev); @@ -3552,7 +3559,9 @@ static int qemudDomainDetachDevice(virDomainPtr dom, qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT, "%s", _("only SCSI or virtio disk device can be detached dynamically")); - qemudSaveDomainStatus(dom->conn, driver, vm); + if (!ret && qemudSaveDomainStatus(dom->conn, driver, vm) < 0) + ret = -1; + cleanup: virDomainDeviceDefFree(dev); if (vm) -- GitLab