-
Notifications
You must be signed in to change notification settings - Fork 141
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
Add best fit API for transformations moving vms to openstack #455
Conversation
@agrare Please review |
{ | ||
:source_href => mapping["source_href"], | ||
:best_fit => Api::Utils.build_href_slug(Flavor, fit.best_fit_flavor.try(:id)), | ||
:all_fit => fit.available_fit_flavors.collect { |f| Api::Utils.build_href_slug(Flavor, f.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.
¯\_(ツ)_/¯ Naming is hard... if anyone has better suggestions I'm all ears 😄
787d76a
to
40b23c3
Compare
@abellotti Please review |
I think this is fine, maybe take care of the rubocop warning above. |
40b23c3
to
a0065a7
Compare
def vm_flavor_fit_resource(_type, _id, data) | ||
data["mappings"].collect do |mapping| | ||
source = Api::Utils.resource_search_by_href_slug(mapping["source_href"]) | ||
destination = Api::Utils.resource_search_by_href_slug(mapping["destination_href"]) |
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.
hmm, the above 2 seems to be confusing to be. *_href implies an API href, i.e. http://localhost:3000/api/vms/1 and not the slug, which is normally named href_slug (for vms/1).
If those are expected to be href_slugs, you can rename then accordingly, i.e. mapping["source_href_slug"] and mapping["destination_href_slug"].
Optionally, you can take an object reference which can take either, so mapping["source"] and mapping["destination"] which identify the object as desired
{ "href" : "http://localhost:3000/api/vms/1" }
or
{ "href_slug" : "vms/1" }
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.
Do you have an example of the last alternative you mentioned (object reference)?
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.
look at http://manageiq.org/docs/reference/latest/api/reference/users#creating-users for group, it's just a hash which can be one of many identifiers, id, href, description, etc. or zone reference for creating a provider http://manageiq.org/docs/reference/latest/api/reference/providers#creating-providers, same idea. you can look at any of the helper methods for those parse_. In this case you'd add support for href_slug in addition to href for example.
@@ -3366,6 +3366,8 @@ | |||
:identifier: transformation_mapping_new | |||
- :name: delete | |||
:identifier: transformation_mapping_delete | |||
- :name: vm_flavor_fit | |||
:identifier: transformation_mapping_new |
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.
only folks that can create new mappings can run this action ?
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.
¯\_(ツ)_/¯ That's the only use case for it at the moment.
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.
Ahh ok 👍 we can always change later if need be. Thanks!!
a0065a7
to
0157bae
Compare
Checked commit bdunne@0157bae with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 |
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.
👍 LGTM
@bdunne Thank you for this PR. Recently we completed integrating this API with our frontend work. The current UI design expects |
@AparnaKarve At the moment, we are not comparing the |
Ok, I guess we would have to discuss this use case in detail (possibly during our Wednesday call) |
Depends on: ManageIQ/manageiq#17880
https://trello.com/c/b90ZCyNm/183-extend-cf-api-for-mapping-of-osp-flavors-and-security-groups