[libvirt-users] [virtual interface] detach interface during boot succeed with no changes

Laine Stump laine at laine.org
Wed Sep 13 16:47:53 UTC 2017


On 09/04/2017 03:37 AM, Yalan Zhang wrote:
> Hi guys,
>
> when I detach an interface from vm during boot (vm boot not finished), it
> always fail. I'm not sure if there is an existing bug. I have
> confirmed with someone that for disk, there is similar behavior, if
> this is also acceptable?

unplugging a PCI device properly requires cooperation from the guest OS.
If the guest OS isn't running yet, the unplug won't complete, so qemu
(and libvirt) still show the device as plugged into the guest.

virsh reports success on the unplug because unplugging a device is done
asynchronously - the "success" means "libvirt successfully told qemu to
unplug the device, qemu has told the virtual machine to unplug the
device, and is waiting for acknowledgment from the virtual machine that
the guest has completed removal". At some later time the guest OS may
complete its part of the unplug; when that happens, qemu will get a
notification and will send an event to libvirt - at that time the device
will be removed from libvirt's list of devices.

tl;dr - this is all expected.


>
> # virsh destroy rhel7.2; virsh start rhel7.2 ;sleep 2;  virsh
> detach-interface rhel7.2 network 52:54:00:98:c4:a0; sleep 2; virsh
> dumpxml rhel7.2 |grep /interface -B9
> Domain rhel7.2 destroyed
>
> Domain rhel7.2 started
>
> Interface detached successfully
>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x06'
> function='0x0'/>
>     </controller>
>     <interface type='network'>
>       <mac address='52:54:00:98:c4:a0'/>
>       <source network='default' bridge='virbr0'/>
>       <target dev='vnet0'/>
>       <model type='rtl8139'/>
>       <alias name='net0'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x03'
> function='0x0'/>
>     </interface>
>
> When I detach after the vm boot, expand the sleep time to 10, it will succeed.
>
> # virsh destroy rhel7.2; virsh start rhel7.2 ;sleep 10;  virsh
> detach-interface rhel7.2 network 52:54:00:98:c4:a0; sleep 2; virsh
> dumpxml rhel7.2 |grep /interface -B9
> Domain rhel7.2 destroyed
>
> Domain rhel7.2 started
>
> Interface detached successfully
>
>
> -------
> Best Regards,
> Yalan Zhang
> IRC: yalzhang
> Internal phone: 8389413
>
> _______________________________________________
> libvirt-users mailing list
> libvirt-users at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users
>




More information about the libvirt-users mailing list