Make enableUnit and disableUnit files as optional

Disable Unit Files has no effect if the service is already masked.
Here are the logs:
root:~# systemctl mask xyz.openbmc_project.PCIe
Created symlink /etc/systemd/system/xyz.openbmc_project.PCIe.service ->
/dev/null.
root:~# systemctl disable xyz.openbmc_project.PCIe
Unit /etc/systemd/system/xyz.openbmc_project.PCIe.service is masked,
ignoring.
Thus disabling after masking is not really required.

As masking creates a symlink of the unit file in /etc/systemd/system to
/dev/null and unmasking removes it. Due to symlink being directed to
/dev/null, it would not be possible to start a masked service at all.

Disabling removes an existing (proper) symlink in /etc/systemd/system/
<multi-user.target.wants>or<insert-other-relevant-directory>/* to the
unit file, and enabling it inserts back the symlink in /etc/systemd/
system/<multi-user.target.wants>or<insert-other-relevant-directory>/*.
In case of mctpd, the "enable unit" created an unnecessary symlink in
/etc/systemd/system, thus it caused systemd to start mctp service but
they are designed to be started by a different service than systemd.
Thus, enabling after unmasking is not required for mctp.

However, there is an issue here with the service which has its unit
file's symlink defined in /etc/systemd/system directory, then,
unmasking will remove the symlink altogether. Although no service
today has its symlink in /etc/systemd/system, but to work with such
possibility we made an optional parameter disableOrEnableUnitFiles i.e.
pass it as an argument for the startOrStopService. Also, the correct
order needs to be disable the service first and mask it. In the other
way around - it needs to be unmasked first and enable it.

Tested:
Regression testing has been done and all the functionalities are working
as intended for all the below tests:
1) Stop,start,enable and disable functionalities for all the MCTP
   services and PCIe service.
2) For disable test, we disable the service, restart the BMC and check
   is it still disabled or not. Same with AC cycle.
3) For enable test, we re-enable the service, restart BMC  and check
   whether it is enabled or not and same with
   AC cycle.

Signed-off-by: ANJALI RAY <anjali.ray@intel.com>
Change-Id: I9ebd20a4f0ba8c11d6f08a54078550172cb382ea
1 file changed
tree: 5078a4a9aa4f6452f8358d7961b38b700b91cc99
  1. cmake/
  2. docs/
  3. include/
  4. non-yocto/
  5. src/
  6. tests/
  7. .clang-format
  8. .gitignore
  9. cmake-format.json
  10. CMakeLists.txt
  11. CMakeLists.txt.in
  12. generate-whitelist.py
  13. ipmi-whitelist.conf
  14. LICENSE
  15. MAINTAINERS
  16. OWNERS
  17. README.md
README.md

Intel IPMI OEM support library

This component is intended to provide Intel-specific IPMI[3] command handlers for OpenBMC. These handlers are intended to integrate BMC with servers based on Intel architecture.

Overview

intel-ipmi-oem serves as an extension[1] to OpenBMC IPMI daemon[2]. It is compiled as a shared library and intended to both:

  • override existing implementation of standard IPMI commands to comply with Intel-specific solutions,
  • provide implementation for non-standard OEM extensions.

Capabilities

Related features provided by the library are grouped in separate source files. Main extensions to vanilla OpenBMC IPMI stack are the following:

  • Acquiring SMBIOS data over IPMI
  • Commands for better integration with Intel hardware
  • Firmware update extensions
  • Extended parsing of IPMI Platform Events[4]

References

  1. OpenBMC IPMI Architecture
  2. Phosphor IPMI Host
  3. IPMI Specification v2.0
  4. Intel Platform Events parsing