Hello Everyone
I know this 'might' have been already asked, but I need to help as I’m having major problems understanding this. So, if someone can point me in the right direction, that would be greatly appreciated.
I am 'competent' (to a certain extent) in PowerCLI and feel comfortable creating functions, scripts and even use the Get-View Cmdlet in a load of my scripts to improve performance. Where my knowledge seems to be lacking, is understanding how to use the vSphere Web Services SDK to step up to the 'next' level in my PowerCLI scripting. I have read some of the literature pertaining to the SDK but where I am having problems is actually, implementing it practically. So for example how I go from trying to find a 'property' say, to getting to the correct object to give me the relevant information I require. Kinda hard to explain but it might make a bit more sense if I were to use an example:
So here goes ...... Say for example I am looking for the 'TOTALSLOTS' in a cluster. I do a search in the API (All properties) and it gives me the following property situated in the ClusterDasFailoverLevelAdvancedRuntimeInfoSlotInfo data object.
Now if you read the ‘totalslots’ property it says ‘See SlotInfo’. You go to the ‘SlotInfo’ property which is of type ClusterDasFailoverLevelAdvancedRuntimeInfoSlotInfo . So my understanding would be that if I could get a ‘SlotInfo’ data object I could get to the total slots property. ?!?!?!?
So when I look at that object it comes back with the following:
Now what this tells me is that it’s a property of the previous object (which I know) but what I do not know is where to go from here. ?!??
If anyone can point me in the right direction that would be extremely helpful. I just need some assistance for that ‘Eureka’ moment and hopefully I’ll be fine after that :smileycool:
As always many thanks in advance
Munster
Its also vSphere 5.5 - Build 1312298
I did some searching in the forum and a 'Freakin11' had a similar issue (HA configuration (ClusterDasAdvancedRuntimeInfo) w/ VMWare.vim?))
when coding in C#. He mentioned the following:
And I've answered my own question seconds later. I strongly typed the return and it included the information I needed. I still don't know why there is the discrepancy between return types...
Do I have to return my objects as 'strongly typed' maybe ???
I was wondering is there something I'm missing or havent configured because all I wanted to learn about was the API and i seem to have gone off track :smileycry:
Just to clarify - I opened a new pCLI window and tried the following:
HA ENABLED
C:\> $clusview = get-view -ViewType clustercomputeresource -Filter @{'name'='cluster1'}
C:\> $clusview.RetrieveDasAdvancedRuntimeInfo() | ft -au
DasHostInfo VmcpSupported HeartbeatDatastoreInfo
----------- ------------- ----------------------
{VMware.Vim.DasHeartbeatDatastoreInfo, VMware.Vim.DasHeartbeatDatastoreInfo}
HA DISABLED
C:\> $clusviewHAdis = get-view -ViewType clustercomputeresource -Filter @{'name'='cluster1'}
C:\> $clusview.RetrieveDasAdvancedRuntimeInfo() | ft -au
DasHostInfo VmcpSupported HeartbeatDatastoreInfo
----------- ------------- ----------------------
Still seeing the same object ?!??
Interesting, try with a typecast
$clusterName = 'MyCluster'
$cluster = Get-Cluster -Name $clusterName
$info = [VMware.Vim.ClusterDasFailoverLevelAdvancedRuntimeInfo]($cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo())
$info
Update: The 3rd & 4th lines are one line
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
So following what you have said I get the error:
Cannot convert the "VMware.Vim.ClusterDasAdvancedRuntimeInfo" value of type "VMware.Vim.ClusterDasAdvancedRuntimeInfo" to type "VMware.Vim.ClusterDasFailoverLevelAdvancedRuntimeInfo".
At line:1 char:1
+ $info = [VMware.Vim.ClusterDasFailoverLevelAdvancedRuntimeInfo]($cluster.Extensi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : ConvertToFinalInvalidCastException
So even typecasting is not working.
Do you have a station where you never used PowerCLI ?
I would suggest you do a new install on such a station, and then try from there.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
'Might' be getting closer ......
I had an old workstation I hadn't used in a while hence installed a new copy of PCLI v6 & PS v4. Did the same as you mentioned and got the following:
C:\> $clusterName = 'cluster1'
C:\> $cluster = Get-cluster -Name $clusterName
C:\> $info = [VMware.Vim.ClusterDasFailoverLevelAdvancedRuntimeInfo]($cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo())
Cannot convert the "VMware.Vim.ClusterDasAdvancedRuntimeInfo" value of type "VMware.Vim.ClusterDasAdvancedRuntimeInfo" to type
"VMware.Vim.ClusterDasFailoverLevelAdvancedRuntimeInfo".
At line:1 char:1
+ $info = [VMware.Vim.ClusterDasFailoverLevelAdvancedRuntimeInfo]($cluster.Extensi ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : ConvertToFinalInvalidCastException
C:\> $cluster.ExtensionData.RetrieveDasAdvancedRuntimeInfo() | gm
TypeName: VMware.Vim.ClusterDasAdvancedRuntimeInfo
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
DasHostInfo Property VMware.Vim.ClusterDasHostInfo DasHostInfo {get;set;}
DynamicProperty Property VMware.Vim.DynamicProperty[] DynamicProperty {get;set;}
DynamicType Property string DynamicType {get;set;}
HeartbeatDatastoreInfo Property VMware.Vim.DasHeartbeatDatastoreInfo[] HeartbeatDatastoreInfo {get;set;}
Sorry - there is NO VmcpSupported property like before ?????
Should I completely uninstall and reinstall - because this installation was done within the last 2 weeks
As far as I can tell DasHostInfo was already there on the other station.
Could you show me what you have configured for HA in the cluster ?
This page
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Here you go :
If I use such a HA config, the object is still returned with the slot information.
I'm afraid that at the moment I have no more ideas what could be causing this.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Ouch ( the mighty LucD is at a quandry !) :smileyconfused:
Could you confirm one last thing that my build is OK
PowerCLI C:\> $psversiontable
Name Value
---- -----
PSVersion 4.0
WSManStackVersion 3.0
SerializationVersion 1.1.0.1
CLRVersion 4.0.30319.18063
BuildVersion 6.3.9600.16406
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0}
PSRemotingProtocolVersion 2.2
PowerCLI C:\> Get-PowerCLIVersion
PowerCLI Version
----------------
VMware vSphere PowerCLI 5.8 Release 1 build 2057893
---------------
Snapin Versions
---------------
VMWare AutoDeploy PowerCLI Component 5.5 build 1983942
VMWare ImageBuilder PowerCLI Component 5.5 build 1983942
VMware License PowerCLI Component 5.5 build 1265954
VMware Storage PowerCLI Component 5.8 build 2057894
VMware VDS PowerCLI Component 5.8 build 2031581
VMware vSphere PowerCLI Component 5.8 build 2031581
I had a load of 'stuff' in my 'profile' and even after loading my PCLI console without anything in my profile I am still getting the same ??!?!
That all looks ok.
But if you have the time and the possibility, I would still try a fresh PowerCLI install (on a station that didn't have PowerCLI before).
I'm curious to know if the problem will be there as well then.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
OK Luc
I took a completely new WINDOWS 2012 R2 std install with nothing on it and simply installed PCLI v6 from scratch. (nothing else).
The exact same occurred ?!?!?!?
PowerCLI C:\> $clusview = Get-View -ViewType ClusterComputeResource -Filter @{'Name'='cluster1'}
PowerCLI C:\> $clusview.RetrieveDasAdvancedRuntimeInfo().gettype().name
ClusterDasAdvancedRuntimeInfo
PowerCLI C:\> $clusview.RetrieveDasAdvancedRuntimeInfo()| ft -au
DasHostInfo VmcpSupported HeartbeatDatastoreInfo
----------- ------------- ----------------------
{VMware.Vim.DasHeartbeatDatastoreInfo, VMware.Vim.DasHeartbeatDatastoreInfo}
The cluster definitely has HA enabled but I am still seeing the problem with returning the required objects ?!?!?? Could it be my vcenters ?????
One thing i am finding is that irrespective of HA being enabled or not i am getting the same ClusterDasAdvancedRuntimeInfo object ?!?
Very strange.
I have to admit I don't have an explanation for what you are seeing I'm afraid.
Perhaps someone from the PowerCLI Dev Team could help ?
Or else open a SR with VMware, PowerCLI is supported.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
A wild shot, do you get the same when you start PowerCLI in 32-bit mode ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes I do - same result.
I am slightly confused as to the reasoning behind the 'Extended By' title in the API in relation to what we are doing here. let me explain.....
I understand that when I retrieve the method RetrieveDasAdvancedRuntimeInfo against my clusters it reports back a return value of ClusterDasAdvancedRuntimeInfo data object type. This in turn has an Extended by value of ClusterDasFailoverLevelAdvancedRuntimeInfo - This is the data object I require to get the TOTALSLOTS value I need.
So my question was what does the Extended by mean when trying to work out the relationships of the data objects ????
Looks like I might 'log a call' with VMWare and see if they can help ???? :smileycry:
The Extended By object has a condition listed ( if you have the cluster configured with a "failover level admission control policy.").
If that condition is not met, you will get the ClusterDasAdvancedRuntimeInfo object returned by the RetrieveDasAdvancedRuntimeInfo method.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I have been investigating the issue further and with some help from a VERY old link (andreaspa - https://communities.vmware.com/thread/390211) I tried the following in my environment and this is what i got:
When I change my 'Admission Control Policy' entries I get the following objects:
HOST FAILURES = ClusterDasFailoverLevelAdvancedRuntimeInfo
PERCENTAGE OF CLUSTER RESOURCES = ClusterDasAdvancedRuntimeInfo
FAILOVER HOSTS = ClusterDasAdvancedRuntimeInfo
So its seems that when the policy is changed to 'Host failures' I get the information I require ??!?!
'Andreaspa' didnt also get a resolution to this question. Now I'm wondering, is this indeed a bug ????
Isn't that exactly what the remark "failover level admission control policy." means ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference