Googling, asking in IRC channels, no answers to be found. It wasn’t until I finally backported libvirt-bin 0.4.4 to hardy (and /etc/init.d/libvirt-bin restart!) that I figured this out due to an updated error message. You can’t use attach-interface with qemu/kvm:
virsh # attach-interface domain bridge br0.11
libvir: QEMU error : this function is not supported by the hypervisor: only CDROM disk devices can be attached
Which is much more useful than:
virsh # attach-interface domain bridge br0
libvir: QEMU error : unknown device type
In fact, it looks like most of libvirt is xen-centric. Which is pretty annoying. ubuntu-vm-builder generates a MAC address like so:
MAC=”52:54:00$(hexdump -e ‘/1 “:%02x”‘ -n 3 /dev/urandom)”
I saw a list post saying libvirt would create a MAC, and tested it. I added a interface by copying the interface block in the xml configuration file for the domain, then removing the mac address entry and updating the source bridge line to the other interface I want to bridge. I connected back to libvirt with virsh, ran ‘define /etc/libvirt/qemu/domain.xml’ and ‘start domain’. Sure enough I had the second interface. When I halted the domain and dropped to shell I could see that libvirt had added a mac address line to that interface. Interestingly, it’s also in the ’52:54:00′ OUI.
I’m a little upset about all of this. I had to hack up ubuntu-vm-builder to get bridge support for kvm/qemu. (LP:257090) And now, I can’t script virsh to configure that second interface.
I think I’m back to using a text manipulation tool to modify the xml configuration file by hand, which is just plain stupid. I’m already doing that to create my vmx files for VMware Server, and virt-manager (0.5.3-0ubuntu10) lacks the ability to add interfaces to a running or stopped qemu/kvm guest. Which the vmware GUI already supports.
I suppose this is what I get for being an early adopter.