本文整理汇总了C#中VirtualMachine.getMoRef方法的典型用法代码示例。如果您正苦于以下问题:C# VirtualMachine.getMoRef方法的具体用法?C# VirtualMachine.getMoRef怎么用?C# VirtualMachine.getMoRef使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VirtualMachine
的用法示例。
在下文中一共展示了VirtualMachine.getMoRef方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: printNetworkInfo
///<summary>
///Take the ObjectContent[] from RetrieveProperties()
///and print it out.
///ObjectContent[] should have Network information
///</summary>
private static void printNetworkInfo(ObjectContent[] ocs)
{
// Network MoRef -> Network
Hashtable networksByNetwork = new Hashtable();
// Network MoRef -> Host
Hashtable hostsByNetwork = new Hashtable();
// Network MoRef -> VirtualMachine
Hashtable vmsByNetwork = new Hashtable();
// HostSystem MoRef -> Host
Hashtable hostByHost = new Hashtable();
if (ocs != null)
{
for (int i = 0; i < ocs.Length; ++i)
{
ObjectContent oc = ocs[i];
String type = oc.obj.type;
// Create our Network objects
if ("Network".Equals(type))
{
Network network = new Network(oc.obj);
DynamicProperty[] dps = oc.propSet;
if (dps != null)
{
for (int j = 0; j < dps.Length; ++j)
{
DynamicProperty dp = dps[j];
if ("name".Equals(dp.name))
{
network.setName((String)dp.val);
}
}
}
// Put them in the Map
networksByNetwork.Add(oc.obj.Value,
network);
// Create our Host objects
}
else if ("HostSystem".Equals(type))
{
Host cHost = new Host(oc.obj);
ManagedObjectReference[] network = null;
DynamicProperty[] dps = oc.propSet;
if (dps != null)
{
for (int j = 0; j < dps.Length; ++j)
{
String pName = dps[j].name;
Object pVal = dps[j].val;
if ("name".Equals(pName))
{
cHost.setName((String)pVal);
}
else if ("network".Equals(pName))
{
network =
(ManagedObjectReference[])pVal;
}
else if (
"summary.hardware".Equals(pName))
{
cHost.setHardware(
(HostHardwareSummary)pVal);
}
else if ("runtime.connectionState"
.Equals(pName))
{
cHost.setConnectionState(
(HostSystemConnectionState)pVal);
}
else if ("summary.overallStatus"
.Equals(pName))
{
cHost.setOverallStatus(
(ManagedEntityStatus)pVal);
}
else if ("summary.quickStats"
.Equals(pName))
{
cHost.setQuickStats(
(HostListSummaryQuickStats)pVal);
}
}
}
Host host = new Host(
cHost.getMoRef(),
cHost.getName(),
cHost.getHardware(),
cHost.getConnectionState(),
cHost.getOverallStatus(),
cHost.getQuickStats());
hostByHost.Add(
host.getMoRef().Value, host);
for (int n = 0; n < network.Length; ++n)
{
ArrayList hl = (ArrayList)hostsByNetwork[network[n].Value];
//.........这里部分代码省略.........