FENCE_AGENT(8)

πŸ“¦
version 4.17.0 Β· 5 versions
, in debian trixie, fedora 43, fedora 44, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– FENCE_AGENT(8) β€” bestie edition πŸ’–

okay so we're doing fence_virsh today, from the System Manager's Manual, and honestly? she's iconic. let's get into it. ✨


🌸 NAME 🌸

fence_virsh β€” the fence agent for virsh, no cap 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

fence_virsh is a Power Fencing agent that works with virtual machines managed by libvirt. the way it does this is lowkey unhinged but it WORKS: it logs in via ssh to a dom0, and then it runs the virsh command over there, and virsh does literally all the actual work. she's just the messenger bestie πŸ’…

by default, virsh needs the root account to do its thing properly. so yeah, you must allow ssh login in your sshd_config. no way around it, sorry babe 😭

the fence agent takes options on the command line and from stdin, because she's versatile like that. Fenced sends parameters through stdin when it execs the agent. but you can also just run the agent by itself with command line options β€” super useful for testing, and for turning outlets on or off from scripts. main character energy fr fr πŸ‘‘

Vendor URL: http://libvirt.org β€” go say hi 🌈


✨ PARAMETERS ✨

okay this is the big one, grab a snack πŸ“

  • -o, --action=[action] β€” the fencing action. (Default Value: reboot)
  • -c, --command-prompt=[prompt] β€” force a Python regex for the command prompt. (Default Value: ['\\[EXPECT\\]#'])
  • -k, --identity-file=[filename] β€” identity file (the private key) for SSH πŸ”‘
  • -4, --inet4-only β€” forces the agent to use IPv4 addresses only
  • -6, --inet6-only β€” forces the agent to use IPv6 addresses only
  • -a, --ip=[ip] β€” IP address or hostname of the fencing device. This parameter is always required.
  • -u, --ipport=[port] β€” TCP/UDP port to use for the connection with the device. (Default Value: 22)
  • -p, --password=[password] β€” login password or passphrase
  • -S, --password-script=[script] β€” script to run to retrieve the password
  • -n, --plug=[id] β€” physical plug number on the device, or the UUID / identification of the machine. This parameter is always required.
  • -x, --ssh β€” use an SSH connection. (Default Value: 1)
  • --ssh-options=[options] β€” SSH options to use. (Default Value: -t '/bin/bash -c "PS1=\\[EXPECT\\]# /bin/bash --noprofile --norc"')
  • -l, --username=[name] β€” login name. This parameter is always required.
  • -q, --quiet β€” disable logging to stderr. heads up tho: it does not affect --verbose, --debug-file, or logging to syslog. πŸ™ˆ
  • -v, --verbose β€” verbose mode. you can stack multiple -v flags on the command line (like -vvv) to crank up the verbosity. more v's, more tea β˜•
  • --verbose-level β€” level of debugging detail in the output. defaults to the number of --verbose flags you specified on the command line, or to 1 if verbose=1 in a stonith device configuration (i.e., on stdin).
  • -D, --debug-file=[debugfile] β€” write debug information to the given file
  • -V, --version β€” display version information and exit
  • -h, --help β€” display help and exit
  • --plug-separator=[char] β€” separator for the plug parameter when you're specifying more than 1 plug. (Default Value: ,)
  • -C, --separator=[char] β€” separator for the CSV created by the list operation. (Default Value: ,)
  • --delay=[seconds] β€” wait X seconds before fencing is started. (Default Value: 0)
  • --disable-timeout=[true/false] β€” disable timeout (true/false). (default: true when run from Pacemaker 2.0+)
  • --login-timeout=[seconds] β€” wait X seconds for the cmd prompt after login. (Default Value: 5)
  • --missing-as-off β€” missing port returns OFF instead of failure
  • --power-timeout=[seconds] β€” test X seconds for status change after ON/OFF. (Default Value: 20)
  • --power-wait=[seconds] β€” wait X seconds after issuing ON/OFF. (Default Value: 0)
  • --shell-timeout=[seconds] β€” wait X seconds for the cmd prompt after issuing a command. (Default Value: 3)
  • --stonith-status-sleep=[seconds] β€” sleep X seconds between status calls during a STONITH action. (Default Value: 1)
  • --retry-on=[attempts] β€” count of attempts to retry power on. (Default Value: 1)
  • --use-sudo β€” use sudo (without password) when calling 3rd party software
  • --ssh-path=[path] β€” path to the ssh binary. (Default Value: /usr/bin/ssh)
  • --sudo-path=[path] β€” path to the sudo binary. (Default Value: /usr/bin/sudo)

