Home > Blogs > VMware vSphere Blog > Tag Archives: esxcli

Tag Archives: esxcli

Understanding ESXi Patches – Manually Patching ESXi hosts

Kyle Gleed, Sr. Technical Product Manager, VMware

I’ve recently been blogging about ESXi patches with the hopes of making it easier for you to identify and track  available updates and to keep your ESXi hosts up-to-date.  In my first post I talked about how to find patches.  In my second post I went over the steps to manually upload the patches into Update Manager.  The next topic I want to cover is how to install the patches using the vCLI.  Fortunately, this is easily done because there are already a couple of good blog posts that show how to do this.  So rather than reinvent the wheel, I’m just going to point to the existing articles.

Back in September 2010, shortly after we released our first ESXi 5.0 update I wrote this article giving an overview on how to use the new ESXCLI command released with vSphere 5.0 to install ESXi updates update.

More recently William Lam recently posted this excellent article that not only shows how to use the new ESXCLI command with ESXi 5.0, but also provides a good overview of the other available vCLI and PowerCLI commands that can be used to patch versions of ESX/ESXi prior to 5.0: 

Follow me on twitter @VMwareESXi

ESXCLI Partner Extensiblity

By William Lam, Sr. Technical Marketing Engineer

Many vSphere administrators are familiar with the ESXCLI command-line utility that helps manage and configure settings on their ESX and ESXi hosts. With the release of vSphere 5.0, ESXCLI now includes a total of 250 commands that span across various namespaces.

Esxcli-partner-1
One would expect that VMware can easily extend and create new namespaces to expose VMware platform specific functionality. An example of this would be the vcloud namespace that is made available when vCloud Director is installed. What you may not know is, ESXCLI was actually built with a modular and extensible framework from the ground up and can easily be extended by third party providers as well.

Wouldn’t it be cool to see a hardware vendor extend ESXCLI to include commands to help manage and configure their specific hardware?

Esxcli-partner-3
Well, this is exactly what HP had done. Juan Manuel Rey, who works for HP, recently blogged about several new HP specific namespaces that are bundled as part of the HP’s customized ESXi image profile. Note that even if you are not running HPs custom image profile, or if you have an earlier version that does not include the new namespaces, you can still get access to the HP specific ESXCLI namespaces. You can simply install the relevant VIBs from HP’s online VIB depot using the command-line or using VMware Image Builder as shown here by Kyle Gleed.

Here is a screenshot of the HP namespaces using the local ESXCLI in the ESXi Shell:
Esxcli-partner-4

Another neat thing about integrating with ESXCLI, is that you not only get access to the vendor specific commands using the local ESXCLI utility available from the ESXi shell, but you also automatically get a free remote command-line version using the remote ESXCLI utility that is part of vCLI/vMA. This provides you the benefit of centralized management and configuration of your ESX(i) hosts leveraging the capabilities provided by your vendor.

Here is a screenshot of the HP namespaces using the remote ESXCLI command:
Esxcli-partner-5

Note: The remote ESXCLI requires additional parameters such as the ESX(i) host, username and password. You also have the option of authenticating against vCenter if the ESX(i) host is being managed by a vCenter Server.

As you can see the ESXCLI extensibility framework not only benefits VMware but can also benefit other vendor solutions that integrate with VMware. If you are a customer who would like to see this type of integration from other vendors, be sure to let them know about the extensibility of ESXCLI in vSphere 5.0 and how they can seamlessly integrate their tools with VMware to help make life a lot easier for the vSphere admininstrator. If there are other vendors who have similar capabilities and have integrated with ESXCLI, I would love to hear about it.

UPDATE:

Brocade – ESXCLI plug-in (BCU) support

LSI – ESXCLI plug-in (MegaCLI) support

Get notification of new blog postings and more by following lamw on Twitter:  @lamw

Quickest Way to Patch an ESX/ESXi Using the Command-line

By William Lam, Sr. Technical Marketing Engineer

As you know, when it comes to automating patch management for your vSphere infrastructure, we highly recommend leveraging our vSphere Update Manager (VUM) which is part of the vSphere vCenter Suite to help simplify the update process. Though not all environments have the luxury of running vCenter Server to manage their ESX(i) hosts. An example of this could be 1-2 hosts running at a ROBO (remote office/branch office) site or single test/dev host in a home or office lab where VUM is not available.

However, it is still possible to patch/upgrade your ESX(i) host using the command-line without the need of VUM, but you will have to manually identify the patch dependencies and ensure host compliance.

Depending on the version of ESX or ESXi you are running, you may have several options that could include local and/or remote command-line utilities that are available in following four forms:

  • ESX Service Console
    • esxupdate – Local utility found on classic ESX hosts to manage/install patches
  • ESXi Shell
    • ESXCLI – Local utility found on ESXi 5.0 hosts that can be used manage/install patches
  • vCLI (Windows/Linux or use vMA)
    • vihostupdate35 – Remote utility to manage/install patches for ESXi 3.5
    • vihostupdate – Remote utility to manage/install patches for ESX(i) 4.0 & 4.1
    • ESXCLI – Remote utility to manage/install patches for ESXi 5.0 (patch capability introduced in vSphere 5 for ESXi 5.0 hosts only)
  • PowerCLI(Windows)
    • InstallVMHostPatch – Remote utility using PowerCLI to manage/install patches for ESX(i) 4.0 and 4.1

