[et-mgmt-tools] [PATCH][virt-clone] Check the MAC addressconfliction with ignoring character case.
Daniel P. Berrange
berrange at redhat.com
Wed Oct 3 13:22:01 UTC 2007
On Wed, Oct 03, 2007 at 06:16:32PM +0900, S.Sakamoto wrote:
> 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.
Ah, I didn't realize it was new in 2.0. Don't worry about changing it - i'll
apply your current patch.
Dan.
--
|=- Red Hat, Engineering, Emerging Technologies, Boston. +1 978 392 2496 -=|
|=- Perl modules: http://search.cpan.org/~danberr/ -=|
|=- Projects: http://freshmeat.net/~danielpb/ -=|
|=- GnuPG: 7D3B9505 F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 -=|
More information about the et-mgmt-tools
mailing list