mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 18:05:20 +00:00
qemu: hotplug: Allow update of disk default snapshot location
Since the field is internal to libvirt we can allow the users to modify it.
This commit is contained in:
parent
3b3debfb7f
commit
662862ec5f
@ -3923,7 +3923,7 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
|
||||
CHECK_EQ(ioeventfd, "ioeventfd", true);
|
||||
CHECK_EQ(event_idx, "event_idx", true);
|
||||
CHECK_EQ(copy_on_read, "copy_on_read", true);
|
||||
CHECK_EQ(snapshot, "snapshot", true);
|
||||
/* "snapshot" is a libvirt internal field and thus can be changed */
|
||||
/* startupPolicy is allowed to be updated. Therefore not checked here. */
|
||||
CHECK_EQ(transient, "transient", true);
|
||||
CHECK_EQ(info.bootIndex, "boot order", true);
|
||||
|
@ -7682,6 +7682,7 @@ qemuDomainChangeDiskLive(virConnectPtr conn,
|
||||
virDomainDiskDefPtr disk = dev->data.disk;
|
||||
virDomainDiskDefPtr orig_disk = NULL;
|
||||
int startupPolicy;
|
||||
int snapshot;
|
||||
int ret = -1;
|
||||
|
||||
if (virStorageTranslateDiskSourcePool(conn, disk) < 0)
|
||||
@ -7700,6 +7701,7 @@ qemuDomainChangeDiskLive(virConnectPtr conn,
|
||||
}
|
||||
|
||||
startupPolicy = orig_disk->startupPolicy;
|
||||
snapshot = orig_disk->snapshot;
|
||||
|
||||
switch ((virDomainDiskDevice) disk->device) {
|
||||
case VIR_DOMAIN_DISK_DEVICE_CDROM:
|
||||
@ -7708,6 +7710,7 @@ qemuDomainChangeDiskLive(virConnectPtr conn,
|
||||
goto cleanup;
|
||||
|
||||
orig_disk->startupPolicy = dev->data.disk->startupPolicy;
|
||||
orig_disk->snapshot = dev->data.disk->snapshot;
|
||||
|
||||
if (qemuDomainDiskSourceDiffers(conn, disk, orig_disk)) {
|
||||
/* Add the new disk src into shared disk hash table */
|
||||
@ -7742,6 +7745,7 @@ qemuDomainChangeDiskLive(virConnectPtr conn,
|
||||
return ret;
|
||||
|
||||
rollback:
|
||||
orig_disk->snapshot = snapshot;
|
||||
orig_disk->startupPolicy = startupPolicy;
|
||||
goto cleanup;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user