Hey All,
It is nice to see a vb.net example has finally made it on to the dev site Thanks for that.
I have started to work with it, but am stuck and was hoping someone could help?
I have downloaded the sample code and it runs well, but how do I retrieve all of the vswitches for a specific host? How are where in the following code block would I do this? Thanks in advance.
'Sub gethostinformation()
' Dim OC() As VimApi.ObjectContent
' OC = find_objects(VCConnection, ConnectionDetails.RootFolder, "HostSystem", New String() {"name", "summary"})
' For l As Integer = 0 To OC.Length - 1
' Dim Objects As Array
' Objects = OC(l).propSet
' Dim hostname As String = ""
' Dim Vmotion As Boolean = False
' Dim maxvcpu As Integer = 0
' For i As Integer = 0 To Objects.Length - 1
' Dim DP As New VimApi.DynamicProperty
' DP = Objects(i)
' If DP.name = "name" Then ' here the dynamic property is just a string, so we will retrieve the value of it.
' hostname = DP.val
' End If
' If DP.name = "capability" Then ' here the dynamic property is of the type HostCapability (see SDK reference guide).
' Dim cp As New VimApi.HostCapability
' cp = DP.val
' Vmotion = cp.vmotionSupported
' maxvcpu = cp.maxSupportedVcpus
' End If
' Next
' MsgBox("Host : " + hostname)
' MsgBox(" Vmotion supported : " + Vmotion.ToString)
' MsgBox(" maxSupportedVcpus : " + maxvcpu.ToString)
' Next
'End Sub
If you found this helpful, please consider awarding points
Hi,
To retrieve all the vswitches for a specific host, you need to drill down to the HostVirtualSwitch property.
The path which leads to the above property is HostSystem->config->network->vswtich.
(Access the config property of the HostSystem managed object in the same way as your code is accessing HostCapability property)
I hope this information is helpful.
Thanks.
Angela
Hi,
To retrieve all the vswitches for a specific host, you need to drill down to the HostVirtualSwitch property.
The path which leads to the above property is HostSystem->config->network->vswtich.
(Access the config property of the HostSystem managed object in the same way as your code is accessing HostCapability property)
I hope this information is helpful.
Thanks.
Angela