[libvirt] [PATCH] conf: Check for user aliases duplicates only

Michal Privoznik mprivozn at redhat.com
Tue Feb 6 15:03:44 UTC 2018


On 02/06/2018 03:52 PM, Daniel P. Berrangé wrote:
> On Tue, Feb 06, 2018 at 03:40:18PM +0100, Michal Privoznik wrote:
>> When validating a device XML config we check if user provided
>> alias is unique. We do this by maintaining a hash table of device
>> aliases as we iterated over all devices defined for the domain.
>> However, it may happen that what appears as two devices in domain
>> XML is in fact just one interface in hypervisor. For instance in
>> qemu driver this is true for uhci/ehci controllers. In that case
>> an error is reported even though it is not actually an error. At
>> any rate, we can assume libvirt generated aliases to be unique
>> and thus really check user provided ones only.
>>
>> Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>> ---
>>  src/conf/domain_conf.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
>> index 34aae82f1..44724bd01 100644
>> --- a/src/conf/domain_conf.c
>> +++ b/src/conf/domain_conf.c
>> @@ -5569,7 +5569,7 @@ virDomainDeviceDefValidateAliasesIterator(virDomainDefPtr def,
>>      struct virDomainDefValidateAliasesData *data = opaque;
>>      const char *alias = info->alias;
>>  
>> -    if (!alias)
>> +    if (!alias || !STRPREFIX(alias, "ua-"))
>>          return 0;
> 
> nitpick  - use USER_ALIAS_PREFIX constant

Even better, I can call virDomainDeviceAliasIsUserAlias().

Michal




More information about the libvir-list mailing list