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

Physical Server details #14275

Merged
merged 4 commits into from
May 4, 2017
Merged

Physical Server details #14275

merged 4 commits into from
May 4, 2017

Conversation

walteraa
Copy link
Member

@walteraa walteraa commented Mar 10, 2017

This PR contains a migration to add the follow informations in physical server table:

Support contact: String
Description: String
Location: String
Room ID: String (I am not sure if this information can be a String or a Integer)
Rack name: String
Lowest rack unit: String (I am not sure about this data)

@walteraa
Copy link
Member Author

@blomquisg @juliancheal @rodneyhbrown7 Can you guys comment about the properties data types which has comments?

@juliancheal
Copy link
Member

Which editors do you use? Some like Atom & Sublime (I think) can run Rubocop inline.

Also might be worth if your editor can't run Rubocop using https://github.com/m4i/rubocop-git to just run Rubocop on the diffs.

Might save having to do a second commit to remove things like the extra space above. 🍰

@juliancheal
Copy link
Member

Support contact: String
Description: String
Location: String
Room ID: String (I am not sure if this information can be a String or a Integer)
Rack name: String
Lowest rack unit: String (I am not sure about this data)

Actually thinking about it, I'm not sure if these details should be in PhysicalServer as looking at their data types some of them should probably be :text fields as they're probably longer than 255 chars long, and I think having lots of text fields in a table might not be the most efficient, seeing as the main purpose of PhysicalServer is to be a server. Where it is and who to call when it brakes is secondary almost.

Also are description and location the location and description of the server or the rack?
rack_name should probably be rack_id to a rack object eventually.

I'm looking to see if we have existing tables these details can be stored in, or if we should extract it to a separate table. As I imagine if we in the future create tables like PhysicalStorage, etc they would want to share such attributes.

Is this data already in XClarity? How much of this do we need to store in ManageIQ? Things like if a server requires maintenance, a warning might come from ManageIQ, but a technician would could get that data via an API call to XClairty, or the XClairty app?

@rodneyhbrown7
Copy link

I had a thought about creating a separate tables for contact information and maybe a second one for location details. The description is meant to be more of a free form string the user can use to provide additional information about the server, location is typically the location of the rack and may be an address, the rack-name identifies the rack at that location.

These details are availabe in Xclarity today. One of the automations/services that we might include is to identify failing hardware, relocate vms and then notify an admin that hardware requires attention. I will also note that some of the location details may be related to Region/Zone information.

@walteraa
Copy link
Member Author

walteraa commented Mar 13, 2017

@rodneyhbrown7 @juliancheal the VM has a column named location, so I think the location should be in physical_servers table or we can add a table containing only three columns(id, location and room_id) instead.

About the support_contact the XClarity REST API has a string property named "contact", I think don't sonds good create a table to save only two columns(ID and support_contact).

About the rack informations, are you sure that it should be an other table? So, there are only three columns in this table(id, rack_name and lowest_rack_unit), right?

For now I'll remove this columns from migration and I will let only description and contact in migration. Once you guys answer, I do the other changes.

@skovic
Copy link

skovic commented Mar 13, 2017

We discussed this offline, and we decided that instead of creating two tables, we'll create a single new table, named assets, that contains: description, location, room_id, rack_name, and lowest_rack_unit.

@skovic
Copy link

skovic commented Mar 13, 2017

@walteraa Just a suggestion, if you have time, consider changing assets_details to asset_details

@walteraa
Copy link
Member Author

For sure, @skovic

@rodneyhbrown7
Copy link

@walteraa can you clean up the rubocop messages?

@miq-bot
Copy link
Member

miq-bot commented Mar 14, 2017

This pull request is not mergeable. Please rebase and repush.

@@ -0,0 +1,5 @@
class AddAssetsDetailsRefToPhysicalServer < ActiveRecord::Migration[5.0]
def change
add_reference :physical_servers, :asset_details, index: true, foreign_key: true
Copy link
Member

Choose a reason for hiding this comment

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

Two things here:

  1. Remove the foreign_key constraint
  2. add type: :bigint

Also, @Fryguy will probably be happier if you use Hash Rockets instead. I.e.,

add_reference :physical_servers, :asset_details, :index => true, :type => :bigint

t.text :location
t.text :room
t.text :rack_name
t.text :lowest_rack_unit
Copy link
Member

Choose a reason for hiding this comment

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

not sure this is needed, but you might want to add t.timestamps to this table to track created and last updated dates.

@walteraa walteraa changed the title [WIP] Physical Server details Physical Server details Mar 14, 2017
@miq-bot miq-bot removed the wip label Mar 14, 2017
@walteraa walteraa changed the title Physical Server details [WIP]Physical Server details Mar 17, 2017
@walteraa
Copy link
Member Author

I should to change the ref between asset details and Physical server.

@miq-bot miq-bot added the wip label Mar 17, 2017
@walteraa walteraa changed the title [WIP]Physical Server details Physical Server details Mar 21, 2017
@miq-bot miq-bot removed the wip label Mar 21, 2017
Add a migration to create asset_details table.
Add properties to schema.yml referring to the new table(asset_details).
@walteraa
Copy link
Member Author

walteraa commented Apr 25, 2017

@blomquisg Can you review this PR and #14827, #14749 as well?

t.bigint :resource_id
t.string :resource_type
t.timestamps
t.index %w(resource_id resource_type), :name => "index_asset_details_on_resource_id_and_resource_type", :using => :btree
Copy link
Member

Choose a reason for hiding this comment

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

You should not need the name nor using, as Rails will default those properly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Member

@Fryguy Fryguy left a comment

Choose a reason for hiding this comment

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

I had one comment on the index, but otherwise LGTM

@juliancheal
Copy link
Member

LGTM 👍

Remove 'name' and 'using' from asset details index.
@miq-bot
Copy link
Member

miq-bot commented May 3, 2017

Checked commits https://github.com/lenovo/manageiq/compare/7069f6134f686c68d626faf2d10ded50c1a0cb7a~...33eecf1231055ea139a6148703969d04f2c7131a with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0
1 file checked, 0 offenses detected
Everything looks fine. 🍰

@walteraa
Copy link
Member Author

walteraa commented May 4, 2017

🎂🎂

@blomquisg blomquisg merged commit f2cb9cd into ManageIQ:master May 4, 2017
@blomquisg blomquisg added this to the Sprint 60 Ending May 8, 2017 milestone May 4, 2017
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.

8 participants