提交 0751786d 编写于 作者: M Michal Privoznik

qemuDomainChangeDiskLive: Allow startupPolicy change

https://bugzilla.redhat.com/show_bug.cgi?id=1159219Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 08573b63
......@@ -3157,7 +3157,7 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
CHECK_EQ(event_idx, "event_idx", true);
CHECK_EQ(copy_on_read, "copy_on_read", true);
CHECK_EQ(snapshot, "snapshot", true);
CHECK_EQ(startupPolicy, "startupPolicy", true);
/* startupPolicy is allowed to be updated. Therefore not checked here. */
CHECK_EQ(transient, "transient", true);
CHECK_EQ(info.bootIndex, "boot order", true);
CHECK_EQ(rawio, "rawio", true);
......
......@@ -7904,6 +7904,7 @@ qemuDomainChangeDiskLive(virConnectPtr conn,
{
virDomainDiskDefPtr disk = dev->data.disk;
virDomainDiskDefPtr orig_disk = NULL;
int startupPolicy;
int ret = -1;
if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
......@@ -7921,23 +7922,29 @@ qemuDomainChangeDiskLive(virConnectPtr conn,
goto cleanup;
}
startupPolicy = orig_disk->startupPolicy;
switch ((virDomainDiskDevice) disk->device) {
case VIR_DOMAIN_DISK_DEVICE_CDROM:
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
if (!qemuDomainDiskChangeSupported(disk, orig_disk))
goto cleanup;
/* Add the new disk src into shared disk hash table */
if (qemuAddSharedDevice(driver, dev, vm->def->name) < 0)
goto cleanup;
orig_disk->startupPolicy = dev->data.disk->startupPolicy;
if (qemuDomainChangeEjectableMedia(driver, conn, vm,
orig_disk, disk->src, force) < 0) {
ignore_value(qemuRemoveSharedDisk(driver, disk, vm->def->name));
goto cleanup;
}
if (qemuDomainDiskSourceDiffers(conn, disk, orig_disk)) {
/* Add the new disk src into shared disk hash table */
if (qemuAddSharedDevice(driver, dev, vm->def->name) < 0)
goto cleanup;
disk->src = NULL;
if (qemuDomainChangeEjectableMedia(driver, conn, vm,
orig_disk, dev->data.disk->src, force) < 0) {
ignore_value(qemuRemoveSharedDisk(driver, dev->data.disk, vm->def->name));
goto rollback;
}
dev->data.disk->src = NULL;
}
break;
case VIR_DOMAIN_DISK_DEVICE_DISK:
......@@ -7956,6 +7963,10 @@ qemuDomainChangeDiskLive(virConnectPtr conn,
ret = 0;
cleanup:
return ret;
rollback:
orig_disk->startupPolicy = startupPolicy;
goto cleanup;
}
static int
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册