Skip to content
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

Change system dependencies for "post" systemd service #680

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
contents: |
[Unit]
Description=Configures SRIOV NIC - post network configuration
After=systemd-networkd-wait-online.service NetworkManager-wait-online.service
Before=network-online.target
After=systemd-networkd-wait-online.service NetworkManager-wait-online.service openvswitch-switch.service
Before=kubelet.service

[Service]
Type=oneshot
ExecStart=/var/lib/sriov/sriov-network-config-daemon -v 2 --zap-log-level 2 service --phase post
StandardOutput=journal+console

[Install]
WantedBy=network-online.target
WantedBy=multi-user.target
enabled: true
name: sriov-config-post-network.service
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ spec:
# Removal of this file signals firstboot completion
ConditionPathExists=!/etc/ignition-machine-config-encapsulated.json
Description=Configures SRIOV NIC - post network configuration
After=systemd-networkd-wait-online.service NetworkManager-wait-online.service
Before=network-online.target
After=systemd-networkd-wait-online.service NetworkManager-wait-online.service openvswitch-switch.service
Before=kubelet.service

[Service]
Type=oneshot
ExecStart=/var/lib/sriov/sriov-network-config-daemon service -v {{ .LogLevel }} --zap-log-level {{ .LogLevel }} --phase post
StandardOutput=journal+console

[Install]
WantedBy=network-online.target
WantedBy=multi-user.target
enabled: true
name: "sriov-config-post-network.service"
7 changes: 5 additions & 2 deletions pkg/host/internal/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,11 @@ func (s *service) EnableService(service *types.Service) error {
}
defer exit()

// Enable service
_, _, err = s.utilsHelper.RunCommand("systemctl", "enable", service.Name)
// Enable the service
// we use reenable command (the command is a combination of disable+enable) to reset
// symlinks for the unit and make sure that only symlinks that are currently
// configured in the [Install] section exist for the service.
_, _, err = s.utilsHelper.RunCommand("systemctl", "reenable", service.Name)
return err
}

Expand Down
Loading