mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-26 14:03:49 +03:00
qemu: driver: Allow disk update of startupPolicy/snapshot for all disks
The libvirt internal bits can be changed for disks that don't otherwise support changing media. Remove the switch statement and allow changes of non-source data for all disks.
This commit is contained in:
parent
e78794c95f
commit
a09d9f5b7a
@ -7672,45 +7672,36 @@ qemuDomainChangeDiskLive(virConnectPtr conn,
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch ((virDomainDiskDevice) disk->device) {
|
if (!qemuDomainDiskChangeSupported(disk, orig_disk))
|
||||||
case VIR_DOMAIN_DISK_DEVICE_CDROM:
|
goto cleanup;
|
||||||
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
|
|
||||||
if (!qemuDomainDiskChangeSupported(disk, orig_disk))
|
if (qemuDomainDiskSourceDiffers(disk, orig_disk)) {
|
||||||
|
/* Disk source can be changed only for removable devices */
|
||||||
|
if (disk->device != VIR_DOMAIN_DISK_DEVICE_CDROM &&
|
||||||
|
disk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("disk source can be changed only in removable "
|
||||||
|
"drives"));
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (qemuDomainDiskSourceDiffers(disk, orig_disk)) {
|
|
||||||
/* Add the new disk src into shared disk hash table */
|
|
||||||
if (qemuAddSharedDevice(driver, dev, vm->def->name) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (qemuDomainChangeEjectableMedia(driver, vm, orig_disk,
|
|
||||||
dev->data.disk->src,
|
|
||||||
force) < 0) {
|
|
||||||
ignore_value(qemuRemoveSharedDisk(driver, dev->data.disk,
|
|
||||||
vm->def->name));
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev->data.disk->src = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
orig_disk->startupPolicy = dev->data.disk->startupPolicy;
|
/* Add the new disk src into shared disk hash table */
|
||||||
orig_disk->snapshot = dev->data.disk->snapshot;
|
if (qemuAddSharedDevice(driver, dev, vm->def->name) < 0)
|
||||||
break;
|
goto cleanup;
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_DEVICE_DISK:
|
if (qemuDomainChangeEjectableMedia(driver, vm, orig_disk,
|
||||||
case VIR_DOMAIN_DISK_DEVICE_LUN:
|
dev->data.disk->src, force) < 0) {
|
||||||
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
|
ignore_value(qemuRemoveSharedDisk(driver, dev->data.disk,
|
||||||
_("disk bus '%s' cannot be updated."),
|
vm->def->name));
|
||||||
virDomainDiskBusTypeToString(disk->bus));
|
goto cleanup;
|
||||||
goto cleanup;
|
}
|
||||||
break;
|
|
||||||
|
|
||||||
case VIR_DOMAIN_DISK_DEVICE_LAST:
|
dev->data.disk->src = NULL;
|
||||||
/* nada */
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
orig_disk->startupPolicy = dev->data.disk->startupPolicy;
|
||||||
|
orig_disk->snapshot = dev->data.disk->snapshot;
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
cleanup:
|
cleanup:
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user