[libvirt] RFC: setting mac address on network devices being assigned to a guest via PCI passthrough (<hostdev>)

Laine Stump laine at laine.org
Mon Jan 23 16:52:16 UTC 2012


On 01/23/2012 11:12 AM, Laine Stump wrote:
> On 01/23/2012 09:08 AM, Paolo Bonzini wrote:
>
>>
>> In view of the discussion on SCSI passthrough, it seems to me that 
>> this should be attached to an <interface> element:
>>
>> <devices>
>> <interface type='hostdev'>
>> <source>
>> <address type='pci' bus='0x06' slot='0x02' function='0x0'/>
>> </source>
>> <mac address='00:16:3e:5d:c7:9e'/>
>> <address type='pci' .../>
>> </interface>
>> </devices>


BTW, another advantage of defining these in <interface> rather than 
<hostdev> is that it makes it easier to decide when to auto-generate a 
MAC address - if there's an <interface>, libvirt knows that if a MAC 
address isn't given, it should always generate one. <hostdev> currently 
has no concept of <mac address>, so we would have to come up with some 
syntax hack to indicate that one should be created, e.g. if <mac 
address=""/> is given (or maybe just an empty "<mac>"), then a mac 
address should be autogenerated. That's inconsistent with existing 
practice in other places that mac address is used, though.




More information about the libvir-list mailing list