Comment 0 for bug 1825882

The following commit (1) is causing volume attachments which fail due to libvirt device attach erros to be silently ignored and Nova report the attachment as successful.

It seems that the original intention of the commit was to log a condition and re-raise the exeption, but if the exception is of type libvirt.libvirtError and does not contain the searched pattern, the exception is ignored. If you unindent the raise statement, errors are reported again.

In our case we had ceph/apparmor configuration problems in compute nodes which prevented virsh attaching the device; volumes appeared as successfully attached but the corresponding block device missing in guests VMs. Other libvirt attach error conditions are ignored also, as when you have already occuppied device names (i.e. 'Target vdb already exists', device is busy, etc.)


Steps to reproduce
This is somewhat hacky, but is a quick way to provoke a virsh attach error:
- virsh detach-disk <domain> vdb
- update nova & cinder DB as if volume is detached
- re-attach volume
- volume is marked as attached, but VM block device is missing

Expected result
- Error 'libvirtError: Requested operation is not valid: target vdb already exists' should be raised, and volume not attached

Actual result
- Attach successful but virsh block device not created

- Openstack version Queens