]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu: qemuDomainDiskChangeSupported: Add missing 'address' check
authorMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
Tue, 6 Dec 2016 14:30:13 +0000 (15:30 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 20 Dec 2016 10:22:44 +0000 (11:22 +0100)
Disk->info is not live updatable so add a check for this. Otherwise
libvirt reports success even though no data was updated.

Signed-off-by: Marc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: Bjoern Walk <bwalk@linux.vnet.ibm.com>
Reviewed-by: Boris Fiuczynski <fiuczy@linux.vnet.ibm.com>
src/qemu/qemu_domain.c

index ecf72a84dbd26f01cdff01b200239f2b20a344ed..acfa69589bac046c207cbefb50334bb8b83e3944 100644 (file)
@@ -5291,6 +5291,19 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
     /* "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);
+
+    /* Note: For some address types the address auto generation for
+     * @disk has still not happened at this point (e.g. driver
+     * specific addresses) therefore we can't catch these possible
+     * address modifications here. */
+    if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE &&
+        !virDomainDeviceInfoAddressIsEqual(&disk->info, &orig_disk->info)) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+                       _("cannot modify field '%s' of the disk"),
+                       "address");
+        return false;
+    }
+
     CHECK_EQ(info.bootIndex, "boot order", true);
     CHECK_EQ(rawio, "rawio", true);
     CHECK_EQ(sgio, "sgio", true);