[libvirt] [PATCH] nwfilter: prevent multiple filters with different name but same UUID

Stefan Berger stefanb at linux.vnet.ibm.com
Thu Oct 14 15:55:40 UTC 2010


  On 10/14/2010 11:27 AM, Daniel P. Berrange wrote:
> On Thu, Oct 14, 2010 at 11:20:15AM -0400, Stefan Berger wrote:
>>   Patch to prevent multiple nwfilters with different name but same UUID.
>>
>> Signed-off-by: Stefan Berger<stefanb at us.ibm.com>
>>
>> ---
>>   src/conf/nwfilter_conf.c |   14 ++++++++++++++
>>   1 file changed, 14 insertions(+)
>>
>> Index: libvirt-acl/src/conf/nwfilter_conf.c
>> ===================================================================
>> --- libvirt-acl.orig/src/conf/nwfilter_conf.c
>> +++ libvirt-acl/src/conf/nwfilter_conf.c
>> @@ -2399,6 +2399,20 @@ virNWFilterPoolObjAssignDef(virConnectPt
>>   {
>>       virNWFilterPoolObjPtr pool;
>>
>> +    pool = virNWFilterPoolObjFindByUUID(pools, def->uuid);
>> +
>> +    if (pool) {
>> +        if (!STREQ(def->name, pool->def->name)) {
>> +            virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
>> +                               _("filter with same UUID but different
>> name "
>> +                                 "('%s') already exists"),
>> +                               pool->def->name);
>> +            virNWFilterPoolObjUnlock(pool);
>> +            return NULL;
>> +        }
>> +        virNWFilterPoolObjUnlock(pool);
>> +    }
>> +
>>       if (virNWFilterDefLoopDetect(conn, pools, def)) {
>>           virNWFilterReportError(VIR_ERR_INVALID_NWFILTER,
>>                                 "%s", _("filter would introduce a loop"));
>>
> ACK
>
> Daniel
Pushed.
    Stefan




More information about the libvir-list mailing list