[et-mgmt-tools] [PATCH] check a MAC address format

Saori Fukuta fukuta.saori at jp.fujitsu.com
Mon Feb 26 05:55:23 UTC 2007


Hi,

When I install by virt-intall with invalid MAC address(e.g."--mac=AA:"),
virt-install get an error message that says "unable to connect to
host:Connection refused(111)".

So, here's the patch adds to check a MAC address with following format:
    xx:xx:xx:xx:xx:xx ( xx should be in hexadecimal )

Signed-off-by: Saori Fukuta <fukuta.saori at jp.fujitsu.com>

Thanks,
Saori Fukuta.

Index: virtinst-0.101.0/virtinst/Guest.py
===================================================================
--- Guest.py    2007-02-21 05:26:23.000000000 +0900
+++ Guest.py.mac        2007-02-26 11:54:51.000000000 +0900
@@ -141,6 +141,10 @@ class XenDisk(VirtualDisk):

 class VirtualNetworkInterface:
     def __init__(self, macaddr = None, bridge = None):
+        if macaddr is not None:
+            form = re.match("^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$",macaddr)
+            if form is None:
+                raise ValueError, "Invalid value for MAC address"
         self.macaddr = macaddr
         self.bridge = bridge




More information about the et-mgmt-tools mailing list