-
Notifications
You must be signed in to change notification settings - Fork 16
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
Identify clustered sap instances #3397
Conversation
@@ -669,7 +715,7 @@ defmodule Trento.Discovery.Policies.ClusterPolicy do | |||
}) do | |||
Enum.concat( | |||
primitives, | |||
Enum.flat_map(clones, &Map.get(&1, :primitives, [])) ++ | |||
Enum.flat_map(clones, &(&1 |> Map.get(:primitive, []) |> List.wrap())) ++ |
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.
This was a small bug we had. We didn't notice as we were not using cloned resources coming from this function
cluster | ||
|> Map.put(:sid, SapInstance.get_hana_instance_sid(sap_instances)) | ||
|> Map.put(:additional_sids, SapInstance.get_sap_instance_sids(sap_instances)) | ||
|> Map.delete(:sap_instances) |
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.
Removing the sap_instances
by now.
I will work on the frontend part in a next implementation and see how to give the information to the frontend
af24c5e
to
30ff192
Compare
30ff192
to
dba7f30
Compare
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.
Tested using http://ghcr.io/trento-project/trento-web:3397-env.
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.
hey @arbulu89 the code looks good. These kind of changes require possibly a lot of changes indeed 😄 and I trust the testing that has been made.
Question about the modified events: why are we changing legacy events as well? And did not changes to events require upcasting? 🤔
Indeed. Changing legacy events was not needed. I thought that the params would be superseded, but they are not, we simply redirect to the new module. Good catch. About the upcasting, as the |
Hey @nelsonkopliku , I think that I will avoid adding not needed extra complexity/code and simply bump the PD: I'm going to even remove the version bump. This forces me to have the |
Sounds reasonable @arbulu89, thanks for looking into it. |
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.
LGTM
1828cf5
to
3b131a4
Compare
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.
Just one comment/side-note.
case Repo.one(query) do | ||
nil -> [] | ||
sap_instances -> sap_instances | ||
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.
This will raise an exception if there's more than one result, IIRC.
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.
This is the host_id
, UUID and primary key in the database. It is impossible by database definition as the host can only have one cluster.
But thank you for pointing it out, you never know until you double-check hehe
Description
Identify clustered SAP instances as right now, all SAP application and database instances running in a cluster host are identified as clustered instances, which is not always the case.
With this, we can be precise in the
ApplicationInstanceMoved
event, and only do it when the instance is clustered.All the new logic is almost implemented in the policies code. Everything else is just side-effect work.
Now that we have a more detailed SAP instances data, I have removed the
sid
andadditional_sids
entries from all the code, except the frontend.In the next PR I want to deprecate the
sid
andadditional_sids
elements from the API (keep them for backward compatibility) and send the new SAP instances to the frontend. This way, we can display properly if the instance is clustered as well.How was this tested?
UT, regression test, manual testing...