[PATCHv2 7/7] Do not pass driver to qemuDomainNamespace{Setup, Teardown} functions

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

 



The underlying function which needs the driver gets it from the
passed virDomainObj object anyway.
---
 src/qemu/qemu_domain.c  | 34 ++++++++++++----------------------
 src/qemu/qemu_domain.h  | 30 ++++++++++--------------------
 src/qemu/qemu_driver.c  |  2 +-
 src/qemu/qemu_hotplug.c | 42 +++++++++++++++++++++---------------------
 4 files changed, 44 insertions(+), 64 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index c9d7dc5b0..97f8a5a61 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6454,7 +6454,7 @@ qemuDomainDiskChainElementRevoke(virQEMUDriverPtr driver,
     if (qemuSecurityRestoreImageLabel(driver, vm, elem) < 0)
         VIR_WARN("Unable to restore security label on %s", NULLSTR(elem->path));
 
-    if (qemuDomainNamespaceTeardownDisk(driver, vm, elem) < 0)
+    if (qemuDomainNamespaceTeardownDisk(vm, elem) < 0)
         VIR_WARN("Unable to remove /dev entry for %s", NULLSTR(elem->path));
 
     if (virDomainLockImageDetach(driver->lockManager, vm, elem) < 0)
@@ -6496,7 +6496,7 @@ qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver,
         goto cleanup;
 
     if (newSource &&
-        qemuDomainNamespaceSetupDisk(driver, vm, elem) < 0)
+        qemuDomainNamespaceSetupDisk(vm, elem) < 0)
         goto cleanup;
 
     if (qemuSetupImageCgroup(vm, elem) < 0)
