[et-mgmt-tools] [PATCH] check a MAC address format
Hugh Brock
hbrock at redhat.com
Tue Feb 27 15:20:44 UTC 2007
Saori Fukuta wrote:
> 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
>
I have applied this, thanks!
--Hugh
--
Red Hat Virtualization Group http://redhat.com/virtualization
Hugh Brock | virt-manager http://virt-manager.org
hbrock at redhat.com | virtualization library http://libvirt.org
More information about the et-mgmt-tools
mailing list