Note: If you are using vSphere Hypervisor (Free ESXi), you will not be able to leverage any of the the remote CLI’s but you can still use the local CLI.

Here is a table summarizing all available command-line options based on the version of ESX(i) you are running:

Hypervisor Version Local Command vCLI Remote Command PowerCLI Remote Command
ESX 3.5 esxupdate −−bundle=<zip> update N/A N/A
ESXi 3.5 N/A vihostupdate35
−−bundle=<zip> −−install
N/A
ESX 4.0 esxupdate −−bundle=<zip> update vihostupdate <<bundle=<zip> −−install Install-VMHostPatch
ESXi 4.0 N/A vihostupdate −−bundle=<zip> −−install Install-VMHostPatch
ESX 4.1 esxupdate −−bundle=<zip> update vihostupdate −−bundle=<zip> −−install Install-VMHostPatch
ESXi 4.1 N/A vihostupdate −−bundle=<zip> −−install Install-VMHostPatch
ESXi 5.0 esxcli software vib update −−depot=/vmfs/volumes/[datastore]/<zip> esxcli software vib update −−depot=/vmfs/volumes/[datastore]/<zip> Install-VMHostPatch
Or Get-ESXCLI with the local command referenced in this table.

Note: When you download patches from VMware, there is an associated VMware KB article and it provides a link to the patch management documentation. You should always refer to that for more details and information for different methods of applying a patch.

Here is an example of using esxupdate on a classic ESX host. The patch bundle needs to be uploaded to ESX host using scp or winSCP and then specifying the full path on the command-line:

$ esxupdate −−bundle=ESX400-200907001.zip update

Here is an example of using the remote vihostupdate utility for an ESXi host, you will need to specify the ESXi host using the −−server parameter and −−username/−−password for remote authenication. You may choose to leave off −−password and you will be prompted to enter your credentials. The patch bundle does not need to be uploaded to ESXi host, it can reside on the system that is running the vihostupdate command. During the execution, the patch bundle will automatically be transfered to the host:

$ vihostupdate −−server [ESXI-FQDN] −−username [USERNAME] −−bundle=ESXi410-201011001.zip −−install

Here is an example of using the local esxcli utility for an ESXi 5.0 host. The patch bundle needs to be uploaded to ESXi host using scp or winSCP and then specifying the full path on the command-line:

$ esxcli software vib update −−depot=/vmfs/volumes/datastore1/ESXi500-201112001.zip

Here is an example of using the remote esxcli utility for an ESXi 5 host, you will need to specify the ESXi host using the −−server parameter and −−username/−−password for remote authenication. You may choose to leave off −−password and you will be prompted to enter your credentials. The patch bundle needs to be uploaded to ESXi host using scp/winSCP or vCLI’s vifs utility and then specifying the full path on the command-line:

$ vifs −−server [ESXI-FQDN] −−username [USERNAME] -p ESXi500-201112001.zip “[datastore1] ESXi500-201112001.zip”
$ esxcli −−server [ESXI-FQDN] −−username [USERNAME] software vib update −−depot=/vmfs/volumes/datastore1/ESXi500-201112001.zip

Note: In ESXi 5, −−depot only supports local server path or remote URL. The latter is to help centralize the location of your patches and help reduce manual transfer. This is why you need to transfer the patch to host if you do not have a patch depot.

Here is an example of using Install-VMHostPatch utility for an ESXi host:

Get-VMHost ESXI-FQDN | Set-VMHost -State Maintenance
$DS = Get-VMHost ESXI-FQDN | Get-Datastore datastore1
Copy-DatastoreItem C:\tmp\ESXi500-201112001\ $DS.DatastoreBrowserPath -Recurse
Get-VMHost ESX-FQDN | Install-VMHostPatch -Hostpath “/vmfs/volumes/datastore1/ESXi500-201112001/metadata.zip”

Note: The Install-VMHostPatch cmdlet does have a -LocalPath parameter for you to specify a local path to the patch. For larger files it is recommended you use the Copy-Datastore cmdlet to upload the file to a datastore on the host and then the -HostPath parameter as can be seen in the example above.

As you can see over the releases, we have had several methods of patching a host using the command-line both locally/remotely and it may not always be intuitive. When we converged to only ESXi with the release of vSphere 5.0, you will see that patching from the command-line has also converged to a single command-line utility using ESXCLI and a common patch format called a VIB. ESXCLI was first introduced in vSphere 4.0 and it had some limited capabilities. With vSphere 5.0, it has been significantly enhanced and now supports patching as one of it’s many capabilities. The syntax and expected output is exactly the same if you execute ESXCLI locally or remotely on an ESXi host with the exception of the remote authentication that is required for a remote execution. This should provide for a better user experience and consistency going forward.

An alternative method to patching from the command-line if you do not have VUM is using VMware Go, which is an online service (SaaS) provided by VMware. VMware Go can help manage your ESXi host but it also provides a patching capability similar to that of VUM.

Get notification of new blog postings and more by following lamw on Twitter:  @lamw