diff --git a/cli/create.go b/cli/create.go index 982d5c31a..3bdfa7794 100644 --- a/cli/create.go +++ b/cli/create.go @@ -187,13 +187,8 @@ var systemdKernelParam = []vc.Param{ }, } -func getKernelParams(containerID string, needSystemd bool) []vc.Param { - p := []vc.Param{ - { - Key: "ip", - Value: fmt.Sprintf("::::::%s::off::", containerID), - }, - } +func getKernelParams(needSystemd bool) []vc.Param { + p := []vc.Param{} if needSystemd { p = append(p, systemdKernelParam...) @@ -209,7 +204,7 @@ func needSystemd(config vc.HypervisorConfig) bool { // setKernelParams adds the user-specified kernel parameters (from the // configuration file) to the defaults so that the former take priority. func setKernelParams(containerID string, runtimeConfig *oci.RuntimeConfig) error { - defaultKernelParams := getKernelParamsFunc(containerID, needSystemd(runtimeConfig.HypervisorConfig)) + defaultKernelParams := getKernelParamsFunc(needSystemd(runtimeConfig.HypervisorConfig)) if runtimeConfig.HypervisorConfig.Debug { strParams := vc.SerializeParams(defaultKernelParams, "=") diff --git a/cli/create_test.go b/cli/create_test.go index fd4dd892a..49ff3d34e 100644 --- a/cli/create_test.go +++ b/cli/create_test.go @@ -838,7 +838,7 @@ func TestCreateInvalidKernelParams(t *testing.T) { getKernelParamsFunc = savedFunc }() - getKernelParamsFunc = func(containerID string, needSystemd bool) []vc.Param { + getKernelParamsFunc = func(needSystemd bool) []vc.Param { return []vc.Param{ { Key: "", @@ -1135,7 +1135,9 @@ func TestSetKernelParams(t *testing.T) { err := setKernelParams(testContainerID, &config) assert.NoError(err) - assert.NotEmpty(config.HypervisorConfig.KernelParams) + if needSystemd(config.HypervisorConfig) { + assert.NotEmpty(config.HypervisorConfig.KernelParams) + } } func TestSetKernelParamsUserOptionTakesPriority(t *testing.T) {