def LocalizeVirtualPath(path, _noderoot=_VIRT_NODEROOT):
  """Localizes a virtual path.

  A "virtualized" path consists of a prefix (L{LocalizeVirtualPath}) and a
  local path. This function adds the node-specific directory to the local path.
  Virtual paths are meant to be transported via RPC.

  """
  assert os.path.isabs(path), "Path not absolute: " + path

  if _noderoot and path not in _VPATH_WHITELIST:
    if path.startswith(_VIRT_PATH_PREFIX):
      return AddNodePrefix(path[len(_VIRT_PATH_PREFIX):], _noderoot=_noderoot)
    else:
      raise RuntimeError("Path '%s' is not a virtual path" % path)
  else:
    return path
dataset/ETHPy150Open ganeti/ganeti/lib/vcluster.py/LocalizeVirtualPath/original