Thank you very much for the reply. But the interesting thing is that qemu monitoring
command info blocks returns the specified device has been detached while virsh domblklist
still displays the device. So does this imply qemu does not reply to libvirt when the device is
detached?

Best,
Jiatong Shen

On Thu, Nov 24, 2022 at 10:58 PM Peter Krempa <pkrempa@redhat.com> wrote:
On Thu, Nov 24, 2022 at 16:47:48 +0800, Jiatong Shen wrote:
> Hello Commnunity,
>
> I saw an weird situation on a phytium machine (arm64 v8),  after the
> following commands, I can still see the interface which should be
> successfully detached.
>
> virsh # detach-interface 4a365b06-2597-4c17-8b44-dbb6953f9ced bridge --mac
> fa:16:3e:c5:62:40
> Interface detached successfully
>
> Future qmp commands shows, that a device hostnet23 exists but seems no
> front end device exists.
>
> So what could be the problem? Thank you very much.

The man page for virsh states for the 'detach-interface' command:

 "Please see documentation for detach-device for known quirks."

And the 'quirks' part of 'detach-device':

  Quirk:  Device  unplug is asynchronous in most cases and requires guest
  cooperation. This means that it's up to the discretion of the guest  to
  disallow  or  delay  the unplug arbitrarily. As the libvirt API used in
  this command was designed as synchronous it returns success after  some
  timeout  even  if the device was not unplugged yet to allow further in‐
  teractions with the domain e.g. if the guest is  unresponsive.  Callers
  which  need  to make sure that the device was unplugged can use libvirt
  events (see virsh event) to be notified when  the  device  is  removed.
  Note that the event may arrive before the command returns.



--

Best Regards,

Jiatong Shen