how to use volume multi-attach in Mitaka version?

asked 2018-08-08 10:01:25 -0500

hi guys,

I do know that multi-attach volumes are officially supported from Queens, surely upgrade is easy, yet I need it in Mitaka. Upgrade is not an option here.

These are version I'm at and have to stay there!

$ # NOVA
$ nova --version
out: 3.3.1
$ nova-api --version
out: 13.1.4
$ nova-compute --version
out: 13.1.4
$ nova-cert --version
out: 13.1.4
$ nova-scheduler --version
out: 13.1.4
$ nova-conductor --version
out: 13.1.4
$ nova-consoleauth --version
out: 13.1.4
$ # CINDER
$ cinder --version
out: 1.6.0
$ cinder-api --version
out: 8.1.1
$ cinder-scheduler --version
out: 8.1.1
$ cinder-volume --version
out: 8.1.1
$ # KVM
$ kvm --version
out: QUEMU emulator version 2.5.0

I have two instances - i1 and i2, and one cinder volume with --allow-multiattach flag. We use nova volume-attach to atach volume to i1. Up to here- everything works as expected. if you try to use nova volume-attachagain to attach volume to i2 you'll get an error (saying that to attach - volume status has to be 'available', not 'in-use').

i did a small code search and decided to comment out lines from 319 to 326 (two if statements) from this source file: https://github.com/openstack/nova/blob/mitaka-eol/nova/volume/cinder.py (https://github.com/openstack/nova/blo...) --> they enforce that the volume has to be available in order to attach it.

results:

  • i can now attach one volume to multiple instances (tested with two only)
  • if I call nova show i1 or nova show i2 I can see that both instances have volume dict in os-extended-volumes:volumes_attached list attribute.
  • cinder doesn't seem to acknowledge this :cinder list only shows that volume is attached to one instance (the one that was attached the first), and also state of the volume is stuck on attaching forever
  • cinder show <volume_id> has only one instance dict in attachments attribute
  • virsh dumpxml <instance_name> lacks shareable flag
  • when I enter instance I can mount and umount read and write with no problem. I only need to umount and mount again to see changes cross-instance
  • there are also issues when nova volume-detach is called on the instance that was attached second (ERROR volume id not found), I assume because the volume appears to be in attaching state. However, state change from attaching to in-use via cinder reset-state <volume_id> --state 'in-use' --attach-state 'attached' does not change the error.
  • if firstly attached (i1) is detached first - it is correctly detached. nova show i1 will correctly show os-extended-volumes:volumes_attached as empty list. Then when trying to detach volume from second instance (i2) ERROR is returned that the volume is already detached. attachments entry in cinder show volume is emptied after first call to detach (i1)

QUESTIONS:

Has anyone hacked it like this and was successful in his/her effort? Is anyone able to enumerate all aspects of the code that has to be changed in order to get multi-attach working in Mitaka? Correctly?

Advice of any kind is warmly welcomed!

edit retag flag offensive close merge delete