Applying a hotfix or update using the command line
In the following example, we will discover how to apply a hotfix using the xe CLI to the XenServer host xenserver2
:
First, download and extract the update file to a known location on your computer.
If High Availability is enabled on the pool, disable it by executing the
xe
commandpool-ha-disable
.Copy the update file to a folder on the XenServer host, using a tool such as
WinSCP
. In this example we copy the file to the path/home/
.Note
You can download the WinSCP tool available at http://winscp.net.
Upload the hotfix file to the host you wish to update using the
xe
commandpatch
upload
:xe patch-upload file-name=<file-name> -s <server> -u <username> -pw <password>
where:
The
file-name
parameter is the path where you have uploaded the hotfix fileThe
server
parameter is the name or IP address of the host where you want to apply the hotfixThe
username
parameter is the name of the user account that XenServer will use to upload the fileThe
password
parameter is the password related to the user account that you will use to upload the file
In our example, we execute the following command:
xe patch-upload file-name=/home/XS60E001.xsupdate -s 192.168.0.2 -u root -pw xenserver
XenServer assigns the hotfix file a unique identifier (UUID). We use this UUID for installing the hotfix. In our example, the
uuid
is95ac709c-e408-423f-8d22-84b8134a149e
.Note
As we have seen using XenCenter, if XenServer detects any errors or preparatory steps that have not been taken it informs you. So, follow any guidance before continuing with the update.
Now, start the update process using the
xe
commandpatch-apply
:xe patch-apply host-uuid=<host-uuid> uuid=<hotfix-uuid>
where:
The
host-uuid
parameter is the unique identifier of the XenServer host that you are updatingThe
uuid
parameter is the unique identifier of the hotfix that you have uploaded previously
In our example, we execute the following command:
xe patch-apply host-uuid=5b344339-620c-42f2-b0d1-1b6ad5ec8802 uuid=95ac709c-e408-423f-8d22-84b8134a149e
After you have applied the hotfix, you can verify that the update has been successfully applied by using the
xe
commandpatch
-list
. If the update has been successful, thehosts
(SRO)
field contains the host UUID:The command
patch-list
also informs you about the post-update tasks that you have to perform. Theafter-apply-guidance
(SRO)
field in this example instructs you to restart the host.After you have completed the update process, enable again the High Availability feature on your pool with the
xe
commandpool-ha-enable
.