[PATCH 06/18] virSecurityDACRestoreAllLabel: Reorder device relabeling

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

 



It helps whe trying to match calls with virSecurityDACSetAllLabel
if the order in which devices are set/restored is the same in
both functions.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/security/security_dac.c | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/security/security_dac.c b/src/security/security_dac.c
index 82b16f96ee..9b3069e60c 100644
--- a/src/security/security_dac.c
+++ b/src/security/security_dac.c
@@ -1665,24 +1665,6 @@ virSecurityDACRestoreAllLabel(virSecurityManagerPtr mgr,
     VIR_DEBUG("Restoring security label on %s migrated=%d",
               def->name, migrated);
 
-    for (i = 0; i < def->nhostdevs; i++) {
-        if (virSecurityDACRestoreHostdevLabel(mgr,
-                                              def,
-                                              def->hostdevs[i],
-                                              NULL) < 0)
-            rc = -1;
-    }
-
-    for (i = 0; i < def->ngraphics; i++) {
-        if (virSecurityDACRestoreGraphicsLabel(mgr, def, def->graphics[i]) < 0)
-            return -1;
-    }
-
-    for (i = 0; i < def->ninputs; i++) {
-        if (virSecurityDACRestoreInputLabel(mgr, def, def->inputs[i]) < 0)
-            rc = -1;
-    }
-
     for (i = 0; i < def->ndisks; i++) {
         if (virSecurityDACRestoreImageLabelInt(mgr,
                                                def,
@@ -1691,6 +1673,24 @@ virSecurityDACRestoreAllLabel(virSecurityManagerPtr mgr,
             rc = -1;
     }
 
+    for (i = 0; i < def->ngraphics; i++) {
+        if (virSecurityDACRestoreGraphicsLabel(mgr, def, def->graphics[i]) < 0)
+            return -1;
+    }
+
+    for (i = 0; i < def->ninputs; i++) {
+        if (virSecurityDACRestoreInputLabel(mgr, def, def->inputs[i]) < 0)
+            rc = -1;
+    }
+
+    for (i = 0; i < def->nhostdevs; i++) {
+        if (virSecurityDACRestoreHostdevLabel(mgr,
+                                              def,
+                                              def->hostdevs[i],
+                                              NULL) < 0)
+            rc = -1;
+    }
+
     for (i = 0; i < def->nmems; i++) {
         if (virSecurityDACRestoreMemoryLabel(mgr,
                                              def,
-- 
2.18.1

--
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]

  Powered by Linux