[PATCH 3/3] qemu: hotplug: Allow update of disk default snapshot location

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Since the field is internal to libvirt we can allow the users to modify
it.
---
 src/qemu/qemu_domain.c | 2 +-
 src/qemu/qemu_driver.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index f6e68ea..e6cd775 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -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);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index e5badf6..351f400 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -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;
 }
-- 
2.8.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]