-
Notifications
You must be signed in to change notification settings - Fork 898
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
Use the new OvirtSDK for refresh #14398
Conversation
5c2dab5
to
dd43a5f
Compare
If the ovirt provider supports version 4 of the api use the new OvirtSDK to do refresh and targeted refresh.
dd43a5f
to
ccb1cf8
Compare
@pkliczewski @masayag please review. |
Add a setting that by default will disable the use of the OvirtSDK for refresh and provisioning.
12c5514
to
d2cbf43
Compare
@@ -101,6 +101,7 @@ | |||
:omit_default_port: true | |||
:read_timeout: 60 | |||
:ems_redhat: | |||
:use_ovirt_engine_sdk: false |
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.
Not a fan of adding another option. When would a customer ever turn this on?
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 idea is that we want to get the code in and allow people who want to try it to use it but if there are problems they can turn it off. Its off by default as a safety measure.
One might want to turn this on if he wants better performance due to the improved sdk for example.
When it is tested enough the default will be true and when the old api is not supported anymore it will just be removed.
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 @blomquisg exactly. This feature toggle is basically the same approach we took for the graph refresh in amazon.
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.
Basically ok with the feature toggle approach.
@borod108 could you explain a bit, how the current refresh code is still used? Although you dont delete much existing code you still introduce a bunch of V3 code...
other suggestions as comments
@blomquisg this is intended to go into Fine. In the end this is you call, but we discussed it's ok with the feature toggle approach
@@ -101,6 +101,7 @@ | |||
:omit_default_port: true | |||
:read_timeout: 60 | |||
:ems_redhat: | |||
:use_ovirt_engine_sdk: false |
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 @blomquisg exactly. This feature toggle is basically the same approach we took for the graph refresh in amazon.
@@ -9,6 +9,7 @@ | |||
@ems.default_endpoint.path = "/ovirt-engine/api" | |||
allow(@ems).to receive(:supported_api_versions).and_return([3, 4]) | |||
allow(@ems).to receive(:resolve_ip_address).with(ip_address).and_return(ip_address) | |||
::Settings.ems.ems_redhat.use_ovirt_engine_sdk = true |
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 should use stub_settings
- otherwise you are modifying the Settings
singleton and it will be true for others as well
@@ -5,6 +5,7 @@ | |||
:port => 8443) | |||
@ems.update_authentication(:default => {:userid => "admin@internal", :password => "123456"}) | |||
allow(@ems).to receive(:supported_api_versions).and_return([3, 4]) | |||
::Settings.ems.ems_redhat.use_ovirt_engine_sdk = true |
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.
stub_settings
too - see below
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!
subject { described_class.new(ems, options).build } | ||
describe 'chooses the right parsing strategy' do | ||
before do | ||
::Settings.ems.ems_redhat.use_ovirt_engine_sdk = use_ovirt_engine_sdk |
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.
stub_settings
- see below
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!
end | ||
|
||
def host_targeted_refresh(target) | ||
@ems.with_provider_connection(:version => 4) do |connection| |
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'd use the attr_reader
ems
if you already have it
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!
@@ -0,0 +1,63 @@ | |||
module ManageIQ::Providers::Redhat::InfraManager::Refresh::Parse::Strategies | |||
class DatacenterInventory | |||
attr_reader :datacenter_inv, :_log |
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.
_log
will mask _log here
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!
Some comments on commits borod108/manageiq@ccb1cf8~...7e639d3 spec/models/manageiq/providers/redhat/infra_manager/refresh/refresher_4_1_spec.rb
spec/models/manageiq/providers/redhat/infra_manager/refresh/refresher_target_vm_4_spec.rb
|
Checked commits borod108/manageiq@ccb1cf8~...7e639d3 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 app/models/manageiq/providers/redhat/infra_manager/refresh/parse/strategies/vm_inventory.rb
spec/models/manageiq/providers/redhat/infra_manager/event_parser_spec.rb
spec/models/manageiq/providers/redhat/infra_manager/refresh/parse/parser_builder_spec.rb
spec/models/manageiq/providers/redhat/infra_manager/refresh/refresher_4_1_spec.rb
|
@Fryguy @blomquisg @durandom please note that when the setting use_ovirt_engine_sdk is set to false it the code that will be used is the old code for both collecting th einventory and parsing. A little more details: this: https://github.com/ManageIQ/manageiq/pull/14398/files#diff-d6125c21d43685840429020f8c5a57aaR233 |
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.
👍
QE also tested this part extensively and found no regressions
@blomquisg please merge
@miq-bot add_labels enhancement |
…e_sdk setting and will not use OvirtSDK if it is off. This was a common effort with big contribution from @pkliczewski and help from @jhernand and @masayag This PR is based on: ManageIQ#14398
If the ovirt provider supports version 4 of the api use the new
OvirtSDK to do refresh and targeted refresh.
(This is a first in a series of PRs that will allow using the OvirtSDK with providers that support version 4 for refresh, event handling and provisioning.)