[PATCH 07/10] qemu: cgroup: Switch to qemu(Setup|Teardown)ImageCgroup

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

 



For other objects we use the two functions rather than one with a bool.
Convert qemuSetImageCgroup to the same approach.
---
 src/qemu/qemu_cgroup.c | 17 ++++++++++++-----
 src/qemu/qemu_cgroup.h |  7 ++++---
 src/qemu/qemu_driver.c |  4 ++--
 3 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index b37af6d..978dfa2 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -99,11 +99,18 @@ qemuSetImageCgroupInternal(virDomainObjPtr vm,


 int
-qemuSetImageCgroup(virDomainObjPtr vm,
-                   virStorageSourcePtr src,
-                   bool deny)
+qemuSetupImageCgroup(virDomainObjPtr vm,
+                     virStorageSourcePtr src)
 {
-    return qemuSetImageCgroupInternal(vm, src, deny, false);
+    return qemuSetImageCgroupInternal(vm, src, false, false);
+}
+
+
+int
+qemuTeardownImageCgroup(virDomainObjPtr vm,
+                        virStorageSourcePtr src)
+{
+    return qemuSetImageCgroupInternal(vm, src, true, false);
 }


@@ -133,7 +140,7 @@ qemuTeardownDiskCgroup(virDomainObjPtr vm,
     virStorageSourcePtr next;

     for (next = disk->src; next; next = next->backingStore) {
-        if (qemuSetImageCgroup(vm, next, true) < 0)
+        if (qemuSetImageCgroupInternal(vm, next, true, false) < 0)
             return -1;
     }

diff --git a/src/qemu/qemu_cgroup.h b/src/qemu/qemu_cgroup.h
index a31fa34..a8b8e1b 100644
--- a/src/qemu/qemu_cgroup.h
+++ b/src/qemu/qemu_cgroup.h
@@ -29,9 +29,10 @@
 # include "domain_conf.h"
 # include "qemu_conf.h"

-int qemuSetImageCgroup(virDomainObjPtr vm,
-                       virStorageSourcePtr src,
-                       bool deny);
+int qemuSetupImageCgroup(virDomainObjPtr vm,
+                         virStorageSourcePtr src);
+int qemuTeardownImageCgroup(virDomainObjPtr vm,
+                            virStorageSourcePtr src);
 int qemuSetupDiskCgroup(virDomainObjPtr vm,
                         virDomainDiskDefPtr disk);
 int qemuTeardownDiskCgroup(virDomainObjPtr vm,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index fa1d9b7..be42d77 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -13374,7 +13374,7 @@ qemuDomainPrepareDiskChainElement(virQEMUDriverPtr driver,
                                                 vm->def, elem) < 0)
             VIR_WARN("Unable to restore security label on %s", elem->path);

-        if (qemuSetImageCgroup(vm, elem, true) < 0)
+        if (qemuTeardownImageCgroup(vm, elem) < 0)
             VIR_WARN("Failed to teardown cgroup for disk path %s", elem->path);

         if (virDomainLockImageDetach(driver->lockManager, vm, elem) < 0)
@@ -13384,7 +13384,7 @@ qemuDomainPrepareDiskChainElement(virQEMUDriverPtr driver,
                                      vm, elem) < 0)
             goto cleanup;

-        if (qemuSetImageCgroup(vm, elem, false) < 0)
+        if (qemuSetupImageCgroup(vm, elem) < 0)
             goto cleanup;

         if (virSecurityManagerSetImageLabel(driver->securityManager,
-- 
2.6.2

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