Description of problem:
Currently, a volume detach at the libvirt driver level happens in two
steps:
1. Detach from persistent domain (affect instance upon next reboot)
2. Detach from live domain (affect running instance)
A detach from a live domain is a request from the host to the guest,
which the guest can choose to ignore. For example, if the guest
has a file open on the volume by some process, it might ignore the
request to detach that volume because the file is in use.
If this scenario occurs, when a user tries a later request to detach
the volume, it will fail with this error when the attempt to detach
from the persistent domain is made:
libvirtError: invalid argument: no target device <device>
because the volume was detached from the persistent domain the first
time. Because of this, the volume can only be detached by rebooting
the instance.
Version-Release number of selected component (if applicable):
RH-OSP9 with latest available updates
How reproducible:
- Create a VM and attach a volume
- Format the volume and mount it
- Create any sort of I/O and at the same time try to detach the volume
Of course, the 3rd point is not a best practice but unfortunately, if you create a Heat Stack with a VM and an attachment procedure, Heat will first detach the volume and then delete the VM. In this situation, the Stack delete operation might fail because the guest refuses to detach the volume.
Actual results:
Sometimes the volume detach fails and a then it is impossible to detach the volume unless a hard reboot is done.
Expected results:
It's fine the guest refuses to detach the Volume but Nova should allow the user to retry the detach operation.
Additional info:
https://bugzilla.redhat.com/show_bug.cgi?id=1474102https://review.openstack.org/#/c/425114/