mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-01 17:52:40 +00:00
cli: do not set ip based kernel parameter
For one thing, it is not used by any kata components. For another thing, it breaks vm factory hypervisor config check. Signed-off-by: Peng Tao <bergwolf@gmail.com>
This commit is contained in:
parent
0309e59cf8
commit
7cdc0fe912
@ -187,13 +187,8 @@ var systemdKernelParam = []vc.Param{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func getKernelParams(containerID string, needSystemd bool) []vc.Param {
|
func getKernelParams(needSystemd bool) []vc.Param {
|
||||||
p := []vc.Param{
|
p := []vc.Param{}
|
||||||
{
|
|
||||||
Key: "ip",
|
|
||||||
Value: fmt.Sprintf("::::::%s::off::", containerID),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
if needSystemd {
|
if needSystemd {
|
||||||
p = append(p, systemdKernelParam...)
|
p = append(p, systemdKernelParam...)
|
||||||
@ -209,7 +204,7 @@ func needSystemd(config vc.HypervisorConfig) bool {
|
|||||||
// setKernelParams adds the user-specified kernel parameters (from the
|
// setKernelParams adds the user-specified kernel parameters (from the
|
||||||
// configuration file) to the defaults so that the former take priority.
|
// configuration file) to the defaults so that the former take priority.
|
||||||
func setKernelParams(containerID string, runtimeConfig *oci.RuntimeConfig) error {
|
func setKernelParams(containerID string, runtimeConfig *oci.RuntimeConfig) error {
|
||||||
defaultKernelParams := getKernelParamsFunc(containerID, needSystemd(runtimeConfig.HypervisorConfig))
|
defaultKernelParams := getKernelParamsFunc(needSystemd(runtimeConfig.HypervisorConfig))
|
||||||
|
|
||||||
if runtimeConfig.HypervisorConfig.Debug {
|
if runtimeConfig.HypervisorConfig.Debug {
|
||||||
strParams := vc.SerializeParams(defaultKernelParams, "=")
|
strParams := vc.SerializeParams(defaultKernelParams, "=")
|
||||||
|
@ -838,7 +838,7 @@ func TestCreateInvalidKernelParams(t *testing.T) {
|
|||||||
getKernelParamsFunc = savedFunc
|
getKernelParamsFunc = savedFunc
|
||||||
}()
|
}()
|
||||||
|
|
||||||
getKernelParamsFunc = func(containerID string, needSystemd bool) []vc.Param {
|
getKernelParamsFunc = func(needSystemd bool) []vc.Param {
|
||||||
return []vc.Param{
|
return []vc.Param{
|
||||||
{
|
{
|
||||||
Key: "",
|
Key: "",
|
||||||
@ -1135,7 +1135,9 @@ func TestSetKernelParams(t *testing.T) {
|
|||||||
err := setKernelParams(testContainerID, &config)
|
err := setKernelParams(testContainerID, &config)
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
|
|
||||||
|
if needSystemd(config.HypervisorConfig) {
|
||||||
assert.NotEmpty(config.HypervisorConfig.KernelParams)
|
assert.NotEmpty(config.HypervisorConfig.KernelParams)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSetKernelParamsUserOptionTakesPriority(t *testing.T) {
|
func TestSetKernelParamsUserOptionTakesPriority(t *testing.T) {
|
||||||
|
Loading…
Reference in New Issue
Block a user