OpenStack can’t attach cinder volume
Yesterday I was setting up a few things at my home OpenStack server and ran into an ugly problem that took me a while to resolve. I couldn’t attach any volume from the backends I had configured previously. The worst thing (as usually happens on OpenStack), Horizon didn’t show any error message.
Warning: this issue is likely to be found on RDO installation with CentOS 7. At the moment I found this issue I was using CentOS7/RDO/OpenStack Kilo.
Before getting too much into technicalities, let me explain the problem. On my home server I have some storage, and decided it was about time to use Cinder volumes, to store private data. I used LVM to take care of the Volumes, everything fine, however, at the moment of attaching a Volume to an Instance… something went wrong. And the worst thing is that (as usual) OpenStack Horizon shows no error. It instead failed silently, reporting it was going to attach for a millisecond, and ultimately returning to the original state (everything WITHOUT errors). After a bit of trial-and-error, decided to look at the logs (/var/log/cinder/volume.log) and found the following.
Command: sudo cinder-rootwrap /etc/cinder/rootwrap.conf tgtadm --lld iscsi --op show --mode target
Stderr: u'/usr/bin/cinder-rootwrap: Executable not found: tgtadm (filter match = tgtadm)\n' to caller
As everyone could guess tgtadm isn’t installed, so let’s install it! NOT. RHEL/CentOS 7 do not use tgtd, instead they use targetd.
That was the problem, so I googled a bit and found this bug report. So I edited the DEFAULT value of iscsi_helper and set it to lioadm, restarted the associated services but… it didn’t work. Then I read again the bug report and Mr. Eric Harney said the iscsi_helper had to be inserted under EACH configured backend. So I just did it and voilà, everything worked (remeber to restart services). Here’s an example of configuration.
[my_hard_disk_backend] volume_group=hard_disk_backend volume_driver=cinder.volume.drivers.lvm.LVMVolumeDriver volume_backend_name=lvm_hard_disk iscsi_helper=lioadm
That’s it, however it took me quite some times to figure why it happened. Hope this can save you some time.