[libvirt] [Qemu-devel] Problems using netdev_del+netdev_add w/o corresponding device_del+device_add

Stefan Hajnoczi stefanha at gmail.com
Mon Oct 15 08:30:07 UTC 2012


On Sat, Oct 13, 2012 at 04:47:14PM -0400, Laine Stump wrote:
> Here is the sequence sent to disconnect only the host side, then
> reconnect it with a new tap device. (although the fd is the same, this
> is because the old tap device had already been closed, so the number is
> just being used - the same thing happens when doing sequential full
> detach/attach cycles, and they all work with no problems):
> 
> 
> 168.750 > 0x7f8e20000c90
> {"execute":"netdev_del","arguments":{"id":"hostnet0"},"id":"libvirt-30"}
> 168.762 < 0x7f8e20000c90 {"return": {}, "id": "libvirt-30"}
> 168.800 > 0x7f8e20000c90
> {"execute":"getfd","arguments":{"fdname":"fd-net0"},"id":"libvirt-31"}
> (fd=27)
> 168.801 < 0x7f8e20000c90 {"return": {}, "id": "libvirt-31"}
> 168.801 > 0x7f8e20000c90
> {"execute":"netdev_add","arguments":{"type":"tap","fd":"fd-net0","id":"hostnet0"},"id":"libvirt-32"}
> 168.802 < 0x7f8e20000c90 {"return": {}, "id": "libvirt-32"}
> 168.802 > 0x7f8e20000c90
> {"execute":"set_link","arguments":{"name":"net0","up":true},"id":"libvirt-33"}
> 168.803 < 0x7f8e20000c90 {"return": {}, "id": "libvirt-33"}
> 
> After this sequence is done, everything about the network device
> *appears* normal on both the guest and host (at least the things I know
> to look at), but no traffic from the host shows up in a tcpdump of the
> interface on the guest, and no traffic from the guest shows up in a
> tcpdump of the tap device on the host.

What you are trying to do isn't possible today.

The device associates with the netdev during initialization only - there
is no command to associate at a later point in time.  That is why your
example works only when the device is deleted together with the netdev.

It is certainly possible to implement a command to switch netdevs but
I'm curious what the use case is.  Is this necessary just because QEMU
doesn't provide a way to modify the existing netdev or because you
really want to switch to a completely different netdev?

Stefan




More information about the libvir-list mailing list