Revision fe4f6dca lib/vcluster.py
b/lib/vcluster.py | ||
---|---|---|
32 | 32 |
from ganeti import compat |
33 | 33 |
|
34 | 34 |
|
35 |
ETC_HOSTS = "/etc/hosts" |
|
36 |
|
|
35 | 37 |
_VIRT_PATH_PREFIX = "/###-VIRTUAL-PATH-###," |
36 | 38 |
_ROOTDIR_ENVNAME = "GANETI_ROOTDIR" |
37 | 39 |
_HOSTNAME_ENVNAME = "GANETI_HOSTNAME" |
38 | 40 |
|
41 |
#: List of paths which shouldn't be virtualized |
|
42 |
_VPATH_WHITELIST = frozenset([ |
|
43 |
ETC_HOSTS, |
|
44 |
]) |
|
45 |
|
|
39 | 46 |
|
40 | 47 |
def _GetRootDirectory(envname): |
41 | 48 |
"""Retrieves root directory from an environment variable. |
... | ... | |
236 | 243 |
""" |
237 | 244 |
assert os.path.isabs(path) |
238 | 245 |
|
239 |
if _noderoot: |
|
246 |
if _noderoot and path not in _VPATH_WHITELIST:
|
|
240 | 247 |
return _VIRT_PATH_PREFIX + _RemoveNodePrefix(path, _noderoot=_noderoot) |
241 | 248 |
else: |
242 | 249 |
return path |
... | ... | |
252 | 259 |
""" |
253 | 260 |
assert os.path.isabs(path) |
254 | 261 |
|
255 |
if _noderoot: |
|
262 |
if _noderoot and path not in _VPATH_WHITELIST:
|
|
256 | 263 |
if path.startswith(_VIRT_PATH_PREFIX): |
257 | 264 |
return AddNodePrefix(path[len(_VIRT_PATH_PREFIX):], _noderoot=_noderoot) |
258 | 265 |
else: |
Also available in: Unified diff