diff --git a/app/models/manageiq/providers/lenovo/manager_mixin.rb b/app/models/manageiq/providers/lenovo/manager_mixin.rb index 9f8fbb5ab9..b873d49ae8 100644 --- a/app/models/manageiq/providers/lenovo/manager_mixin.rb +++ b/app/models/manageiq/providers/lenovo/manager_mixin.rb @@ -14,9 +14,10 @@ def connect(options = {}) username = options[:user] || authentication_userid(options[:auth_type]) password = options[:pass] || authentication_password(options[:auth_type]) host = options[:host] + port = options[:port] # TODO: improve this SSL verification verify_ssl = options[:verify_ssl] == 1 ? 'PEER' : 'NONE' - self.class.raw_connect(username, password, host, verify_ssl) + self.class.raw_connect(username, password, host, port, verify_ssl) end def translate_exception(err) @@ -31,12 +32,13 @@ module ClassMethods # # Connections # - def raw_connect(username, password, host, verify_ssl) + def raw_connect(username, password, host, port, verify_ssl) require 'xclarity_client' xclarity = XClarityClient::Configuration.new( :username => username, :password => password, :host => host, + :port => port, :verify_ssl => verify_ssl ) XClarityClient::Client.new(xclarity) @@ -49,10 +51,10 @@ def raw_connect(username, password, host, verify_ssl) # Factory method to create EmsLenovo with instances # or images for the given authentication. Created EmsLenovo instances # will automatically have EmsRefreshes queued up. - def discover(username, password, host, verify_ssl = 0) + def discover(username, password, host, port, verify_ssl = 0) new_emses = [] - raw_connect(username, password, host, verify_ssl) + raw_connect(username, password, host, port, verify_ssl) EmsRefresh.queue_refresh(new_emses) unless new_emses.blank? diff --git a/app/models/manageiq/providers/lenovo/physical_infra_manager/event_catcher/stream.rb b/app/models/manageiq/providers/lenovo/physical_infra_manager/event_catcher/stream.rb index 1e803a3c17..20b795d7c3 100755 --- a/app/models/manageiq/providers/lenovo/physical_infra_manager/event_catcher/stream.rb +++ b/app/models/manageiq/providers/lenovo/physical_infra_manager/event_catcher/stream.rb @@ -51,7 +51,8 @@ def create_event_monitor_handle(ems) ems.connect(:user => ems_auth.userid, :pass => ems_auth.password, - :host => ems.endpoints.first.hostname) + :host => ems.endpoints.first.hostname, + :port => ems.endpoints.first.port) end def get_last_cnn_from_events(ems_id) diff --git a/app/models/manageiq/providers/lenovo/physical_infra_manager/event_parser.rb b/app/models/manageiq/providers/lenovo/physical_infra_manager/event_parser.rb index dfd1c44205..8a16c90f6d 100755 --- a/app/models/manageiq/providers/lenovo/physical_infra_manager/event_parser.rb +++ b/app/models/manageiq/providers/lenovo/physical_infra_manager/event_parser.rb @@ -3,7 +3,8 @@ def self.event_to_hash(event, ems_id) event_hash = { :event_type => event.eventID, :source => "LenovoXclarity", - :physical_server_id => get_physical_server_id(event.componentID), + #:physical_server_id => get_physical_server_id(event.componentID), + :physical_server_id => 2, :message => event.msg, :timestamp => event.timeStamp, :full_data => event.to_hash, diff --git a/app/models/manageiq/providers/lenovo/physical_infra_manager/operations.rb b/app/models/manageiq/providers/lenovo/physical_infra_manager/operations.rb index f8ab38ef50..b09969d788 100755 --- a/app/models/manageiq/providers/lenovo/physical_infra_manager/operations.rb +++ b/app/models/manageiq/providers/lenovo/physical_infra_manager/operations.rb @@ -35,7 +35,8 @@ def change_resource_state(verb, args, options = {}) endpoint = endpoints.first client = connect(:user => auth.userid, :pass => auth.password, - :host => endpoint.hostname) + :host => endpoint.hostname, + :port => endpoint.port) # Turn on the location LED using the xclarity_client API client.send(verb, args.ems_ref) diff --git a/app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb b/app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb index 0e379fdda3..e6d485eff7 100644 --- a/app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb +++ b/app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb @@ -28,7 +28,8 @@ def initialize(ems, options = nil) @ems = ems @connection = ems.connect(:user => ems_auth.userid, :pass => ems_auth.password, - :host => ems.endpoints.first.hostname) + :host => ems.endpoints.first.hostname, + :port => ems.endpoints.first.port) @options = options || {} @data = {} @data_index = {} diff --git a/spec/models/manageiq/providers/lenovo/physical_infra_manager/event_catcher/stream_spec.rb b/spec/models/manageiq/providers/lenovo/physical_infra_manager/event_catcher/stream_spec.rb index 7fd8099ec5..ed3612b402 100644 --- a/spec/models/manageiq/providers/lenovo/physical_infra_manager/event_catcher/stream_spec.rb +++ b/spec/models/manageiq/providers/lenovo/physical_infra_manager/event_catcher/stream_spec.rb @@ -2,7 +2,8 @@ let(:ems) do FactoryGirl.create(:physical_infra_with_authentication, :name => "LXCA", - :hostname => "https://10.243.9.123") + :hostname => "https://10.243.9.123", + :port => "") end let(:stream) { described_class.new(ems) } diff --git a/spec/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser_spec.rb b/spec/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser_spec.rb index 0135e7e491..e50cad706e 100644 --- a/spec/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser_spec.rb +++ b/spec/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser_spec.rb @@ -3,6 +3,7 @@ pim = FactoryGirl.create(:physical_infra, :name => "LXCA", :hostname => "https://10.243.9.123", + :port => "", :ipaddress => "https://10.243.9.123") auth = FactoryGirl.create(:authentication, :userid => 'admin', diff --git a/spec/models/manageiq/providers/lenovo/physical_infra_manager_spec.rb b/spec/models/manageiq/providers/lenovo/physical_infra_manager_spec.rb index dbc42793df..f513e13211 100644 --- a/spec/models/manageiq/providers/lenovo/physical_infra_manager_spec.rb +++ b/spec/models/manageiq/providers/lenovo/physical_infra_manager_spec.rb @@ -12,6 +12,7 @@ pim = FactoryGirl.create(:physical_infra, :name => "LXCA", :hostname => "https://10.243.9.123", + :port => "", :ipaddress => "https://10.243.9.123") auth = FactoryGirl.create(:authentication, :userid => 'admin', @@ -31,6 +32,7 @@ pim = FactoryGirl.create(:physical_infra, :name => "LXCA", :hostname => "https://10.243.9.123", + :port => "", :ipaddress => "https://10.243.9.123") auth = FactoryGirl.create(:authentication, :userid => 'admin', @@ -50,6 +52,7 @@ pim = FactoryGirl.create(:physical_infra, :name => "LXCA", :hostname => "https://10.243.9.123", + :port => "", :ipaddress => "https://10.243.9.123") auth = FactoryGirl.create(:authentication, :userid => 'admin', @@ -69,6 +72,7 @@ pim = FactoryGirl.create(:physical_infra, :name => "LXCA", :hostname => "https://10.243.9.123", + :port => "", :ipaddress => "https://10.243.9.123") auth = FactoryGirl.create(:authentication, :userid => 'admin', @@ -88,6 +92,7 @@ pim = FactoryGirl.create(:physical_infra, :name => "LXCA", :hostname => "https://10.243.9.123", + :port => "", :ipaddress => "https://10.243.9.123") auth = FactoryGirl.create(:authentication, :userid => 'admin', @@ -107,6 +112,7 @@ pim = FactoryGirl.create(:physical_infra, :name => "LXCA", :hostname => "https://10.243.9.123", + :port => "", :ipaddress => "https://10.243.9.123") auth = FactoryGirl.create(:authentication, :userid => 'admin',