Do not pass driver to qemuDomainNamespace{Setup,Teardown} functions

The underlying function which needs the driver gets it from the
passed virDomainObj object anyway.
This commit is contained in:
Ján Tomko 2017-11-24 17:52:15 +01:00
parent c317328976
commit a6f7c1b04c
4 changed files with 44 additions and 64 deletions

View File

@ -6462,7 +6462,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)
@ -6504,7 +6504,7 @@ qemuDomainDiskChainElementPrepare(virQEMUDriverPtr driver,
goto cleanup;
if (newSource &&
qemuDomainNamespaceSetupDisk(driver, vm, elem) < 0)
qemuDomainNamespaceSetupDisk(vm, elem) < 0)
goto cleanup;
if (qemuSetupImageCgroup(vm, elem) < 0)
@ -10029,8 +10029,7 @@ qemuDomainNamespaceUnlinkPath(virDomainObjPtr vm,
int
qemuDomainNamespaceSetupDisk(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
qemuDomainNamespaceSetupDisk(virDomainObjPtr vm,
virStorageSourcePtr src)
{
virStorageSourcePtr next;
@ -10063,8 +10062,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,
@ -10078,8 +10076,7 @@ qemuDomainNamespaceTeardownDisk(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
int
qemuDomainNamespaceSetupHostdev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
qemuDomainNamespaceSetupHostdev(virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
{
int ret = -1;
@ -10105,8 +10102,7 @@ qemuDomainNamespaceSetupHostdev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
int
qemuDomainNamespaceTeardownHostdev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
qemuDomainNamespaceTeardownHostdev(virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev)
{
int ret = -1;
@ -10134,8 +10130,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)
@ -10149,8 +10144,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)
@ -10164,8 +10158,7 @@ qemuDomainNamespaceTeardownMemory(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
int
qemuDomainNamespaceSetupChardev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
qemuDomainNamespaceSetupChardev(virDomainObjPtr vm,
virDomainChrDefPtr chr)
{
const char *path;
@ -10186,8 +10179,7 @@ qemuDomainNamespaceSetupChardev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
int
qemuDomainNamespaceTeardownChardev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
qemuDomainNamespaceTeardownChardev(virDomainObjPtr vm,
virDomainChrDefPtr chr)
{
const char *path = NULL;
@ -10205,8 +10197,7 @@ qemuDomainNamespaceTeardownChardev(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
int
qemuDomainNamespaceSetupRNG(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
qemuDomainNamespaceSetupRNG(virDomainObjPtr vm,
virDomainRNGDefPtr rng)
{
const char *path = NULL;
@ -10229,8 +10220,7 @@ qemuDomainNamespaceSetupRNG(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
int
qemuDomainNamespaceTeardownRNG(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
virDomainObjPtr vm,
qemuDomainNamespaceTeardownRNG(virDomainObjPtr vm,
virDomainRNGDefPtr rng)
{
const char *path = NULL;

View File

@ -906,44 +906,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,

View File

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

View File

@ -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)
@ -1832,7 +1832,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;
@ -1884,7 +1884,7 @@ int qemuDomainAttachChrDevice(virConnectPtr conn,
VIR_WARN("Unable to remove chr device cgroup ACL on hotplug fail");
if (teardownlabel && qemuSecurityRestoreChardevLabel(driver, vm, chr) < 0)
VIR_WARN("Unable to restore security label on char device");
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);
@ -1941,7 +1941,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;
@ -2005,7 +2005,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");
}
@ -2091,7 +2091,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;
@ -2149,7 +2149,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");
}
@ -2210,7 +2210,7 @@ qemuDomainAttachHostUSBDevice(virQEMUDriverPtr driver,
added = true;
if (qemuDomainNamespaceSetupHostdev(driver, vm, hostdev) < 0)
if (qemuDomainNamespaceSetupHostdev(vm, hostdev) < 0)
goto cleanup;
teardowndevice = true;
@ -2251,7 +2251,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);
@ -2309,7 +2309,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;
@ -2382,7 +2382,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);
@ -2436,7 +2436,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;
@ -2506,7 +2506,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);
@ -3740,7 +3740,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;
@ -3823,7 +3823,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);
@ -3953,7 +3953,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) {
@ -4164,7 +4164,7 @@ qemuDomainRemoveChrDevice(virQEMUDriverPtr driver,
if (qemuSecurityRestoreChardevLabel(driver, vm, chr) < 0)
VIR_WARN("Unable to restore security label on char device");
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);
@ -4245,7 +4245,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);