[Kimchi-devel] [RFC]: help, how to get the mac after create a VM interface.

Sheldon shaohef at linux.vnet.ibm.com
Mon Jan 20 13:34:33 UTC 2014


when I create a interface, There is no mac attribute in the xml.
After create successfully, libvirt will allocate a mac.
The problem is that, How can I get the mac.

Should the CREATE method always needs to return an interface info?

Here is some of create code.

def vmifaces_create(self, vm, params):
dom = self._get_vm(vm)
xml = """
<interface type='network'>
<source network='default'/>
</interface>
"""

dom.attachDeviceFlags(xml,
libvirt.VIR_DOMAIN_AFFECT_CURRENT)

# here I need to return the mac
return ????



The libvirt will create a xml like the follow? The problem is that the a 
vm may have several interfaces.
xml = """
<interface type='network'>
<mac address='52:54:00:2a:53:8f'/>
<source network='default'/>
<model type='rtl8139'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</interface>
"""


-- 
Thanks and best regards!

Sheldon Feng(冯少合)<shaohef at linux.vnet.ibm.com>
IBM Linux Technology Center




More information about the Kimchi-devel mailing list