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

Hugh Brock hbrock at redhat.com
Thu Mar 15 15:42:11 UTC 2007


Tatsuro Enokura wrote:
> Hi, Hugh
> 
> Hugh Brock 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.
>>>> 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.
>>> Thank you for your suggestion.
>>> I rewrite the patch.
>> I'm reviewing this now. I'm trying to work out if there's a way to do it 
>> without repeating so much code... :)...
> 
> Thank you for viewing my code.
> I rewrite the patch that the repeating code become the method.
> 
> Thanks,
> Tatsuro Enokura

That looks much better. I've tested and committed it.

Thanks!

Take care,
--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