[libvirt] [PATCH] qemuDomainDiskChangeSupported: Forbid alias change
Marc Hartmayer
mhartmay at linux.vnet.ibm.com
Fri Jan 5 14:18:00 UTC 2018
On Fri, Jan 05, 2018 at 02:24 PM +0100, Michal Privoznik <mprivozn at redhat.com> wrote:
> 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.
Currently, I don't have time for this as it’s not that important.
> Unfortunately, I'm buried under some other work right now.
>
> Michal
>
--
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
More information about the libvir-list
mailing list