qemuDomainDiskChangeSupported: Forbid alias change

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>
This commit is contained in:
Michal Privoznik 2017-12-13 15:12:01 +01:00
parent b372983d14
commit d0204e373d

View 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);