Skip to content

Commit

Permalink
runtime/virtiofsd: Drop all references to "--cache=none"
Browse files Browse the repository at this point in the history
This syntax belongs to the legacy C virtiofsd implementation that
we don't support anymore since kata-containers 3.1.3 because
of other API breaking changes.

People have been warned to switch from "none" to "never" since
kata-containers 2.5.2. Let's officially do that.

The compat code that would convert "none" to "never" isn't
needed anymore. Just drop it.

Fixes #7864

Signed-off-by: Greg Kurz <groug@kaod.org>
(cherry picked from commit 72c510d)
Signed-off-by: Greg Kurz <groug@kaod.org>
  • Loading branch information
gkurz committed Oct 18, 2023
1 parent 4679aa7 commit f0278f4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
4 changes: 0 additions & 4 deletions src/runtime/virtcontainers/virtiofsd.go
Expand Up @@ -39,7 +39,6 @@ var (

const (
typeVirtioFSCacheModeNever = "never"
typeVirtioFSCacheModeNone = "none"
typeVirtioFSCacheModeAlways = "always"
typeVirtioFSCacheModeAuto = "auto"
)
Expand Down Expand Up @@ -219,9 +218,6 @@ func (v *virtiofsd) valid() error {

if v.cache == "" {
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 {
return errVirtiofsdInvalidVirtiofsCacheMode(v.cache)
}
Expand Down
13 changes: 4 additions & 9 deletions src/runtime/virtcontainers/virtiofsd_test.go
Expand Up @@ -76,15 +76,15 @@ func TestVirtiofsdArgs(t *testing.T) {
v := &virtiofsd{
path: "/usr/bin/virtiofsd",
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)
assert.NoError(err)
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)
assert.NoError(err)
assert.Equal(expected, strings.Join(args, " "))
Expand Down Expand Up @@ -130,12 +130,7 @@ func TestValid(t *testing.T) {
{"source is not available", func(v *virtiofsd) {
v.sourcePath = "/foo/bar"
}, errVirtiofsdSourceNotAvailable, nil},
{"replace cache mode none by never", 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) {
{"invalid cache mode", func(v *virtiofsd) {
v.cache = "foo"
}, errVirtiofsdInvalidVirtiofsCacheMode("foo"), nil},
}
Expand Down

0 comments on commit f0278f4

Please sign in to comment.