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

Inventory task #16980

Merged
merged 5 commits into from
Feb 21, 2018
Merged

Inventory task #16980

merged 5 commits into from
Feb 21, 2018

Conversation

kbrock
Copy link
Member

@kbrock kbrock commented Feb 9, 2018

When support wants a quick snapshot of an installation, they just want to know
the general layout for regions, zones, and emses. The numbers for the size of the ems installations as well.

This adds the evm:inventory task to display the current inventory
This also fixed 2 virtual columns that were not executing in sql, but rather in ruby. storages_count is still an N+1 query.

rake evm:inventory

 region | zone           | kind            | ems                                 | clusters | hosts | vms | storages | containers
--------+----------------+-----------------+-------------------------------------+----------+-------+-----+----------+------------
      0 | Amazon Zone    | Amazon          | Amazon                              |          |       |  19 |          |
      0 | Amazon Zone    | Amazon          | Amazon Network Manager              |          |       |  19 |          |
      0 | Amazon Zone    | StorageManager  | Amazon EBS Storage Manager          |          |       |     |          |
      0 | Azure Zone     | Azure           | Azure (East US)                     |          |       |  68 |          |
      0 | Azure Zone     | Azure           | Azure (East US) Network Manager     |          |       |  68 |          |
      0 | Config Zone    | AnsibleTower    | Ansible Tower Automation Manager    |          |       |     |          |
      0 | Config Zone    | EmbeddedAnsible | Embedded Ansible Automation Manager |          |       |     |          |
      0 | Config Zone    | Foreman         | Satellite 6 Configuration Manager   |          |       |     |          |
      0 | Config Zone    | Foreman         | Satellite 6 Provisioning Manager    |          |       |     |          |
      0 | Config Zone    | Lenovo          | Lenovo xClarity                     |          |     6 | 118 |          |
      0 | Google Zone    | Google          | Google (Eastern US)                 |          |       |   3 |          |
      0 | Google Zone    | Google          | Google (Eastern US) Network Manager |          |       |   3 |          |
      0 | HyperV Zone    | Microsoft       | HyperV                              |          |     3 |   6 |        6 |
      0 | Nuage Zone     | Nuage           | Network Manager                     |          |       |     |          |
      0 | OpenShift Zone | Openshift       | OCP 3.6 QE                          |          |       |     |          | 22
      0 | OpenShift Zone | Openshift       | OpenShift 3.7                       |          |       |     |          | 76
      0 | OpenShift Zone | Openshift       | OpenShift 3.7 Monitoring Manager    |          |       |     |          |
      0 | OpenStack Zone | Openstack       | OpenStack                           |          |       |  20 |          |
      0 | OpenStack Zone | Openstack       | OpenStack Director                  |        2 |     3 |     |          |
      0 | OpenStack Zone | Openstack       | OpenStack Director Network Manager  |          |       |     |          |
      0 | OpenStack Zone | Openstack       | OpenStack Network Manager           |          |       |  20 |          |
      0 | OpenStack Zone | StorageManager  | OpenStack Cinder Manager            |          |       |     |          |
      0 | OpenStack Zone | StorageManager  | OpenStack Swift Manager             |          |       |     |          |
      0 | RHV Zone       | Redhat          | RHV                                 |        2 |     3 |  78 |        5 |
      0 | VMware Zone    | Vmware          | vCenter                             |        1 |     3 |  98 |        4 |

@kbrock kbrock force-pushed the inventory_task branch 3 times, most recently from 4c09acc to c5e6e55 Compare February 9, 2018 14:12
@ManageIQ ManageIQ deleted a comment from miq-bot Feb 9, 2018
@dmetzger57
Copy link
Contributor

Looks good, the performance enhancement is a nice "extra".

Copy link
Member

@bdunne bdunne left a comment

Choose a reason for hiding this comment

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

Feels like a lot of iteration over the data array, but maybe it's not as bad as I'm thinking.

ems.try(:containers).try(:count)
]
end
unless data.empty?
Copy link
Member

Choose a reason for hiding this comment

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

return if data.empty?

# remove 0's (except for the region)
data = data.map { |row| row.each_with_index.map { |col, i| i > 0 && col == 0 ? nil : col } }
data.unshift(%w(region zone kind ems clusters hosts vms storages containers))
# remove columns where all values (except for the header) are blank
Copy link
Member Author

Choose a reason for hiding this comment

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

@bdunne this is mostly for containers. yea - others won't be empty

# remove 0's (except for the region)
data = data.map { |row| row.each_with_index.map { |col, i| i > 0 && col == 0 ? nil : col } }
data.unshift(%w(region zone kind ems clusters hosts vms storages containers))
# remove columns where all values (except for the header) are blank
Copy link
Member Author

Choose a reason for hiding this comment

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

@bdunne this is mostly for containers. yea - others won't be empty

# remove 0's (except for the region)
data = data.map { |row| row.each_with_index.map { |col, i| i > 0 && col == 0 ? nil : col } }
data.unshift(%w(region zone kind ems clusters hosts vms storages containers))
# remove columns where all values (except for the header) are blank
Copy link
Member Author

Choose a reason for hiding this comment

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

thanks @bdunne - I added specs to exercise this. yea it is mostly for the container column

ugh - I deleted your comment instead of mine

@kbrock kbrock force-pushed the inventory_task branch 3 times, most recently from a636a7e to dc5b5d2 Compare February 20, 2018 21:12
this outputs general counts for all inventories
also don't display the column if it is empty (or all 0)
@miq-bot
Copy link
Member

miq-bot commented Feb 20, 2018

Some comments on commits kbrock/manageiq@df28c1f~...3f2ca09

lib/tasks/evm.rake

  • ⚠️ - 56 - Detected puts. Remove all debugging statements.

@miq-bot
Copy link
Member

miq-bot commented Feb 20, 2018

Checked commits kbrock/manageiq@df28c1f~...3f2ca09 with ruby 2.3.3, rubocop 0.52.0, haml-lint 0.20.0, and yamllint 1.10.0
6 files checked, 0 offenses detected
Everything looks fine. 🏆

@bdunne bdunne merged commit f20008d into ManageIQ:master Feb 21, 2018
@bdunne bdunne added this to the Sprint 80 Ending Feb 26, 2018 milestone Feb 21, 2018
@bdunne bdunne self-assigned this Feb 21, 2018
@kbrock kbrock deleted the inventory_task branch February 21, 2018 18:34
@kbrock kbrock mentioned this pull request Mar 22, 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