Re: [PATCH] qemuDomainDiskChangeSupported: Forbid alias change

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

 



On Wed, Dec 13, 2017 at 03:30 PM +0100, Michal Privoznik <mprivozn@xxxxxxxxxx> 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@xxxxxxxxxx>
> ---
>  src/qemu/qemu_domain.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> 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);
> --
> 2.13.6
>
> --
> libvir-list mailing list
> libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list
>

I'm not sure if our current approach is the way to go… Couldn’t we just
invert the logic for qemuDomainDiskChangeSupported in that way that it
returns by default false and only for cases where we know that it’s
supported to change we return true? Not sure if this proposed approach
is feasible.

--
Beste Grüße / Kind regards
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


--
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]
  Powered by Linux