qemu: hotplug: Refactor qemuDomainAttachDeviceDiskLiveInternal

We now explicitly handle media change elsewhere so we can drop the
switch statement. This will also make it more intuitive once CDROM
device hotplug might be supported.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Peter Krempa 2018-09-25 15:07:01 +02:00
parent a1d3fc09f8
commit 0d981bcefc

View File

@ -1113,9 +1113,6 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriverPtr driver,
if (qemuDomainDetermineDiskChain(driver, vm, disk, true) < 0) if (qemuDomainDetermineDiskChain(driver, vm, disk, true) < 0)
goto cleanup; goto cleanup;
switch ((virDomainDiskDevice) disk->device) {
case VIR_DOMAIN_DISK_DEVICE_DISK:
case VIR_DOMAIN_DISK_DEVICE_LUN:
for (i = 0; i < vm->def->ndisks; i++) { for (i = 0; i < vm->def->ndisks; i++) {
if (virDomainDiskDefCheckDuplicateInfo(vm->def->disks[i], disk) < 0) if (virDomainDiskDefCheckDuplicateInfo(vm->def->disks[i], disk) < 0)
goto cleanup; goto cleanup;
@ -1153,13 +1150,6 @@ qemuDomainAttachDeviceDiskLiveInternal(virQEMUDriverPtr driver,
_("disk bus '%s' cannot be hotplugged."), _("disk bus '%s' cannot be hotplugged."),
virDomainDiskBusTypeToString(disk->bus)); virDomainDiskBusTypeToString(disk->bus));
} }
break;
case VIR_DOMAIN_DISK_DEVICE_CDROM:
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
case VIR_DOMAIN_DISK_DEVICE_LAST:
break;
}
cleanup: cleanup:
if (ret != 0) if (ret != 0)