當前位置: 首頁>>代碼示例>>Java>>正文


Java EnvironmentBrowser.queryConfigTarget方法代碼示例

本文整理匯總了Java中com.vmware.vim25.mo.EnvironmentBrowser.queryConfigTarget方法的典型用法代碼示例。如果您正苦於以下問題:Java EnvironmentBrowser.queryConfigTarget方法的具體用法?Java EnvironmentBrowser.queryConfigTarget怎麽用?Java EnvironmentBrowser.queryConfigTarget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.vmware.vim25.mo.EnvironmentBrowser的用法示例。


在下文中一共展示了EnvironmentBrowser.queryConfigTarget方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getDVPortgroupInfo

import com.vmware.vim25.mo.EnvironmentBrowser; //導入方法依賴的package包/類
public DistributedVirtualPortgroupInfo getDVPortgroupInfo(VirtualMachine machine, String networkName) {
    HostSystem host = new HostSystem(machine.getServerConnection(), machine.getRuntime().getHost());
    ComputeResource computeResource = (ComputeResource) host.getParent();
    EnvironmentBrowser envBrowser = computeResource.getEnvironmentBrowser();

    DistributedVirtualPortgroupInfo dvPortgroupInfo = null;
    try {
        ConfigTarget configTarget = envBrowser.queryConfigTarget(host);

        // 分散ポートグループの場合
        if (configTarget.getDistributedVirtualPortgroup() != null) {
            // 分散ポートグループ情報を取得
            dvPortgroupInfo = findDVPortgroupInfo(configTarget.getDistributedVirtualPortgroup(), networkName);
        }
    } catch (RemoteException e) {
        throw new RuntimeException(e);
    }

    return dvPortgroupInfo;
}
 
開發者ID:primecloud-controller-org,項目名稱:primecloud-controller,代碼行數:21,代碼來源:VmwareNetworkProcess.java

示例2: getValidCdromOnHost

import com.vmware.vim25.mo.EnvironmentBrowser; //導入方法依賴的package包/類
private List<String> getValidCdromOnHost() throws InvalidProperty, RuntimeFault, RemoteException 
{
  List<String> result = new ArrayList<String>();

  EnvironmentBrowser envBrower = vm.getEnvironmentBrowser();

  ConfigTarget configTarget;

  try 
  {
    configTarget = envBrower.queryConfigTarget(null);
  } 
  catch (Exception ex) 
  {
    throw new RuntimeException("Error in getting Cdrom devices from host.");
  }

  if(configTarget != null && configTarget.cdRom != null) 
  {
    for(VirtualMachineCdromInfo cdromInfo : configTarget.cdRom) 
    {
             result.add(cdromInfo.name);
    }
  }
  return result;
}
 
開發者ID:Juniper,項目名稱:vijava,代碼行數:27,代碼來源:VirtualMachineDeviceManager.java

示例3: doesNetworkNameExist

import com.vmware.vim25.mo.EnvironmentBrowser; //導入方法依賴的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;
}
 
開發者ID:Juniper,項目名稱:vijava,代碼行數:23,代碼來源:VmNicOp.java

示例4: findDatastoreSummary

import com.vmware.vim25.mo.EnvironmentBrowser; //導入方法依賴的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;
}
 
開發者ID:Juniper,項目名稱:vijava,代碼行數:26,代碼來源:VmCdOp.java

示例5: createNetworkAdapter

import com.vmware.vim25.mo.EnvironmentBrowser; //導入方法依賴的package包/類
/** Create a new virtual network adapter on the VM
* Your MAC address should start with 00:50:56
  */
 public void createNetworkAdapter(VirtualNetworkAdapterType type, String networkName, String macAddress, boolean wakeOnLan, boolean startConnected) throws InvalidProperty, RuntimeFault, RemoteException, InterruptedException
 {
   VirtualMachinePowerState powerState = vm.getRuntime().getPowerState();
   String vmVerStr = vm.getConfig().getVersion();
   int vmVer = Integer.parseInt(vmVerStr.substring(vmVerStr.length()-2));
   
   if((powerState == VirtualMachinePowerState.suspended) ||
     (powerState == VirtualMachinePowerState.suspended && vmVer < 7))
   {
     throw new InvalidPowerState();
   }
   
   HostSystem host = new HostSystem(vm.getServerConnection(), vm.getRuntime().getHost());
   ComputeResource cr = (ComputeResource) host.getParent();
   EnvironmentBrowser envBrowser = cr.getEnvironmentBrowser();
   ConfigTarget configTarget = envBrowser.queryConfigTarget(host);
   VirtualMachineConfigOption vmCfgOpt = envBrowser.queryConfigOption(null, host);

   type = validateNicType(vmCfgOpt.getGuestOSDescriptor(), vm.getConfig().getGuestId(), type);

   VirtualDeviceConfigSpec nicSpec = createNicSpec(type, networkName, macAddress, wakeOnLan, startConnected, configTarget);
   
   VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
   vmConfigSpec.setDeviceChange(new VirtualDeviceConfigSpec []{nicSpec});
   Task task = vm.reconfigVM_Task(vmConfigSpec);

   task.waitForTask(200, 100);
 }
 
開發者ID:Juniper,項目名稱:vijava,代碼行數:32,代碼來源:VirtualMachineDeviceManager.java


注:本文中的com.vmware.vim25.mo.EnvironmentBrowser.queryConfigTarget方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。