Skip to content
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

Parse Physical Storage #170

Merged
merged 1 commit into from
Jun 7, 2018
Merged

Conversation

EsdrasVP
Copy link
Member

@EsdrasVP EsdrasVP commented May 8, 2018

This PR is able to:

  • Parse Physical Storage informations and maps the relationship to Physical Racks.
  • Adds storage to the /cabinet mock.

Depends on:

@agrare agrare self-assigned this May 14, 2018
@skovic
Copy link

skovic commented Jun 4, 2018

@agrare Looks like the PR that this one depends on has been merged. Have you had a chance to look at this yet? Thanks

@agrare
Copy link
Member

agrare commented Jun 4, 2018

@skovic this actually also depends on ManageIQ/manageiq#17380 (which should be added to the description) and yes I'm reviewing it there

@EsdrasVP
Copy link
Member Author

EsdrasVP commented Jun 4, 2018

@skovic @agrare Sorry for that, just added the other dependency to the description

@agrare
Copy link
Member

agrare commented Jun 4, 2018

@EsdrasVP I'm still getting a lot of errors running the specs in this PR with ManageIQ/manageiq#17380 applied locally.

There are basically three kinds of errors:

  1) ManageIQ::Providers::Lenovo::PhysicalInfraManager::RefreshParser parse config patterns will retrieve config patterns
     Failure/Error: storage = XClarityClient::Storage.new(storage_hash)
     
     ActiveModel::UnknownAttributeError:
       unknown attribute 'uuid' for Storage.
     # /home/agrare/.gem/ruby/2.4.4/gems/activemodel-5.0.7/lib/active_model/attribute_assignment.rb:48:in `_assign_attribute'
     # /home/agrare/.gem/ruby/2.4.4/gems/activemodel-5.0.7/lib/active_model/attribute_assignment.rb:40:in `block in _assign_attributes'
     # /home/agrare/.gem/ruby/2.4.4/gems/activemodel-5.0.7/lib/active_model/attribute_assignment.rb:39:in `each'
     # /home/agrare/.gem/ruby/2.4.4/gems/activemodel-5.0.7/lib/active_model/attribute_assignment.rb:39:in `_assign_attributes'
     # /home/agrare/.gem/ruby/2.4.4/gems/activerecord-5.0.7/lib/active_record/attribute_assignment.rb:26:in `_assign_attributes'
     # /home/agrare/.gem/ruby/2.4.4/gems/activemodel-5.0.7/lib/active_model/attribute_assignment.rb:33:in `assign_attributes'
     # /home/agrare/.gem/ruby/2.4.4/gems/activerecord-5.0.7/lib/active_record/core.rb:319:in `initialize'
     # /home/agrare/.gem/ruby/2.4.4/gems/activerecord-5.0.7/lib/active_record/inheritance.rb:65:in `new'
     # /home/agrare/.gem/ruby/2.4.4/gems/activerecord-5.0.7/lib/active_record/inheritance.rb:65:in `new'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/parser/physical_storage_parser.rb:13:in `parse_physical_storage'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/parser.rb:45:in `parse_physical_storage'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb:92:in `block (2 levels) in get_all_physical_infra'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb:91:in `each'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb:91:in `block in get_all_physical_infra'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb:59:in `each'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb:59:in `get_all_physical_infra'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb:30:in `ems_inv_to_hashes'
     # ./spec/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser_spec.rb:35:in `block (2 levels) in <top (required)>'
     # ./spec/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser_spec.rb:368:in `block (3 levels) in <top (required)>'

This looks like a namespace issue, it is trying to reference the top-level model Storage instead of the XClarityClient::Storage

  2) ManageIQ::Providers::Lenovo::PhysicalInfraManager::RefreshParser parse physical storages will parse physical storage hardware data
     Failure/Error: storage = XClarityClient::Storage.new(storage_hash)
     
     NameError:
       uninitialized constant XClarityClient::Storage
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/parser/physical_storage_parser.rb:13:in `parse_physical_storage'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/parser.rb:45:in `parse_physical_storage'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb:92:in `block (2 levels) in get_all_physical_infra'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb:91:in `each'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb:91:in `block in get_all_physical_infra'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb:59:in `each'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb:59:in `get_all_physical_infra'
     # ./app/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser.rb:30:in `ems_inv_to_hashes'
     # ./spec/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser_spec.rb:35:in `block (2 levels) in <top (required)>'
     # ./spec/models/manageiq/providers/lenovo/physical_infra_manager/refresh_parser_spec.rb:94:in `block (3 levels) in <top (required)>'

