How to fence a Host using a Power Shell Script in Red Hat Virtualization 2.2 ?
Environment
- Red Hat Enterprise Virtualization 2.2
- Windows Powershell
Issue
- How to fence hosts using Power Shell Scripts?
Resolution
-
To fence a host the host status must be first updated to Maintenance Mode.
-
To update a hosts status to maintenance,use the
Suspend-Host
PS command and set the status toMaintenance
. -
But note that use the shell's tab completion to ensure we get the correct value.
-
Check the Id of host, please execute the following command first:
PS C:\> Select-Host
- Suspend the host using:
PS C:\> Suspend-Host -HostId <Id-of-host>
- After the Host in in Maintenance Mode execute the below command to fence it.
Fence-Host -HostId $HOST_N.HostId -Action Stop
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.