本文整理汇总了Java中com.vmware.vim25.mo.VirtualMachine.getEnvironmentBrowser方法的典型用法代码示例。如果您正苦于以下问题:Java VirtualMachine.getEnvironmentBrowser方法的具体用法?Java VirtualMachine.getEnvironmentBrowser怎么用?Java VirtualMachine.getEnvironmentBrowser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.vmware.vim25.mo.VirtualMachine
的用法示例。
在下文中一共展示了VirtualMachine.getEnvironmentBrowser方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doesNetworkNameExist
import com.vmware.vim25.mo.VirtualMachine; //导入方法依赖的package包/类
static boolean doesNetworkNameExist(VirtualMachine vm,
String netName) throws Exception
{
VirtualMachineRuntimeInfo vmRuntimeInfo = vm.getRuntime();
EnvironmentBrowser envBrowser = vm.getEnvironmentBrowser();
ManagedObjectReference hmor = vmRuntimeInfo.getHost();
HostSystem host = new HostSystem(
vm.getServerConnection(), hmor);
ConfigTarget cfg = envBrowser.queryConfigTarget(host);
VirtualMachineNetworkInfo[] nets = cfg.getNetwork();
for (int i = 0; nets!=null && i < nets.length; i++)
{
NetworkSummary netSummary = nets[i].getNetwork();
if (netSummary.isAccessible() &&
netSummary.getName().equalsIgnoreCase(netName))
{
return true;
}
}
return false;
}
示例2: findDatastoreSummary
import com.vmware.vim25.mo.VirtualMachine; //导入方法依赖的package包/类
static DatastoreSummary findDatastoreSummary(VirtualMachine vm, String dsName) throws Exception
{
DatastoreSummary dsSum = null;
VirtualMachineRuntimeInfo vmRuntimeInfo = vm.getRuntime();
EnvironmentBrowser envBrowser = vm.getEnvironmentBrowser();
ManagedObjectReference hmor = vmRuntimeInfo.getHost();
if(hmor == null)
{
System.out.println("No Datastore found");
return null;
}
ConfigTarget configTarget = envBrowser.queryConfigTarget(new HostSystem(vm.getServerConnection(), hmor));
VirtualMachineDatastoreInfo[] dis = configTarget.getDatastore();
for (int i=0; dis!=null && i<dis.length; i++)
{
dsSum = dis[i].getDatastore();
if (dsSum.isAccessible() && dsName.equals(dsSum.getName()))
{
break;
}
}
return dsSum;
}
示例3: getDefaultDevices
import com.vmware.vim25.mo.VirtualMachine; //导入方法依赖的package包/类
static VirtualDevice[] getDefaultDevices(VirtualMachine vm)
throws Exception
{
VirtualMachineRuntimeInfo vmRuntimeInfo = vm.getRuntime();
EnvironmentBrowser envBrowser = vm.getEnvironmentBrowser();
ManagedObjectReference hmor = vmRuntimeInfo.getHost();
VirtualMachineConfigOption cfgOpt = envBrowser.queryConfigOption(null, new HostSystem(vm.getServerConnection(), hmor));
VirtualDevice[] defaultDevs = null;
if (cfgOpt != null)
{
defaultDevs = cfgOpt.getDefaultDevice();
if (defaultDevs == null)
{
throw new Exception("No Datastore found in ComputeResource");
}
}
else
{
throw new Exception("No VirtualHardwareInfo found in ComputeResource");
}
return defaultDevs;
}