[et-mgmt-tools] [PATCH] Check the making domain's mac address

Hugh Brock hbrock at redhat.com
Tue Mar 13 17:26:50 UTC 2007


Tatsuro Enokura wrote:
> Hi,
> 
> Would you give me a comment on this patch?
> If not, please apply it.
> 
> Tatsuro Enokura wrote:
>> The virt-install command can specify the making domain's vnif
>> MAC address. The MAC address must be unique on the system,
>> but the virt-install command doesn't check that
>> the MAC address is unique among the running domains and host.
>>
>> The attached patch resolve this issue in the following way:
>>
>>   1) Get the running Domain's vnif MAC address.
>>   2) Get the host's NIC MAC address.
>>   3) Check the making domain's MAC address with 1) and 2) 's data.
> 
> Signed-off-by: Tatsuro Enokura <fj1826dm at aa.jp.fujitsu.com>
> 
> Thanks,
> Tatsuro Enokura
> 

Hi there!

Actually, you really don't need to build up a list of mac addresses and
iterate over them. A much easier way is simply to get the XML for a
domain and then use an xpath expression something like

	if ctx.xpathEval("count(/domain/devices/interface/mac/@address='%s')" %
macaddr) > 0:
	# handle the case where the macaddr conflicts with an existing domain

If you can rewrite the patch along these lines I'll be happy to take it.

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