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

[libvirt] [PATCH v2 06/18] virSecurityDACRestoreAllLabel: Reorder device relabeling



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 redhat com>
---
 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


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