本文整理汇总了C#中VirtualMachine.getHost方法的典型用法代码示例。如果您正苦于以下问题:C# VirtualMachine.getHost方法的具体用法?C# VirtualMachine.getHost怎么用?C# VirtualMachine.getHost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtualMachine
的用法示例。
在下文中一共展示了VirtualMachine.getHost方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: printNetworkInfo
//.........这里部分代码省略.........
else if ("network".Equals(pName))
{
network =
(ManagedObjectReference[])pVal;
}
else if ("runtime.host".Equals(pName))
{
cVm.setHost(
(ManagedObjectReference)pVal);
}
else if ("runtime.powerState"
.Equals(pName))
{
cVm.setPowerState(
(VirtualMachinePowerState)pVal);
}
else if ("summary.overallStatus"
.Equals(pName))
{
cVm.setOverallStatus(
(ManagedEntityStatus)pVal);
}
else if ("summary.quickStats"
.Equals(pName))
{
cVm.setQuickStats(
(VirtualMachineQuickStats)pVal);
}
}
}
VirtualMachine vm = new VirtualMachine(
cVm.getMoRef(),
cVm.getName(),
cVm.getHost(),
cVm.getPowerState(),
cVm.getOverallStatus(),
cVm.getQuickStats());
for (int n = 0; n < network.Length; ++n)
{
ArrayList vml = (ArrayList)vmsByNetwork[network[n].Value];
if (vml == null)
{
vml = new ArrayList();
vmsByNetwork.Add(network[n].Value,
vml);
}
vml.Add(vm);
}
}
}
}
// Now the Hashtables have all the information
// Now populate our Network object with the Hosts
// and VMs connected and print out the 'tables'
for (IEnumerator nit = networksByNetwork.GetEnumerator();
nit.MoveNext(); )
{
foreach (String key in networksByNetwork.Keys)
{
Network network = networksByNetwork[key] as Network;
if (network != null)
{
ArrayList vms = (ArrayList)
vmsByNetwork[network.getMoRef().Value];
ArrayList hosts = (ArrayList)hostsByNetwork[network.getMoRef().Value];
Console.WriteLine("Network: " + network.getName());