[PATCH 03/11] qemu: cgroup: Change qemu[Setup|Teardown]DiskCgroup to take virStorageSource

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

 



Since the disk is necessary only to get the source modify the functions
to take the source directly and rename them  to
qemu[Setup|Teardown]ImageChainCgroup.

Additionally drop a pointless comment containing the old function name.

Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/qemu/qemu_cgroup.c  | 14 +++++++-------
 src/qemu/qemu_cgroup.h  |  8 ++++----
 src/qemu/qemu_domain.c  |  3 ---
 src/qemu/qemu_driver.c  |  2 +-
 src/qemu/qemu_hotplug.c |  4 ++--
 5 files changed, 14 insertions(+), 17 deletions(-)

diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
index 4931fb6575..9ceecb884e 100644
--- a/src/qemu/qemu_cgroup.c
+++ b/src/qemu/qemu_cgroup.c
@@ -204,13 +204,13 @@ qemuTeardownImageCgroup(virDomainObjPtr vm,


 int
-qemuSetupDiskCgroup(virDomainObjPtr vm,
-                    virDomainDiskDefPtr disk)
+qemuSetupImageChainCgroup(virDomainObjPtr vm,
+                          virStorageSourcePtr src)
 {
     virStorageSourcePtr next;
     bool forceReadonly = false;

-    for (next = disk->src; virStorageSourceIsBacking(next); next = next->backingStore) {
+    for (next = src; virStorageSourceIsBacking(next); next = next->backingStore) {
         if (qemuSetupImageCgroupInternal(vm, next, forceReadonly) < 0)
             return -1;

@@ -223,12 +223,12 @@ qemuSetupDiskCgroup(virDomainObjPtr vm,


 int
-qemuTeardownDiskCgroup(virDomainObjPtr vm,
-                       virDomainDiskDefPtr disk)
+qemuTeardownImageChainCgroup(virDomainObjPtr vm,
+                             virStorageSourcePtr src)
 {
     virStorageSourcePtr next;

-    for (next = disk->src; virStorageSourceIsBacking(next); next = next->backingStore) {
+    for (next = src; virStorageSourceIsBacking(next); next = next->backingStore) {
         if (qemuTeardownImageCgroup(vm, next) < 0)
             return -1;
     }
@@ -720,7 +720,7 @@ qemuSetupDevicesCgroup(virDomainObjPtr vm)
         goto cleanup;

     for (i = 0; i < vm->def->ndisks; i++) {
-        if (qemuSetupDiskCgroup(vm, vm->def->disks[i]) < 0)
+        if (qemuSetupImageChainCgroup(vm, vm->def->disks[i]->src) < 0)
             goto cleanup;
     }

diff --git a/src/qemu/qemu_cgroup.h b/src/qemu/qemu_cgroup.h
index 17a565244f..dc6d173fce 100644
--- a/src/qemu/qemu_cgroup.h
+++ b/src/qemu/qemu_cgroup.h
@@ -31,10 +31,10 @@ int qemuSetupImageCgroup(virDomainObjPtr vm,
                          virStorageSourcePtr src);
 int qemuTeardownImageCgroup(virDomainObjPtr vm,
                             virStorageSourcePtr src);
-int qemuSetupDiskCgroup(virDomainObjPtr vm,
-                        virDomainDiskDefPtr disk);
-int qemuTeardownDiskCgroup(virDomainObjPtr vm,
-                           virDomainDiskDefPtr disk);
+int qemuSetupImageChainCgroup(virDomainObjPtr vm,
+                              virStorageSourcePtr src);
+int qemuTeardownImageChainCgroup(virDomainObjPtr vm,
+                                 virStorageSourcePtr src);
 int qemuSetupInputCgroup(virDomainObjPtr vm,
                          virDomainInputDefPtr dev);
 int qemuTeardownInputCgroup(virDomainObjPtr vm,
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index e42b93e051..9ec30099a1 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -11238,9 +11238,6 @@ qemuDomainGetHostdevPath(virDomainDefPtr def,
         case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI:
             if (scsisrc->protocol == VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI) {
                 virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc = &scsisrc->u.iscsi;
-                /* Follow qemuSetupDiskCgroup() and qemuSetImageCgroupInternal()
-                 * which does nothing for non local storage
-                 */
                 VIR_DEBUG("Not updating /dev for hostdev iSCSI path '%s'", iscsisrc->src->path);
             } else {
                 virDomainHostdevSubsysSCSIHostPtr scsihostsrc = &scsisrc->u.host;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b254e96131..fbc2a20915 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -17189,7 +17189,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
         if (disk->mirror->format &&
             disk->mirror->format != VIR_STORAGE_FILE_RAW &&
             (qemuDomainNamespaceSetupDisk(vm, disk->src) < 0 ||
-             qemuSetupDiskCgroup(vm, disk) < 0 ||
+             qemuSetupImageChainCgroup(vm, disk->src) < 0 ||
              qemuSecuritySetDiskLabel(driver, vm, disk) < 0))
             goto cleanup;

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 615105d595..000102ac3f 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -116,14 +116,14 @@ qemuHotplugPrepareDiskAccess(virQEMUDriverPtr driver,
     if (qemuSecuritySetDiskLabel(driver, vm, disk) < 0)
         goto rollback_namespace;

-    if (qemuSetupDiskCgroup(vm, disk) < 0)
+    if (qemuSetupImageChainCgroup(vm, disk->src) < 0)
         goto rollback_label;

     ret = 0;
     goto cleanup;

  rollback_cgroup:
-    if (qemuTeardownDiskCgroup(vm, disk) < 0)
+    if (qemuTeardownImageChainCgroup(vm, disk->src) < 0)
         VIR_WARN("Unable to tear down cgroup access on %s",
                  NULLSTR(virDomainDiskGetSource(disk)));
  rollback_label:
-- 
2.20.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