2015-07-29 18:25:56 +00:00
|
|
|
package main
|
|
|
|
|
2022-01-06 21:20:15 +00:00
|
|
|
import (
|
|
|
|
cdcgroups "github.com/containerd/cgroups"
|
|
|
|
systemdDaemon "github.com/coreos/go-systemd/v22/daemon"
|
|
|
|
"github.com/docker/docker/daemon/config"
|
|
|
|
"github.com/docker/docker/pkg/sysinfo"
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
)
|
2015-09-23 23:42:08 +00:00
|
|
|
|
2020-12-22 09:43:01 +00:00
|
|
|
// preNotifyReady sends a message to the host when the API is active, but before the daemon is
|
|
|
|
func preNotifyReady() {
|
2017-02-01 18:52:16 +00:00
|
|
|
}
|
|
|
|
|
2020-12-22 09:43:01 +00:00
|
|
|
// notifyReady sends a message to the host when the server is ready to be used
|
|
|
|
func notifyReady() {
|
2015-09-23 23:42:08 +00:00
|
|
|
// Tell the init daemon we are accepting requests
|
2018-05-23 17:06:34 +00:00
|
|
|
go systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyReady)
|
2015-09-23 23:42:08 +00:00
|
|
|
}
|
2020-12-22 09:43:01 +00:00
|
|
|
|
|
|
|
// notifyStopping sends a message to the host when the server is shutting down
|
|
|
|
func notifyStopping() {
|
|
|
|
go systemdDaemon.SdNotify(false, systemdDaemon.SdNotifyStopping)
|
|
|
|
}
|
2022-01-06 21:20:15 +00:00
|
|
|
|
|
|
|
func validateCPURealtimeOptions(config *config.Config) error {
|
|
|
|
if config.CPURealtimePeriod == 0 && config.CPURealtimeRuntime == 0 {
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
if cdcgroups.Mode() == cdcgroups.Unified {
|
|
|
|
return errors.New("daemon-scoped cpu-rt-period and cpu-rt-runtime are not implemented for cgroup v2")
|
|
|
|
}
|
|
|
|
if !sysinfo.New().CPURealtime {
|
|
|
|
return errors.New("daemon-scoped cpu-rt-period and cpu-rt-runtime are not supported by the kernel")
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|