-
Notifications
You must be signed in to change notification settings - Fork 357
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
Cloud Volume creation fixes #4908
Conversation
4cdf368
to
75e0157
Compare
ping @AlexanderZagaynov |
54c339c
to
ea52035
Compare
@@ -270,6 +277,8 @@ ManageIQ.angular.app.controller('cloudVolumeFormController', ['miqService', 'API | |||
vm.supportsCinderVolumeTypes = data.supports_cinder_volume_types; | |||
if (vm.supportsCinderVolumeTypes) { | |||
vm.volumeTypes = data.parent_manager.cloud_volume_types; | |||
} else if (vm.cloudVolumeModel.emstype === 'ManageIQ::Providers::Amazon::StorageManager::Ebs') { | |||
loadEBSVolumeTypes(); |
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 we need to call it here as well? I think we call it inside setForm()
already which is called regardless where we arrived to the page from.
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.
The vm.storageManagerChanged
is called from https://github.com/ManageIQ/manageiq-ui-classic/blob/master/app/views/cloud_volume/_common_new_edit.html.haml#L8. And from, there I need to populate the Volume types when the provider type is selected.
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.
Oh I see 👍 You actually moved it to better place, we should probably delete it from setForm
function eventually (not sure if in this PR that will be backported)
@miha-plesko : Please, provide more detailed steps for the error that you found. I'd love to reproduce what you got. To be honest I am pretty lost in this form. It seems to be doing multiple things from multiple contexts and I don't know all the situations then need to be covered. I welcome any help here. |
Ahh, I know what it is. There is also variant
On this page it's also possible to click "Add new volume" but here |
Let's make a list of all the stuff that is expected to work with
Creating a volume should work
Providers:
|
Oh how I love code that does a million things from a dozen contexts that is greatly documented and test-covered :-D |
I know the feeling @martinpovolny , was working on this controller in Gaprindashvilli blocker-only phase... @himdel said the same thing, "we need to split into 7 controllers". But are we really going to, assuming we're in Hammer blocker phase this time? 😂 |
@martinpovolny it should fix the problem if we replace this line with @storage_manager = begin
if (manager = find_record_with_rbac(ExtManagementSystem, params[:storage_manager_id]))
# Handle situation when CloudProvider ID is given instead StorageManager
manager unless manager.respond_to?(:storage_managers)
manager.storage_managers.detect { |m| m.supports_block_storage? }
end
end |
I have added one more commit that does not fix things, but removes a creating of an empty CloudVolume instance. Should that cause a problem, please try testing w/o the last commit. Thx! |
return nil unless manager | ||
return manager.id unless manager.respond_to?(:storage_managers) | ||
manager.storage_managers.detect { |m| m.supports_block_storage? }&.id | ||
end |
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.
I like this. Maybe rename function into
def block_storage_manager_idbecause at some point we'll probably need
def object_storage_manager_idas well. Or even better, make it accept additional parameter to support both storage manager types:
def storage_manager_id(provider_id, criteria: :supports_block_storage?)
...
manager.storage_managers.detect { |m| m.send(criteria) }&.id
end
I'll test your latest changes tomorrow when I come to the office.
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.
@martinpovolny the last commit causes haml crash in _common_new_edit.haml if I go to:
Storage > BlockStorage > Volumes > "Add a new Cloud Volume"
We need to modify the HAML as well, please see the comment.
@@ -185,7 +185,6 @@ def new | |||
assert_privileges("cloud_volume_new") | |||
assert_privileges("cloud_tenant_show_list") | |||
|
|||
@volume = CloudVolume.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.
Please also modify haml:
"disabled" => !@storage_manager.nil? || !@volume.id.nil?, |
Here ^ it crashes with
undefined method 'id' for nil:NilClass
. We should probably test if @volume
itself is nil, not try to access its 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.
Right. I fixed it and added a simple spec.
4a3c9a3
to
14cdc9e
Compare
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. Tested and it works - NEW volume form gets properly populated no matter where I access it from 👍. I'd still rename the function into def block_storage_manager_id()
(see comment from before), but as you wish.
BTW while testing I realized EDIT requires "storage manager show" permission (besides "volume edit") but that's not a problem to solve here. Not sure if it's really a bug even, because you shouldn't edit volume without accessing the manager options anyway, but I got the red bubble on UI so... :)
@miha-plesko : Renaming the method as you suggested. However not adding the parameters as you also suggested. It's a good suggestion, but one that is not (yet) relevant. And a good practice is not to do things that are not needed. Not add parameters that are not needed. Thank you for your cooperation and testing! |
@AlexanderZagaynov : good to merge? |
@martinpovolny yes, looks good, let's do that :) |
Checked commits martinpovolny/manageiq-ui-classic@b5d15d8~...b8731b6 with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 **
|
ping @mzazrivec, @himdel, @h-kataria ? |
LGTM, code looks good and both BZs seem fixed 👍 |
Cloud Volume creation fixes (cherry picked from commit c7af6b6) Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1644310
Hammer backport details:
|
@martinpovolny @himdel can this be |
I think so, yes. #4549 is in gaprindashvili |
This seeems to take all the relevant changes git cherry-pick -x -m1 70b2475 # #3927 git cherry-pick -x -m1 46260de # #4345 git cherry-pick -x -m1 7c4afa8 # #4536 git cherry-pick -x -m1 c7af6b6 # #4908 not sure how to proceed :) |
@himdel Oh my...... thanks for finding out all those dependencies and extra steps!!! Let me check with mgmt team with this info, this might be more than what we'd like in G branch. Thanks again 😄 |
@martinpovolny Please hold off working on PRs for Gaprindashvili. We might not take this into G release. |
Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1644310
emstype
(and possibly other) parameters where missing) . Therefor the case when adding a new volume w/o selecting a storage manager did not work.Part of the problems seem to be coming from 771e97f .
Populate volume types for EBS. Fixing:
https://bugzilla.redhat.com/show_bug.cgi?id=1644306
I have issues with understanding what are all the possible situations here and what is the expected behavior. Review and more testing is very welcome. Ping @mansam, @miha-plesko, @gberginc