-
Notifications
You must be signed in to change notification settings - Fork 358
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
Support VM Reconfigure for VMware vCloud provider #3854
Conversation
55db92b
to
2ad0cd2
Compare
40f2352
to
d54af30
Compare
Removed WIP tag as this PR is done even if it's pending core. @martinpovolny I kindly ask for review even if core is not merged yet, to speed up the process. |
d54af30
to
1276141
Compare
I have no idea why JavaScript spec is failing, doesn't seem to be related with this PR. @martinpovolny do you perhaps know what could be the cause? |
I restarted travis, now it's green. @himdel, @AparnaKarve, @Hyperkid123 : can you, please, review this PR, it's out of my area of expertise. Thx! |
@@ -353,11 +355,6 @@ def reconfigure_handle_submit_button | |||
url = previous_breadcrumb_url.split('/') | |||
javascript_redirect(:controller => url[1], :action => url[2]) | |||
end | |||
|
|||
if @flash_array |
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.
This bit is surprising, why would you remove a flash message?
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.
Thanks for asking. This flash rendering breaks redirect as far as I've tested because it happend AFTER redirecting to other page. See the condition in L352:
if ...
javascript_redirect(...)
else
javascript_redirect(...)
end
There is no way we can arrive to L357 without callind redirect first. Or am I missing something? Looking forward to your answer, I'm curious how this can work for other providers. Most probably it doesn't :)
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.
Aah... I think you're right.. A few lines above, there is a flash_to_session
call which saves the flash messages for later.
Since both branches do javascript_redirect
, unconditionally, I agree this is broken.
And since flash_to_session
I think we can expect this won't hide any flash messages that would otherwise appear.
👍
The angular changes look good, I don't see a problem there. Where I do see a problem is - %td{"ng-if" => @reconfigitems.first.vendor == 'vmware'}
+ %td{"ng-if" => "vm.vm_type.includes('Vmware::InfraManager')"} We should never expect the class name to be meaningful like this and making the UI depend on the exact format of class names sounds wrong. If you need to distinguish between infra and cloud, we need a method on the provider(/vm/whatever?) class. |
@agrare I kindly ask for your suggestion here. Question is: what field to use on a) use Approach (a) will result in additional VMDB query while approach (b) pollutes the code... WDYT? |
I'd probably go with checking the VM's ems_type, something like is_cloud? on a CloudManager::Vm just seems strange. @himdel the UI doesn't do any class/kind_of/is_a checks? We can't backport it because it would require a data migration but we could always set the vendor to |
@agrare It's more like the UI has been trying to remove any mentions of provider classes ever since Provider pluggability became a goal. You can't have provider pluggability and still rely on class names. So, I'm not saying the check would be a new thing in the UI, but I am saying that at some point, we will need to remove it, so why would we want to introduce it in the first place. As for The main point is.. the UI can't have the knowledge that |
@himdel yeah I get where you're coming from there, but checking for vendor which should be 1:1 with the type when determining if you should show something seems like the same thing as checking for the type. Not all cloud vms are going to support reconfigure, so it would have to be something like The pluggable thing to do would be to ask the vm if you support reconfigure disk remove backing file before showing that slider no? |
Careful now, I'm not sure we want to have a dozen of methods on VM like:
Or do we? |
@miha-plesko yeah that's kind of my point, if we ask for every little thing it is going to get out of hand. Ideally in the foreman plugin sense the provider would might their own reconfigure UI, these options are pretty specific to the vSphere provider. |
Coming back from future into present time with approaching deadline for 4.6.3 - @himdel would you agree to go with option (a) then where we'd check like this:
where rails would set |
Yeah, as long as we're trying to go in the right direction... :)
(Also, if we relax the "no class" restriction a bit, we could still rely on classes defined in the core - so ManageIQ::Providers, as long as it's not ManageIQ::Providers::$Vendor) So, another option would be to test if the Vm is a descendant of CloudManager::Vm and has |
That would be perfect, yes. (I'm thinking asking for every single field is wrong, but.. most likely they can be described by a common property ... |
1276141
to
1548029
Compare
@miha-plesko vmware provider PR merged |
1548029
to
c148ae4
Compare
Tested once again and of course there was some small error so I'm really glad I did :) Everything seems to be working now, @himdel looking forward to any further comments you might have. |
@miq-bot remove_label pending core |
With this commit we add support to reconfigure VM hardware for VMware vCloud provider. Different configuration is needed for VMware vSphere (infra) than for VMware vCloud (cloud) so we cannot rely on `vm.vendor = vmware` attribute anymore, which is common to them both... Instead, we rely on VM class name. Also, there seems to be a bug in ruby controller which tries to render flash message AFTER redirect was invoked. This results in ugly rails crash. Solved by removing the flash rendering part. BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1572086 Signed-off-by: Miha Pleško <miha.plesko@xlab.si>
c148ae4
to
a79575d
Compare
Checked commit miha-plesko@a79575d with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0 **
|
LGTM, thanks! :) |
Support VM Reconfigure for VMware vCloud provider (cherry picked from commit 9a05d39) https://bugzilla.redhat.com/show_bug.cgi?id=1584699
Gaprindashvili backport details:
|
With this commit we add support to reconfigure VM hardware for VMware vCloud provider. Different configuration is needed for VMware vSphere (infra) than for VMware vCloud (cloud) so we cannot rely on
vm.vendor = vmware
attribute anymore, which is common to them both... Instead, we rely on VM class name.Also, there seems to be a bug in ruby controller which tries to render flash message AFTER redirect was invoked. This results in ugly rails crash. Solved by removing the flash rendering part.
Video: http://x.k00.fr/reconfigure
Depends on: ManageIQ/manageiq-providers-vmware#231
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1572086
@miq-bot add_label enhancement,gaprindashvili/yes
@miq-bot assign @martinpovolny