Revision e8cd390d lib/hypervisor/hv_chroot.py

b/lib/hypervisor/hv_chroot.py
83 83
  def _GetMountSubdirs(path):
84 84
    """Return the list of mountpoints under a given path.
85 85

  
86
    This function is Linux-specific.
87

  
88 86
    """
89
    #TODO(iustin): investigate and document non-linux options
90
    #(e.g. via mount output)
91
    data = []
92
    fh = open("/proc/mounts", "r")
93
    try:
94
      for line in fh:
95
        _, mountpoint, _ = line.split(" ", 2)
96
        if (mountpoint.startswith(path) and
97
            mountpoint != path):
98
          data.append(mountpoint)
99
    finally:
100
      fh.close()
101
    data.sort(key=lambda x: x.count("/"), reverse=True)
102
    return data
87
    result = []
88
    for _, mountpoint, _, _ in utils.GetMounts():
89
      if (mountpoint.startswith(path) and
90
          mountpoint != path):
91
        result.append(mountpoint)
92

  
93
    result.sort(key=lambda x: x.count("/"), reverse=True)
94
    return result
103 95

  
104 96
  @classmethod
105 97
  def _InstanceDir(cls, instance_name):

Also available in: Unified diff