Bug 1384686 - [RFE][nova] Support volume_type as a BDM parameter when boot instances
Summary: [RFE][nova] Support volume_type as a BDM parameter when boot instances
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat OpenStack
Classification: Red Hat
Component: openstack-nova
Version: 11.0 (Ocata)
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: Upstream M2
: ---
Assignee: Eoghan Glynn
QA Contact: Prasanth Anbalagan
URL: https://blueprints.launchpad.net/nova...
Whiteboard: upstream_milestone_none upstream_defi...
Depends On: 1384684
Blocks: 1419948 ciscoosp13features, ciscoosp13rfe
TreeView+ depends on / blocked
 
Reported: 2016-10-13 20:53 UTC by Charles Crouch
Modified: 2019-09-09 13:38 UTC (History)
12 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1384684
Environment:
Last Closed: 2018-02-20 12:05:12 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
OpenStack gerrit 373203 0 None MERGED Add spec to use cinder's new attachment API 2020-05-21 12:52:07 UTC
OpenStack gerrit 417541 0 None ABANDONED Nova BFV by reserving volume 2020-05-21 12:52:07 UTC

Description Charles Crouch 2016-10-13 20:53:17 UTC
Cisco (Metapod team in particular) would like to see the following blueprint prioritized in the Ocata cycle:

https://blueprints.launchpad.net/nova/+spec/add-volume-type-when-boot-instances

Comment 1 Charles Crouch 2016-11-15 17:35:49 UTC
Just wanted to add a comment on our suggested approach (from Chet)...


h2. Problem Statement
If you use the nova Boot From Volume (BFV) workflow you can not specify a cinder volume-type on the request. As a result the volume is *always* created in the default volume-type as defined by the default_volume_type option in cinder.conf (if default_volume_type is not set then one of the backends is randomly selected by the cinder scheduler service). In a tiered storage deployment this means users have to first pre-create the volume, wait for the volume to be created, and then boot onto it if they want anything other then the default.

Ideally the solution to this problem is to extend the nova API to accept volume-type as an optional field on the BFV call. After 2 cycles of discussion we have been unable to get agreement from the nova core team to pursue this route. nova has taken that stance that the proper way to address this is to simply create a volume using cinder and boot from that volume. The main problem with this is that you have to create the volume *and* wait for it to become "available" before you issue the boot command. If the status of a volume is not "available" the nova API will reject the request as invalid. Today this is done in the check_attach function of the compute API, however nova core plans on merging https://review.openstack.org/#/c/335358/ which will remove the check_attach code and will instead rely on cinder's reserve volume call (https://github.com/openstack/cinder/blob/master/cinder/volume/api.py#L614). The reserve volume call uses similar logic to the nova API in that it won't allow you "reserve" a volume if its isn't in the "available" or "in-use" (for multiattach only) state. Additionally the reserve volume call changes the status of the volume to "attaching" which isn't accurate at all because its not actually "attaching" rather someone has expressed that they intend to attach to the volume at some future time.

h2. Proposed Solution
We propose to change the reserve volume call such that it will allow for the reserving of a volume that is in the "creating" or "downloading" state. Since we now want to "reserve" a volume that is still in a transitory state ("creating" or "downloading") we wish to change the way the reserve volume call works such that it does not need to change the status to "attaching". We propose that we extend the existing attach_status field to indicate a reserved volume. The attach_status field today have two values "attached" and "detached". We propose the addition of a 3rd value called "pending". When a reserve call is made the status and attach_status of the volume will be checked and assuming the attach could proceed the attach_status field will be updated to "pending".

The code for the reserve volume call would look something like the following.

NOTE: This code has *not* been tested and may not be complete.

{code}
diff --git a/cinder/volume/api.py b/cinder/volume/api.py
index d964eeb..5202cfc 100644
--- a/cinder/volume/api.py
+++ b/cinder/volume/api.py
@@ -613,10 +613,14 @@ class API(base.Base):
     @wrap_check_policy
     def reserve_volume(self, context, volume):
         expected = {'multiattach': volume.multiattach,
-                    'status': (('available', 'in-use') if volume.multiattach
-                               else 'available')}
-
-        result = volume.conditional_update({'status': 'attaching'}, expected)
+                    'attach_status': ('detatched',),
+                    'status': ('available', 'creating', 'downloading')}
+        if volume.multiattach:
+            expected['attach_status'] += ('attached',)
+            expected['status'] += ('in-use',)
+
+        result = volume.conditional_update({'attach_status': 'pending'},
+                                           expected)

         if not result:
             expected_status = utils.build_or_str(expected['status'])
{code}

In addition to the changes to the reserve volume call the unreserve volume call would also need to be updated to account for this change. Additionally there are handful of locations in the code base today where the attach_status of the volume is checked. Those locations would have to be updated to account for the new status of "pending".

