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

S.Sakamoto fj0588di at aa.jp.fujitsu.com
Tue Oct 2 09:44:44 UTC 2007


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.

Signed-off-by: Shigeki Sakamoto <fj0588di at aa.jp.fujitsu.com>
 
Thanks,
Shigeki Sakamoto.

----------------------------------------------------------------------
diff -r 219bd66150dd virtinst/CloneManager.py
--- a/virtinst/CloneManager.py	Fri Sep 28 12:33:09 2007 -0400
+++ b/virtinst/CloneManager.py	Tue Oct 02 15:17:44 2007 +0900
@@ -422,12 +422,14 @@ class CloneDesign(object):
             except:
                 continue
             ctx = doc.xpathNewContext()
+            mac_index = (str(doc).upper()).find(mac.upper())
+            if mac_index == -1:
+                continue
+            mac_comp = str(doc)[mac_index:mac_index+17]
             try:
                 try:
                     count += ctx.xpathEval("count(/domain/devices/interface/mac[@address='%s'])"
-                                           % mac.upper())
-                    count += ctx.xpathEval("count(/domain/devices/interface/mac[@address='%s'])"
-                                           % mac.lower())
+                                           % mac_comp)
                 except:
                     continue
             finally:




More information about the et-mgmt-tools mailing list