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

Daniel P. Berrange berrange at redhat.com
Tue Oct 2 16:53:28 UTC 2007


On Tue, Oct 02, 2007 at 06:44:44PM +0900, S.Sakamoto wrote:
> Hi,
> 
> This patch adds mac address confliction check for following case on virt-clone.
> 
> hostA:aa:bb:cc:dd:ee:ff
> 
> hostB:Aa:Bb:Cc:Dd:Ee:Ff(planned cloning guest)
> 
> This patch stops cloning for above case, because of MAC address confliction.

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')])

Regards,
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