[libvirt] [PATCH 3/4] qemu: On attach to live XML check for user alias collision only live XML

Michal Prívozník mprivozn at redhat.com
Sat Apr 27 06:33:22 UTC 2019


On 4/26/19 4:23 PM, Peter Krempa wrote:
> On Fri, Apr 26, 2019 at 15:52:22 +0200, Michal Privoznik wrote:
>> When attaching a device to live XML we don't care (well,
>> shouldn't care) that there's already a device in inactive XML
>> that has the same user alias.
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
>>  src/qemu/qemu_driver.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
>> index 2b2d531441..40fd8b9d2d 100644
>> --- a/src/qemu/qemu_driver.c
>> +++ b/src/qemu/qemu_driver.c
>> @@ -8663,7 +8663,8 @@ qemuDomainAttachDeviceLiveAndConfig(virDomainObjPtr vm,
>>                                                  driver->xmlopt, parse_flags)))
>>              goto cleanup;
>>  
>> -        if (virDomainDeviceValidateAliasForHotplug(vm, devLive, flags) < 0)
>> +        if (virDomainDeviceValidateAliasForHotplug(vm, devLive,
>> +                                                   VIR_DOMAIN_AFFECT_LIVE) < 0)
> 
> Since this function already interprets the VIR_DOMAIN_AFFECT_* flags,
> wouldn't it make more sense to move this out before the LIVE/CONFIG
> attach is actually attempted?
> 
> That would also replace the second copy of the function which is added
> by the next patch.
> 

That's how it used to be e2797e3256c but then we had to change it in
55ce6564634. Long story short, at the beginning of this function we
haven't parsed device XML yet, so we don't know the device alias.

Michal




More information about the libvir-list mailing list