mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-08 22:15:21 +00:00
Replace virDomainDiskInsertPreAlloced by virDomainDiskInsert
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@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
3df66f27a6
commit
7c67afce65
@ -3042,8 +3042,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;
|
||||
|
||||
@ -3066,7 +3064,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,
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user