0

I'm trying to define a VM for libvirt with an XML file. I have an interface of type=user defined in the XML file. According to the libvirt documentation defining this interface should automatically get assigned an IPv4 address. However, I have found this not to be the case when I add multiple interfaces of type=ethernet (I need to add 64 such interfaces). When I define these interfaces in the XML file, the user interface doesn't get an IP address assigned.

Here's the XML file I'm using:

<domain type='kvm' xmlns:qemu='http://libvirt.org/schemas/domain/qemu/1.0'>
  <name>sonic</name>
  <memory unit='KiB'>2048000</memory>
  <currentMemory unit='KiB'>2048000</currentMemory>
  <vcpu placement='static'>1</vcpu>
  <resource>
    <partition>/machine</partition>
  </resource>
  <os>
    <type arch='x86_64' machine='pc-i440fx-1.5'>hvm</type>
    <boot dev='hd'/>
  </os>
  <features>
    <acpi/>
    <apic/>
  </features>
  <clock offset='utc'/>
  <on_poweroff>destroy</on_poweroff>
  <on_reboot>restart</on_reboot>
  <on_crash>restart</on_crash>
  <devices>
    <emulator>/usr/bin/qemu-system-x86_64</emulator>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2' cache='writeback'/>
      <source file='/media/big/sonic-buildimage/target/sonic-vs.img'/>
      <target bus='virtio' dev='vda'/>
    </disk>
    <serial type='tcp'>
      <source host='127.0.0.1' mode='bind' service='7000'/>
      <target port='0'/>
      <protocol type='telnet'/>
    </serial>
    <interface type='user'>
        <model type='e1000' />
    </interface>
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <interface type='ethernet' />
    <controller type='usb' index='0'/>
    <memballoon model='virtio'>
      <alias name='balloon0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    </memballoon>
  </devices>
  <seclabel type='dynamic' model='apparmor' relabel='yes'/>
  <qemu:commandline>
   <qemu:arg value='-redir'/>
   <qemu:arg value='tcp:3040::22'/>
  </qemu:commandline>
</domain>

I've tried assigning the address statically by modifying the DHCP portion of the default libvirt network (as seen here) to no avail, and by manually adding the ip and necessary routes with iproute2 tools. I'm at a loss for how to proceed. One interesting thing to note is that when the IP address doesn't get assigned to the user interface, networking.service takes nearly a minute and a half to start up.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.