On 03/25/2011 12:43 AM, Osier Yang wrote:
于 2011年03月24日 19:16, 何文聪 写道:
When a vm move from one VLAN(e.g. VLAN 1) to another VLAN (e.g. VLAN 2),
it is needed to restart the network connection of guest OS, so that it
can begin a dhcp discover and get a new ip again. But i can't find the
way to restart the guest os's network connection by libvirt (neither
python API nor virsh command). Is any other ways?
Hi,
Won't virt-manager (if has) in your guest try to restart the network?
PS: i found that the VirtualBox can detach the cable of VMs and
re-attach so that the guest OS will recognize and restart a dhcp
discover when the cable re-attach. I guess the KVM will have some
feature like that , is anybody know something about that?
Libvirt supports similar function.
# virsh detach-interface
# virsh attach-interface
Or
# virsh detach-device
# virsh attach-device
the difference between "*-device" and "*-interface" is the
accepted arguments, the later one accepts interface xml.
Those present to the guest as if the interface itself was being
unplugged. What he's looking for is a way to just emulate a loss of
carrier on the interface (ie unplugging the *cable*). There is an open
bug for that:
https://bugzilla.redhat.com/show_bug.cgi?id=643373
but no work has been done on it yet.
Note that the required qemu monitor command does exist: "set_link XXX
off" and "set_link XXX on", but I was unable to get a form of "virsh
qemu-monitor-command" that could make this work.