提交 a09d9f5b 编写于 作者: P Peter Krempa

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.
上级 e78794c9
......@@ -7672,20 +7672,25 @@ qemuDomainChangeDiskLive(virConnectPtr conn,
goto cleanup;
}
switch ((virDomainDiskDevice) disk->device) {
case VIR_DOMAIN_DISK_DEVICE_CDROM:
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
if (!qemuDomainDiskChangeSupported(disk, orig_disk))
goto cleanup;
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;
}
/* 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) {
dev->data.disk->src, force) < 0) {
ignore_value(qemuRemoveSharedDisk(driver, dev->data.disk,
vm->def->name));
goto cleanup;
......@@ -7696,20 +7701,6 @@ qemuDomainChangeDiskLive(virConnectPtr conn,
orig_disk->startupPolicy = dev->data.disk->startupPolicy;
orig_disk->snapshot = dev->data.disk->snapshot;
break;
case VIR_DOMAIN_DISK_DEVICE_DISK:
case VIR_DOMAIN_DISK_DEVICE_LUN:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("disk bus '%s' cannot be updated."),
virDomainDiskBusTypeToString(disk->bus));
goto cleanup;
break;
case VIR_DOMAIN_DISK_DEVICE_LAST:
/* nada */
break;
}
ret = 0;
cleanup:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册