mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-09-01 17:06:28 +00:00
Merge pull request #7865 from gkurz/fix-more-virtiofs-args
runtime: Fix more virtiofs args
This commit is contained in:
@@ -513,7 +513,7 @@ func (q *qemu) createVirtiofsDaemon(sharedPath string) (VirtiofsDaemon, error) {
|
|||||||
// in virtiofs if SELinux on the guest side is enabled.
|
// in virtiofs if SELinux on the guest side is enabled.
|
||||||
if !q.config.DisableGuestSeLinux {
|
if !q.config.DisableGuestSeLinux {
|
||||||
q.Logger().Info("Set the xattr option for virtiofsd")
|
q.Logger().Info("Set the xattr option for virtiofsd")
|
||||||
q.config.VirtioFSExtraArgs = append(q.config.VirtioFSExtraArgs, "-o", "xattr")
|
q.config.VirtioFSExtraArgs = append(q.config.VirtioFSExtraArgs, "--xattr")
|
||||||
}
|
}
|
||||||
|
|
||||||
// default use virtiofsd
|
// default use virtiofsd
|
||||||
|
@@ -39,7 +39,6 @@ var (
|
|||||||
|
|
||||||
const (
|
const (
|
||||||
typeVirtioFSCacheModeNever = "never"
|
typeVirtioFSCacheModeNever = "never"
|
||||||
typeVirtioFSCacheModeNone = "none"
|
|
||||||
typeVirtioFSCacheModeAlways = "always"
|
typeVirtioFSCacheModeAlways = "always"
|
||||||
typeVirtioFSCacheModeAuto = "auto"
|
typeVirtioFSCacheModeAuto = "auto"
|
||||||
)
|
)
|
||||||
@@ -219,9 +218,6 @@ func (v *virtiofsd) valid() error {
|
|||||||
|
|
||||||
if v.cache == "" {
|
if v.cache == "" {
|
||||||
v.cache = typeVirtioFSCacheModeAuto
|
v.cache = typeVirtioFSCacheModeAuto
|
||||||
} else if v.cache == typeVirtioFSCacheModeNone {
|
|
||||||
v.Logger().Warn("virtio-fs cache mode `none` is deprecated since Kata Containers 2.5.0 and will be removed in the future release, please use `never` instead. For more details please refer to https://github.com/kata-containers/kata-containers/issues/4234.")
|
|
||||||
v.cache = typeVirtioFSCacheModeNever
|
|
||||||
} else if v.cache != typeVirtioFSCacheModeAuto && v.cache != typeVirtioFSCacheModeAlways && v.cache != typeVirtioFSCacheModeNever {
|
} else if v.cache != typeVirtioFSCacheModeAuto && v.cache != typeVirtioFSCacheModeAlways && v.cache != typeVirtioFSCacheModeNever {
|
||||||
return errVirtiofsdInvalidVirtiofsCacheMode(v.cache)
|
return errVirtiofsdInvalidVirtiofsCacheMode(v.cache)
|
||||||
}
|
}
|
||||||
|
@@ -76,15 +76,15 @@ func TestVirtiofsdArgs(t *testing.T) {
|
|||||||
v := &virtiofsd{
|
v := &virtiofsd{
|
||||||
path: "/usr/bin/virtiofsd",
|
path: "/usr/bin/virtiofsd",
|
||||||
sourcePath: "/run/kata-shared/foo",
|
sourcePath: "/run/kata-shared/foo",
|
||||||
cache: "none",
|
cache: "never",
|
||||||
}
|
}
|
||||||
|
|
||||||
expected := "--syslog --cache=none --shared-dir=/run/kata-shared/foo --fd=123"
|
expected := "--syslog --cache=never --shared-dir=/run/kata-shared/foo --fd=123"
|
||||||
args, err := v.args(123)
|
args, err := v.args(123)
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
assert.Equal(expected, strings.Join(args, " "))
|
assert.Equal(expected, strings.Join(args, " "))
|
||||||
|
|
||||||
expected = "--syslog --cache=none --shared-dir=/run/kata-shared/foo --fd=456"
|
expected = "--syslog --cache=never --shared-dir=/run/kata-shared/foo --fd=456"
|
||||||
args, err = v.args(456)
|
args, err = v.args(456)
|
||||||
assert.NoError(err)
|
assert.NoError(err)
|
||||||
assert.Equal(expected, strings.Join(args, " "))
|
assert.Equal(expected, strings.Join(args, " "))
|
||||||
@@ -130,12 +130,7 @@ func TestValid(t *testing.T) {
|
|||||||
{"source is not available", func(v *virtiofsd) {
|
{"source is not available", func(v *virtiofsd) {
|
||||||
v.sourcePath = "/foo/bar"
|
v.sourcePath = "/foo/bar"
|
||||||
}, errVirtiofsdSourceNotAvailable, nil},
|
}, errVirtiofsdSourceNotAvailable, nil},
|
||||||
{"replace cache mode none by never", func(v *virtiofsd) {
|
{"invalid cache mode", func(v *virtiofsd) {
|
||||||
v.cache = "none"
|
|
||||||
}, nil, func(name string, a *assert.Assertions, v *virtiofsd) {
|
|
||||||
a.Equal("never", v.cache, "test case %+s, cache mode none should be replaced by never", name)
|
|
||||||
}},
|
|
||||||
{"invald cache mode: replace none by never", func(v *virtiofsd) {
|
|
||||||
v.cache = "foo"
|
v.cache = "foo"
|
||||||
}, errVirtiofsdInvalidVirtiofsCacheMode("foo"), nil},
|
}, errVirtiofsdInvalidVirtiofsCacheMode("foo"), nil},
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user