[libvirt] [PATCH] qemuDomainDiskChangeSupported: Forbid alias change

Michal Privoznik mprivozn at redhat.com
Fri Jan 5 13:24:49 UTC 2018


On 01/05/2018 01:16 PM, Marc Hartmayer wrote:
> On Wed, Dec 13, 2017 at 03:30 PM +0100, Michal Privoznik <mprivozn at redhat.com> 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(+)
>>
>> 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 at redhat.com
>> 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.

Maybe. If you want to work on it, be my guest. It looks feasible to me.
Unfortunately, I'm buried under some other work right now.

Michal




More information about the libvir-list mailing list