# This script is automatically generated at build time.
# Do not modify manually.
_ganeti_dbglog() {
  if [[ -n "$GANETI_COMPL_LOG" ]]; then
    {
      echo ---
      echo "$@"
      echo
    } >> $GANETI_COMPL_LOG
  fi
}
_ganeti_nodes() {
  cat /var/lib/ganeti/ssconf_node_list 2>/dev/null || :
}
_ganeti_instances() {
  cat /var/lib/ganeti/ssconf_instance_list 2>/dev/null || :
}
_ganeti_jobs() {
  local jlist=$( shopt -s nullglob && cd /var/lib/ganeti/queue 2>/dev/null && echo job-* || : )
  echo "${jlist//job-/}"
}
_ganeti_os() {
  ( shopt -s nullglob && cd /srv/ganeti/os 2>/dev/null && echo * || : )
  ( shopt -s nullglob && cd /usr/local/lib/ganeti/os 2>/dev/null && echo * || : )
  ( shopt -s nullglob && cd /usr/lib/ganeti/os 2>/dev/null && echo * || : )
  ( shopt -s nullglob && cd /usr/share/ganeti/os 2>/dev/null && echo * || : )
}
_ganeti_iallocator() {
  ( shopt -s nullglob && cd /usr/local/lib/ganeti/iallocators 2>/dev/null && echo * || : )
  ( shopt -s nullglob && cd /usr/lib/ganeti/iallocators 2>/dev/null && echo * || : )
}
_ganeti_nodegroup() {
  cat /var/lib/ganeti/ssconf_nodegroups 2>/dev/null || :
}
_ganeti_find_first_arg() {
  local w i
  first_arg_idx=
  for (( i=$1; i < COMP_CWORD; ++i )); do
    w=${COMP_WORDS[$i]}
    if [[ -n "$2" && "$w" == @($2) ]]; then let ++i
    elif [[ -n "$3" && "$w" == @($3) ]]; then :
    else first_arg_idx=$i; break;
    fi
  done
}
_ganeti_list_options() {
  if [[ -z "$first_arg_idx" ]]; then
    arg_idx=0
    if [[ "$cur" == -* ]]; then
      choices=$1
    fi
    return
  fi
  arg_idx=$(( COMP_CWORD - first_arg_idx ))
  choices=
}
_ganeti_checkopt() {
  if [[ -n "$1" && "$cur" == @($1) ]]; then
    optcur="${cur#--*=}"
    return 0
  elif [[ -n "$2" && "$prev" == @($2) ]]; then
    optcur="$cur"
    return 0
  fi
  _ganeti_dbglog optcur="'$optcur'"
  return 1
}
_ganeti_compgen() {
  COMPREPLY=( $(compgen "$@") )
  _ganeti_dbglog COMPREPLY="${COMPREPLY[@]}"
}
_gnt_backup() {
  local  cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" i first_arg_idx choices compgenargs arg_idx optcur
  _ganeti_dbglog cur="$cur" prev="$prev"
  [[ -n "$GANETI_COMPL_LOG" ]] && _ganeti_dbglog "$(set | grep ^COMP_)"
  COMPREPLY=()
  if [[ "$COMP_CWORD" == 1 ]]; then
    _ganeti_compgen -W 'export import list remove' -- "$cur"
    return
  fi
  case "${COMP_WORDS[1]}" in
  export)
    _ganeti_find_first_arg 2 '--node|--priority|--shutdown-timeout|-n' '--debug|--dry-run|--force|--help|--ignore-remove-failures|--node=*|--noshutdown|--priority=*|--remove-instance|--shutdown-timeout=*|-d|-f|-h'
    if _ganeti_checkopt '--shutdown-timeout=*' --shutdown-timeout; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--node=*' '--node|-n'; then
      _ganeti_compgen -W "$(_ganeti_nodes)" -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --force --help --ignore-remove-failures --node --noshutdown --priority --remove-instance --shutdown-timeout -d -f -h -n'
    # 0: <ArgInstance min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  list)
    _ganeti_find_first_arg 2 '--node|-n' '--debug|--help|--node=*|-d|-h'
    if _ganeti_checkopt '--node=*' '--node|-n'; then
      _ganeti_compgen -W "$(_ganeti_nodes)" -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --node -d -h -n'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  remove)
    _ganeti_find_first_arg 2 --priority '--debug|--dry-run|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --help --priority -d -h'
    # 0: <ArgUnknown min=1 max=1>
    compgenargs=
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  import)
    _ganeti_find_first_arg 2 '--backend-parameters|--disk|--disk-template|--file-driver|--file-storage-dir|--hypervisor-parameters|--iallocator|--net|--node|--os-parameters|--os-size|--priority|--src-dir|--src-node|--tags|-B|-H|-I|-O|-n|-s|-t' '--backend-parameters=*|--debug|--disk-template=*|--disk=*|--dry-run|--file-driver=*|--file-storage-dir=*|--help|--hypervisor-parameters=*|--iallocator=*|--identify-defaults|--net=*|--no-ip-check|--no-name-check|--no-nics|--no-wait-for-sync|--node=*|--os-parameters=*|--os-size=*|--priority=*|--src-dir=*|--src-node=*|--submit|--tags=*|-d|-h'
    if _ganeti_checkopt '--backend-parameters=*|--disk=*|--file-storage-dir=*|--hypervisor-parameters=*|--net=*|--os-parameters=*|--os-size=*|--tags=*|--src-dir=*' '--backend-parameters|-B|--disk|--file-storage-dir|--hypervisor-parameters|-H|--net|--os-parameters|-O|--os-size|-s|--tags|--src-dir'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--file-driver=*' --file-driver; then
      _ganeti_compgen -W 'blktap loop' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--src-node=*' --src-node; then
      _ganeti_compgen -W "$(_ganeti_nodes)" -- "$optcur"
      return
    elif _ganeti_checkopt '--iallocator=*' '--iallocator|-I'; then
      _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
      return
    elif _ganeti_checkopt '--node=*' '--node|-n'; then
      local tmp= node1= pfx= curvalue="${optcur#*:}"
      if [[ "$optcur" == *:* ]]; then
        node1="${optcur%%:*}"
        if [[ "$COMP_WORDBREAKS" != *:* ]]; then
          pfx="$node1:"
        fi
      fi
      _ganeti_dbglog pfx="'$pfx'" curvalue="'$curvalue'" node1="'$node1'"
      for i in $(_ganeti_nodes); do
        if [[ -z "$node1" ]]; then
          tmp="$tmp $i $i:"
        elif [[ "$i" != "$node1" ]]; then
          tmp="$tmp $i"
        fi
      done
      _ganeti_compgen -P "$pfx" -W "$tmp" -- "$curvalue"
      return
    elif _ganeti_checkopt '--disk-template=*' '--disk-template|-t'; then
      _ganeti_compgen -W 'blockdev diskless drbd file plain sharedfile' -- "$optcur"
      return
    fi
    _ganeti_list_options '--backend-parameters --debug --disk --disk-template --dry-run --file-driver --file-storage-dir --help --hypervisor-parameters --iallocator --identify-defaults --net --no-ip-check --no-name-check --no-nics --no-wait-for-sync --node --os-parameters --os-size --priority --src-dir --src-node --submit --tags -B -H -I -O -d -h -n -s -t'
    # 0: <ArgInstance min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  esac
}
complete -F _gnt_backup -o filenames gnt-backup
_gnt_cluster() {
  local  cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" i first_arg_idx choices compgenargs arg_idx optcur
  _ganeti_dbglog cur="$cur" prev="$prev"
  [[ -n "$GANETI_COMPL_LOG" ]] && _ganeti_dbglog "$(set | grep ^COMP_)"
  COMPREPLY=()
  if [[ "$COMP_CWORD" == 1 ]]; then
    _ganeti_compgen -W 'add-tags command copyfile destroy epo getmaster info init list-tags master-failover master-ping masterfailover modify queue redist-conf remove-tags rename renew-crypto repair-disk-sizes search-tags verify verify-disks version watcher' -- "$cur"
    return
  fi
  case "${COMP_WORDS[1]}" in
  rename)
    _ganeti_find_first_arg 2 '' '--debug|--dry-run|--force|--help|-d|-f|-h'
    _ganeti_list_options '--debug --dry-run --force --help -d -f -h'
    # 0: <ArgHost min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      compgenargs='-A hostname'
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  copyfile)
    _ganeti_find_first_arg 2 '--node|--node-group|-g|-n' '--debug|--help|--node-group=*|--node=*|--use-replication-network|-d|-h'
    if _ganeti_checkopt '--node-group=*' '--node-group|-g'; then
      _ganeti_compgen -W "$(_ganeti_nodegroup)" -- "$optcur"
      return
    elif _ganeti_checkopt '--node=*' '--node|-n'; then
      _ganeti_compgen -W "$(_ganeti_nodes)" -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --node --node-group --use-replication-network -d -g -h -n'
    # 0: <ArgFile min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      compgenargs=-f
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  verify-disks)
    _ganeti_find_first_arg 2 --priority '--debug|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --priority -d -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  search-tags)
    _ganeti_find_first_arg 2 --priority '--debug|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --priority -d -h'
    # 0: <ArgUnknown min=1 max=1>
    compgenargs=
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  modify)
    _ganeti_find_first_arg 2 '--add-uids|--backend-parameters|--candidate-pool-size|--default-iallocator|--drbd-usermode-helper|--enabled-hypervisors|--hypervisor-parameters|--maintain-node-health|--master-netdev|--nic-parameters|--node-parameters|--prealloc-wipe-disks|--priority|--remove-uids|--reserved-lvs|--uid-pool|--vg-name|-B|-C|-H|-I|-N' '--add-uids=*|--backend-parameters=*|--candidate-pool-size=*|--debug|--default-iallocator=*|--drbd-usermode-helper=*|--dry-run|--enabled-hypervisors=*|--help|--hypervisor-parameters=*|--maintain-node-health=*|--master-netdev=*|--nic-parameters=*|--no-drbd-storage|--no-lvm-storage|--node-parameters=*|--prealloc-wipe-disks=*|--priority=*|--remove-uids=*|--reserved-lvs=*|--uid-pool=*|--vg-name=*|-d|-h'
    if _ganeti_checkopt '--backend-parameters=*|--candidate-pool-size=*|--enabled-hypervisors=*|--hypervisor-parameters=*|--master-netdev=*|--nic-parameters=*|--vg-name=*|--uid-pool=*|--add-uids=*|--remove-uids=*|--drbd-usermode-helper=*|--reserved-lvs=*|--node-parameters=*' '--backend-parameters|-B|--candidate-pool-size|-C|--enabled-hypervisors|--hypervisor-parameters|-H|--master-netdev|--nic-parameters|-N|--vg-name|--uid-pool|--add-uids|--remove-uids|--drbd-usermode-helper|--reserved-lvs|--node-parameters'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--default-iallocator=*' '--default-iallocator|-I'; then
      _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--maintain-node-health=*|--prealloc-wipe-disks=*' '--maintain-node-health|--prealloc-wipe-disks'; then
      _ganeti_compgen -W 'no yes' -- "$optcur"
      return
    fi
    _ganeti_list_options '--add-uids --backend-parameters --candidate-pool-size --debug --default-iallocator --drbd-usermode-helper --dry-run --enabled-hypervisors --help --hypervisor-parameters --maintain-node-health --master-netdev --nic-parameters --no-drbd-storage --no-lvm-storage --node-parameters --prealloc-wipe-disks --priority --remove-uids --reserved-lvs --uid-pool --vg-name -B -C -H -I -N -d -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  remove-tags)
    _ganeti_find_first_arg 2 '--from|--priority' '--debug|--from=*|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--from=*' --from; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --from --help --priority -d -h'
    # 0: <ArgUnknown min=0 max=None>
    compgenargs=
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  list-tags)
    _ganeti_find_first_arg 2 '' '--debug|--help|-d|-h'
    _ganeti_list_options '--debug --help -d -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  getmaster)
    _ganeti_find_first_arg 2 '' '--debug|--help|-d|-h'
    _ganeti_list_options '--debug --help -d -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  redist-conf)
    _ganeti_find_first_arg 2 --priority '--debug|--dry-run|--help|--priority=*|--submit|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --help --priority --submit -d -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  watcher)
    _ganeti_find_first_arg 2 '' '--debug|--help|-d|-h'
    _ganeti_list_options '--debug --help -d -h'
    # 0: <ArgChoice min=1 max=1 choices=['pause', 'continue', 'info']>
    # 1: <ArgSuggest min=0 max=1 choices=['30m', '1h', '4h']>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "'pause continue info'
    elif [[ "$arg_idx" -ge 1 && "$arg_idx" -lt 2 ]]; then
      choices="$choices "'30m 1h 4h'
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  master-ping)
    _ganeti_find_first_arg 2 '' '--debug|--help|-d|-h'
    _ganeti_list_options '--debug --help -d -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  renew-crypto)
    _ganeti_find_first_arg 2 '--cluster-domain-secret|--rapi-certificate' '--cluster-domain-secret=*|--debug|--force|--help|--new-cluster-certificate|--new-cluster-domain-secret|--new-confd-hmac-key|--new-rapi-certificate|--rapi-certificate=*|-d|-f|-h'
    if _ganeti_checkopt '--rapi-certificate=*|--cluster-domain-secret=*' '--rapi-certificate|--cluster-domain-secret'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    fi
    _ganeti_list_options '--cluster-domain-secret --debug --force --help --new-cluster-certificate --new-cluster-domain-secret --new-confd-hmac-key --new-rapi-certificate --rapi-certificate -d -f -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  info)
    _ganeti_find_first_arg 2 '' '--debug|--help|--roman|-d|-h'
    _ganeti_list_options '--debug --help --roman -d -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  master-failover)
    _ganeti_find_first_arg 2 '' '--debug|--help|--no-voting|-d|-h'
    _ganeti_list_options '--debug --help --no-voting -d -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  verify)
    _ganeti_find_first_arg 2 '--node-group|--priority|-g' '--debug|--debug-simulate-errors|--dry-run|--error-codes|--help|--no-nplus1-mem|--node-group=*|--priority=*|--verbose|-d|-h|-v'
    if _ganeti_checkopt '--node-group=*' '--node-group|-g'; then
      _ganeti_compgen -W "$(_ganeti_nodegroup)" -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --debug-simulate-errors --dry-run --error-codes --help --no-nplus1-mem --node-group --priority --verbose -d -g -h -v'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  repair-disk-sizes)
    _ganeti_find_first_arg 2 --priority '--debug|--dry-run|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --help --priority -d -h'
    # 0: <ArgInstance min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  queue)
    _ganeti_find_first_arg 2 '' '--debug|--help|-d|-h'
    _ganeti_list_options '--debug --help -d -h'
    # 0: <ArgChoice min=1 max=1 choices=['drain', 'undrain', 'info']>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "'drain undrain info'
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  epo)
    _ganeti_find_first_arg 2 '--oob-timeout|--power-delay|--shutdown-timeout' '--all|--debug|--force|--groups|--help|--on|--oob-timeout=*|--power-delay=*|--shutdown-timeout=*|-d|-f|-h'
    if _ganeti_checkopt '--oob-timeout=*|--shutdown-timeout=*|--power-delay=*' '--oob-timeout|--shutdown-timeout|--power-delay'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    fi
    _ganeti_list_options '--all --debug --force --groups --help --on --oob-timeout --power-delay --shutdown-timeout -d -f -h'
    # 0: <ArgUnknown min=0 max=None>
    compgenargs=
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  init)
    _ganeti_find_first_arg 2 '--backend-parameters|--candidate-pool-size|--default-iallocator|--drbd-usermode-helper|--enabled-hypervisors|--file-storage-dir|--hypervisor-parameters|--mac-prefix|--maintain-node-health|--master-netdev|--nic-parameters|--node-parameters|--prealloc-wipe-disks|--primary-ip-version|--secondary-ip|--shared-file-storage-dir|--uid-pool|--vg-name|-B|-C|-H|-I|-N|-m|-s' '--backend-parameters=*|--candidate-pool-size=*|--debug|--default-iallocator=*|--drbd-usermode-helper=*|--enabled-hypervisors=*|--file-storage-dir=*|--help|--hypervisor-parameters=*|--mac-prefix=*|--maintain-node-health=*|--master-netdev=*|--nic-parameters=*|--no-drbd-storage|--no-etc-hosts|--no-lvm-storage|--no-ssh-init|--node-parameters=*|--prealloc-wipe-disks=*|--primary-ip-version=*|--secondary-ip=*|--shared-file-storage-dir=*|--uid-pool=*|--vg-name=*|-d|-h'
    if _ganeti_checkopt '--backend-parameters=*|--candidate-pool-size=*|--enabled-hypervisors=*|--file-storage-dir=*|--hypervisor-parameters=*|--mac-prefix=*|--master-netdev=*|--nic-parameters=*|--secondary-ip=*|--vg-name=*|--uid-pool=*|--drbd-usermode-helper=*|--primary-ip-version=*|--node-parameters=*|--shared-file-storage-dir=*' '--backend-parameters|-B|--candidate-pool-size|-C|--enabled-hypervisors|--file-storage-dir|--hypervisor-parameters|-H|--mac-prefix|-m|--master-netdev|--nic-parameters|-N|--secondary-ip|-s|--vg-name|--uid-pool|--drbd-usermode-helper|--primary-ip-version|--node-parameters|--shared-file-storage-dir'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--default-iallocator=*' '--default-iallocator|-I'; then
      _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
      return
    elif _ganeti_checkopt '--maintain-node-health=*|--prealloc-wipe-disks=*' '--maintain-node-health|--prealloc-wipe-disks'; then
      _ganeti_compgen -W 'no yes' -- "$optcur"
      return
    fi
    _ganeti_list_options '--backend-parameters --candidate-pool-size --debug --default-iallocator --drbd-usermode-helper --enabled-hypervisors --file-storage-dir --help --hypervisor-parameters --mac-prefix --maintain-node-health --master-netdev --nic-parameters --no-drbd-storage --no-etc-hosts --no-lvm-storage --no-ssh-init --node-parameters --prealloc-wipe-disks --primary-ip-version --secondary-ip --shared-file-storage-dir --uid-pool --vg-name -B -C -H -I -N -d -h -m -s'
    # 0: <ArgHost min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      compgenargs='-A hostname'
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  version)
    _ganeti_find_first_arg 2 '' '--debug|--help|-d|-h'
    _ganeti_list_options '--debug --help -d -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  command)
    _ganeti_find_first_arg 2 '--node|--node-group|-g|-n' '--debug|--help|--node-group=*|--node=*|-d|-h'
    if _ganeti_checkopt '--node-group=*' '--node-group|-g'; then
      _ganeti_compgen -W "$(_ganeti_nodegroup)" -- "$optcur"
      return
    elif _ganeti_checkopt '--node=*' '--node|-n'; then
      _ganeti_compgen -W "$(_ganeti_nodes)" -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --node --node-group -d -g -h -n'
    # 0: <ArgCommand min=1 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      compgenargs=-c
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  add-tags)
    _ganeti_find_first_arg 2 '--from|--priority' '--debug|--from=*|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--from=*' --from; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --from --help --priority -d -h'
    # 0: <ArgUnknown min=0 max=None>
    compgenargs=
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  destroy)
    _ganeti_find_first_arg 2 '' '--debug|--help|--ya-rly|--yes-do-it|-d|-h'
    _ganeti_list_options '--debug --help --ya-rly --yes-do-it -d -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  masterfailover)
    _ganeti_find_first_arg 2 '' '--debug|--help|--no-voting|-d|-h'
    _ganeti_list_options '--debug --help --no-voting -d -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  esac
}
complete -F _gnt_cluster -o filenames gnt-cluster
_gnt_debug() {
  local  cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" i first_arg_idx choices compgenargs arg_idx optcur
  _ganeti_dbglog cur="$cur" prev="$prev"
  [[ -n "$GANETI_COMPL_LOG" ]] && _ganeti_dbglog "$(set | grep ^COMP_)"
  COMPREPLY=()
  if [[ "$COMP_CWORD" == 1 ]]; then
    _ganeti_compgen -W 'allocator delay iallocator locks submit-job test-jobqueue' -- "$cur"
    return
  fi
  case "${COMP_WORDS[1]}" in
  delay)
    _ganeti_find_first_arg 2 '--priority|--repeat|-n|-r' '--debug|--dry-run|--help|--no-master|--priority=*|--repeat=*|-d|-h'
    if _ganeti_checkopt '--repeat=*' '-n|--repeat|-r'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --help --no-master --priority --repeat -d -h -n -r'
    # 0: <ArgUnknown min=1 max=1>
    compgenargs=
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  locks)
    _ganeti_find_first_arg 2 '--interval|--output|--separator|-o' '--debug|--help|--interval=*|--no-headers|--output=*|--separator=*|--verbose|-d|-h|-v'
    if _ganeti_checkopt '--separator=*|--output=*|--interval=*' '--separator|--output|-o|--interval'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --interval --no-headers --output --separator --verbose -d -h -o -v'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  iallocator)
    _ganeti_find_first_arg 2 '--dir|--disk-template|--disks|--evac-mode|--iallocator|--memory|--mode|--nics|--os-type|--priority|--tags|--target-groups|--vcpus|-I|-m|-o|-p|-t' '--debug|--dir=*|--disk-template=*|--disks=*|--dry-run|--evac-mode=*|--help|--iallocator=*|--memory=*|--mode=*|--nics=*|--os-type=*|--priority=*|--tags=*|--target-groups=*|--vcpus=*|-d|-h'
    if _ganeti_checkopt '--memory=*|--disks=*|--nics=*|--vcpus=*|--tags=*|--target-groups=*' '--memory|--disks|--nics|--vcpus|-p|--tags|--target-groups'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--disk-template=*' '--disk-template|-t'; then
      _ganeti_compgen -W 'blockdev diskless drbd file plain sharedfile' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--os-type=*' '--os-type|-o'; then
      _ganeti_compgen -W "$(_ganeti_os)" -- "$optcur"
      return
    elif _ganeti_checkopt '--iallocator=*' '--iallocator|-I'; then
      _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
      return
    elif _ganeti_checkopt '--mode=*' '--mode|-m'; then
      _ganeti_compgen -W 'allocate change-group node-evacuate relocate' -- "$optcur"
      return
    elif _ganeti_checkopt '--evac-mode=*' --evac-mode; then
      _ganeti_compgen -W 'all primary-only secondary-only' -- "$optcur"
      return
    elif _ganeti_checkopt '--dir=*' --dir; then
      _ganeti_compgen -W 'in out' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dir --disk-template --disks --dry-run --evac-mode --help --iallocator --memory --mode --nics --os-type --priority --tags --target-groups --vcpus -I -d -h -m -o -p -t'
    # 0: <ArgUnknown min=1 max=None>
    compgenargs=
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  submit-job)
    _ganeti_find_first_arg 2 '--job-repeat|--op-repeat|--priority' '--debug|--dry-run|--each|--help|--job-repeat=*|--op-repeat=*|--priority=*|--timing-stats|--verbose|-d|-h|-v'
    if _ganeti_checkopt '--op-repeat=*|--job-repeat=*' '--op-repeat|--job-repeat'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --each --help --job-repeat --op-repeat --priority --timing-stats --verbose -d -h -v'
    # 0: <ArgFile min=1 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      compgenargs=-f
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  test-jobqueue)
    _ganeti_find_first_arg 2 --priority '--debug|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --priority -d -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  allocator)
    _ganeti_find_first_arg 2 '--dir|--disk-template|--disks|--evac-mode|--iallocator|--memory|--mode|--nics|--os-type|--priority|--tags|--target-groups|--vcpus|-I|-m|-o|-p|-t' '--debug|--dir=*|--disk-template=*|--disks=*|--dry-run|--evac-mode=*|--help|--iallocator=*|--memory=*|--mode=*|--nics=*|--os-type=*|--priority=*|--tags=*|--target-groups=*|--vcpus=*|-d|-h'
    if _ganeti_checkopt '--memory=*|--disks=*|--nics=*|--vcpus=*|--tags=*|--target-groups=*' '--memory|--disks|--nics|--vcpus|-p|--tags|--target-groups'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--disk-template=*' '--disk-template|-t'; then
      _ganeti_compgen -W 'blockdev diskless drbd file plain sharedfile' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--os-type=*' '--os-type|-o'; then
      _ganeti_compgen -W "$(_ganeti_os)" -- "$optcur"
      return
    elif _ganeti_checkopt '--iallocator=*' '--iallocator|-I'; then
      _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
      return
    elif _ganeti_checkopt '--mode=*' '--mode|-m'; then
      _ganeti_compgen -W 'allocate change-group node-evacuate relocate' -- "$optcur"
      return
    elif _ganeti_checkopt '--evac-mode=*' --evac-mode; then
      _ganeti_compgen -W 'all primary-only secondary-only' -- "$optcur"
      return
    elif _ganeti_checkopt '--dir=*' --dir; then
      _ganeti_compgen -W 'in out' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dir --disk-template --disks --dry-run --evac-mode --help --iallocator --memory --mode --nics --os-type --priority --tags --target-groups --vcpus -I -d -h -m -o -p -t'
    # 0: <ArgUnknown min=1 max=None>
    compgenargs=
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  esac
}
complete -F _gnt_debug -o filenames gnt-debug
_gnt_group() {
  local  cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" i first_arg_idx choices compgenargs arg_idx optcur
  _ganeti_dbglog cur="$cur" prev="$prev"
  [[ -n "$GANETI_COMPL_LOG" ]] && _ganeti_dbglog "$(set | grep ^COMP_)"
  COMPREPLY=()
  if [[ "$COMP_CWORD" == 1 ]]; then
    _ganeti_compgen -W 'add add-tags assign-nodes evacuate list list-fields list-tags modify remove remove-tags rename' -- "$cur"
    return
  fi
  case "${COMP_WORDS[1]}" in
  rename)
    _ganeti_find_first_arg 2 '' '--debug|--dry-run|--help|-d|-h'
    _ganeti_list_options '--debug --dry-run --help -d -h'
    # 0: <ArgGroup min=2 max=2>
    compgenargs=
    if [[ "$arg_idx" -ge 0 && "$arg_idx" -lt 2 ]]; then
      choices="$choices "$(_ganeti_nodegroup)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  modify)
    _ganeti_find_first_arg 2 '--alloc-policy|--node-parameters' '--alloc-policy=*|--debug|--dry-run|--help|--node-parameters=*|--submit|-d|-h'
    if _ganeti_checkopt '--alloc-policy=*|--node-parameters=*' '--alloc-policy|--node-parameters'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    fi
    _ganeti_list_options '--alloc-policy --debug --dry-run --help --node-parameters --submit -d -h'
    # 0: <ArgGroup min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodegroup)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  remove-tags)
    _ganeti_find_first_arg 2 '--from|--priority' '--debug|--from=*|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--from=*' --from; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --from --help --priority -d -h'
    # 0: <ArgGroup min=1 max=1>
    # 1: <ArgUnknown min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodegroup)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  evacuate)
    _ganeti_find_first_arg 2 '--iallocator|--to|-I' '--debug|--early-release|--help|--iallocator=*|--to=*|-d|-h'
    if _ganeti_checkopt '--iallocator=*' '--iallocator|-I'; then
      _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
      return
    elif _ganeti_checkopt '--to=*' --to; then
      _ganeti_compgen -W "$(_ganeti_nodegroup)" -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --early-release --help --iallocator --to -I -d -h'
    # 0: <ArgGroup min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodegroup)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  list-tags)
    _ganeti_find_first_arg 2 --priority '--debug|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --priority -d -h'
    # 0: <ArgGroup min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodegroup)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  list-fields)
    _ganeti_find_first_arg 2 --separator '--debug|--help|--no-headers|--separator=*|-d|-h'
    if _ganeti_checkopt '--separator=*' --separator; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --no-headers --separator -d -h'
    # 0: <ArgUnknown min=0 max=None>
    compgenargs=
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  assign-nodes)
    _ganeti_find_first_arg 2 '' '--debug|--dry-run|--force|--help|-d|-f|-h'
    _ganeti_list_options '--debug --dry-run --force --help -d -f -h'
    # 0: <ArgGroup min=1 max=1>
    # 1: <ArgNode min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodegroup)
    elif [[ "$arg_idx" -ge 1 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  add-tags)
    _ganeti_find_first_arg 2 '--from|--priority' '--debug|--from=*|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--from=*' --from; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --from --help --priority -d -h'
    # 0: <ArgGroup min=1 max=1>
    # 1: <ArgUnknown min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodegroup)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  list)
    _ganeti_find_first_arg 2 '--output|--separator|-o' '--debug|--filter|--help|--no-headers|--output=*|--separator=*|--verbose|-F|-d|-h|-v'
    if _ganeti_checkopt '--separator=*|--output=*' '--separator|--output|-o'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --filter --help --no-headers --output --separator --verbose -F -d -h -o -v'
    # 0: <ArgGroup min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_nodegroup)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  remove)
    _ganeti_find_first_arg 2 '' '--debug|--dry-run|--help|-d|-h'
    _ganeti_list_options '--debug --dry-run --help -d -h'
    # 0: <ArgGroup min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodegroup)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  add)
    _ganeti_find_first_arg 2 '--alloc-policy|--node-parameters' '--alloc-policy=*|--debug|--dry-run|--help|--node-parameters=*|-d|-h'
    if _ganeti_checkopt '--alloc-policy=*|--node-parameters=*' '--alloc-policy|--node-parameters'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    fi
    _ganeti_list_options '--alloc-policy --debug --dry-run --help --node-parameters -d -h'
    # 0: <ArgGroup min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodegroup)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  esac
}
complete -F _gnt_group -o filenames gnt-group
_gnt_instance() {
  local  cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" i first_arg_idx choices compgenargs arg_idx optcur
  _ganeti_dbglog cur="$cur" prev="$prev"
  [[ -n "$GANETI_COMPL_LOG" ]] && _ganeti_dbglog "$(set | grep ^COMP_)"
  COMPREPLY=()
  if [[ "$COMP_CWORD" == 1 ]]; then
    _ganeti_compgen -W 'activate-disks add add-tags batch-create change-group console deactivate-disks failover grow-disk info list list-fields list-tags migrate modify move reboot recreate-disks reinstall remove remove-tags rename replace-disks shutdown start startup stop' -- "$cur"
    return
  fi
  case "${COMP_WORDS[1]}" in
  rename)
    _ganeti_find_first_arg 2 --priority '--debug|--dry-run|--help|--no-ip-check|--no-name-check|--priority=*|--submit|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --help --no-ip-check --no-name-check --priority --submit -d -h'
    # 0: <ArgInstance min=1 max=1>
    # 1: <ArgHost min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    elif [[ "$arg_idx" == 1 ]]; then
      compgenargs='-A hostname'
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  migrate)
    _ganeti_find_first_arg 2 '--iallocator|--migration-mode|--priority|--target-node|-I|-n' '--allow-failover|--cleanup|--debug|--dry-run|--force|--help|--iallocator=*|--migration-mode=*|--non-live|--priority=*|--target-node=*|-d|-f|-h'
    if _ganeti_checkopt '--iallocator=*' '--iallocator|-I'; then
      _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--target-node=*' '--target-node|-n'; then
      _ganeti_compgen -W "$(_ganeti_nodes)" -- "$optcur"
      return
    elif _ganeti_checkopt '--migration-mode=*' --migration-mode; then
      _ganeti_compgen -W 'live non-live' -- "$optcur"
      return
    fi
    _ganeti_list_options '--allow-failover --cleanup --debug --dry-run --force --help --iallocator --migration-mode --non-live --priority --target-node -I -d -f -h -n'
    # 0: <ArgInstance min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  modify)
    _ganeti_find_first_arg 2 '--backend-parameters|--disk|--disk-template|--hypervisor-parameters|--net|--node|--os-parameters|--os-type|--priority|-B|-H|-O|-n|-o|-t' '--backend-parameters=*|--debug|--disk-template=*|--disk=*|--dry-run|--force|--force-variant|--help|--hypervisor-parameters=*|--net=*|--no-wait-for-sync|--node=*|--os-parameters=*|--os-type=*|--priority=*|--submit|-d|-f|-h'
    if _ganeti_checkopt '--backend-parameters=*|--disk=*|--hypervisor-parameters=*|--net=*|--os-parameters=*' '--backend-parameters|-B|--disk|--hypervisor-parameters|-H|--net|--os-parameters|-O'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--disk-template=*' '--disk-template|-t'; then
      _ganeti_compgen -W 'blockdev diskless drbd file plain sharedfile' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--node=*' '--node|-n'; then
      _ganeti_compgen -W "$(_ganeti_nodes)" -- "$optcur"
      return
    elif _ganeti_checkopt '--os-type=*' '--os-type|-o'; then
      _ganeti_compgen -W "$(_ganeti_os)" -- "$optcur"
      return
    fi
    _ganeti_list_options '--backend-parameters --debug --disk --disk-template --dry-run --force --force-variant --help --hypervisor-parameters --net --no-wait-for-sync --node --os-parameters --os-type --priority --submit -B -H -O -d -f -h -n -o -t'
    # 0: <ArgInstance min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  move)
    _ganeti_find_first_arg 2 '--node|--priority|--shutdown-timeout|-n' '--debug|--dry-run|--force|--help|--ignore-consistency|--node=*|--priority=*|--shutdown-timeout=*|--submit|-d|-f|-h'
    if _ganeti_checkopt '--shutdown-timeout=*' --shutdown-timeout; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--node=*' '--node|-n'; then
      _ganeti_compgen -W "$(_ganeti_nodes)" -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --force --help --ignore-consistency --node --priority --shutdown-timeout --submit -d -f -h -n'
    # 0: <ArgInstance min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  startup)
    _ganeti_find_first_arg 2 '--backend-parameters|--hypervisor-parameters|--priority|-B|-H' '--all|--backend-parameters=*|--debug|--dry-run|--force|--force-multiple|--help|--hypervisor-parameters=*|--ignore-offline|--instance|--no-remember|--node|--node-tags|--paused|--pri-node-tags|--primary|--priority=*|--sec-node-tags|--secondary|--submit|--tags|-d|-f|-h'
    if _ganeti_checkopt '--hypervisor-parameters=*|--backend-parameters=*' '--hypervisor-parameters|-H|--backend-parameters|-B'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--all --backend-parameters --debug --dry-run --force --force-multiple --help --hypervisor-parameters --ignore-offline --instance --no-remember --node --node-tags --paused --pri-node-tags --primary --priority --sec-node-tags --secondary --submit --tags -B -H -d -f -h'
    # 0: <ArgInstance min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  remove-tags)
    _ganeti_find_first_arg 2 '--from|--priority' '--debug|--from=*|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--from=*' --from; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --from --help --priority -d -h'
    # 0: <ArgInstance min=1 max=1>
    # 1: <ArgUnknown min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  list-tags)
    _ganeti_find_first_arg 2 --priority '--debug|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --priority -d -h'
    # 0: <ArgInstance min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  stop)
    _ganeti_find_first_arg 2 '--priority|--timeout' '--all|--debug|--dry-run|--force-multiple|--help|--ignore-offline|--instance|--no-remember|--node|--node-tags|--pri-node-tags|--primary|--priority=*|--sec-node-tags|--secondary|--submit|--tags|--timeout=*|-d|-h'
    if _ganeti_checkopt '--timeout=*' --timeout; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--all --debug --dry-run --force-multiple --help --ignore-offline --instance --no-remember --node --node-tags --pri-node-tags --primary --priority --sec-node-tags --secondary --submit --tags --timeout -d -h'
    # 0: <ArgInstance min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  activate-disks)
    _ganeti_find_first_arg 2 --priority '--debug|--help|--ignore-size|--priority=*|--submit|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --ignore-size --priority --submit -d -h'
    # 0: <ArgInstance min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  shutdown)
    _ganeti_find_first_arg 2 '--priority|--timeout' '--all|--debug|--dry-run|--force-multiple|--help|--ignore-offline|--instance|--no-remember|--node|--node-tags|--pri-node-tags|--primary|--priority=*|--sec-node-tags|--secondary|--submit|--tags|--timeout=*|-d|-h'
    if _ganeti_checkopt '--timeout=*' --timeout; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--all --debug --dry-run --force-multiple --help --ignore-offline --instance --no-remember --node --node-tags --pri-node-tags --primary --priority --sec-node-tags --secondary --submit --tags --timeout -d -h'
    # 0: <ArgInstance min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  remove)
    _ganeti_find_first_arg 2 '--priority|--shutdown-timeout' '--debug|--dry-run|--force|--help|--ignore-failures|--priority=*|--shutdown-timeout=*|--submit|-d|-f|-h'
    if _ganeti_checkopt '--shutdown-timeout=*' --shutdown-timeout; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --force --help --ignore-failures --priority --shutdown-timeout --submit -d -f -h'
    # 0: <ArgInstance min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  list-fields)
    _ganeti_find_first_arg 2 --separator '--debug|--help|--no-headers|--separator=*|-d|-h'
    if _ganeti_checkopt '--separator=*' --separator; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --no-headers --separator -d -h'
    # 0: <ArgUnknown min=0 max=None>
    compgenargs=
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  deactivate-disks)
    _ganeti_find_first_arg 2 --priority '--debug|--dry-run|--force|--help|--priority=*|--submit|-d|-f|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --force --help --priority --submit -d -f -h'
    # 0: <ArgInstance min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  recreate-disks)
    _ganeti_find_first_arg 2 '--disks|--node|--priority|-n' '--debug|--disks=*|--dry-run|--help|--node=*|--priority=*|--submit|-d|-h'
    if _ganeti_checkopt '--disks=*' --disks; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--node=*' '--node|-n'; then
      local tmp= node1= pfx= curvalue="${optcur#*:}"
      if [[ "$optcur" == *:* ]]; then
        node1="${optcur%%:*}"
        if [[ "$COMP_WORDBREAKS" != *:* ]]; then
          pfx="$node1:"
        fi
      fi
      _ganeti_dbglog pfx="'$pfx'" curvalue="'$curvalue'" node1="'$node1'"
      for i in $(_ganeti_nodes); do
        if [[ -z "$node1" ]]; then
          tmp="$tmp $i $i:"
        elif [[ "$i" != "$node1" ]]; then
          tmp="$tmp $i"
        fi
      done
      _ganeti_compgen -P "$pfx" -W "$tmp" -- "$curvalue"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --disks --dry-run --help --node --priority --submit -d -h -n'
    # 0: <ArgInstance min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  reinstall)
    _ganeti_find_first_arg 2 '--os-parameters|--os-type|--priority|-O|-o' '--all|--debug|--dry-run|--force|--force-multiple|--force-variant|--help|--instance|--node|--node-tags|--os-parameters=*|--os-type=*|--pri-node-tags|--primary|--priority=*|--sec-node-tags|--secondary|--select-os|--submit|--tags|-d|-f|-h'
    if _ganeti_checkopt '--os-parameters=*' '--os-parameters|-O'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--os-type=*' '--os-type|-o'; then
      _ganeti_compgen -W "$(_ganeti_os)" -- "$optcur"
      return
    fi
    _ganeti_list_options '--all --debug --dry-run --force --force-multiple --force-variant --help --instance --node --node-tags --os-parameters --os-type --pri-node-tags --primary --priority --sec-node-tags --secondary --select-os --submit --tags -O -d -f -h -o'
    # 0: <ArgInstance min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  info)
    _ganeti_find_first_arg 2 --priority '--all|--debug|--help|--priority=*|--roman|--static|-d|-h|-s'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--all --debug --help --priority --roman --static -d -h -s'
    # 0: <ArgInstance min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  batch-create)
    _ganeti_find_first_arg 2 --priority '--debug|--dry-run|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --help --priority -d -h'
    # 0: <ArgFile min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      compgenargs=-f
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  console)
    _ganeti_find_first_arg 2 --priority '--debug|--help|--priority=*|--show-cmd|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --priority --show-cmd -d -h'
    # 0: <ArgInstance min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  add-tags)
    _ganeti_find_first_arg 2 '--from|--priority' '--debug|--from=*|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--from=*' --from; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --from --help --priority -d -h'
    # 0: <ArgInstance min=1 max=1>
    # 1: <ArgUnknown min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  failover)
    _ganeti_find_first_arg 2 '--iallocator|--priority|--shutdown-timeout|--target-node|-I|-n' '--debug|--dry-run|--force|--help|--iallocator=*|--ignore-consistency|--priority=*|--shutdown-timeout=*|--submit|--target-node=*|-d|-f|-h'
    if _ganeti_checkopt '--shutdown-timeout=*' --shutdown-timeout; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--iallocator=*' '--iallocator|-I'; then
      _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--target-node=*' '--target-node|-n'; then
      _ganeti_compgen -W "$(_ganeti_nodes)" -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --force --help --iallocator --ignore-consistency --priority --shutdown-timeout --submit --target-node -I -d -f -h -n'
    # 0: <ArgInstance min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  list)
    _ganeti_find_first_arg 2 '--output|--separator|--units|-o' '--debug|--filter|--help|--no-headers|--output=*|--separator=*|--units=*|--verbose|-F|-d|-h|-v'
    if _ganeti_checkopt '--separator=*|--output=*' '--separator|--output|-o'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--units=*' --units; then
      _ganeti_compgen -W 'g h m t' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --filter --help --no-headers --output --separator --units --verbose -F -d -h -o -v'
    # 0: <ArgInstance min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  reboot)
    _ganeti_find_first_arg 2 '--priority|--shutdown-timeout|--type|-t' '--all|--debug|--dry-run|--force-multiple|--help|--ignore-secondaries|--instance|--node|--node-tags|--pri-node-tags|--primary|--priority=*|--sec-node-tags|--secondary|--shutdown-timeout=*|--submit|--tags|--type=*|-d|-h'
    if _ganeti_checkopt '--type=*' '--type|-t'; then
      _ganeti_compgen -W 'full hard soft' -- "$optcur"
      return
    elif _ganeti_checkopt '--shutdown-timeout=*' --shutdown-timeout; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--all --debug --dry-run --force-multiple --help --ignore-secondaries --instance --node --node-tags --pri-node-tags --primary --priority --sec-node-tags --secondary --shutdown-timeout --submit --tags --type -d -h -t'
    # 0: <ArgInstance min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  change-group)
    _ganeti_find_first_arg 2 '--iallocator|--to|-I' '--debug|--early-release|--help|--iallocator=*|--to=*|-d|-h'
    if _ganeti_checkopt '--iallocator=*' '--iallocator|-I'; then
      _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
      return
    elif _ganeti_checkopt '--to=*' --to; then
      _ganeti_compgen -W "$(_ganeti_nodegroup)" -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --early-release --help --iallocator --to -I -d -h'
    # 0: <ArgInstance min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  replace-disks)
    _ganeti_find_first_arg 2 '--disks|--iallocator|--new-secondary|--priority|-I|-n' '--auto|--debug|--disks=*|--dry-run|--early-release|--help|--iallocator=*|--new-secondary=*|--on-primary|--on-secondary|--priority=*|--submit|-a|-d|-h|-p|-s'
    if _ganeti_checkopt '--disks=*' --disks; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--iallocator=*' '--iallocator|-I'; then
      _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--new-secondary=*' '--new-secondary|-n'; then
      _ganeti_compgen -W "$(_ganeti_nodes)" -- "$optcur"
      return
    fi
    _ganeti_list_options '--auto --debug --disks --dry-run --early-release --help --iallocator --new-secondary --on-primary --on-secondary --priority --submit -I -a -d -h -n -p -s'
    # 0: <ArgInstance min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  start)
    _ganeti_find_first_arg 2 '--backend-parameters|--hypervisor-parameters|--priority|-B|-H' '--all|--backend-parameters=*|--debug|--dry-run|--force|--force-multiple|--help|--hypervisor-parameters=*|--ignore-offline|--instance|--no-remember|--node|--node-tags|--paused|--pri-node-tags|--primary|--priority=*|--sec-node-tags|--secondary|--submit|--tags|-d|-f|-h'
    if _ganeti_checkopt '--hypervisor-parameters=*|--backend-parameters=*' '--hypervisor-parameters|-H|--backend-parameters|-B'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--all --backend-parameters --debug --dry-run --force --force-multiple --help --hypervisor-parameters --ignore-offline --instance --no-remember --node --node-tags --paused --pri-node-tags --primary --priority --sec-node-tags --secondary --submit --tags -B -H -d -f -h'
    # 0: <ArgInstance min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  add)
    _ganeti_find_first_arg 2 '--backend-parameters|--disk|--disk-template|--file-driver|--file-storage-dir|--hypervisor-parameters|--iallocator|--net|--node|--os-parameters|--os-size|--os-type|--priority|--tags|-B|-H|-I|-O|-n|-o|-s|-t' '--backend-parameters=*|--debug|--disk-template=*|--disk=*|--dry-run|--file-driver=*|--file-storage-dir=*|--force-variant|--help|--hypervisor-parameters=*|--iallocator=*|--net=*|--no-install|--no-ip-check|--no-name-check|--no-nics|--no-start|--no-wait-for-sync|--node=*|--os-parameters=*|--os-size=*|--os-type=*|--priority=*|--submit|--tags=*|-d|-h'
    if _ganeti_checkopt '--backend-parameters=*|--disk=*|--file-storage-dir=*|--hypervisor-parameters=*|--net=*|--os-parameters=*|--os-size=*|--tags=*' '--backend-parameters|-B|--disk|--file-storage-dir|--hypervisor-parameters|-H|--net|--os-parameters|-O|--os-size|-s|--tags'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--file-driver=*' --file-driver; then
      _ganeti_compgen -W 'blktap loop' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--os-type=*' '--os-type|-o'; then
      _ganeti_compgen -W "$(_ganeti_os)" -- "$optcur"
      return
    elif _ganeti_checkopt '--iallocator=*' '--iallocator|-I'; then
      _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
      return
    elif _ganeti_checkopt '--node=*' '--node|-n'; then
      local tmp= node1= pfx= curvalue="${optcur#*:}"
      if [[ "$optcur" == *:* ]]; then
        node1="${optcur%%:*}"
        if [[ "$COMP_WORDBREAKS" != *:* ]]; then
          pfx="$node1:"
        fi
      fi
      _ganeti_dbglog pfx="'$pfx'" curvalue="'$curvalue'" node1="'$node1'"
      for i in $(_ganeti_nodes); do
        if [[ -z "$node1" ]]; then
          tmp="$tmp $i $i:"
        elif [[ "$i" != "$node1" ]]; then
          tmp="$tmp $i"
        fi
      done
      _ganeti_compgen -P "$pfx" -W "$tmp" -- "$curvalue"
      return
    elif _ganeti_checkopt '--disk-template=*' '--disk-template|-t'; then
      _ganeti_compgen -W 'blockdev diskless drbd file plain sharedfile' -- "$optcur"
      return
    fi
    _ganeti_list_options '--backend-parameters --debug --disk --disk-template --dry-run --file-driver --file-storage-dir --force-variant --help --hypervisor-parameters --iallocator --net --no-install --no-ip-check --no-name-check --no-nics --no-start --no-wait-for-sync --node --os-parameters --os-size --os-type --priority --submit --tags -B -H -I -O -d -h -n -o -s -t'
    # 0: <ArgHost min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      compgenargs='-A hostname'
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  grow-disk)
    _ganeti_find_first_arg 2 --priority '--debug|--dry-run|--help|--no-wait-for-sync|--priority=*|--submit|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --help --no-wait-for-sync --priority --submit -d -h'
    # 0: <ArgInstance min=1 max=1>
    # 1: <ArgUnknown min=1 max=1>
    # 2: <ArgUnknown min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_instances)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  esac
}
complete -F _gnt_instance -o filenames gnt-instance
_gnt_job() {
  local  cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" i first_arg_idx choices compgenargs arg_idx optcur
  _ganeti_dbglog cur="$cur" prev="$prev"
  [[ -n "$GANETI_COMPL_LOG" ]] && _ganeti_dbglog "$(set | grep ^COMP_)"
  COMPREPLY=()
  if [[ "$COMP_CWORD" == 1 ]]; then
    _ganeti_compgen -W 'archive autoarchive cancel info list show watch' -- "$cur"
    return
  fi
  case "${COMP_WORDS[1]}" in
  info)
    _ganeti_find_first_arg 2 '' '--debug|--help|-d|-h'
    _ganeti_list_options '--debug --help -d -h'
    # 0: <ArgJobId min=1 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_jobs)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  autoarchive)
    _ganeti_find_first_arg 2 '' '--debug|--help|-d|-h'
    _ganeti_list_options '--debug --help -d -h'
    # 0: <ArgSuggest min=1 max=1 choices=['1d', '1w', '4w', 'all']>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "'1d 1w 4w all'
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  show)
    _ganeti_find_first_arg 2 '' '--debug|--help|-d|-h'
    _ganeti_list_options '--debug --help -d -h'
    # 0: <ArgJobId min=1 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_jobs)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  cancel)
    _ganeti_find_first_arg 2 '' '--debug|--help|-d|-h'
    _ganeti_list_options '--debug --help -d -h'
    # 0: <ArgJobId min=1 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_jobs)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  watch)
    _ganeti_find_first_arg 2 '' '--debug|--help|-d|-h'
    _ganeti_list_options '--debug --help -d -h'
    # 0: <ArgJobId min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_jobs)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  list)
    _ganeti_find_first_arg 2 '--output|--separator|-o' '--debug|--help|--no-headers|--output=*|--separator=*|-d|-h'
    if _ganeti_checkopt '--separator=*|--output=*' '--separator|--output|-o'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --no-headers --output --separator -d -h -o'
    # 0: <ArgJobId min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_jobs)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  archive)
    _ganeti_find_first_arg 2 '' '--debug|--help|-d|-h'
    _ganeti_list_options '--debug --help -d -h'
    # 0: <ArgJobId min=1 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_jobs)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  esac
}
complete -F _gnt_job -o filenames gnt-job
_gnt_node() {
  local  cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" i first_arg_idx choices compgenargs arg_idx optcur
  _ganeti_dbglog cur="$cur" prev="$prev"
  [[ -n "$GANETI_COMPL_LOG" ]] && _ganeti_dbglog "$(set | grep ^COMP_)"
  COMPREPLY=()
  if [[ "$COMP_CWORD" == 1 ]]; then
    _ganeti_compgen -W 'add add-tags evacuate failover health info list list-fields list-storage list-tags migrate modify modify-storage power powercycle remove remove-tags repair-storage volumes' -- "$cur"
    return
  fi
  case "${COMP_WORDS[1]}" in
  info)
    _ganeti_find_first_arg 2 '' '--debug|--help|-d|-h'
    _ganeti_list_options '--debug --help -d -h'
    # 0: <ArgNode min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  list-storage)
    _ganeti_find_first_arg 2 '--output|--priority|--separator|--storage-type|--units|-o|-t' '--debug|--help|--no-headers|--output=*|--priority=*|--separator=*|--storage-type=*|--units=*|-d|-h'
    if _ganeti_checkopt '--separator=*|--output=*' '--separator|--output|-o'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--units=*' --units; then
      _ganeti_compgen -W 'g h m t' -- "$optcur"
      return
    elif _ganeti_checkopt '--storage-type=*' '--storage-type|-t'; then
      _ganeti_compgen -W 'file lvm-pv lvm-vg' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --no-headers --output --priority --separator --storage-type --units -d -h -o -t'
    # 0: <ArgNode min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  powercycle)
    _ganeti_find_first_arg 2 --priority '--debug|--dry-run|--force|--help|--priority=*|--yes|-d|-f|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --force --help --priority --yes -d -f -h'
    # 0: <ArgNode min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  power)
    _ganeti_find_first_arg 2 '--oob-timeout|--power-delay|--priority|--separator' '--auto-promote|--debug|--force|--help|--ignore-status|--no-headers|--oob-timeout=*|--power-delay=*|--priority=*|--separator=*|--submit|-d|-f|-h'
    if _ganeti_checkopt '--separator=*|--oob-timeout=*|--power-delay=*' '--separator|--oob-timeout|--power-delay'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--auto-promote --debug --force --help --ignore-status --no-headers --oob-timeout --power-delay --priority --separator --submit -d -f -h'
    # 0: <ArgChoice min=1 max=1 choices=['on', 'off', 'cycle', 'status']>
    # 1: <ArgNode min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "'on off cycle status'
    elif [[ "$arg_idx" -ge 1 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  migrate)
    _ganeti_find_first_arg 2 '--iallocator|--migration-mode|--priority|--target-node|-I|-n' '--debug|--force|--help|--iallocator=*|--migration-mode=*|--non-live|--priority=*|--target-node=*|-d|-f|-h'
    if _ganeti_checkopt '--iallocator=*' '--iallocator|-I'; then
      _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--target-node=*' '--target-node|-n'; then
      _ganeti_compgen -W "$(_ganeti_nodes)" -- "$optcur"
      return
    elif _ganeti_checkopt '--migration-mode=*' --migration-mode; then
      _ganeti_compgen -W 'live non-live' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --force --help --iallocator --migration-mode --non-live --priority --target-node -I -d -f -h -n'
    # 0: <ArgNode min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  modify)
    _ganeti_find_first_arg 2 '--drained|--master-candidate|--master-capable|--node-parameters|--node-powered|--offline|--priority|--secondary-ip|--vm-capable|-C|-D|-O|-s' '--auto-promote|--debug|--drained=*|--dry-run|--force|--help|--master-candidate=*|--master-capable=*|--node-parameters=*|--node-powered=*|--offline=*|--priority=*|--secondary-ip=*|--submit|--vm-capable=*|-d|-f|-h'
    if _ganeti_checkopt '--secondary-ip=*|--node-parameters=*' '--secondary-ip|-s|--node-parameters'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--master-candidate=*|--drained=*|--offline=*|--master-capable=*|--vm-capable=*|--node-powered=*' '--master-candidate|-C|--drained|-D|--offline|-O|--master-capable|--vm-capable|--node-powered'; then
      _ganeti_compgen -W 'no yes' -- "$optcur"
      return
    fi
    _ganeti_list_options '--auto-promote --debug --drained --dry-run --force --help --master-candidate --master-capable --node-parameters --node-powered --offline --priority --secondary-ip --submit --vm-capable -C -D -O -d -f -h -s'
    # 0: <ArgNode min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  failover)
    _ganeti_find_first_arg 2 '--iallocator|--priority|-I' '--debug|--force|--help|--iallocator=*|--ignore-consistency|--priority=*|-d|-f|-h'
    if _ganeti_checkopt '--iallocator=*' '--iallocator|-I'; then
      _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --force --help --iallocator --ignore-consistency --priority -I -d -f -h'
    # 0: <ArgNode min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  list)
    _ganeti_find_first_arg 2 '--output|--separator|--units|-o' '--debug|--filter|--help|--no-headers|--output=*|--separator=*|--units=*|--verbose|-F|-d|-h|-v'
    if _ganeti_checkopt '--separator=*|--output=*' '--separator|--output|-o'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--units=*' --units; then
      _ganeti_compgen -W 'g h m t' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --filter --help --no-headers --output --separator --units --verbose -F -d -h -o -v'
    # 0: <ArgNode min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  repair-storage)
    _ganeti_find_first_arg 2 --priority '--debug|--dry-run|--help|--ignore-consistency|--priority=*|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --help --ignore-consistency --priority -d -h'
    # 0: <ArgNode min=1 max=1>
    # 1: <ArgChoice min=1 max=1 choices=['lvm-vg']>
    # 2: <ArgFile min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    elif [[ "$arg_idx" == 1 ]]; then
      choices="$choices "lvm-vg
    elif [[ "$arg_idx" == 2 ]]; then
      compgenargs=-f
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  evacuate)
    _ganeti_find_first_arg 2 '--iallocator|--new-secondary|--priority|-I|-n' '--debug|--early-release|--force|--help|--iallocator=*|--new-secondary=*|--primary-only|--priority=*|--secondary-only|-d|-f|-h|-p|-s'
    if _ganeti_checkopt '--iallocator=*' '--iallocator|-I'; then
      _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--new-secondary=*' '--new-secondary|-n'; then
      _ganeti_compgen -W "$(_ganeti_nodes)" -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --early-release --force --help --iallocator --new-secondary --primary-only --priority --secondary-only -I -d -f -h -n -p -s'
    # 0: <ArgNode min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  list-tags)
    _ganeti_find_first_arg 2 '' '--debug|--help|-d|-h'
    _ganeti_list_options '--debug --help -d -h'
    # 0: <ArgNode min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  modify-storage)
    _ganeti_find_first_arg 2 '--allocatable|--priority' '--allocatable=*|--debug|--dry-run|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--allocatable=*' --allocatable; then
      _ganeti_compgen -W 'no yes' -- "$optcur"
      return
    fi
    _ganeti_list_options '--allocatable --debug --dry-run --help --priority -d -h'
    # 0: <ArgNode min=1 max=1>
    # 1: <ArgChoice min=1 max=1 choices=['lvm-pv']>
    # 2: <ArgFile min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    elif [[ "$arg_idx" == 1 ]]; then
      choices="$choices "lvm-pv
    elif [[ "$arg_idx" == 2 ]]; then
      compgenargs=-f
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  add)
    _ganeti_find_first_arg 2 '--master-capable|--node-group|--node-parameters|--priority|--secondary-ip|--vm-capable|-g|-s' '--debug|--force-join|--help|--master-capable=*|--no-node-setup|--no-ssh-key-check|--node-group=*|--node-parameters=*|--priority=*|--readd|--secondary-ip=*|--verbose|--vm-capable=*|-d|-h|-v'
    if _ganeti_checkopt '--secondary-ip=*|--node-parameters=*' '--secondary-ip|-s|--node-parameters'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--node-group=*' '--node-group|-g'; then
      _ganeti_compgen -W "$(_ganeti_nodegroup)" -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--master-capable=*|--vm-capable=*' '--master-capable|--vm-capable'; then
      _ganeti_compgen -W 'no yes' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --force-join --help --master-capable --no-node-setup --no-ssh-key-check --node-group --node-parameters --priority --readd --secondary-ip --verbose --vm-capable -d -g -h -s -v'
    # 0: <ArgHost min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      compgenargs='-A hostname'
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  health)
    _ganeti_find_first_arg 2 '--oob-timeout|--priority|--separator' '--debug|--help|--no-headers|--oob-timeout=*|--priority=*|--separator=*|--submit|-d|-h'
    if _ganeti_checkopt '--separator=*|--oob-timeout=*' '--separator|--oob-timeout'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --no-headers --oob-timeout --priority --separator --submit -d -h'
    # 0: <ArgNode min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  remove-tags)
    _ganeti_find_first_arg 2 '--from|--priority' '--debug|--from=*|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--from=*' --from; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --from --help --priority -d -h'
    # 0: <ArgNode min=1 max=1>
    # 1: <ArgUnknown min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  remove)
    _ganeti_find_first_arg 2 --priority '--debug|--dry-run|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --dry-run --help --priority -d -h'
    # 0: <ArgNode min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  volumes)
    _ganeti_find_first_arg 2 '--output|--priority|--separator|--units|-o' '--debug|--help|--no-headers|--output=*|--priority=*|--separator=*|--units=*|-d|-h'
    if _ganeti_checkopt '--separator=*|--output=*' '--separator|--output|-o'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--units=*' --units; then
      _ganeti_compgen -W 'g h m t' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --no-headers --output --priority --separator --units -d -h -o'
    # 0: <ArgNode min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  add-tags)
    _ganeti_find_first_arg 2 '--from|--priority' '--debug|--from=*|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--from=*' --from; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --from --help --priority -d -h'
    # 0: <ArgNode min=1 max=1>
    # 1: <ArgUnknown min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_nodes)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  list-fields)
    _ganeti_find_first_arg 2 --separator '--debug|--help|--no-headers|--separator=*|-d|-h'
    if _ganeti_checkopt '--separator=*' --separator; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --no-headers --separator -d -h'
    # 0: <ArgUnknown min=0 max=None>
    compgenargs=
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  esac
}
complete -F _gnt_node -o filenames gnt-node
_gnt_os() {
  local  cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" i first_arg_idx choices compgenargs arg_idx optcur
  _ganeti_dbglog cur="$cur" prev="$prev"
  [[ -n "$GANETI_COMPL_LOG" ]] && _ganeti_dbglog "$(set | grep ^COMP_)"
  COMPREPLY=()
  if [[ "$COMP_CWORD" == 1 ]]; then
    _ganeti_compgen -W 'diagnose info list modify' -- "$cur"
    return
  fi
  case "${COMP_WORDS[1]}" in
  diagnose)
    _ganeti_find_first_arg 2 --priority '--debug|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --priority -d -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  info)
    _ganeti_find_first_arg 2 --priority '--debug|--help|--priority=*|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --priority -d -h'
    # 0: <ArgOs min=0 max=None>
    compgenargs=
    if [[ "$arg_idx" -ge 0 ]]; then
      choices="$choices "$(_ganeti_os)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  list)
    _ganeti_find_first_arg 2 --priority '--debug|--help|--no-headers|--priority=*|-d|-h'
    if _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    fi
    _ganeti_list_options '--debug --help --no-headers --priority -d -h'
    _ganeti_compgen -W "$choices" -- "$cur"
    return
  ;;
  modify)
    _ganeti_find_first_arg 2 '--blacklisted|--hidden|--hypervisor-parameters|--os-parameters|--priority|-H|-O' '--blacklisted=*|--debug|--dry-run|--help|--hidden=*|--hypervisor-parameters=*|--os-parameters=*|--priority=*|-d|-h'
    if _ganeti_checkopt '--hypervisor-parameters=*|--os-parameters=*' '--hypervisor-parameters|-H|--os-parameters|-O'; then
      _ganeti_compgen -W '' -- "$optcur"
      return
    elif _ganeti_checkopt '--priority=*' --priority; then
      _ganeti_compgen -W 'high low normal' -- "$optcur"
      return
    elif _ganeti_checkopt '--hidden=*|--blacklisted=*' '--hidden|--blacklisted'; then
      _ganeti_compgen -W 'no yes' -- "$optcur"
      return
    fi
    _ganeti_list_options '--blacklisted --debug --dry-run --help --hidden --hypervisor-parameters --os-parameters --priority -H -O -d -h'
    # 0: <ArgOs min=1 max=1>
    compgenargs=
    if [[ "$arg_idx" == 0 ]]; then
      choices="$choices "$(_ganeti_os)
    fi
    _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
    return
  ;;
  esac
}
complete -F _gnt_os -o filenames gnt-os
_ganeti_burnin() {
  local  cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" i first_arg_idx choices compgenargs arg_idx optcur
  _ganeti_dbglog cur="$cur" prev="$prev"
  [[ -n "$GANETI_COMPL_LOG" ]] && _ganeti_dbglog "$(set | grep ^COMP_)"
  COMPREPLY=()
  _ganeti_find_first_arg 1 '--disk-growth|--disk-size|--disk-template|--hypervisor-parameters|--iallocator|--mem-size|--net-timeout|--nodes|--os|--os-parameters|--reboot-types|--rename|--vcpu-count|-H|-I|-O|-n|-o|-t' '--debug|--disk-growth=*|--disk-size=*|--disk-template=*|--early-release|--http-check|--hypervisor-parameters=*|--iallocator=*|--keep-instances|--mem-size=*|--net-timeout=*|--no-activate-disks|--no-add-disks|--no-add-nics|--no-confd|--no-failover|--no-importexport|--no-ip-check|--no-migrate|--no-move|--no-name-check|--no-nics|--no-reboot|--no-reinstall|--no-replace1|--no-replace2|--no-startstop|--nodes=*|--os-parameters=*|--os=*|--parallel|--reboot-types=*|--rename=*|--vcpu-count=*|--verbose|-C|-K|-d|-p|-v'
  if _ganeti_checkopt '--hypervisor-parameters=*|--os-parameters=*|--disk-growth=*|--reboot-types=*|--rename=*' '--hypervisor-parameters|-H|--os-parameters|-O|--disk-growth|--reboot-types|--rename'; then
    _ganeti_compgen -W '' -- "$optcur"
    return
  elif _ganeti_checkopt '--vcpu-count=*' --vcpu-count; then
    _ganeti_compgen -W '1 2 3 4' -- "$optcur"
    return
  elif _ganeti_checkopt '--nodes=*' '--nodes|-n'; then
    _ganeti_compgen -W '' -- "$optcur"
    return
  elif _ganeti_checkopt '--disk-size=*' --disk-size; then
    _ganeti_compgen -W '10G 128M 1G 1G,256M 4G 4G,1G,1G 512M' -- "$optcur"
    return
  elif _ganeti_checkopt '--os=*' '--os|-o'; then
    _ganeti_compgen -W "$(_ganeti_os)" -- "$optcur"
    return
  elif _ganeti_checkopt '--iallocator=*' '--iallocator|-I'; then
    _ganeti_compgen -W "$(_ganeti_iallocator)" -- "$optcur"
    return
  elif _ganeti_checkopt '--mem-size=*' --mem-size; then
    _ganeti_compgen -W '128M 12G 16G 1G 256M 4G 512M 8G' -- "$optcur"
    return
  elif _ganeti_checkopt '--net-timeout=*' --net-timeout; then
    _ganeti_compgen -W '15 300 60 900' -- "$optcur"
    return
  elif _ganeti_checkopt '--disk-template=*' '--disk-template|-t'; then
    _ganeti_compgen -W 'blockdev diskless drbd file plain sharedfile' -- "$optcur"
    return
  fi
  _ganeti_list_options '--debug --disk-growth --disk-size --disk-template --early-release --http-check --hypervisor-parameters --iallocator --keep-instances --mem-size --net-timeout --no-activate-disks --no-add-disks --no-add-nics --no-confd --no-failover --no-importexport --no-ip-check --no-migrate --no-move --no-name-check --no-nics --no-reboot --no-reinstall --no-replace1 --no-replace2 --no-startstop --nodes --os --os-parameters --parallel --reboot-types --rename --vcpu-count --verbose -C -H -I -K -O -d -n -o -p -t -v'
  # 0: <ArgInstance min=1 max=None>
  compgenargs=
  if [[ "$arg_idx" -ge 0 ]]; then
    choices="$choices "$(_ganeti_instances)
  fi
  _ganeti_compgen -W "$choices" $compgenargs -- "$cur"
  return
}
complete -F _ganeti_burnin -o filenames /usr/lib/ganeti/tools/burnin

