[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH] qemudDomainRestore: handle a case of virDomainSaveStatus failure



For each of the other uses of virDomainSaveStatus, the caller
handles failure.  Here it was ignored.

At first I was inclined to simply "goto endjob;", like a few other
uses in this file, but probing a bit, I found a few paths by which
it could fail with no diagnostic whatsoever.  And even if we've
already emitted a diagnostic about some lower-level failure, it
probably helps the user to know what high-level operation failed.

>From af983f0c730fcecf90a8c948a7537095bc2e80e7 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Tue, 18 May 2010 14:07:18 +0200
Subject: [PATCH] qemudDomainRestore: handle a case of virDomainSaveStatus failure

* src/qemu/qemu_driver.c (qemudDomainRestore): Don't ignore
virDomainSaveStatus failure.
---
 src/qemu/qemu_driver.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 948ab5b..5649a20 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6167,25 +6167,28 @@ static int qemudDomainRestore(virConnectPtr conn,
     if (header.was_running) {
         qemuDomainObjPrivatePtr priv = vm->privateData;
         qemuDomainObjEnterMonitorWithDriver(driver, vm);
         if (qemuMonitorStartCPUs(priv->mon, conn) < 0) {
             if (virGetLastError() == NULL)
                 qemuReportError(VIR_ERR_OPERATION_FAILED,
                                 "%s", _("failed to resume domain"));
             qemuDomainObjExitMonitorWithDriver(driver,vm);
             goto endjob;
         }
         qemuDomainObjExitMonitorWithDriver(driver, vm);
         vm->state = VIR_DOMAIN_RUNNING;
-        virDomainSaveStatus(driver->caps, driver->stateDir, vm);
+        if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0) {
+            VIR_WARN("Failed to save status on vm %s", vm->def->name);
+            goto endjob;
+        }
     }
     ret = 0;

 endjob:
     if (vm &&
         qemuDomainObjEndJob(vm) == 0)
         vm = NULL;

 cleanup:
     virDomainDefFree(def);
     VIR_FREE(xml);
     if (fd != -1)
--
1.7.1.250.g7d1e8


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]