[PATCH 14/14] qemu: hotplug: Reject media change when XML contains disk ABI change

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

 



Changing the media doesn't change other (especially ABI based) aspects
of the disk. Add verification and reject disk change if ABI would be
changed.
---
 src/conf/domain_conf.c   | 2 +-
 src/conf/domain_conf.h   | 3 +++
 src/libvirt_private.syms | 1 +
 src/qemu/qemu_driver.c   | 4 ++++
 src/qemu/qemu_hotplug.c  | 4 ++++
 5 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 34c1a8c..126a489 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13667,7 +13667,7 @@ virDomainDeviceInfoCheckABIStability(virDomainDeviceInfoPtr src,
 }


-static bool
+bool
 virDomainDiskDefCheckABIStability(virDomainDiskDefPtr src,
                                   virDomainDiskDefPtr dst)
 {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 21cfba2..c59ad19 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2304,6 +2304,9 @@ virDomainDefPtr virDomainDefParseNode(xmlDocPtr doc,
 bool virDomainDefCheckABIStability(virDomainDefPtr src,
                                    virDomainDefPtr dst);

+bool virDomainDiskDefCheckABIStability(virDomainDiskDefPtr src,
+                                       virDomainDiskDefPtr dst);
+
 int virDomainDefAddImplicitControllers(virDomainDefPtr def);

 char *virDomainDefFormat(virDomainDefPtr def,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 08111d4..e85467e 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -219,6 +219,7 @@ virDomainDiskBusTypeToString;
 virDomainDiskCacheTypeFromString;
 virDomainDiskCacheTypeToString;
 virDomainDiskDefAssignAddress;
+virDomainDiskDefCheckABIStability;
 virDomainDiskDefForeachPath;
 virDomainDiskDefFree;
 virDomainDiskDefNew;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 4b1c69f..ad7cb84 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6642,6 +6642,10 @@ qemuDomainChangeDiskMediaLive(virConnectPtr conn,
             goto end;
         }

+        /* when changing media, rest of the disk ABI cannot change */
+        if (!virDomainDiskDefCheckABIStability(orig_disk, disk))
+            goto end;
+
         if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
             goto end;

diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 4c69c5e..d937d44 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -795,6 +795,10 @@ qemuDomainAttachDeviceDiskLive(virConnectPtr conn,
             goto end;
         }

+        /* when changing media, rest of the disk ABI cannot change */
+        if (!virDomainDiskDefCheckABIStability(orig_disk, disk))
+            goto end;
+
         if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
             goto end;

-- 
2.0.2

--
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]