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

[libvirt] [PATCH 4/4] qemu: Improve error reporting from qemuDomainManagedSaveRemove



Report an error if unlink of the managedsave file fails.
---
Hm, this patch changes semantics a little bit. If the unlink() fails now,
the domain isn't marked as not having a managed save file. If somebody does
not like this change I will return it to the previous semantics.
---
 src/qemu/qemu_driver.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b1cb185..1941ae7 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3342,8 +3342,15 @@ qemuDomainManagedSaveRemove(virDomainPtr dom, unsigned int flags)
     if (!(name = qemuDomainManagedSavePath(driver, vm)))
         goto cleanup;

-    ret = unlink(name);
+    if (unlink(name) < 0) {
+        virReportSystemError(errno,
+                             _("Failed to remove managed save file '%s'"),
+                             name);
+        goto cleanup;
+    }
+
     vm->hasManagedSave = false;
+    ret = 0;

 cleanup:
     VIR_FREE(name);
-- 
1.8.0


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