Archive
Power and maintenance operations in ESXi 5.1 with esxcli
ESXi 5.1 comes with many improvements and one of them is new namespaces and commands in esxcli.
Those new commands enable a system administrator to perform a shutdown, a reboot or a maintenance operation in a host.
Under the system namespace the new commands are the equivalents of the classic vicfg/esxcfg-hostops which until now was the only way to perform such kind of operations with vCLI and are also accesible locally on ESXi Shell.
Maintenance mode operations
Getting the basic usage of the command is as simple as always. You can perform two operations.
- Get the state of the host
- Put the the host in or out of Maintenance Mode
~ # esxcli system maintenanceMode
Usage: esxcli system maintenanceMode {cmd} [cmd options]
Available Commands:
get Get the maintenance mode state of the system.
set Enable or disable the maintenance mode of the system.
~ #
- Get the state of the host
~ # esxcli system maintenanceMode get Disabled ~ #
- Put the host in Maintenance Mode
~ # esxcli system maintenanceMode set -e true -t 0 ~ # ~ # esxcli system maintenanceMode get Enabled ~ #
Power operations
With the shutdown command the host can be either rebooted or shutdown. If the ESXi server is not in Maintenance Mode mode the operation will not be allowed.
~ # esxcli system shutdown
Usage: esxcli system shutdown {cmd} [cmd options]
Available Commands:
poweroff Power off the system. The host must be in maintenance mode.
reboot Reboot the system. The host must be in maintenance mode.
~ #
For both task the delay and reason parameter must be provided.
~ # esxcli system shutdown poweroff Error: Missing required parameter -r|--reason Usage: esxcli system shutdown poweroff [cmd options] Description: poweroff Power off the system. The host must be in maintenance mode. Cmd options: -d|--delay=<long> Delay interval in seconds -r|--reason=<str> Reason for performing the operation (required) ~ #
- Power off the host
~ # esxcli system shutdown poweroff --delay=10 --reason=”Hardware maintenance”
- Reboot the host
~ # esxcli system shutdown reboot -d 10 –r “Patches applied”
Juanma.
VCSA 5.1– Deployment and upgrade
In the last post we discussed about the new features and changes that comes with version 5.1 of the VMware vCenter Server Appliance. In this new one I will explain how to deploy it and perform an upgrade.
VCSA Deployment
The deployment of the VCSA 5.1 is very similar to the previous version. Use the vSphere Client to deploy a new OVF template and browse to the VCSA OVA package, follow the instructions until you get to the Networking Properties screen.
Here you can pre-set the networking configuration values of the appliance.
If you are going to do a fresh VCSA or vSphere installation enter the appropriate values on each field. If you want to perform an upgrade instead leave them blank to get the info by DHCP or put a temporal IP address if there is no DCHP server in place. You don’t need to put here the final values since during the upgrading process all the network settings will be migrated.
Let the deployment process finish and power on the vCenter appliance. During the boot process you can see how the network configuration is applied to the VM.
And finally you will reach the familiar blue screen.
That’s it, now proceed to the WebUI to complete VCSA setup. In your first log into the vCenter a wizard will appear.
After accepting the EULA you will presented with four options:
- Configure with default settings
- Upgrade from a previous version, which also gives you the option to use the default Single Sign On configuration.
- Upload configuration file. Very useful in case your vCenter Server virtual machine gets corrupted or you messed it up, if have a saved copy of the most recent configuration file you can deploy a new appliance and quickly restore its settings by uploading it.
- Set custom configuration <- I used this option for my homelab testing.
In the next screen you choose which database you want to use, the vPostgres embedded or an Oracle external.
Now we must choose the options for the Single Sign On server. vCenter 5.1 comes with a new component known as the Single Sign On server, or SSO.
SSO allows an administrator to login through the vSphere Web Client or the API and perform operations across all components of the vCloud Suite without having to log into them separately. It integrates with multiple identity sources like Windows Active Directory, NIS and OpenLDAP. The SSO is a requirement for the Inventory Service, vCenter Server and the Web Client.
In the Windows based vCenter installer SSO comes as a separate component that can be installed in the same VM as the vCenter or in a different one as a stand-alone server, in High Availability mode or even in a multisite environment.
The VCSA comes with the SSO embedded however it is prepared to use an external SSO server too. If choose the external SSO deployment mode all the appropriate information must be provided in this screen. Again as with the vCenter itself the database type must be set.
Finally set the Active Directory configuration accordingly to your environment, review the configuration and click Start to begin.
At the end if everything goes fine you will see a screen with a confirmation, click close and will see al the vCenter services up and ready in the main screen of the WebUI.
The deployment and basic setup of the VCSA is done, at this point all other components and settings can be setup from here.
VCSA Upgrade
The upgrade of the vCenter Server Appliance will allow to update to a different OS version and migrate to a different database.
If you are upgrading from 5.0 to 5.1 and using the embedded database, it will be migrated from IBM DB2 to VMware vPostgres. The configuration state will be preserved and the schema will be upgraded in order to be compatible with 5.1. VCSA 5.0 Update 1 already comes with vPostgres instead of DB2.
The major upgrade is supported from 5.0 and updates to 5.1.
The upgrading process is relatively simple:
- Deploy VCSA 5.1.
- Set the 5.0 appliance as source and 5.1 as destination.
- Establish a connection between both VCSAs.
- Import network configuration of existing VCSA.
- Prior to the upgrading the VCVA 5.1 must have a valid network connection and vCenter Server service must be stopped and un-configured.
Deploy the appliance as shown above, log into the WebUI and in the wizard accept the EULA in the first screen and select Upgrade from previous version in the second, let Use default SSO configuration as it comes by default.
The next screen that will be displayed is the Local and Remote Appliance keys.
Here we have put the current VCSA 5.0 key. To do so go to the Upgrade tab in VCSA 5.0 web interface. In the Prepare section select source and click Set role.
Go back to the VCSA 5.1 and copy the Local appliance key. On the 5.0 appliance click on Establish Trust and paste the copied key in the Remote key appliance key field. Click on Import remote key and wait for the import to complete.
In the VCSA 5.0 copy the Local appliance key. Go to 5.1 vCenter, paste that key on the Remote appliance key field of the setup wizard screen and click Next. The Pre-Upgrade Checker screen will show up.
After this a check will be run against the ESX/ESXi managed by the old VCSA and it will generate a report.
And the final screen will appear asking for confirmation. Click on the confirmation checkbox and in Start.
During the upgrade VCSA 5.1 will shutdown the 5.0 virtual appliance and assumes its network identity.
When the process is done a final screen will appear.
If you want to check if the process is done log into the VCSA through SSH and list the vmware services, vmware-sso just to name one will show up on the list.
Also you can access the vSphere Web Client and will see the new 5.1 client.
Juanma.
VCSA 5.1– A quick look
Yesterday was a very exciting day, VMware finally announced the new vCloud Suite 5.1. With new products and features announced, each one of them as great as ever.
But yours truly decided that instead of presenting you a generic “What’s new” post it was more interesting, at least for me and hope also to you, to focus in one of my favorite pieces of vSphere, the vCenter Server Virtual Appliance and in a couple of articles describe what new features are coming and how to perform an upgrade from 5.0 to 5.1.
What’s new in the VCSA 5.1
With this new release of the vCenter Server VA a few new features have been added, most of them related to the WebUI and to the new features and services that have been released globally for the vCenter 5.1, Windows and Linux based versions.
These new enhancements can be seen in the Summary section of the vCenter Server Tab as shown in the screenshot below.
From here all the vCenter Service can be started and stopped. The Services Tab no longer exists and it’s now a section of the vCenter Server Tab.
In the Storage Usage are you can check the disk usage of the different components of the VCSA.
There is also a Utilities are where you can:
- Generate a support bundle in case of an incidence with the vCenter Server.
- Download the configuration file of the VCSA and then open it in your favorite text editor.
- Launch again the Setup Wizard to configure the VCSA from scratch or make modifications to some of he initial settings.
- Upload the Windows Sysprep files to the vCenter VA.
- For this last option the procedure is quite simple. Click the
Upload
- button.
A new windows will open, select the operating system and browse for the location of the files.
The files will be uploaded to /etc/vmware-vpx/sysprep/<OS>.
Additionally in the vCenter Server Tab two new sections have been added.
The Service section where the VCSA administrator can setup:
- ESXi Dump Collector repository size
- vSphere Auto Deploy repository size
- Inventory size
The SSO section. Here you can configure all the settings related to the newly introduced Single Sign On server.
In the next post we will discuss about VCSA 5.1 initial deployment and how to upgrade from 5.0 and 5.1.
Juanma.
Change ESXi 5 iSCSI iqn with esxcli
After my previous post about getting the iqn of an ESXi using esxcli Andy Banta (@andybanta) commented on Twitter that you can also change the iqn of the host with esxcli.
As he said it would be tremendously useful if you need to physically replace the server and don’t want to modify all your storage infrastructure, it’s easier to just modify the iqn of the new server and set it to the old name.
The task is as easier as the one described in last post. Using esxcli command with the iscsi namespace you can change the name and the alias of the adapter.
As a precaution first retrieve the current iqn to check that it’s the correct server.
To change the name you have to provide the adapter and the new name.
Hope you find this useful, any comments and suggestions are welcome as always.
Juanma.
How to get iSCSI iqn using esxcli in ESXi 5
Back in 2010 I wrote a post about how to get the iSCSI iqn of an ESXi 4.x server using vSphere CLI from the vMA or any other system with the vCLI installed on it.
The method described in that article is still valid for ESXi 5.0 since the old vicfg and esxcfg commands are still available, however with 5.0 version you can get a similar result using the new esxcli namespaces, following is how to do it.
First task is to get a list of the iSCSI HBAs in order to know the name of the software iSCSI initiator.
Next we get the info of the adapter.
Look at the Name field to get the iqn and we are done.
Juanma.
How to upgrade the vMA 5
Last week vSphere 5 Update 1 was released by VMware, along with the main products some of the SDKs and automation tools were also updated, including the vMA.
As you should remember from my first post about vMA 5 the classic vma-update utility is no longer available. So to be able to update our vMA to the new version we have to use the Web UI. Following is the procedure to perform the upgrade.
First access the web interface using the vi-admin user as always.
From the main screen go to the Update tab. In the Status screen click on Check Updates.
After a few seconds a message will appear showing the new update available.
Click on Install Updates and after asking for confirmation the update process will start.
Once the update process is complete the appliance will ask for a system reboot.
Go to the System tab and perform the reboot. After the reboot is done you can check the new version in the appliance console,
And in the vma-release file, located at /etc.
vi-admin@vma:~> cat /etc/vma-release vMA 5.0.0 BUILD-643553 Copyright (C) 1998-2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more U.S. Patent Numbers D617,808, D617,809, D617,810, D617,811, 6,075,938, 6,397,242, 6,496,847, 6,704,925, 6,711,672, 6,725,289, 6,735,601, 6,785,886, 6,789,156, 6,795,966, 6,880,022, 6,883,095, 6,940,980, 6,944,699, 6,961,806, 6,961,941, 6,970,562, 7,017,041, 7,055,032, 7,065,642, 7,069,413, 7,069,435, 7,082,598, 7,089,377, 7,111,086, 7,111,145, 7,117,481, 7,149,310, 7,149,843, 7,155,558, 7,222,221, 7,260,815, 7,260,820, 7,269,683, 7,275,136, 7,277,998, 7,277,999, 7,278,030, 7,281,102, 7,290,253, 7,343,599, 7,356,679, 7,386,720, 7,409,487, 7,412,492, 7,412,702, 7,424,710, 7,428,636, 7,433,951, 7,434,002, 7,447,854, 7,447,903, 7,467,067, 7,475,002, 7,478,173, 7,478,180, 7,478,218, 7,478,388, 7,484,208, 7,487,313, 7,487,314, 7,490,216, 7,500,048, 7,506,122, 7,516,453, 7,529,897, 7,543,301, 7,555,747, 7,565,527, 7,571,471, 7,577,722, 7,581,064, 7,590,715, 7,590,982, 7,594,111, 7,596,594, 7,596,697, 7,599,493, 7,603,704, 7,606,868, 7,620,523, 7,620,766, 7,620,955, 7,624,240, 7,630,493, 7,636,831, 7,657,659, 7,657,937, 7,665,088, 7,672,814, 7,680,919, 7,689,986, 7,693,996, 7,694,101, 7,702,843, 7,707,185, 7,707,285, 7,707,578, 7,716,446, 7,734,045, 7,734,911, 7,734,912, 7,735,136, 7,743,389, 7,761,917, 7,765,543, 7,774,391, 7,779,091, 7,783,779, 7,783,838, 7,793,279, 7,797,748, 7,801,703, 7,802,000, 7,802,248, 7,805,676, 7,814,495, 7,823,145, 7,831,661, 7,831,739, 7,831,761, 7,831,773, 7,840,790, 7,840,839, 7,840,993, 7,844,954, 7,849,098, 7,853,744, 7,853,960, 7,856,419, 7,856,531, 7,856,637, 7,865,663, 7,869,967, 7,886,127, 7,886,148, 7,886,346, 7,890,754, 7,895,437, 7,908,646, 7,912,951, 7,921,197, 7,925,850; patents pending. VMware, the VMware "boxes" logo and design, Virtual SMP and VMotion are registered trademarks or trademarks of VMware, Inc. in the United States and/or other jurisdictions. All other marks and names mentioned herein may be trademarks of their respective companies. vi-admin@vma:~>
The above procedure use the default VMware repository and your appliance must be able to resolve public DNS addresses and access the internet in order to download de upgrade bits.
Juanma.
More HP sauce on ESXi 5.0
On my first post about HP ESXi 5.0 customized image I discussed about the new esxcli namespaces added by HP. But those tools aren’t the only ones included.
If you list the software bundles and filter the output to display only the included by HP will notice an hponcfg package.
~ # esxcli software vib list |grep Hewlett char-hpcru 5.0.0.8-1OEM.500.0.0.434156 Hewlett-Packard PartnerSupported 2011-05-24 char-hpilo 500.9.0.0.8-1OEM.500.0.0.434156 Hewlett-Packard PartnerSupported 2011-05-24 hp-smx-provider 500.02.10.13.44-434156 Hewlett-Packard VMwareAccepted 2011-05-24 hpbootcfg 01-00.10 Hewlett-Packard PartnerSupported 2011-05-24 hponcfg 03-02.04 Hewlett-Packard PartnerSupported 2011-05-24 ~ #
Hponcfg, also included on ProLiant Support Pack for Linux, is a tool that enable a System Administrator to manage the iLO of a ProLiant server from the operative system.
~ # esxcli software vib get -n hponcfg Hewlett-Packard_bootbank_hponcfg_03-02.04 Name: hponcfg Version: 03-02.04 Type: bootbank Vendor: Hewlett-Packard Acceptance Level: PartnerSupported Summary: HP ProLiant Lights-Out Configuration Utility for ESXi Description: HP ProLiant Lights-Out Configuration Utility for ESXi Release Date: 2011-08-09 Depends: Conflicts: Replaces: Provides: Maintenance Mode Required: False Hardware Platforms Required: HP, Hewlett-Packard Company, Hewlett-Packard, hp Live Install Allowed: False Live Remove Allowed: False Stateless Ready: True Overlay: False Tags: Payloads: hponcfg ~ #
The tool is located at /opt/hp/tools.
/opt/hp/tools # ls hpbootcfg hpbootcfg_esxcli hponcfg /opt/hp/tools #
Launch the utility without arguments and you will get the usage and it will also display current firmware version of the iLO.
/opt/hp/tools # ./hponcfg HP Lights-Out Online Configuration utility Version 3.2-4 (c) Hewlett-Packard Company, 2011 Firmware Revision = 1.26 Device type = iLO 3 Driver name = hpilo USAGE: hponcfg -? hponcfg -h hponcfg -m minFw hponcfg -r [-m minFw ] hponcfg [-a] -w filename [-m minFw] hponcfg -g [-m minFw] hponcfg -f filename [-l filename] [-s namevaluepair] [-v] [-m minFw] hponcfg -i [-l filename] [-s namevaluepair] [-v] [-m minFw] -h, --help Display this message -? Display this message -r, --reset Reset the Management Processor to factory defaults -f, --file Get/Set Management Processor configuration from "filename" -i, --input Get/Set Management Processor configuration from the XML input received through the standard input stream. -w, --writeconfig Write the Management Processor configuration to "filename" -a, --all Capture complete Management Processor configuration to the file. This should be used along with '-w' option -l, --log Log replies to "filename" -v, --xmlverbose Display all the responses from Management Processor -s, --substitute Substitute variables present in input config file with values specified in "namevaluepairs" -g, --get_hostinfo Get the Host information -m, --minfwlevel Minimum firmware level /opt/hp/tools #
As a non intrusive example you can use -g switch to get the server info.
/opt/hp/tools # ./hponcfg -g HP Lights-Out Online Configuration utility Version 3.2-4 (c) Hewlett-Packard Company, 2011 Firmware Revision = 1.26 Device type = iLO 3 Driver name = hpilo Host Information: Server Name: esxi01.hp.local Server Number: /opt/hp/tools #
I’ll let you to investigate the rest of the options carefully.
Juanma.
vMotion error, virtual machine refuses to be migrated.
Last night during a patching job in a customer I found the following error for several VMs when I put a host in maintenance mode and DRS tried to evacuate the virtual machines to the other nodes of the cluster.
Very strange since as far as I could see the virtual machines were running without errors, I was logged into some of them through SSH, and they also appeared as powered on in vSphere Client.
I decided to go to Tech Support Mode on the ESXi and check the virtual machine power state.
Everything looked exactly as it should be, no error logs, nothing. At this point I decided to restart the ESXi management agents.
And it worked, after a few seconds I was able to perform a successful vMotion and the host could be evacuated.
Juanma.
Change ESXi 5.0 hostname with esxcli
Yes another post about esxcli, what can I say I’m studying very hard for my VCP5 and from time to time this kind of unknown information, at least for me, arise and I believe it can be useful for some of you.
Again we are going to make use of the system namespace.
~ # esxcli system hostname
Usage: esxcli system hostname {cmd} [cmd options]
Available Commands:
get Get the host, domain or fully qualified name of the ESX host.
set This command allows the user to set the hostname, domain name or fully qualified domain name of the ESX host.
~ #
First task of course is to get current hostname.
~ # esxcli system hostname get Domain Name: vjlab.local Fully Qualified Domain Name: esxi5.vjlab.local Host Name: esxi5 ~ #
Next change the hostname, but you should check before what options are at your disposal by getting the command help.
~ # esxcli system hostname set --help Usage: esxcli system hostname set [cmd options] Description: set This command allows the user to set the hostname, domain name or fully qualified domain name of the ESX host. Cmd options: -d|--domain=<str> The domain name to set for the ESX host. This option is mutually exclusive with the --fqdn option. -f|--fqdn=<str> Set the fully qualified domain name of the ESX host. -H|--host=<str> The host name to set for the ESX host. This name should not contain the DNS domain name of the host and can only contain letters, numbers and '-'. NOTE this is not the fully qualified name, that can be set with the --fqdn option. This option is mutually exclusive with the --fqdn option. ~ #
Interesting, you can change the short hostname, the domain or the fully qualified domain name. Take into account that –fqdn option is mutually exclusive with the others.
We are going to try all of them.
Domain:
~ # esxcli system hostname set --domain=jreypo.local ~ # ~ # esxcli system hostname get Domain Name: jreypo.local Fully Qualified Domain Name: esxi5.jreypo.local Host Name: esxi5 ~ #
Short hostname:
~ # esxcli system hostname set --host=esxi5-2 ~ # ~ # esxcli system hostname get Domain Name: jreypo.local Fully Qualified Domain Name: esxi5-2.jreypo.local Host Name: esxi5-2 ~ #
Fully qualified domain name:
~ # esxcli system hostname set --fqdn=esxi5.vjlab.local ~ # ~ # esxcli system hostname get Domain Name: vjlab.local Fully Qualified Domain Name: esxi5.vjlab.local Host Name: esxi5 ~ #
Juanma.
Getting network card driver version in ESXi 5.0
This a quick follow-up post to the How to check the driver version of a network interface in ESX(i) one. That post covered ESX(i) 4.x so I decided to write a small update for ESXi 5.0.
First I have to say that the two methods described in my first post still work in ESXi 5.0 Shell.
~ # vmware -l VMware ESXi 5.0.0 GA ~ # ~ # vmkload_mod -s e1000 | grep Version Version: Version 8.0.3.1-NAPI, Build: 456551, Interface: 9.2 Built on: Jul 29 2011 ~ # ~ # ethtool -i vmnic0 driver: e1000 version: 8.0.3.1-NAPI firmware-version: N/A bus-info: 0000:02:00.0 ~ #
Thanks to the new changes made by VMware in ESXi 5.0 we can now use esxcli to get the same result.
~ # esxcli system module get -m e1000 Module: e1000 Module File: /usr/lib/vmware/vmkmod/e1000 License: GPL Version: Version 8.0.3.1-NAPI, Build: 456551, Interface: 9.2 Built on: Jul 29 2011 Signed Status: VMware Signed Signature Issuer: VMware, Inc. Signature Digest: 1049 0611 a944 efc3 b683 341d 34b1 bebc 552d cb81 a874 ef4c 0562 8f25 2775 8c8d Signature FingerPrint: cb44 247a 1614 cea1 2079 362d ec86 9d0e Provided Namespaces: Required Namespaces: com.vmware.driverAPI@9.2.0.0, com.vmware.vmkapi@v2_0_0_0 ~ # ~ # esxcli system module get -m e1000 | grep Version Version: Version 8.0.3.1-NAPI, Build: 456551, Interface: 9.2 Built on: Jul 29 2011 ~ #
There is a big advantage on using esxcli over the other methods. In ESX(i) 4.x and ESXi 5.0 with the old procedure you had to be logged into the host but with esxcli it can be performed remotely using vSphere CLI.
vi-admin@vma:~[esxi5.vjlab.local]> esxcli system module get -m e1000 Module: e1000 Module File: /usr/lib/vmware/vmkmod/e1000 License: GPL Version: Version 8.0.3.1-NAPI, Build: 456551, Interface: 9.2 Built on: Jul 29 2011 Signed Status: VMware Signed Signature Issuer: VMware, Inc. Signature Digest: 1049 0611 a944 efc3 b683 341d 34b1 bebc 552d cb81 a874 ef4c 0562 8f25 2775 8c8d Signature FingerPrint: cb44 247a 1614 cea1 2079 362d ec86 9d0e Provided Namespaces: Required Namespaces: com.vmware.driverAPI@9.2.0.0, com.vmware.vmkapi@v2_0_0_0 vi-admin@vma:~[esxi5.vjlab.local]> vi-admin@vma:~[esxi5.vjlab.local]> esxcli system module get -m e1000 | grep Version Version: Version 8.0.3.1-NAPI, Build: 456551, Interface: 9.2 Built on: Jul 29 2011 vi-admin@vma:~[esxi5.vjlab.local]>
But there is more, thanks to Get-EsxCli cmdleet the same operation can be done using PowerCLI, here it is how.
First we need to setup the Esxcli instance.
And now we issue the command using the name of the module as the argument, please pay attention to the syntax.
As you should have imagined this procedure can be used to get info about any VMkernel module in the host, not just the network interface one,.
Juanma.

