def BlockdevAssemble(disk, instance, as_primary, idx):
  try:
    result = _RecursiveAssembleBD(disk, instance.name, as_primary)
    if isinstance(result, BlockDev):
      # pylint: disable=E1103
      dev_path = result.dev_path
      link_name = None
      uri = None
      if as_primary:
        # Create both index-based and uuid-based symlinks
        # for backwards compatibility
        _SymlinkBlockDev(instance.name, dev_path, idx=idx)
        link_name = _SymlinkBlockDev(instance.name, dev_path, uuid=disk.uuid)
        uri = _CalculateDeviceURI(instance, disk, result)
    elif result:
      return result, result
    else:
      _Fail("Unexpected result from _RecursiveAssembleBD")
  except errors.BlockDeviceError, err:
    _Fail("Error while assembling disk: %s", err, exc=True)
  except OSError, err:
    _Fail("Error while symlinking disk: %s", err, exc=True)

  return dev_path, link_name, uri
Return a dictionary of emacs-style local variables.
dataset/ETHPy150Open ganeti/ganeti/lib/backend.py/BlockdevAssemble--crossover with--dataset/ETHPy150Open CollabQ/CollabQ/vendor/markdown/markdown2.py/Markdown._get_emacs_vars