Understanding different kinds of virtual disks and their creation using vSphere SDK
0 comments Posted by vvirtualizeFollowing are the virtual disk types that are relevant to ESX/ESXi:
1. thin
2. pre-allocated (should be used instead of “thick” which we do not recommend any more)
3. eagerZeroedThick
4. rdm
5. rdmp
For the first 3 types of virtual disks, one should use the VirtualDiskFlatVer2BackingInfo as the backing for your VirtualDisk in the the VirtualMachineConfigSpec when creating/reconfiguring the VM.
* If the thinProvisioned property is set, it is a thin disk
* If thinProvisioned is false (or not set) AND eagerlyScrub is false (or not set), it is a preallocated disk
* If eagerlyScrub is true AND thinProvisioned is false, it is an eagerZeroedThick disk
For the last 2 types of virtual disks, one should use the
VirtualDiskRawDiskMappingVer1BackingInfo as part of the
VirtualMachineConfigSpec when creating/reconfiguring the VM.
* If the compatibilityMode property is set to virtualMode, the disk is of type rdm
* If it is set to physicalMode, the disk is of type rdmp
Labels: virtual disk, vmdk
vSphere client script-based plug-in behavior with different values of “Display” attribute of URL tag
0 comments Posted by vvirtualizeThe display behavior of the URL mentioned in script based plug-ins, varies with different values of the “Display” attribute specified while registering the plug-in. You can register the plug-in with different extension points for example menu, tab etc., but display behavior of the URL is only applicable in context to Menu extensions. In case you register your plug-in with Tab extension, then URL will be launched in the tab only for all display modes.
a. If Display attribute is not specified.
For example:
<url >http://maps.google.com</url>
Then URL, i.e., web page maps.google.com opens in the new browser window.
b. If Display attribute "window" is specified.
For example:
<url display="window">http://maps.google.com</url>
Then, a non-modal window (c# form) is opened and the url is launched within the client.
c. If Display attribute "modalwindow" is specified.
For example:
<url display="modalwindow">http://maps.google.com</url>
Then, a modal window is opened and the url is launched within the client.
d. If Display attribute "none" is specified.
For example:
<url display="none">http://maps.google.com</url>
In case you want to run any script without launching any UI on the click of menu item, then you can specify display attribute value as “none”.
Labels: Plugin, VI-Client Plugin
As per the XML Schemas, the sequence tag in the WSDL file specifies a list of sub elements. This list gives an order in which the sub-elements should appear in the SOAP request. If this sequence is not followed, server does not interpret the SOAP request correctly and throws a fault.
It is the responsibility of the SOAP client to follow the WSDL design and construct the SOAP request. Maintaining the sequence of elements is among one of the several points to keep in mind.
To illustrate this using vSphere APIs, while creating an Alarm using CreateAlarm API, one has to follow the sequence when passing properties in the AlarmSpec. To refer the WSDL definition for the AlarmSpec object, click "Show WSDL type definition" below the object:
Thus, ordering of the elements is a major factor in the SOAP requests processing.
Labels: sequence, soap request, wsdl
What should be disk.key parameter when adding multiple virtual disks?
0 comments Posted by vvirtualizeWhen adding multiple virtual disks to a VM (either during createVM or reconfig operation), we assign the disk.key as a negative number. This ensures that hostd automatically assigns a unique positive key to the new virtual disk. However, when adding multiple disks, this negative number should also be unique. For e.g., while adding 2 virtual disks, both disks should not have same negative integer assigned, for e.g., "-100". It should be -100 and -101.
We have sometimes seen a behavior which leads to additional 0-byte VMDKs being created because of same negative number being assigned to all virtual disks being added. With unique negative number for each virtual disk, this issue got resolved.
Labels: disk.key, virtual disk, vmdk
I installed a vCenter on a VM, and accidentally the IP address of the VM changed (will not lie, I changed intentionally, IP was difficult to rememberJ ). In next few seconds, the hosts that were being managed by vCenter showed as disconnected through vSphere Client. I tried to reconnect them but it displayed “heart beat” mismatch error under “Summary” tab.
There are few steps to rectify this error.
1. From vSphere Client, right-click on the ESX host and click Remove.
2. Remove the agent from ESX host.
3. Add the ESX host again to vCenter inventory. Select New > Add Host.
This will result in reinstallation of the VMware vCenter Server agent.
I tried to automate this in Power Shell. Below is the script for the same:
{code}
$Server = Read-Host "Enter the server name"
$S_User = Read-Host "Enter the User name to connect server"
$S_Password = Read-Host "Enter the Password to connect server"
$DCname = Read-Host "Enter the Datacenter name"
# Connect to server
Connect-VIServer $Server -User $S_User -Password $S_Password
$si = get-view serviceinstance
# Build of the VC
$build = $si.content.about.Build
# Version of the VC
$version = $si.content.about.Version
#Host name to remove the agent
$HostName = Read-Host "Enter the Host name to remove agent"
#Removing the Host from VC
Remove-VMHost -VMHost (Get-VMHost -Name $HostName) -Confirm:$false
$VCBuild = "$version-$build"
#credentials of the User having shell excess
$User = Read-Host "Enter the User name having shell access"
$Password = Read-Host "Enter the User's password having shell access"
#Path of putty available
$plink = "c:\putty\plink.exe"
$plinkoptions = " -v -batch -pw $Password"
#To implement special commands like "|" and "&&" ,I have used the below way
$cmd1 = 'rpm -qa "|" grep vpxa'
$cmd2 = 'service mgmt-vmware stop "&&" service vmware-vpxa stop "&&" service vmware-vmkauthd stop "&&" service xinetd restart'
$cmd3 = 'rpm -qa "|" grep -i vpxa "|" awk ''{print $1}''"|" xargs rpm -ef $1 "&&" userdel vpxuser "&&" service mgmt-vmware start "&&" service vmware-vmkauthd start'
#command1 for VirtualCenter Agents on Host
$command = $plink + " " + $plinkoptions + " " + $User + "@" + $HostName + " " + $cmd1
#command2 for stopping the management services
$command2 = $plink + " " + $plinkoptions + " " + $User + "@" + $HostName + " " + $cmd2
#command3 for removing the vpxa agent, "userdel vpxuser" removes the vpxa user, restart the services of Host
$command3 = $plink + " " + $plinkoptions + " " + $User + "@" + $HostName + " " + $cmd3
#invoking the command1
$msg = Invoke-Expression -command $command
#invoking the command2
$msg1 = Invoke-Expression -command $command2
#invoking the command3
$msg2 = Invoke-Expression -command $command3
#time given to restart the services
sleep -Seconds 500
# Adding the Host to the VC, agent will automatically get installed
Add-VMHost -Name $HostName -User $User -Password $Password -Location (Get-Datacenter -Name $DCname)
{code}
Pre-requisites to run the above script:-
- PowerShell
- VMware vSphere PowerCLI
- Putty
Note: This script will work against ESX classic hosts only.
Labels: conflict, powershell, vCenter IP