Move nsenter mounter to pkg/volume/util/nsenter

As part of moving pkg/util/mount out of tree, the NSEnter implementation
of mount.Interface needs to be relocated out of pkg/util/mount, as it is
K8s specific. This patch relocates that mounter implementation to
pkg/volume/util/nsenter.

Since the NSEnter mounter shares a lot of its logic with the Linux
mounter implementation, many of the previously private methods of the
Linux mounter are now made public to maintain that shared code.

Additionaly, it was observed that *all* mount.Interface implemenations
were using the same common method for IsNotMountPoint, so this patch
removes that method from the mount.Interface definition and just exports
the common implementation instead.
This commit is contained in:
Travis Rhoden
2019-04-02 13:19:27 -06:00
parent aa52140928
commit 1c045a09db
23 changed files with 194 additions and 160 deletions

View File

@@ -631,7 +631,7 @@ func TestGetSELinuxSupport(t *testing.T) {
}
for _, test := range tests {
out, err := getSELinuxSupport(test.mountPoint, filename)
out, err := GetSELinux(test.mountPoint, filename)
if err != nil {
t.Errorf("Test %s failed with error: %s", test.name, err)
}
@@ -907,7 +907,7 @@ func TestSearchMountPoints(t *testing.T) {
tmpFile.Seek(0, 0)
tmpFile.WriteString(v.mountInfos)
tmpFile.Sync()
refs, err := searchMountPoints(v.source, tmpFile.Name())
refs, err := SearchMountPoints(v.source, tmpFile.Name())
if !reflect.DeepEqual(refs, v.expectedRefs) {
t.Errorf("test %q: expected Refs: %#v, got %#v", v.name, v.expectedRefs, refs)
}