@@ -10021,8 +10021,7 @@ qemuDomainNamespaceUnlinkPath(virDomainObjPtr vm,
 
 
 int
-qemuDomainNamespaceSetupDisk(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
-                             virDomainObjPtr vm,
+qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
                              virStorageSourcePtr src)
 {
     virStorageSourcePtr next;
@@ -10055,8 +10054,7 @@ qemuDomainNamespaceSetupDisk(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
 
 
 int
-qemuDomainNamespaceTeardownDisk(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
-                                virDomainObjPtr vm ATTRIBUTE_UNUSED,
+qemuDomainNamespaceTeardownDisk(virDomainObjPtr vm ATTRIBUTE_UNUSED,
                                 virStorageSourcePtr src ATTRIBUTE_UNUSED)
 {
     /* While in hotplug case we create the whole backing chain,
@@ -10070,8 +10068,7 @@ qemuDomainNamespaceTeardownDisk(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
 
 
 int
-qemuDomainNamespaceSetupHostdev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
-                                virDomainObjPtr vm,
+qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
                                 virDomainHostdevDefPtr hostdev)
 {
     int ret = -1;
@@ -10097,8 +10094,7 @@ qemuDomainNamespaceSetupHostdev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
 
 
 int
-qemuDomainNamespaceTeardownHostdev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
-                                   virDomainObjPtr vm,
+qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm,
                                    virDomainHostdevDefPtr hostdev)
 {
     int ret = -1;
@@ -10125,8 +10121,7 @@ qemuDomainNamespaceTeardownHostdev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
 
 
 int
-qemuDomainNamespaceSetupMemory(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
-                               virDomainObjPtr vm,
+qemuDomainNamespaceSetupMemory(virDomainObjPtr vm,
                                virDomainMemoryDefPtr mem)
 {
     if (mem->model != VIR_DOMAIN_MEMORY_MODEL_NVDIMM)
@@ -10140,8 +10135,7 @@ qemuDomainNamespaceSetupMemory(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
 
 
 int
-qemuDomainNamespaceTeardownMemory(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
-                                  virDomainObjPtr vm,
+qemuDomainNamespaceTeardownMemory(virDomainObjPtr vm,
                                   virDomainMemoryDefPtr mem)
 {
     if (mem->model != VIR_DOMAIN_MEMORY_MODEL_NVDIMM)
@@ -10155,8 +10149,7 @@ qemuDomainNamespaceTeardownMemory(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
 
 
 int
-qemuDomainNamespaceSetupChardev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
-                                virDomainObjPtr vm,
+qemuDomainNamespaceSetupChardev(virDomainObjPtr vm,
                                 virDomainChrDefPtr chr)
 {
     const char *path;
@@ -10177,8 +10170,7 @@ qemuDomainNamespaceSetupChardev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
 
 
 int
-qemuDomainNamespaceTeardownChardev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
-                                   virDomainObjPtr vm,
+qemuDomainNamespaceTeardownChardev(virDomainObjPtr vm,
                                    virDomainChrDefPtr chr)
 {
     const char *path = NULL;
@@ -10196,8 +10188,7 @@ qemuDomainNamespaceTeardownChardev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
 
 
 int
-qemuDomainNamespaceSetupRNG(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
-                            virDomainObjPtr vm,
+qemuDomainNamespaceSetupRNG(virDomainObjPtr vm,
                             virDomainRNGDefPtr rng)
 {
     const char *path = NULL;
@@ -10220,8 +10211,7 @@ qemuDomainNamespaceSetupRNG(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
 
 
 int
-qemuDomainNamespaceTeardownRNG(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
-                               virDomainObjPtr vm,
+qemuDomainNamespaceTeardownRNG(virDomainObjPtr vm,
                                virDomainRNGDefPtr rng)
 {
     const char *path = NULL;
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index c33af3671..e1f8a809a 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -905,44 +905,34 @@ void qemuDomainDestroyNamespace(virQEMUDriverPtr driver,
 
 bool qemuDomainNamespaceAvailable(qemuDomainNamespace ns);
 
-int qemuDomainNamespaceSetupDisk(virQEMUDriverPtr driver,
-                                 virDomainObjPtr vm,
+int qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
                                  virStorageSourcePtr src);
 
-int qemuDomainNamespaceTeardownDisk(virQEMUDriverPtr driver,
-                                    virDomainObjPtr vm,
+int qemuDomainNamespaceTeardownDisk(virDomainObjPtr vm,
                                     virStorageSourcePtr src);
 
-int qemuDomainNamespaceSetupHostdev(virQEMUDriverPtr driver,
-                                    virDomainObjPtr vm,
+int qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
                                     virDomainHostdevDefPtr hostdev);
 
-int qemuDomainNamespaceTeardownHostdev(virQEMUDriverPtr driver,
-                                       virDomainObjPtr vm,
+int qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm,
                                        virDomainHostdevDefPtr hostdev);
 
-int qemuDomainNamespaceSetupMemory(virQEMUDriverPtr driver,
-                                   virDomainObjPtr vm,
+int qemuDomainNamespaceSetupMemory(virDomainObjPtr vm,
                                    virDomainMemoryDefPtr memory);
 
-int qemuDomainNamespaceTeardownMemory(virQEMUDriverPtr driver,
-                                      virDomainObjPtr vm,
+int qemuDomainNamespaceTeardownMemory(virDomainObjPtr vm,
                                       virDomainMemoryDefPtr memory);
 
-int qemuDomainNamespaceSetupChardev(virQEMUDriverPtr driver,
-                                    virDomainObjPtr vm,
+int qemuDomainNamespaceSetupChardev(virDomainObjPtr vm,
                                     virDomainChrDefPtr chr);
 
-int qemuDomainNamespaceTeardownChardev(virQEMUDriverPtr driver,
-                                       virDomainObjPtr vm,
+int qemuDomainNamespaceTeardownChardev(virDomainObjPtr vm,
                                        virDomainChrDefPtr chr);
 
-int qemuDomainNamespaceSetupRNG(virQEMUDriverPtr driver,
-                                virDomainObjPtr vm,
+int qemuDomainNamespaceSetupRNG(virDomainObjPtr vm,
                                 virDomainRNGDefPtr rng);
 
-int qemuDomainNamespaceTeardownRNG(virQEMUDriverPtr driver,
-                                   virDomainObjPtr vm,
+int qemuDomainNamespaceTeardownRNG(virDomainObjPtr vm,
                                    virDomainRNGDefPtr rng);
 
 int qemuDomainNamespaceSetupInput(virDomainObjPtr vm,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 5eae7d24a..3cf488d42 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -16529,7 +16529,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
 
         if (disk->mirror->format &&
             disk->mirror->format != VIR_STORAGE_FILE_RAW &&
-            (qemuDomainNamespaceSetupDisk(driver, vm, disk->src) < 0 ||
+            (qemuDomainNamespaceSetupDisk(vm, disk->src) < 0 ||
              qemuSetupDiskCgroup(vm, disk) < 0 ||
              qemuSecuritySetDiskLabel(driver, vm, disk) < 0))
             goto cleanup;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index cbc7af59b..f26839c09 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -112,7 +112,7 @@ qemuHotplugPrepareDiskAccess(virQEMUDriverPtr driver,
                                 vm, disk) < 0)
         goto cleanup;
 
-    if (qemuDomainNamespaceSetupDisk(driver, vm, disk->src) < 0)
+    if (qemuDomainNamespaceSetupDisk(vm, disk->src) < 0)
         goto rollback_lock;
 
     if (qemuSecuritySetDiskLabel(driver, vm, disk) < 0)
@@ -134,7 +134,7 @@ qemuHotplugPrepareDiskAccess(virQEMUDriverPtr driver,
                  virDomainDiskGetSource(disk));
 
  rollback_namespace:
-    if (qemuDomainNamespaceTeardownDisk(driver, vm, disk->src) < 0)
+    if (qemuDomainNamespaceTeardownDisk(vm, disk->src) < 0)
         VIR_WARN("Unable to remove /dev entry for %s",
                  virDomainDiskGetSource(disk));
 
@@ -1304,7 +1304,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
     }
     vm->def->hostdevs[--(vm->def->nhostdevs)] = NULL;
 
-    if (qemuDomainNamespaceSetupHostdev(driver, vm, hostdev) < 0)
+    if (qemuDomainNamespaceSetupHostdev(vm, hostdev) < 0)
         goto error;
     teardowndevice = true;
 
@@ -1374,7 +1374,7 @@ qemuDomainAttachHostPCIDevice(virQEMUDriverPtr driver,
         qemuSecurityRestoreHostdevLabel(driver, vm, hostdev) < 0)
         VIR_WARN("Unable to restore host device labelling on hotplug fail");
     if (teardowndevice &&
-        qemuDomainNamespaceTeardownHostdev(driver, vm, hostdev) < 0)
+        qemuDomainNamespaceTeardownHostdev(vm, hostdev) < 0)
         VIR_WARN("Unable to remove host device from /dev");
 
     if (releaseaddr)
@@ -1831,7 +1831,7 @@ int qemuDomainAttachChrDevice(virConnectPtr conn,
     if (rc == 1)
         need_release = true;
 
-    if (qemuDomainNamespaceSetupChardev(driver, vm, chr) < 0)
+    if (qemuDomainNamespaceSetupChardev(vm, chr) < 0)
         goto cleanup;
     teardowndevice = true;
 
@@ -1877,7 +1877,7 @@ int qemuDomainAttachChrDevice(virConnectPtr conn,
             qemuDomainReleaseDeviceAddress(vm, &chr->info, NULL);
         if (teardowncgroup && qemuTeardownChardevCgroup(vm, chr) < 0)
             VIR_WARN("Unable to remove chr device cgroup ACL on hotplug fail");
-        if (teardowndevice && qemuDomainNamespaceTeardownChardev(driver, vm, chr) < 0)
+        if (teardowndevice && qemuDomainNamespaceTeardownChardev(vm, chr) < 0)
             VIR_WARN("Unable to remove chr device from /dev");
     }
     VIR_FREE(tlsAlias);
@@ -1934,7 +1934,7 @@ qemuDomainAttachRNGDevice(virConnectPtr conn,
     if (qemuDomainEnsureVirtioAddress(&releaseaddr, vm, &dev, "rng") < 0)
         return -1;
 
-    if (qemuDomainNamespaceSetupRNG(driver, vm, rng) < 0)
+    if (qemuDomainNamespaceSetupRNG(vm, rng) < 0)
         goto cleanup;
     teardowndevice = true;
 
@@ -1998,7 +1998,7 @@ qemuDomainAttachRNGDevice(virConnectPtr conn,
             qemuDomainReleaseDeviceAddress(vm, &rng->info, NULL);
         if (teardowncgroup && qemuTeardownRNGCgroup(vm, rng) < 0)
             VIR_WARN("Unable to remove RNG device cgroup ACL on hotplug fail");
-        if (teardowndevice && qemuDomainNamespaceTeardownRNG(driver, vm, rng) < 0)
+        if (teardowndevice && qemuDomainNamespaceTeardownRNG(vm, rng) < 0)
             VIR_WARN("Unable to remove chr device from /dev");
     }
 
@@ -2084,7 +2084,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
     if (qemuProcessBuildDestroyMemoryPaths(driver, vm, mem, true) < 0)
         goto cleanup;
 
-    if (qemuDomainNamespaceSetupMemory(driver, vm, mem) < 0)
+    if (qemuDomainNamespaceSetupMemory(vm, mem) < 0)
         goto cleanup;
     teardowndevice = true;
 
@@ -2142,7 +2142,7 @@ qemuDomainAttachMemory(virQEMUDriverPtr driver,
         if (teardownlabel && qemuSecurityRestoreMemoryLabel(driver, vm, mem) < 0)
             VIR_WARN("Unable to restore security label on memdev");
         if (teardowndevice &&
-            qemuDomainNamespaceTeardownMemory(driver, vm, mem) <  0)
+            qemuDomainNamespaceTeardownMemory(vm, mem) <  0)
             VIR_WARN("Unable to remove memory device from /dev");
     }
 
@@ -2203,7 +2203,7 @@ qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver,
 
     added = true;
 
-    if (qemuDomainNamespaceSetupHostdev(driver, vm, hostdev) < 0)
+    if (qemuDomainNamespaceSetupHostdev(vm, hostdev) < 0)
         goto cleanup;
     teardowndevice = true;
 
@@ -2244,7 +2244,7 @@ qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver,
             qemuSecurityRestoreHostdevLabel(driver, vm, hostdev) < 0)
             VIR_WARN("Unable to restore host device labelling on hotplug fail");
         if (teardowndevice &&
-            qemuDomainNamespaceTeardownHostdev(driver, vm, hostdev) < 0)
+            qemuDomainNamespaceTeardownHostdev(vm, hostdev) < 0)
             VIR_WARN("Unable to remove host device from /dev");
         if (added)
             qemuHostdevReAttachUSBDevices(driver, vm->def->name, &hostdev, 1);
@@ -2302,7 +2302,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
     if (qemuHostdevPrepareSCSIDevices(driver, vm->def->name, &hostdev, 1) < 0)
         return -1;
 
-    if (qemuDomainNamespaceSetupHostdev(driver, vm, hostdev) < 0)
+    if (qemuDomainNamespaceSetupHostdev(vm, hostdev) < 0)
         goto cleanup;
     teardowndevice = true;
 
@@ -2375,7 +2375,7 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn,
             qemuSecurityRestoreHostdevLabel(driver, vm, hostdev) < 0)
             VIR_WARN("Unable to restore host device labelling on hotplug fail");
         if (teardowndevice &&
-            qemuDomainNamespaceTeardownHostdev(driver, vm, hostdev) < 0)
+            qemuDomainNamespaceTeardownHostdev(vm, hostdev) < 0)
             VIR_WARN("Unable to remove host device from /dev");
     }
     qemuDomainSecretHostdevDestroy(hostdev);
@@ -2429,7 +2429,7 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver,
     if (qemuHostdevPrepareSCSIVHostDevices(driver, vm->def->name, &hostdev, 1) < 0)
         return -1;
 
-    if (qemuDomainNamespaceSetupHostdev(driver, vm, hostdev) < 0)
+    if (qemuDomainNamespaceSetupHostdev(vm, hostdev) < 0)
         goto cleanup;
     teardowndevice = true;
 
@@ -2499,7 +2499,7 @@ qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver,
             qemuSecurityRestoreHostdevLabel(driver, vm, hostdev) < 0)
             VIR_WARN("Unable to restore host device labelling on hotplug fail");
         if (teardowndevice &&
-            qemuDomainNamespaceTeardownHostdev(driver, vm, hostdev) < 0)
+            qemuDomainNamespaceTeardownHostdev(vm, hostdev) < 0)
             VIR_WARN("Unable to remove host device from /dev");
         if (releaseaddr)
             qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL);
@@ -3733,7 +3733,7 @@ qemuDomainRemoveDiskDevice(virQEMUDriverPtr driver,
     if (virDomainLockDiskDetach(driver->lockManager, vm, disk) < 0)
         VIR_WARN("Unable to release lock on %s", src);
 
-    if (qemuDomainNamespaceTeardownDisk(driver, vm, disk->src) < 0)
+    if (qemuDomainNamespaceTeardownDisk(vm, disk->src) < 0)
         VIR_WARN("Unable to remove /dev entry for %s", src);
 
     dev.type = VIR_DOMAIN_DEVICE_DISK;
@@ -3816,7 +3816,7 @@ qemuDomainRemoveMemoryDevice(virQEMUDriverPtr driver,
     if (qemuTeardownMemoryDevicesCgroup(vm, mem) < 0)
         VIR_WARN("Unable to remove memory device cgroup ACL");
 
-    if (qemuDomainNamespaceTeardownMemory(driver, vm, mem) <  0)
+    if (qemuDomainNamespaceTeardownMemory(vm, mem) <  0)
         VIR_WARN("Unable to remove memory device from /dev");
 
     virDomainMemoryDefFree(mem);
@@ -3946,7 +3946,7 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver,
     if (qemuTeardownHostdevCgroup(vm, hostdev) < 0)
         VIR_WARN("Failed to remove host device cgroup ACL");
 
-    if (qemuDomainNamespaceTeardownHostdev(driver, vm, hostdev) < 0)
+    if (qemuDomainNamespaceTeardownHostdev(vm, hostdev) < 0)
         VIR_WARN("Unable to remove host device from /dev");
 
     switch ((virDomainHostdevSubsysType) hostdev->source.subsys.type) {
@@ -4154,7 +4154,7 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
     if (qemuTeardownChardevCgroup(vm, chr) < 0)
         VIR_WARN("Failed to remove chr device cgroup ACL");
 
-    if (qemuDomainNamespaceTeardownChardev(driver, vm, chr) < 0)
+    if (qemuDomainNamespaceTeardownChardev(vm, chr) < 0)
         VIR_WARN("Unable to remove chr device from /dev");
 
     event = virDomainEventDeviceRemovedNewFromObj(vm, chr->info.alias);
@@ -4235,7 +4235,7 @@ qemuDomainRemoveRNGDevice(virQEMUDriverPtr driver,
     if (qemuTeardownRNGCgroup(vm, rng) < 0)
         VIR_WARN("Failed to remove RNG device cgroup ACL");
 
-    if (qemuDomainNamespaceTeardownRNG(driver, vm, rng) < 0)
+    if (qemuDomainNamespaceTeardownRNG(vm, rng) < 0)
         VIR_WARN("Unable to remove RNG device from /dev");
 
     event = virDomainEventDeviceRemovedNewFromObj(vm, rng->info.alias);
-- 
2.13.6

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