Skip to content

Commit

Permalink
Merge pull request #680 from ykulazhenkov/pr-systemd-service-fix
Browse files Browse the repository at this point in the history
Change system dependencies for "post" systemd service
  • Loading branch information
SchSeba authored Apr 24, 2024
2 parents 1c54e87 + 359282a commit 3e804f8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
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

0 comments on commit 3e804f8

Please sign in to comment.