[libvirt] [PATCH] qemuDomainDiskChangeSupported: Forbid alias change

John Ferlan jferlan at redhat.com
Fri Jan 5 00:15:55 UTC 2018



On 12/13/2017 09:30 AM, Michal Privoznik wrote:
> 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.
> 
> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
> ---
>  src/qemu/qemu_domain.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 

So IIUC this would be adding a check that the libvirt supplied alias
matches, true? But your goal is to check if a "ua-" prefixed alias was
being used - so should the check use of the prefix?

There's probably a few more info. fields that could be considered - any
thoughts on those? Perhaps fairly difficult to keep up with the various
_virDomainDiskDef and friends alterations for what this function is
indicating...

John

> diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> index 347fc0742..00d6c41c9 100644
> --- a/src/qemu/qemu_domain.c
> +++ b/src/qemu/qemu_domain.c
> @@ -6762,6 +6762,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);
> 




More information about the libvir-list mailing list