Search This Blog

Monday, 24 January 2011

datacenter.QueryConnectionInfo error when connecting ESX host

I had a bit of a problem in my home lab. I have 2 hosts, and one crashed. Unfortunately this was the host running AD & vCenter. When I brought the host back, I managed to restart the VMs, but looking in the vSphere client when I connected back onto vCenter, both hosts were disconnected. When I tried to reconnect, I got this Datacenter.QueryConnectionInfo error message. I have a feeling that name resolution was to blame here, but couldn't work out what was wrong. I could ping the hosts from vCenter by IP & name, I could add the hosts by IP address, but not by name. The only work around I could come up with was to add the ESX host details into the hosts file to avoid using DNS. As soon as I did that, I could reconnect the hosts. I've no idea what the actual problem is, although i wonder if some connection information is stored in the database and was corrupted when the host died.

Useful vMA commands




NFS Storage

If you are connecting an NFS share to your ESX(i) server, use the command vicfg-nas

To see what NFS datastores are connected to a host, use

  • vicfg-nas -h esxhostname/ip address -l
  • e.g. vicfg-nas -h esx.test.com -l

To add a datastore to a host

  • vicfg-nas -h ESXhostname/ip address -a "Datastore name" -o NFS Servername/ip address -s sharename
  • vicfg-nas -h esx.test.com -a "NFS datastore" -o nfs.test.com -s /mnt/nfs

To delete a datastore from a host

  • vicfg-nas -h ESXhostname/ip address -d "Datastore name"
  • e.g. vicfg-nas -h esx.test.com -d "NFS datastore"

Virtual Machine vSwitch Configuration

To list vSwitches and portgroups use:

  • vicfg-vswitch -h ESXhostname/ip address -l
  • e.g. vicfg-vswitch -h esx.test.com -l
To create a vSwitch

  • vicfg-vswitch -h ESXhostname/ip address -a vSwitchname
  • e.g. vicfg-vswitch -h esx.test.com -a esxvSwitch

To delete a vSwitch

  • vicfg-vswitch -h ESXhostname/ip address -d vSwitchname
  • e.g. vicfg-vswitch -h esx.test.com -d esxvSwitch

To create a portgroup in a vSwitch
  • vicfg-vswitch -h ESXhostname/ip address -A portgroupname vSwitchname
  • e.g. vicfg-vswitch -h esx.test.com -A portgroup1 esxvSwitch