Is there actually an XClarityClient::Storage class? I tried doing

>> require 'xclarity_client'
=> true
>> XClarityClient
=> XClarityClient
>> XClarityClient::Storage
NameError: uninitialized constant XClarityClient::Storage
	from (irb):3
	from /home/agrare/.rubies/ruby-2.4.4/bin/irb:11:in `<main>'
>> require 'xclarity_client/storage'
LoadError: cannot load such file -- xclarity_client/storage
	from /home/agrare/.rubies/ruby-2.4.4/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:120:in `require'
	from /home/agrare/.rubies/ruby-2.4.4/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:120:in `require'
	from (irb):4
	from /home/agrare/.rubies/ruby-2.4.4/bin/irb:11:in `<main>'

Then:

  41) ManageIQ::Providers::Lenovo::PhysicalInfraManager::Refresher will parse the legacy inventory
      Failure/Error: VCR.insert_cassette("#{vcr_path}/mock_aicc", options)
      
      ArgumentError:
        There is already a cassette with the same name (manageiq/providers/lenovo/physical_infra_manager/mock_aicc).  You cannot nest multiple cassettes with the same name.
      # /home/agrare/.gem/ruby/2.4.4/gems/vcr-3.0.3/lib/vcr.rb:130:in `insert_cassette'
      # ./spec/models/manageiq/providers/lenovo/physical_infra_manager/refresher_spec.rb:6:in `block (2 levels) in <top (required)>'

@EsdrasVP
Copy link
Member Author

EsdrasVP commented Jun 4, 2018

@agrare I think this is happening because the gem for XClarityClient was not updated yet, so when storage parser tries to call XClarityClient::Storage it does not exist. I already implemented this, so this model should exist. Could you check that @rodneyhbrown7 ?

@agrare
Copy link
Member

agrare commented Jun 4, 2018

@EsdrasVP you probably need @rodneyhbrown7 to cut a new version of the client gem

@agrare agrare closed this Jun 4, 2018
@agrare agrare reopened this Jun 4, 2018
@EsdrasVP EsdrasVP closed this Jun 7, 2018
@EsdrasVP EsdrasVP reopened this Jun 7, 2018
@agrare
Copy link
Member

agrare commented Jun 7, 2018

@EsdrasVP I see you have a spec test for the parser, can you also add one to the refresher_spec which does the full EmsRefresh to make sure that the save_inventory part is working?

@EsdrasVP
Copy link
Member Author

EsdrasVP commented Jun 7, 2018

@agrare Yes, I can do that. I'll make the changes and amend here.

@EsdrasVP EsdrasVP force-pushed the parse_physical_storage branch from 84f8ba5 to 87a59c8 Compare June 7, 2018 16:56
@EsdrasVP EsdrasVP changed the title Parse Physical Storage [WIP] Parse Physical Storage Jun 7, 2018
@EsdrasVP EsdrasVP force-pushed the parse_physical_storage branch from 87a59c8 to 7523d9f Compare June 7, 2018 19:25
@EsdrasVP EsdrasVP changed the title [WIP] Parse Physical Storage Parse Physical Storage Jun 7, 2018
@EsdrasVP EsdrasVP force-pushed the parse_physical_storage branch from 7523d9f to b04de4c Compare June 7, 2018 19:36
@miq-bot
Copy link
Member

miq-bot commented Jun 7, 2018

Checked commit EsdrasVP@b04de4c with ruby 2.3.3, rubocop 0.52.1, haml-lint 0.20.0, and yamllint 1.10.0
7 files checked, 0 offenses detected
Everything looks fine. 👍

@EsdrasVP
Copy link
Member Author

EsdrasVP commented Jun 7, 2018

@agrare I implemented tests for PhysicalStorage in refresher_spec.rb, could you check it out?

Copy link
Member

@agrare agrare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@agrare agrare merged commit b04de4c into ManageIQ:master Jun 7, 2018
agrare added a commit that referenced this pull request Jun 7, 2018
@agrare agrare added this to the Sprint 88 Ending Jun 18, 2018 milestone Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants