Skip to content

Commit

Permalink
Fix MountPointChecker
Browse files Browse the repository at this point in the history
  • Loading branch information
Yingke Liu committed Dec 10, 2018
1 parent 4055dab commit 53b8a3b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
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

0 comments on commit 53b8a3b

Please sign in to comment.