Pre-extending the disk array size is pointless nowadays since we've
switched to memory APIs which don't return failure.
Switch all uses of reallocation of the array followed by
'virDomainDiskInsertPreAlloced' with direct virDomainDiskInsert.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/libxl/libxl_driver.c | 4 +---
src/lxc/lxc_driver.c | 6 +-----
src/qemu/qemu_hotplug.c | 3 +--
3 files changed, 3 insertions(+), 10 deletions(-)
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c
index d54cd41785..e305f64f9c 100644
--- a/src/libxl/libxl_driver.c
+++ b/src/libxl/libxl_driver.c
@@ -3048,8 +3048,6 @@ libxlDomainAttachDeviceDiskLive(virDomainObj *vm, virDomainDeviceDef
*dev)
goto cleanup;
}
- VIR_REALLOC_N(vm->def->disks, vm->def->ndisks+1);
-
if (libxlMakeDisk(l_disk, &x_disk) < 0)
goto cleanup;
@@ -3072,7 +3070,7 @@ libxlDomainAttachDeviceDiskLive(virDomainObj *vm, virDomainDeviceDef
*dev)
}
libxlUpdateDiskDef(l_disk, &x_disk);
- virDomainDiskInsertPreAlloced(vm->def, l_disk);
+ virDomainDiskInsert(vm->def, l_disk);
} else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c
index 07aeb56b0c..8f2ca19f44 100644
--- a/src/lxc/lxc_driver.c
+++ b/src/lxc/lxc_driver.c
@@ -3401,10 +3401,6 @@ lxcDomainAttachDeviceDiskLive(virLXCDriver *driver,
perms) < 0)
goto cleanup;
- vm->def->disks = g_renew(virDomainDiskDef *,
- vm->def->disks,
- vm->def->ndisks + 1);
-
file = g_strdup_printf("/dev/%s", def->dst);
if (lxcDomainAttachDeviceMknod(driver,
@@ -3423,7 +3419,7 @@ lxcDomainAttachDeviceDiskLive(virLXCDriver *driver,
goto cleanup;
}
- virDomainDiskInsertPreAlloced(vm->def, def);
+ virDomainDiskInsert(vm->def, def);
ret = 0;
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 7a1b413be0..ee72762d0d 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -737,7 +737,6 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver,
if (!(devstr = qemuBuildDiskDeviceStr(vm->def, disk, priv->qemuCaps)))
goto cleanup;
- VIR_REALLOC_N(vm->def->disks, vm->def->ndisks + 1);
if (qemuHotplugAttachManagedPR(driver, vm, disk->src, QEMU_ASYNC_JOB_NONE) <
0)
goto cleanup;
@@ -784,7 +783,7 @@ qemuDomainAttachDiskGeneric(virQEMUDriver *driver,
virDomainAuditDisk(vm, NULL, disk->src, "attach", true);
- virDomainDiskInsertPreAlloced(vm->def, disk);
+ virDomainDiskInsert(vm->def, disk);
ret = 0;
cleanup:
--
2.31.1