[PATCH] qemu: Only restore security label when saving is successfull.

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

 



"qemudDomainSaveFlag" trys to restore security label even if
the saving fails, a useless warning will be thowed then, e.g.
if "doStopVcpus" fails.

* src/qemu/qemu_driver.c
---
 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 af897ad..1baee58 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1823,6 +1823,7 @@ static int qemudDomainSaveFlag(struct qemud_driver *driver, virDomainPtr dom,
     int is_reg = 0;
     unsigned long long offset;
     virCgroupPtr cgroup = NULL;
+    bool saved = false;

     memset(&header, 0, sizeof(header));
     memcpy(header.magic, QEMUD_SAVE_MAGIC, sizeof(header.magic));
@@ -2040,6 +2041,8 @@ static int qemudDomainSaveFlag(struct qemud_driver *driver, virDomainPtr dom,
     if (rc < 0)
         goto endjob;

+    saved = true;
+
     if ((!bypassSecurityDriver) &&
         virSecurityManagerRestoreSavedStateLabel(driver->securityManager,
                                                  vm, path) < 0)
@@ -2087,7 +2090,7 @@ endjob:
                              path, vm->def->name, rc);
             }

-            if ((!bypassSecurityDriver) &&
+            if ((!bypassSecurityDriver) && saved &&
                 virSecurityManagerRestoreSavedStateLabel(driver->securityManager,
                                                          vm, path) < 0)
                 VIR_WARN("failed to restore save state label on %s", path);
--
1.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]