-
Notifications
You must be signed in to change notification settings - Fork 116
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
2132242: [1.28] Outsource uploading DNF profile to rhsmcertd #3242
2132242: [1.28] Outsource uploading DNF profile to rhsmcertd #3242
Conversation
jirihnidek
commented
Apr 4, 2023
•
edited by ptoscano
edited by ptoscano
- Backport to 1.28 branch.
- Original PRs:
- 2131789: Outsource uploading DNF profile to rhsmcertd #3139
- ENT-5532: Call rhsm-package-profile-uploader with --force-upload #3179
- rhsmcertd reads default_log_level from rhsm.conf #3142
- Original commits:
- b70c0d5
- cc3f24c
- 43e7905
- 3a8e42a
- d3075ac
- 1bb1850
- Original PRs:
- BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2132242
- Card ID: ENT-5530
- The subscription-manager tries to upload combined DNF profile at the end of registration process. Gathering of this profile can take very long time. It can be several minutes in some edge cases. This blocked registration process and the activity of gathering DNF profile was not communicated using live status message like other activities.
- This commit uses novel approach. The process of gathering and uploading of DNF process is outsourced to rhsmcertd service. The subscription-manager sends SIGUSR1 signal to rhsmcertd service to trigger gathering and uploading DNF profile. When rhsmcertd is not running, then old blocking approach is used, but this activity is communicated to user using live status message.
- The rhsmcertd can receive SIGUSR1 signal and it starts Python script package-profile-uploader, which is already part of installation.
- The information about rhsmcertd PID is written to lock file of rhsmcertd /var/lock/subsys/rhsmcertd
- When rhsmcertd is shutting down, then it tries to delete lock file
- glib functions are used for handling signals and spawning new process (only uploading of profile ATM).
- Fixes one issue with not supported macro in old glib
- Updated some unit tests
- rhsm-package-profile-uploader is always spawned with --force-upload CLI option
- rhsmcertd reads log levels from rhsm.conf
5390b6d
to
0b438fa
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.
this is mostly OK, I think there are couple of fixups needed:
- regarding commit
2132242: [1.28] Outsource uploading DNF profile to rhsmcertd
:- this contains also the backport of commit b70c0d5; can you please backport it as separate commit, so it's easier to review and to audit in the git history?
- regarding commit
rhsmcertd reads default_log_level from rhsm.conf
:- this contains also the backport of commit 3a8e42a; can you please backport it as separate commit, so it's easier to review and to audit in the git history?
- if I remember the testing that happened back then, I think you need to also backport commit 1bb1850 to avoid SELinux issues when
rhsm-package-profile-uploader
runs
(and while you are there, please also rebase it, as there were other commits pushed to the 1.28 branch in the meanwhile) |
92cba9d
to
e619502
Compare
(cherry picked from commit b70c0d5)
* Backport to 1.28 branch. * Original PR: #3139 * Original commit: cc3f24c * BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2132242 * Card ID: ENT-5530 * The subscription-manager tries to upload combined DNF profile at the end of registration process. Gathering of this profile can take very long time. It can be several minutes in some edge cases. This blocked registration process and the activity of gathering DNF profile was not communicated using live status message like other activities. * This commit uses novel approach. The process of gathering and uploading of DNF process is outsourced to rhsmcertd service. The subscription-manager sends SIGUSR1 signal to rhsmcertd service to trigger gathering and uploading DNF profile. When rhsmcertd is not running, then old blocking approach is used, but this activity is communicated to user using live status message. * The rhsmcertd can receive SIGUSR1 signal and it starts Python script package-profile-uploader, which is already part of installation. * The information about rhsmcertd PID is written to lock file of rhsmcertd /var/lock/subsys/rhsmcertd * When rhsmcertd is shutting down, then it tries to delete lock file * glib functions are used for handling signals and spawning new process (only uploading of profile ATM). * Updated some unit tests * TODO: * Use same approach for DNF plugin subscription-manager
* Macro is re-implemented in rhsmcertd, because it is really simple and it is only used for suppressing GCC warnings * The macro is re-implemented for glib older than 2.58
* When log directory /var/log/rhsm does not exist, then rhsmcertd tries to create this directory before it tries to print anything to log file (cherry picked from commit 3a8e42a)
* When default_log_level was set to DEBUG or any other value, then it was just not read by rhsmcertd. Thus it was not possible to get debug messages to rhsm.log from rhsmcertd, when rhsmcertd was started using: `systemctl start rhsmcertd.service` without hacking rhsmcertd.service file * The rhsmcertd is able to read default_log_level from rhsm.conf now. It supports following log levels: ERROR, WARM, INFO and DEBUG. Default value is INFO. * When logging.rhsmcertd is set, then value of this option overrides logging.default_log_level * When rhsmcertd is started from command line with --debug option, then it overrides log level specified in rhsm.conf * Added line and number to log message * Added few more usages of debug () for testing purpose.
* Card ID: ENT-5532 * When configuration option report_package_config is set to 0, then package profile should not be usually reported. It only has to be reported during registration regardless the value of report_package_config option. For this reason the rhsm-package-profile-uploader is always spawned with --force-upload CLI option. * Note: if you want to use this approach for other cases, then it is necessary to check if value of report_package_config is equal and then it is possible to send SIGUSR1 signal to rhsmcertd. * Small changes: - Removed unused definition in rhsmcertd.c - Emphasize that update_check() is called with force=True
Merely importing "pkg_resources" will perform its initialization, which is not exactly lightweight. "pkg_resources" is used to get the version of subscription-manager as installed, in case there is no valid version in the internal "version" module, which usually happens in developer-only setups. Since the build system takes care of filling "pkg_version" in the "version" module, a distro build of subscription-manager does not need to query "pkg_resources" for the version. Hence, import "pkg_resources" only when we actually need to use it for getting the version.
e619502
to
3068a8a
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.
LGTM -- the CI failure is npm
crashing in Fedoraw Rawhide, which can be ignored for something targeted at RHEL 8.
Thanks 👍 |