-
Notifications
You must be signed in to change notification settings - Fork 545
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
[Policy|Plugin] Provide a Container Runtime Abstraction #1873
[Policy|Plugin] Provide a Container Runtime Abstraction #1873
Conversation
This pull request introduces 1 alert when merging 9ad3d60 into 7eb369e - view on LGTM.com new alerts:
|
Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Resolves: sosreport#1873 Signed-off-by: Jake Hunsaker <[email protected]>
9ad3d60
to
39d9754
Compare
Re-pushed to address the LGTM alert. This patchset will need some better-than-normal testing across different environments before it is merge ready, since it touches a heck of a lot especially for layered technology deployments. @danalsan would you be able to give this a check from an OVN perspective? @battlemidget @BryanQuigley I'm fairly certain this change as written would actually break a decent amount of I think the best solution there is to have those policies define an |
Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Resolves: sosreport#1873 Signed-off-by: Jake Hunsaker <[email protected]>
39d9754
to
62b2282
Compare
This pull request introduces 1 alert when merging 62b2282 into 7eb369e - view on LGTM.com new alerts:
|
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.
Thanks Jake, this looks great! I have no objections to the ovn_central plugin changes.
Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Resolves: sosreport#1873 Signed-off-by: Jake Hunsaker <[email protected]>
62b2282
to
ffccf07
Compare
Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Resolves: sosreport#1873 Signed-off-by: Jake Hunsaker <[email protected]>
ffccf07
to
02353f2
Compare
Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Resolves: sosreport#1873 Signed-off-by: Jake Hunsaker <[email protected]>
02353f2
to
756c9fe
Compare
Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Resolves: sosreport#1873 Signed-off-by: Jake Hunsaker <[email protected]>
756c9fe
to
f9b91b2
Compare
Updated to address @pmoravec 's points. Also, now there is support for multiple runtimes on a single system. This should almost never be the case, but it could feasibly be configured and we'd still want to collect data from both. Since the @danalsan were you able to test the |
else: | ||
self._log_info("Cannot run cmd '%s' in container %s: no such " | ||
"container is running." % (cmd, container)) | ||
|
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.
Shall not we call return _default
here? (well, current behaviour will call docker/podman cmd on non-existing container that works "well" also).
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.
Hmm.. it might be valuable to let execute that command and get something like:
Error: error getting image "3848ec06ffb6": unable to find a name and tag match for 3848ec06ffb6 in repotags: no such image
No preferences from my side here.
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.
Hmm, fair point on executing it anyway and collecting the failure. I'll think this over a bit more.
It's failing for me on RHEL 8.1. Timing out on rabbit and podman plugins so perhaps we need to extend this commit 0c9a1f0 to other plugins... I didn't catch this earlier when we tested it with @bmr-cymru [root@controller-0 ~]# ps -aef|grep timeout Plugin podman timed out Podman version: This seems unrelated to this particular PR but looks like there's another issue and ovn_central is not detected as enabled but it does in the same environment using master branch. Hope it helps, PS. I won't be around in the coming days so apologies for the delays |
From my code review and testing on About the Dan's comment: For the plugins timeouts:
|
If both are present, then the policy-default one will be used whenever a specific runtime isn't specified. For RHEL systems, this default is I'm hesitant to remove |
So far the only ones I mentioned is the ones I'm aware of. Until EOY I won't have time to handle this time but I'll try my best to get some time on it after that.
'docker' is an alias for
|
Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Resolves: sosreport#1873 Signed-off-by: Jake Hunsaker <[email protected]>
f9b91b2
to
11a5ea9
Compare
Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Resolves: sosreport#1873 Signed-off-by: Jake Hunsaker <[email protected]>
11a5ea9
to
9379f79
Compare
I had pushed an update to this patchset that added changes to Also, further fixed up the docstring messages to actually make sense this time. |
Can't this be an issue for the https://github.com/sosreport/sos/pull/1873/files#diff-c281e660b4e6e9273cdbb534ba04dc36R973 code where we decide the container runtime implementation? But till this PR works well on OpenStack, I am fine with this. |
Right, this is why I flipped the order on the ovn_central plugin and checked for 'podman' first at |
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.
ACK from me. As it is a bigger change, I would prefer an ack from yet another approver.
Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Resolves: #1873 Signed-off-by: Jake Hunsaker <[email protected]>
I think this is close and it passes basic smoke testing for me (rebased on current master), but I think it's too big a change to take at the last minute before 3.9 - we can finish review once the release is out and distributions that want to take on the functionality now can take a patch from master once it's merged. |
9379f79
to
f2be094
Compare
Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Resolves: sosreport#1873 Signed-off-by: Jake Hunsaker <[email protected]>
Latest update is rebasing on current master following the 3.9 tag. |
Adds a `ContainerRuntime()` class to allow policies to specify a container runtime to allow plugins to utilize. The `ContainerRuntime` is intended to allow for the discovery of containers, including specific ones by name, and for the execution of commands inside those containers. This is meant to remove the overhead of manually defining ways to determine an active runtime and if a component is containerized within plugins. Related: sosreport#1866 Signed-off-by: Jake Hunsaker <[email protected]>
Integrates the ContainerRuntime checks to the Plugin API - `Plugin.exec_cmd()` now accepts a `container` argument that, if set, will first check to see if the container exists and if it does, format the requested command to be executed by the runtime in the selected container. If the runtime is not available, or the container does not exist, the command is not run. Additionally adds a `container_exists()` call to check to see if a container is present/running, and a `fmt_container_cmd()` call that wraps the `ContainerRuntime` method to allow for easy formatting of commands for `add_cmd_output()` calls. Closes: sosreport#1866 Signed-off-by: Jake Hunsaker <[email protected]>
Removes the duplicated container runtime checks from individual plugins, and updates them to use the new methods exposed in `Plugin`, thus reducing the number of times sos calls out to the runtime. Signed-off-by: Jake Hunsaker <[email protected]>
Updates `ovn_central` to use the new ContainerRuntime methods exposed to the `Plugin` class. Rather than manually checking for runtimes, and then manually building the exec commands, the plugin now relies on the `Plugin` methods for discovering containers and formatting commands to be run in a container, if applicable. Signed-off-by: Jake Hunsaker <[email protected]>
Updates the `rabbitmq` plugin to use the new ContainerRuntime abstraction. Signed-off-by: Jake Hunsaker <[email protected]>
Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Signed-off-by: Jake Hunsaker <[email protected]>
Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Resolves: sosreport#1873 Signed-off-by: Jake Hunsaker <[email protected]>
f2be094
to
d191a98
Compare
Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Resolves: sosreport#1873 Signed-off-by: Jake Hunsaker <[email protected]>
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.
Should be mostly a no-op for Ubuntu, noted tasks in #1996
Updates the plugin to use the new `ContainerRuntime` abstraction provided by the loaded `Policy` rather than shelling out again to get the same data loaded during `Policy` initialization. Resolves: sosreport#1873 Signed-off-by: Jake Hunsaker <[email protected]>
Adds a new
ContainerRuntime
abstraction class that should streamline the use/probing of a container runtime by plugins.Plugins now have access to new methods that allow them to query for the presence of containers, images, and volumes without needing to manually specify different runtime commands to run through.
The OpenStack plugins that were doing these checks have been updated to now use the loaded
ContainerRuntime
initialized withPolicy
, as have thedocker
andpodman
plugins to get their element lists.Please place an 'X' inside each '[]' to confirm you adhere to our Contributor Guidelines
Closes: #ISSUENUMBER
included in an independent line?Resolves: #PRNUMBER
included in an independent line?