This is very similar to ones I fixed yesterday.
The difference is that I'm adding ATTRIBUTE_RETURN_CHECK, now.
Here, it's easy, since the function is private.
From cfce459e9aebae840356e62473f550f358834f30 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Wed, 19 May 2010 17:48:03 +0200
Subject: [PATCH] qemudDomainMigrateFinish2: handle a case of virDomainSaveStatus failure
* src/qemu/qemu_driver.c (qemudDomainMigrateFinish2): Don't ignore
virDomainSaveStatus failure.
* src/conf/domain_conf.h (virDomainSaveStatus): Use
ATTRIBUTE_RETURN_CHECK, so this doesn't happen again.
---
src/conf/domain_conf.h | 2 +-
src/qemu/qemu_driver.c | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index fadc8bd..a7206d3 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1011,7 +1011,7 @@ int virDomainSaveConfig(const char *configDir,
virDomainDefPtr def);
int virDomainSaveStatus(virCapsPtr caps,
const char *statusDir,
- virDomainObjPtr obj);
+ virDomainObjPtr obj) ATTRIBUTE_RETURN_CHECK;
typedef void (*virDomainLoadConfigNotify)(virDomainObjPtr dom,
int newDomain,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 65ca117..a519c02 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10816,7 +10816,10 @@ qemudDomainMigrateFinish2 (virConnectPtr dconn,
VIR_DOMAIN_EVENT_SUSPENDED,
VIR_DOMAIN_EVENT_SUSPENDED_PAUSED);
}
- 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;
+ }
} else {
qemudShutdownVMDaemon(driver, vm, 0);
event = virDomainEventNewFromObj(vm,
--
1.7.1.259.g3aef8