πŸ’… ACTIONS πŸ’…

here's what she can actually do, bestie:

  • on β€” power on machine. ⚑
  • off β€” power off machine.
  • reboot β€” reboot machine.
  • status β€” this returns the status of the plug / virtual machine.
  • list β€” list available plugs with aliases / virtual machines, if there's support for more than one device. returns N/A otherwise.
  • list-status β€” list available plugs with aliases / virtual machines and their power state, if it can be obtained without additional commands.
  • monitor β€” check the health of the fence device 🩺
  • metadata β€” display the XML metadata describing this resource.
  • manpage β€” the operational behavior of this is not known. (yeah. that's literally what it says. we don't know either πŸ’€)
  • validate-all β€” validate if all required parameters are entered.

πŸŽ€ STDIN PARAMETERS πŸŽ€

same vibes, but these ones come in through stdin. note the underscore names and the Obsoletes: notes β€” those are the old names that got replaced, keep them in mind iykyk:

  • action β€” fencing action. (Default Value: reboot)
  • command_prompt β€” force Python regex for command prompt. (Default Value: ['\\[EXPECT\\]#']) Obsoletes: cmd_prompt
  • identity_file β€” identity file (private key) for SSH
  • inet4_only β€” forces agent to use IPv4 addresses only
  • inet6_only β€” forces agent to use IPv6 addresses only
  • ip β€” IP address or hostname of fencing device. This parameter is always required. Obsoletes: ipaddr
  • ipport β€” TCP/UDP port to use for connection with device. (Default Value: 22)
  • password β€” login password or passphrase. Obsoletes: passwd
  • password_script β€” script to run to retrieve password. Obsoletes: passwd_script
  • plug β€” physical plug number on device, UUID or identification of machine. This parameter is always required. Obsoletes: port
  • ssh β€” use SSH connection. (Default Value: 1) Obsoletes: secure
  • ssh_options β€” SSH options to use. (Default Value: -t '/bin/bash -c "PS1=\\[EXPECT\\]# /bin/bash --noprofile --norc"')
  • username β€” login name. This parameter is always required. Obsoletes: login
  • quiet β€” disable logging to stderr. does not affect --verbose or --debug-file or logging to syslog.
  • verbose β€” verbose mode. multiple -v flags can be stacked on the command line (e.g., -vvv) to increase verbosity.
  • verbose_level β€” level of debugging detail in output. defaults to the number of --verbose flags specified on the command line, or to 1 if verbose=1 in a stonith device configuration (i.e., on stdin).
  • debug_file β€” write debug information to given file. Obsoletes: debug
  • version β€” display version information and exit
  • help β€” display help and exit
  • plug_separator β€” separator for plug parameter when specifying more than 1 plug. (Default Value: ,)
  • separator β€” separator for CSV created by list operation. (Default Value: ,)
  • delay β€” wait X seconds before fencing is started. (Default Value: 0)
  • disable_timeout β€” disable timeout (true/false). (default: true when run from Pacemaker 2.0+)
  • login_timeout β€” wait X seconds for cmd prompt after login. (Default Value: 5)
  • missing_as_off β€” missing port returns OFF instead of failure
  • power_timeout β€” test X seconds for status change after ON/OFF. (Default Value: 20)
  • power_wait β€” wait X seconds after issuing ON/OFF. (Default Value: 0)
  • shell_timeout β€” wait X seconds for cmd prompt after issuing command. (Default Value: 3)
  • stonith_status_sleep β€” sleep X seconds between status calls during a STONITH action. (Default Value: 1)
  • retry_on β€” count of attempts to retry power on. (Default Value: 1)
  • use_sudo β€” use sudo (without password) when calling 3rd party software. Obsoletes: sudo
  • ssh_path β€” path to ssh binary. (Default Value: /usr/bin/ssh)
  • sudo_path β€” path to sudo binary. (Default Value: /usr/bin/sudo)

reminder bestie: virsh wants root by default, so make sure your sshd_config lets root ssh in, otherwise this whole thing is just a vibe and not a fence 😭

okay that's the whole page!! this is fence_virsh (Fence Agent), dated 2009-10-20, and it lives in section FENCE_AGENT(8). she's been serving since '09 and she's still slaying. periodt πŸ’–βœ¨πŸ¦‹πŸŽ€πŸ’…πŸ«ΆπŸ‘‘

πŸ“¦ where this page comes from