]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemuDomainDiskChangeSupported: Forbid alias change
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 13 Dec 2017 14:12:01 +0000 (15:12 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 5 Jan 2018 13:22:45 +0000 (14:22 +0100)
Since we have user aliases it may happen that users want to
change it using 'update-device'. Instead of ignoring it silently,
error out loudly. Note that we don't limit the check just for
"ua-" prefixes because users might try to change libvirt
generated aliases too.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
src/qemu/qemu_domain.c

index 70fb40650ef9f4565966bf2fe9a6b78416c159fe..de46ab996265175e01a5b12bd51434c4cf2d0ac8 100644 (file)
@@ -6837,6 +6837,14 @@ qemuDomainDiskChangeSupported(virDomainDiskDefPtr disk,
         return false;
     }
 
+    if (disk->info.alias &&
+        STRNEQ_NULLABLE(disk->info.alias, orig_disk->info.alias)) {
+        virReportError(VIR_ERR_OPERATION_UNSUPPORTED,
+                       _("cannot modify field '%s' of the disk"),
+                       "alias");
+        return false;
+    }
+
     CHECK_EQ(info.bootIndex, "boot order", true);
     CHECK_EQ(rawio, "rawio", true);
     CHECK_EQ(sgio, "sgio", true);