Thanks, let me see it


On Wed, Mar 12, 2014 at 8:01 PM, Michal Privoznik <mprivozn@redhat.com> wrote:
On 12.03.2014 14:41, Sijo Jose wrote:



Hi,
Could anyone help I'm getting the following error when I tried to add a
new network interface.

DETAILS


Connection
---------------------------
import libvirt
conn = libvirt.open('qemu:///system')

Interface XML
----------------------

<interface type="bridge" name="br0">
   <start mode="onboot"/>
   <mtu size="1500"/>
   <protocol family="ipv4">
     <dhcp/>
   </protocol>
   <bridge stp="off" delay="0.01">
     <interface type="ethernet" name="eth0">
       <mac address="ab:bb:cc:dd:ee:ff"/>
     </interface>
     <interface type="ethernet" name="eth1"/>
   </bridge>
</interface>





In [96]:

conn.interfaceDefineXML(interfacexml,0)

---------------------------------------------------------------------------
libvirtError                               Traceback (most recent call last)
/home/saju/<ipython-input-96-0536ffe3fa23>  in<module>()
----> 1  conn.interfaceDefineXML(br1xml,0)

/usr/lib/python2.7/dist-packages/libvirt.pyc  ininterfaceDefineXML(self, xml, flags)
    2750          libvirtd. """
    2751          ret=  libvirtmod.virInterfaceDefineXML(self._o,  xml,  flags)
-> 2752          if  retis  None:raise  libvirtError('virInterfaceDefineXML() failed',  conn=self)
    2753          __tmp=  virInterface(self,  _obj=ret)

    2754          return  __tmp

libvirtError: this function is not supported by the connection driver: virInterfaceDefineXML


That's because you've libvirt compiled with udev rather than netcf. The netcf is the only one backend that knows how to create a new interface.

Install netcf and rebuild libvirt and you should be able to create interfaces via libvirt.

Michal