-
Notifications
You must be signed in to change notification settings - Fork 125
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
Add status column to MiddlewareDomain #72
Conversation
53c283c
to
8ae549f
Compare
@josejulio could you please check this out? Happy to have a code review :) |
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.
Nice but we don't need to test structural changes because these things are tested in rails.
We need to test only when any data migration is happening.
so you can remove it and just leave only part of adding the column in migration.
thanks
cc @agrare |
@lpichler good point. I'll remove it, I am testing a method which is already tested by rails. Gotta say, that I wanted to check some of the tooling you have for testing migrations. My first time on a project with that :) |
Checked commits xeviknal/manageiq-schema@8ae549f~...e32cc42 with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
@@ -0,0 +1,8 @@ | |||
class AddStatusToMiddlewareDomain < ActiveRecord::Migration[5.0] | |||
class MiddlewareDomain < ActiveRecord::Base | |||
end |
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 think you want to disable STI here
self.inheritance_column = :_type_disabled # disable STI
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.
Could you please elaborate that a little bit?
I don't understand how the migration can change by disabling the STI
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 can correct me if I'm wrong but I believe it is so we don't end up loading the models during the migration if the record is subclassed with STI
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.
self.inheritance_column = :_type_disabled # disable STI
here is when the table has column type
. For more details see:#4
Anyway, you don't need to define model here, as you are not using the model in migration either in spec.
@josejulio @israel-hdez I've seen a bit different handling/persisting of status in the middleware server case - isn't all status related info stored in a properties object and not in a separate field? (availability, state, etc) I just want to make sure we are not doing something inconsistent here, but if there is indeed some difference that is ok - then we can leave this as is. |
Deployments have their status as a separate field. |
Servers don't have status in its own column. The status and the availability are both stored in the Note that
Note that there is a Host State property. Is this what you want? Also, be warned that the Host State most likely is reported by inventory and may not be the current status. Usually, you'll want to check the availability metric of the domain host (like the case of the servers). |
thanks for that @israel-hdez and @josejulio. Regarding your question, I don't exactly know which attribute of the hash is the one that says the availability of the domain. I guess it is, yes, the Regarding to the last sentence, I guess you mean that I should add logic to AvailabilityUpdates parser/collector in order to have current domain availability. My approach, thanks to @josejulio, here |
@josejulio don't you thing that properties for each domain are already stored before ( Then, probably the lines you sent, are not needed in this case. Anything to say @israel-hdez ? |
IIRC that fetches the data/properties from the Inventory. As @israel-hdez pointed out Host State is reported on a given refresher and could be outdated. I have checked the default configuration, and I don't see any avail metric for the domain itself(only for the domain servers). I suppose we might need to add one. @israel-hdez, Can you please correct me if I'm wrong? |
@josejulio @xeviknal Yes, Host State is reported by inventory and usually is not updated when the domain goes down. BTW, I checked the changes in @xeviknal branch. The And also, the changes that @josejulio said are also required so that availabilities are collected when a refresh is done. |
@miq-bot add_label providers/middleware |
Okay, I am closing this PR since there is no need to add a new column to domain. Availability is going to be stored on MiddlewareDomain#properties. |
Related to issue #44
Adding status to MiddlewareDomain model.