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

2022-09-08 Thread Yalan Zhang
Hi Peter,

Thank you for pointing that out, I will track the issue on that bug instead.

Yalan


On Thu, Sep 8, 2022 at 3:58 PM Peter Krempa  wrote:

> On Thu, Sep 08, 2022 at 15:16:56 +0800, Yalan Zhang wrote:
> > Hi Laine,
> >
> > As for the hot-unplug behavior, I have one more question about it, could
> > you please help to confirm?
> >
> > 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.
> > >
> >
> > The question is that, when I unplug it during boot, the virsh cmd will
> > succeed but the interface still exists, which is expected.
> > After the vm boot successfully, the guest OS will *not* complete this
> > removal. When I tried to detach it again, it reported that the device was
> > in the process of unplugging.
> > Is this acceptable?
> >
> > # virsh detach-interface rhel_new network 52:54:00:36:a8:d4
> > Interface detached successfully
> > # virsh domiflist rhel_new
> >  Interface   Type  SourceModelMAC
> > -
> >  vnet4   network   default   virtio   52:54:00:36:a8:d4
> >
> > # virsh detach-interface rhel_new network 52:54:00:36:a8:d4
> > error: Failed to detach interface
> > error: internal error: unable to execute QEMU command 'device_del':
> Device
> > net0 is already in the process of unplug
>
> The same problem was already reported for disks:
>
> https://bugzilla.redhat.com/show_bug.cgi?id=2087047
>
> https://gitlab.com/libvirt/libvirt/-/issues/309
>
> The main problem is that qemu doesn't re-send the request to unplug the
> device and rather reprots an eroror. At the same time the guest OS
> doesn't notice it any more, so the unplug can't be finished until the VM
> is rebooted.
>
>


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

2022-09-08 Thread Peter Krempa
On Thu, Sep 08, 2022 at 15:16:56 +0800, Yalan Zhang wrote:
> Hi Laine,
> 
> As for the hot-unplug behavior, I have one more question about it, could
> you please help to confirm?
> 
> 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.
> >
> 
> The question is that, when I unplug it during boot, the virsh cmd will
> succeed but the interface still exists, which is expected.
> After the vm boot successfully, the guest OS will *not* complete this
> removal. When I tried to detach it again, it reported that the device was
> in the process of unplugging.
> Is this acceptable?
> 
> # virsh detach-interface rhel_new network 52:54:00:36:a8:d4
> Interface detached successfully
> # virsh domiflist rhel_new
>  Interface   Type  SourceModelMAC
> -
>  vnet4   network   default   virtio   52:54:00:36:a8:d4
> 
> # virsh detach-interface rhel_new network 52:54:00:36:a8:d4
> error: Failed to detach interface
> error: internal error: unable to execute QEMU command 'device_del': Device
> net0 is already in the process of unplug

The same problem was already reported for disks:

https://bugzilla.redhat.com/show_bug.cgi?id=2087047

https://gitlab.com/libvirt/libvirt/-/issues/309

The main problem is that qemu doesn't re-send the request to unplug the
device and rather reprots an eroror. At the same time the guest OS
doesn't notice it any more, so the unplug can't be finished until the VM
is rebooted.



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

2022-09-08 Thread Yalan Zhang
Hi Laine,

As for the hot-unplug behavior, I have one more question about it, could
you please help to confirm?

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.
>

The question is that, when I unplug it during boot, the virsh cmd will
succeed but the interface still exists, which is expected.
After the vm boot successfully, the guest OS will *not* complete this
removal. When I tried to detach it again, it reported that the device was
in the process of unplugging.
Is this acceptable?

# virsh detach-interface rhel_new network 52:54:00:36:a8:d4
Interface detached successfully
# virsh domiflist rhel_new
 Interface   Type  SourceModelMAC
-
 vnet4   network   default   virtio   52:54:00:36:a8:d4

# virsh detach-interface rhel_new network 52:54:00:36:a8:d4
error: Failed to detach interface
error: internal error: unable to execute QEMU command 'device_del': Device
net0 is already in the process of unplug

Thank you!

Yalan


On Thu, Sep 14, 2017 at 12:48 AM Laine Stump  wrote:

> 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
> >
> >> function='0x0'/>
> > 
> > 
> >   
> >   
> >   
> >   
> >   
> >> function='0x0'/>
> > 
> >
> > 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@redhat.com
> > https://www.redhat.com/mailman/listinfo/libvirt-users
> >
>
>


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

2017-09-13 Thread Laine Stump
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
>
>function='0x0'/>
> 
> 
>   
>   
>   
>   
>   
>function='0x0'/>
> 
>
> 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@redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-users
>

___
libvirt-users mailing list
libvirt-users@redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-users


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

2017-09-04 Thread Yalan Zhang
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?

# 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

  


  
  
  
  
  
  


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@redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-users