To configure a portgroup with a VLAN ID (this can't be done when the portgroup is created

  • vicfg-vswitch -h ESXhostname/ip address -v vlanid -p portgroupname vSwitchname
  • e.g. vicfg-vswitch -h esx.test.com -v 32 -p portgroup1 esxvSwitch

To delete a portgroup from a vSwitch

  • vicfg-vswitch -h ESXhostname/ip address -D portgroupname
  • e.g. vicfg-vswitch -h esx.test.com -D portgroup1

vmkernel vSwitch Configuration


The format is very similar to the vicfg-vswitch command
To list vmkernel portgroup details use:

  • vicfg-vmknic -h ESXhostname/ip address -l
  • e.g. vicfg-vmknic -h esx.test.com -l
To create a vmkernel portgroup (i.e. convert the portgroup from a Virtual Machine portgroup to a vmkernel portgroup)

  • vicfg-vmknic -h ESXhostname/ip address -a -i ipaddress -n netmask -p portgroupname
  • e.g. vicfg-vmknic -h esx.test.com -a -i 10.10.10.1 -n 255.255.255.0 -p portgroup1

To delete a vmkernel portgroup (i.e. convert it back to a Virtual Machine portgroup)

  • vicfg-vmknic -h ESXhostname/ip address -d -p portgroupname
  • e.g. vicfg-vmknic -h esx.test.com -d -p portgroup1

To enable a vmkernel portgroup for VMotion

  • vicfg-vmknic -h ESXhostname/ip address -E -p portgroupname
  • e.g. vicfg-vmknic -h esx.test.com -E -p portgroup1

Wednesday, 12 January 2011

VCD Reservation Pool Capacity

I’ve been playing with some capacity stuff in the cloud, and have used PowerCLI to gather some allocation information for each of the Org vDCs that exist (such as reservation allocated to each vDC & reservations used by the VMs in it).

This has gone swimmingly for PAYG & Allocation Pools, but for Reservation Pools I made the assumption that no VMs in the vDC would have any reservations. I thought I should get some data to validate my script, so created a couple of random vApps in a test Reservation Pool vDC. I ran my script and found that actually reservations existed for some of the VMs.

The reason is that for Reservation Pools only, the resource settings come directly from the template VM, so if the template was created on an Allocation Pool vDC, those settings will be transferred when this template is cloned.

I believe that this is a bug rather than a feature.

Thursday, 11 November 2010

vCD Log Files

Here is a list of inportant log files in vCD and a brief description. The can be found at /opt/vmware/cloud-director/logs

  • yyyy-mm-dd.request.log - This shows all the HTTP requests that have come from the user interface or the API. Very useful to run tail -f on this file to see where connections for users are going to.
  • cell.log - shows information for when the vCD cell is starting up. You can use tail -f on this file to watch the vCD cell start up, you will see the % progress. The cell can be started using command service vmware-vcd start, and stopped using command service vmware-vcd stop.
  • vcloud-container-debug.log - Debug level messages
  • vcloud-container-info.log - Information, warning and error messages for this vCD cell
  • vmware-vcd-watchdog.log - Brief message showing the last time the cell was started
  • diagnostics.log - Empty unless diagnostics logging is enabled in the local logging configuration

Unable to create routed organisation network


I've just had an issue at a customer when they were unable to create any Routed Organization Networks.

Direct and Internal only networks were created fine.

The error that was shown in vCD referred to vShield Manager, and error 401, unauthorized.

I'm unsure what caused the issue, although there were issues with the environment as the ESX boot LUNs had been disconnected.

It appeared that the credentials for vCD to authenticate to the vShield Manager have in someway been corrupted.

So, I connected to vCD, selected the properties of the the vCenter server from the Manage & monitor tab, and re-entered the administrator credentails for vShield Manager.

Thursday, 7 October 2010

Importing Virtual Machines into vCloud Director


So now that we have a nice new vCloud Director implementation, we need to think about how we are going to get our customers Virtual Machines imported, and placed in the appropriate vApp.

I'm going to assume you already have a process to import Virtual Machine(s) into vCenter. If your doing P2V, probably VMware Converter or something similar, if you are importing a Virtual Machine, then something more straight forward.

For a successful import into vCloud Director, the vCenter that you are importing your Virtual Machine(s) into will need to be attached to vCloud Director.




When you have got your VMs into vCenter, you will need to import them as vApps into vCD. Bear in mind that each VM will be imported into its own vApp, so you will have lots of single Virtual Machine vApps.

In vCloud Director, open up the Organisation that the VMs will be imported into, and select My Cloud -> vApps. Click the Import from vSphere... button


You will then be shown the Virtual Machines in the selected vCenter Server that can be imported. You need to select the required Virtual Machine, name the vApp, and select the Organisation vDC that you want to place it in.


Finally, before hitting OK, you will need to select Move VM or Copy VM... depending on whether you want the VM to remain in vCenter or not.

When all the VMs have been imported, you can group them into a single vApp if you want. Simply open the vApp in question, right click the VM (when its not running), and select Move ... You can then specify the destination vApp for this Virtual Machine. The source vApp will now be empty, and can be deleted. Repeat this for as many VMs that you want within the destination vApp.

The final thing you need to do is configure the networking for the newly added VMs in the vApp. I'm going to assume that the vApp has the appropriate networks added to it, so it is just a case of opening the vApp up, editing the Virtual Machines that have been imported, and allocating the correct vApp network to its NICs.

Tuesday, 30 March 2010

ESXi Rollback

So if you patch an ESXi host, and then realise that actually you want to roll back to the pre patch version, this is possible.

As ESXi is basically just firmware, each time you patch it, the whole thing is replaced. Fortunately, before patching, a backup of the current version is taken and stored. So to roll back to the previous version, just press ctrl r when you see the loading hypervisor screen.