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(a)redhat.com>
---
src/qemu/qemu_domain.c | 8 ++++----
src/qemu/qemu_domain.h | 4 ++--
src/qemu/qemu_driver.c | 2 +-
src/qemu/qemu_hotplug.c | 6 +++---
4 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 8ec9601d2..5db8b60c5 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -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
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 39731826e..5cfa3e114 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -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,
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 37ccfdf6b..89bc833de 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 778c8ef20..2f209f12b 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -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;
--
2.11.0