Comment 6 for bug 2020382

Revision history for this message
Brian Rosmaita (brian-rosmaita) wrote :

The upstream Cinder project only provided patches through Xena. To apply them further will require some changes. I don't know about the Nova side, but for cinder, if you go older than Xena, you'll have to use a different request to Nova here:

https://review.opendev.org/c/openstack/cinder/+/882839/2/cinder/compute/nova.py#227

You'll have to use api_version='2.79' (which will be good as far back as Train).

This means that the get_server_volume() function will return a different response, so you'll also have to adjust the code in cinder/volume/api.py.

In particular, at https://review.opendev.org/c/openstack/cinder/+/882839/2/cinder/volume/api.py#2351 we won't be able to check new_volume.attachment_id any more, because there isn't an attachment_id in the response for mv 2.79. The safest thing to do is to just remove lines 2351-2356, because we know that the instance is using the volume, we just don't know whether it's using this particular attachment or not. (If this is an extraneous attachment, it can be deleted later after the volume is detached from Nova in the normal way, or after the instance is deleted. We just won't let it be deleted while the instance is using the volume.)

You'll probably have to also make some adjustments to the unit tests, and once lines 2351-2356 are deleted, the variable 'nova_volume' that's assigned to on line 2343 isn't being used anywhere, and I think pep8 will complain about that. (You can just call the function at line 2343 without saving the return value.)

Those are the most obvious changes you'll have to make to the cinder patch; there may be some less-obvious things, so make sure you test carefully.