[et-mgmt-tools] [PATCH][virt-clone] Check the MAC addressconfliction with ignoring character case.

S.Sakamoto fj0588di at aa.jp.fujitsu.com
Wed Oct 3 09:16:32 UTC 2007


Hi, Dan
Thank you for advice.

> Instead of doing this:
> 
> > +            mac_index = (str(doc).upper()).find(mac.upper())
> > +            if mac_index == -1:
> > +                continue
> > +            mac_comp = str(doc)[mac_index:mac_index+17]
> 
> 
> Can't you simply use the 'lower-case()' function in XPath ?
> 
> eg something like
> 
>   count(/domain/devices/interface/mac[lower-case(@address)=lower-case('%s')])
> 
But, the 'lower-case()' function is not included in XPath 1.0 and is included in XPath 2.0.
libxml only implements XPath 1.0.
The 'translate()' function may simplify it.

Thanks,
Shigeki Sakamoto.




More information about the et-mgmt-tools mailing list