Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1866865

Summary: Disable systemd unit using machineconfig resource works only for units wanted by multi-user.target
Product: OpenShift Container Platform Reporter: Christian Passarelli <cpassare>
Component: Machine Config OperatorAssignee: Yu Qi Zhang <jerzhang>
Status: CLOSED DUPLICATE QA Contact: Michael Nguyen <mnguyen>
Severity: low Docs Contact:
Priority: low    
Version: 4.4CC: agabriel, amurdaca, mkrejci
Target Milestone: ---   
Target Release: 4.7.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-10-06 22:53:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Christian Passarelli 2020-08-06 16:10:51 UTC
Description of problem:
I am trying to disable a systemd unit of type "timer" on OCP nodes using a MachineConfig resource. When it has "enabled: false" MCO only make sure there are no files related to the unit under the directory:

/etc/systemd/system/multi-user.target.wants

But because the unit is of "timer" type the file to enable it is placed under:

/etc/systemd/system/timers.target.wants

So a unit like unbound-anchor.timer will never been disabled by MCO.

Version-Release number of selected component (if applicable):
I have tried OCP 4.4 release


How reproducible:
100% reproducible

Steps to Reproduce:
1. create a machineconfig resource:
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfig
metadata:
  labels:
    machineconfiguration.openshift.io/role: worker
  name: 99-custom-disable-ua-worker
spec:
  config:
    ignition:
      version: 2.2.0
    systemd:
      units:
      - enabled: false
        name: unbound-anchor.timer
2. wait for MCO applying the changes
3. check the unbound-anchor.timer unit status on the node, it will be still active and enabled

Actual results:
The systemd timer unit never will disabled

Expected results:
The systemd timer unit should be disabled

Additional info:
Changing "enabled: false" to "enabled: true" will create a link for unbound-anchor.timer under /etc/systemd/system/multi-user.target.wants

This behavior should be visible for all units wanted by targets different from multi-user.target

Comment 3 Yu Qi Zhang 2020-10-06 22:53:42 UTC
Just picking this up now, this and https://bugzilla.redhat.com/show_bug.cgi?id=1885365 are the same issue. There are some questions for the other BZ so I'm going to close this as a duplicate of the other one. If there are other questions feel free to direct them to the other BZ.

*** This bug has been marked as a duplicate of bug 1885365 ***