Sunday, September 28, 2014

vCenter Appliance 5.5 AD authentication and Web client Failed to connect to VMware Lookup Service




Failed to execute '/usr/sbin/vpxd_servicecfg 'ad' 'test' 'vkunal@vcloud.lab' CENSORED 'vcloud.lab'':
VC_CFG_RESULT=309(Error: Invalid hostname. FQDN is required for joining a domain.)

Source: VMware KB
I was in the process of rebuilding my virtual lab, while setting up vCenter appliance 5.5 I got above error, that not able to connect to active directory. As I knew we can reconfigure this option later, I proceeded with rest of the setup and decided to troubleshoot it later and removed check box from active directory using back button.



Everything got configured correctly except AD authentication, as I have habit to document everything and already created seme on installing and configuring vcenter appliance 5.5.  After comparison I found what mistake I did (missed one step) while configuring vcenter appliance which can be seen here. I didn’t provided FQDN. Which was not allowing me to enabling active directory and it was failing.



VC_CFG_RESULT=302(Error: Enabling Active Directory failed.)



To change host name I puttied into vcenter appliance and used below commands to verify and correct it.

echo vc001.vcloud.lab > /etc/HOSTNAME

hostname vc001.vcloud.lab



Then verified it using commands that I able to see FQDN correctly.

hostname

cat /etc/hostname



I also made DNS entries (forward and reverse) for vCenter appliance (Best practices link)

Then checked name resolution from appliance itself.

Restarted appliance to reflect changes. And confirmed that Hostname is showing correctly.


And in the last, reconfiguration AD authentication was successful (under reconfigure vcenter server\Authentication)


Restart appliance one more time to take effect for changes made to AD configuration,



After all this done When I tried to login with vmware vsphere web client. I faced another issue 

Failed to connect to VMware Lookup Service https://vc001.vcloud.lab:7444/lookupservice/sdk - SSL certificate verification failed.

For this I enabled certificate regeneration under admin tab and submitted it.

One more restart require for this. And after I am able to login successfully through VMware web client.
 

Thursday, September 25, 2014

VMware Datastores inventory powercli

I written this simple and small script, and use to pull datastore inventory data regularly to review the usage and other information, this script, helps me lot in many situation as an Inventory, Capacity Management or any other stuffs. It pulls below details,

Hostname
Datastore Name
Runtime ID
Connonical Device ID (Naa ID)
FreeSpace and Capacity in GB
VMFS File system version
Multipathing Policy for Hostname (Where Datastore is mounted)
How many datacenter this datastore belongs to
all the VMs running on the datastores

 
  #####################################   
  ## http://kunaludapi.blogspot.com   
  ## Version: 2  
  ## Date: 27 August 2014    
  ## Script tested on below platform   
  ## 1) Powershell v3   
  ## 2) Powercli v5.5   
  ## 3) Vsphere 5.1   
  ####################################  
 Add-PSSnapin vmware.vimautomation.core  
 Connect-Viserver #vcenterserver    

function Get-DatastoreInventory {  
   $HostDatastoreInfo = Get-VMHost | Get-ScsiLun -LunType disk   
   $DatastoreInfo = Get-Datastore  
   foreach ($Hostdatastore in $HostDatastoreInfo) {   
     $Datastore = $DatastoreInfo | Where-Object {$_.extensiondata.info.vmfs.extent.Diskname -match $Hostdatastore.CanonicalName}  
     if ($Datastore.ExtensionData.vm) {  
       $VMsOnDatastore = $(Get-view $Datastore.ExtensionData.vm).name -join ","  
     }  
     else {$VMsOnDatastore = "No VMs"}  
   
 #Work on not assigned Luns error at silentlyContinue  
     $DatastoreName = $Datastore.Name -join ","  
     $DatastoreFreeSpace = $Datastore.FreeSpaceGB -join ","  
     $DatastoreCapacityGB = $Datastore.CapacityGB -join ","  
     $DatastoreDatacenter = $Datastore.Datacenter -join ","  
   
     $Obj = New-Object PSObject  
     $Obj | Add-Member -Name VMhost -MemberType NoteProperty -Value $hostdatastore.VMHost  
     $Obj | Add-Member -Name DatastoreName -MemberType NoteProperty -Value $DatastoreName   
     $Obj | Add-Member -Name FreeSpaceGB -MemberType NoteProperty -Value $DatastoreFreeSpace  
     $Obj | Add-Member -Name CapacityGB -MemberType NoteProperty -Value $DatastoreCapacityGB  
     $Obj | Add-Member -Name FileSystemVersion -MemberType NoteProperty -Value $Datastore[0].FileSystemVersion  
     $Obj | Add-Member -Name RuntimeName -MemberType NoteProperty -Value $hostdatastore.RuntimeName  
     $Obj | Add-Member -Name CanonicalName -MemberType NoteProperty -Value $hostdatastore.CanonicalName  
     $Obj | Add-Member -Name MultipathPolicy -MemberType NoteProperty -Value $hostdatastore.MultipathPolicy  
     $Obj | Add-Member -Name Vendor -MemberType NoteProperty -Value $hostdatastore.Vendor  
     $Obj | Add-Member -Name DatastoreDatacenter -MemberType NoteProperty -Value $DatastoreDatacenter  
     $Obj | Add-Member -Name VMsOnDataStore -MemberType NoteProperty -Value $VMsOnDatastore  
     $Obj  
   }  
 }  
 Get-DatastoreInventory

This is the data format it will pull.


I will be adding provisioned space to it soon.

vSphere Datastores inventory report powercli - Volume 2

Saturday, September 20, 2014

Fixing CD/DVD stuck on connecting on VM console

Many times I have faced issue while mounting ISO file to VM console and then it is goes stuck on CD/DVD connecting grey state, where I am not able to do much.



To fix this, I set CD/DVD drive mode to Passthrough IDE (Recommended).



Once the setting done, Close vsphere client completely and open it again.



On VM console try Connect to ISO image on local disk. This time it should successfully get connected.



Note: The passthrough device can only be used on one virtual machine at a time.
Reference VMWare KB

What is differance between Passthrough IDE and Emulate IDE?
Select the mode used for the connection.

  • Passthrough IDE (raw). Use mode only for remote client device access.
  • Emulate IDE. Use to access a host CD-ROM device.
The host CD-ROM device is accessed through emulation mode. Passthrough mode is not functional for local host CD-ROM access. You can write or burn a remote CD only through pass-through mode access, but in emulation mode you can only read a CD-ROM from a host CD-ROM device.