-
Notifications
You must be signed in to change notification settings - Fork 144
Expose the DDF schema for CloudVolume subclasses via OPTIONS #914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
930546f to
684324d
Compare
|
@agrare I have a feeling that this will only work for Amazon, because the OpenStack cloud volumes are subclassed differently. The goal here is to have an endpoint that is able to tell me the @miq-bot add_label question |
|
@skateman we could do |
Perfect! |
684324d to
8281bf5
Compare
8281bf5 to
50d6276
Compare
50d6276 to
37c742c
Compare
37c742c to
fc7a258
Compare
|
@agrare are you okay with these changes? Can we get this merged? |
| end | ||
|
|
||
| def options | ||
| return super unless params[:ems_id] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this imply the user has to pass in the ems_id? (Or do we know the ems_id based on the incoming endpoint?
That is, if a user does OPTIONS /api/cloud_volumes/123 I would expect under the covers we would look up the ems_id and not force the user to enter it into the query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can't really do OPTIONS /api/cloud_volumes/123 if you want to create the very first cloud volume 😕 this is for getting you the right DDF schema from the right provider...
| klass = CloudVolume.class_by_ems(ext_management_system) | ||
|
|
||
| validate = klass.validate_create_volume(ext_management_system) | ||
| raise validate[:message] unless validate[:available] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Fryguy this is the older "AvailabilityMixin" style versus SupportsFeature
|
If possible, my preference here is to specify the type of the CloudVolume instead of the id of the hosting provider. This is for consistency with what we do with the OPTIONS on providers, i.e. do something like this: Also, with this PR, I'm getting a 500 when the provider specified does not have a ::CloudVolume. Getting the following: Probably need to check the klass exists before using it. |
|
@abellotti do we really want to expose |
|
Unfortunately, we've already exposed those types. It's not uncommon to query an endpoint for a particular type or sub-type. |
|
@abellotti we're asking with an |
fc7a258 to
9eb555e
Compare
|
Checked commits skateman/manageiq-api@8f64421~...9eb555e with ruby 2.6.3, rubocop 0.82.0, haml-lint 0.35.0, and yamllint app/controllers/api/cloud_volumes_controller.rb
|
|
Thanks @skateman for looking into it and adding the check for the class existence. LGTM!! 👍 |
Similarly to the provider forms, the CloudVolume forms also have provider-specific fields that we're moving to
params_for_createmethods under the provider-specific subclasses. This change exposes these schemas through the OPTIONS endpoint. The only necessary param is theidof a StorageManager that will be selected from a dropdown defined in the common schema.The current name of the param is
ems_idbut I'm open for better ideas. Also I'm not sure if all the storage manager subclasses follow the"#{provider.class}::CloudVolume"convention on which this PR heavily relies.Parent issue: ManageIQ/manageiq-ui-classic#7334
@miq-bot add_reviewer @agrare
@miq-bot add_label enhancement