mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +00:00
qemuDomainNamespace{Setup,Teardown}Disk: Don't pass pointer to full disk
These functions do not need to see the whole virDomainDiskDef. Moreover, they are going to be called from places where we don't have access to the full disk definition. Sticking with virStorageSource is more than enough. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
76d491ef14
commit
18ce9d139d
@ -7896,7 +7896,7 @@ qemuDomainDetachDeviceUnlink(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
||||
int
|
||||
qemuDomainNamespaceSetupDisk(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk)
|
||||
virStorageSourcePtr src)
|
||||
{
|
||||
virStorageSourcePtr next;
|
||||
struct stat sb;
|
||||
@ -7905,8 +7905,8 @@ qemuDomainNamespaceSetupDisk(virQEMUDriverPtr driver,
|
||||
if (!qemuDomainNamespaceEnabled(vm, QEMU_DOMAIN_NS_MOUNT))
|
||||
return 0;
|
||||
|
||||
for (next = disk->src; next; next = next->backingStore) {
|
||||
if (!next->path || !virStorageSourceIsBlockLocal(disk->src)) {
|
||||
for (next = src; next; next = next->backingStore) {
|
||||
if (!next->path || !virStorageSourceIsBlockLocal(src)) {
|
||||
/* Not creating device. Just continue. */
|
||||
continue;
|
||||
}
|
||||
@ -7939,7 +7939,7 @@ qemuDomainNamespaceSetupDisk(virQEMUDriverPtr driver,
|
||||
int
|
||||
qemuDomainNamespaceTeardownDisk(virQEMUDriverPtr driver ATTRIBUTE_UNUSED,
|
||||
virDomainObjPtr vm ATTRIBUTE_UNUSED,
|
||||
virDomainDiskDefPtr disk ATTRIBUTE_UNUSED)
|
||||
virStorageSourcePtr src ATTRIBUTE_UNUSED)
|
||||
{
|
||||
/* While in hotplug case we create the whole backing chain,
|
||||
* here we must limit ourselves. The disk we want to remove
|
||||
|
@ -810,11 +810,11 @@ int qemuDomainCreateNamespace(virQEMUDriverPtr driver,
|
||||
|
||||
int qemuDomainNamespaceSetupDisk(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk);
|
||||
virStorageSourcePtr src);
|
||||
|
||||
int qemuDomainNamespaceTeardownDisk(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
virDomainDiskDefPtr disk);
|
||||
virStorageSourcePtr src);
|
||||
|
||||
int qemuDomainNamespaceSetupHostdev(virQEMUDriverPtr driver,
|
||||
virDomainObjPtr vm,
|
||||
|
@ -15915,7 +15915,7 @@ qemuDomainBlockPivot(virQEMUDriverPtr driver,
|
||||
|
||||
if (disk->mirror->format &&
|
||||
disk->mirror->format != VIR_STORAGE_FILE_RAW &&
|
||||
(qemuDomainNamespaceSetupDisk(driver, vm, disk) < 0 ||
|
||||
(qemuDomainNamespaceSetupDisk(driver, vm, disk->src) < 0 ||
|
||||
qemuSetupDiskCgroup(vm, disk) < 0 ||
|
||||
qemuSecuritySetDiskLabel(driver, vm, disk) < 0))
|
||||
goto cleanup;
|
||||
|
@ -110,7 +110,7 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver,
|
||||
vm, disk) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (qemuDomainNamespaceSetupDisk(driver, vm, disk) < 0)
|
||||
if (qemuDomainNamespaceSetupDisk(driver, vm, disk->src) < 0)
|
||||
goto rollback_lock;
|
||||
|
||||
if (qemuSecuritySetDiskLabel(driver, vm, disk) < 0)
|
||||
@ -132,7 +132,7 @@ qemuDomainPrepareDisk(virQEMUDriverPtr driver,
|
||||
virDomainDiskGetSource(disk));
|
||||
|
||||
rollback_namespace:
|
||||
if (qemuDomainNamespaceTeardownDisk(driver, vm, disk) < 0)
|
||||
if (qemuDomainNamespaceTeardownDisk(driver, vm, disk->src) < 0)
|
||||
VIR_WARN("Unable to remove /dev entry for %s",
|
||||
virDomainDiskGetSource(disk));
|
||||
|
||||
@ -3649,7 +3649,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) < 0)
|
||||
if (qemuDomainNamespaceTeardownDisk(driver, vm, disk->src) < 0)
|
||||
VIR_WARN("Unable to remove /dev entry for %s", src);
|
||||
|
||||
dev.type = VIR_DOMAIN_DEVICE_DISK;
|
||||
|
Loading…
Reference in New Issue
Block a user