Once the cinder side of things is completed, nova needs to be updated to utilization this new functionality. Depending on how the functionality is implemented in cinder (micro versions etc) work may have to be done to allow nova to use the new reserve volume functionality. Additionally the logic on the nova-compute node that waits for a volume to become available before booting the VM will also need to be updated to wait when a request is made to boot from an existing volume (see the changes to nova/virt/block_device.py in https://review.openstack.org/#/c/391444/ for info).

h2. Next Steps
We need to write-up a cinder spec with the above, propose it, and see if we can get some agreement from the cinder cores on the spec.

Comment 2 Yuming Ma 2016-12-08 19:37:53 UTC
Cinder change https://review.openstack.org/#/c/387712/ will provided the mechanics to reserve a volume while it is in creating or downloading state. This can be leveraged by the nova boot from volume procedure so that BFV will not have to wait for the volume to be completely available. Hence, the user can program the API call flow without worrying about waiting volume creation to complete. The user operation flow will be:
1. Create volume from image which is yet to complete (job running on the background)
2. Nova bfv reserves the volume returns with dict that instance is waiting for volume to be available.  The BFV call is not blocked but running on the background
3. Volume creation job on background completes after downloading etc
4. Instance creation job on background complete after volume creation completes

This will require changes in Nova to:
1. Call cinder API to reserver volume while it is not available yet
2. Unblock bfv call while waiting for volume to be available.
3. Update instance status per reserved volume and BFV background job status

Comment 3 Yuming Ma 2016-12-08 22:47:28 UTC
This blueprint registered, please review/revise: https://blueprints.launchpad.net/nova/+spec/bfv-with-reserved-volume

Comment 4 Charles Crouch 2016-12-12 18:01:26 UTC
Hey Eoghan
What is the next step we need to do to help our teams move this along in Ocata?
Thanks
Charles

Comment 5 Stephen Gordon 2017-01-03 21:23:20 UTC
(In reply to Charles Crouch from comment #4)
> Hey Eoghan
> What is the next step we need to do to help our teams move this along in
> Ocata?
> Thanks
> Charles

We need to actually write a specification, and unfortunately that hasn't been possible for Ocata (there is also quite a long backlog of things that did have specifications but did not land due to the shortened cycle).

To progress this in Pike we will need to identify someone to own writing the specification. Normally this would be the blueprint owner but it's not clear Yuming Ma was taking that here? A review was requested but I don't see a specification with the actual detail linked from:

https://blueprints.launchpad.net/nova/+spec/bfv-with-reserved-volume

There was a specification on the older blueprint this superseded but it of course was using the proxy APIs approach which upstream have rejected.

Comment 6 Yuming Ma 2017-01-03 22:11:22 UTC
Stephen, I can take up on writing the spec and get the ball rolling. Any comments on the blueprint so far?

Comment 8 Yuming Ma 2017-01-06 23:52:17 UTC
spec review at : https://review.openstack.org/#/c/417541

Comment 9 Yuming Ma 2017-01-09 18:51:50 UTC
Hi, Stephen, I have committed the review (see above URL), please comment/review. Thanks

Comment 10 Stephen Gordon 2017-01-11 13:39:16 UTC
(In reply to Yuming Ma from comment #9)
> Hi, Stephen, I have committed the review (see above URL), please
> comment/review. Thanks

Thanks, we're working on preparation for the Pike and the associated PTG at the moment so I will try and get an assignee from our side. Leaving the NEEDINFO open for now.

Comment 11 Yuming Ma 2017-01-21 05:36:49 UTC
Thanks Steve, I am planning to go to the PTG as well and please let me know who on RH side are going and let's sync up before and during the meetings. My email: yumima

Comment 12 Stephen Gordon 2017-02-03 22:22:15 UTC
(In reply to Yuming Ma from comment #11)
> Thanks Steve, I am planning to go to the PTG as well and please let me know
> who on RH side are going and let's sync up before and during the meetings.
> My email: yumima

Hopefully will be confirming who will be following this effort from our side early next week.

Comment 13 Stephen Gordon 2017-03-09 16:32:02 UTC
Based on the discussions at the PTG this work is merging into the spec for using cinder's new attachment API:

https://review.openstack.org/#/c/373203/

Comment 15 Lee Yarwood 2018-02-20 12:05:12 UTC
Closing out as WONTFIX for openstack-nova based on [1] and various other PTG/Forum discussions during previous cycles. Users will either need to create their volumes first _or_ extend the openstackclient to orchestrate the creation of volumes using a specific type before calling the Nova API.

[1] http://lists.openstack.org/pipermail/openstack-dev/2017-May/117242.html


Note You need to log in before you can comment on or make changes to this bug.