Hello,

I experienced an issue with the virDomainDetachDevice call from the C lib
or Virsh CLI.

When I execute two concurrent call in parallel with virDomainDetachDevice,
nothing happens
the device is not detached, no log error in Journald or
/var/log/libvirt/qemu/domain-name.log.

If I execute the two call synchronously or only one call, the device is
always detached with no issue.

It seems there is a bug here, a concurrency issue/race condition...etc?

Nothing in the doc mention such a behaviour:
https://libvirt.org/html/libvirt-libvirt-domain.html#virDomainDetachDevice

Environment:
virsh --version: 8.0.0
Libvirt version: libvirtd (libvirt) 8.0.0

Linux hostname 5.15.0-69-generic #76-Ubuntu SMP Fri Mar 17 17:19:29 UTC
2023 x86_64 x86_64 x86_64 GNU/Linux

Step to reproduce the issue:
With a running domain (22.04.2 LTS)

I'm attaching this device via NBD protocol with the following XML
definition vdb.xml:

<disk device='disk' type='network'>
  <driver name='qemu' type='raw' cache='none' />
    <source  protocol='nbd' name='66f85e15-4ea4-428e-a63e-001f41094d7d'
reconnectDelay='10'>
      <host transport='unix' socket='/var/run/qemu/nbdserver.sock'/>
    </source>
  <target dev='vdb' bus='virtio'/>
</disk>

bash $ virsh attach-device <domain> vdb.xml

the device is successfully attached.

bash $ virsh detach-device <domain> vdb.xml & virsh detach-device
<domain>vdb.xml &
[7] 1780612
[8] 1780613
[7]+  Stopped                 virsh detach-device domain vdb.xml
[8]-  Stopped                 virsh detach-device domain vdb.xml

vdb device is not detached, nothing happen, nor error log...etc.

Thank you for this great project,
Best regards, Pierre-Emmanuel.

PS: Your website TLS certificate expires yesterday:
Sunday, 11 June 2023 at 19:35:27

Reply via email to