Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MountPointChecker #820

Merged
merged 1 commit into from
Dec 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion images/image_skel/prepare-node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mkdir -p /host-var-lib/virtlet/images /hostlog/virtlet/vms /host-var-lib/virtlet

# set up KVM
if [[ ! ${VIRTLET_DISABLE_KVM:-} ]]; then
if ! kvm-ok >&/dev/null; then
if ! kvm-ok &>/dev/null; then
# try to fix the environment by loading appropriate modules
modprobe kvm || (echo "Missing kvm module on the host" >&2 && exit 1)
if grep vmx /proc/cpuinfo &>/dev/null; then
Expand Down
24 changes: 12 additions & 12 deletions pkg/utils/mountinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ LineReader:
case io.EOF:
break LineReader
case nil:
// strip eol
line = strings.Trim(line, "\n")

// split and parse entries acording to section 3.5 in
// https://www.kernel.org/doc/Documentation/filesystems/proc.txt
// TODO: whitespaces and control chars in names are encoded as
// octal values (e.g. for "x x": "x\040x") what should be expanded
// in both mount point source and target
parts := strings.Split(line, " ")
mi[parts[4]] = mountEntry{Source: parts[9], Fs: parts[8]}
default:
return mountPointChecker{}, err
}

// strip eol
line = strings.Trim(line, "\n")

// split and parse entries acording to section 3.5 in
// https://www.kernel.org/doc/Documentation/filesystems/proc.txt
// TODO: whitespaces and control chars in names are encoded as
// octal values (e.g. for "x x": "x\040x") what should be expanded
// in both mount point source and target
parts := strings.Split(line, " ")
mi[parts[4]] = mountEntry{Source: parts[9], Fs: parts[8]}
}
return mountPointChecker{mountInfo: mi}, nil
}
Expand Down Expand Up @@ -107,7 +107,7 @@ func (mpc mountPointChecker) IsPathAnNs(path string) bool {
if !isMountPoint {
return false
}
return entry.Fs == "nsfs"
return entry.Fs == "nsfs" || entry.Fs == "proc"
}

type fakeMountPointChecker struct{}
Expand Down