mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Rename verifyContainerResources to verifyPlatformContainerResources
This validation function is platform-specific; rename it to be more explicit. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
e278678705
commit
b6e373c525
3 changed files with 8 additions and 6 deletions
|
@ -354,7 +354,8 @@ func adaptSharedNamespaceContainer(daemon containerGetter, hostConfig *container
|
|||
}
|
||||
}
|
||||
|
||||
func verifyContainerResources(resources *containertypes.Resources, sysInfo *sysinfo.SysInfo, update bool) (warnings []string, err error) {
|
||||
// verifyPlatformContainerResources performs platform-specific validation of the container's resource-configuration
|
||||
func verifyPlatformContainerResources(resources *containertypes.Resources, sysInfo *sysinfo.SysInfo, update bool) (warnings []string, err error) {
|
||||
fixMemorySwappiness(resources)
|
||||
|
||||
// memory subsystem checks and adjustments
|
||||
|
@ -563,7 +564,7 @@ func UsingSystemd(config *config.Config) bool {
|
|||
func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes.HostConfig, update bool) (warnings []string, err error) {
|
||||
sysInfo := sysinfo.New(true)
|
||||
|
||||
w, err := verifyContainerResources(&hostConfig.Resources, sysInfo, update)
|
||||
w, err := verifyPlatformContainerResources(&hostConfig.Resources, sysInfo, update)
|
||||
|
||||
// no matter err is nil or not, w could have data in itself.
|
||||
warnings = append(warnings, w...)
|
||||
|
|
|
@ -270,7 +270,7 @@ func TestNetworkOptions(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestVerifyContainerResources(t *testing.T) {
|
||||
func TestVerifyPlatformContainerResources(t *testing.T) {
|
||||
t.Parallel()
|
||||
var (
|
||||
no = false
|
||||
|
@ -354,7 +354,7 @@ func TestVerifyContainerResources(t *testing.T) {
|
|||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
warnings, err := verifyContainerResources(&tc.resources, &tc.sysInfo, tc.update)
|
||||
warnings, err := verifyPlatformContainerResources(&tc.resources, &tc.sysInfo, tc.update)
|
||||
assert.NilError(t, err)
|
||||
for _, w := range tc.expectedWarnings {
|
||||
assert.Assert(t, is.Contains(warnings, w))
|
||||
|
|
|
@ -75,7 +75,8 @@ func (daemon *Daemon) adaptContainerSettings(hostConfig *containertypes.HostConf
|
|||
return nil
|
||||
}
|
||||
|
||||
func verifyContainerResources(resources *containertypes.Resources, isHyperv bool) (warnings []string, err error) {
|
||||
// verifyPlatformContainerResources performs platform-specific validation of the container's resource-configuration
|
||||
func verifyPlatformContainerResources(resources *containertypes.Resources, isHyperv bool) (warnings []string, err error) {
|
||||
fixMemorySwappiness(resources)
|
||||
if !isHyperv {
|
||||
// The processor resource controls are mutually exclusive on
|
||||
|
@ -198,7 +199,7 @@ func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *containertypes.
|
|||
return warnings, fmt.Errorf("Windows client operating systems earlier than version 1809 can only run Hyper-V containers")
|
||||
}
|
||||
|
||||
w, err := verifyContainerResources(&hostConfig.Resources, hyperv)
|
||||
w, err := verifyPlatformContainerResources(&hostConfig.Resources, hyperv)
|
||||
warnings = append(warnings, w...)
|
||||
return warnings, err
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue