Examples of EnvironmentBrowser


Examples of com.vmware.vim.binding.vim.EnvironmentBrowser

      } else {
         hardwareVersion = VcContext.inVcSessionDo(new VcSession<Integer>() {
            @Override
            protected Integer body() throws Exception {
               VirtualMachine vimVm = vcVm.getManagedObject();
               EnvironmentBrowser envBrowser =
                     MoUtil.getManagedObject(vimVm.getEnvironmentBrowser());
               ConfigOption configOption =
                     envBrowser.queryConfigOption(null, null);
               int hardwareVersion =
                     configOption.getHardwareOptions().getHwVersion();
               logger.info("hardware version is: " + hardwareVersion);
               return hardwareVersion;
            }
View Full Code Here

Examples of com.vmware.vim25.mo.EnvironmentBrowser

  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()))
View Full Code Here

Examples of com.vmware.vim25.mo.EnvironmentBrowser

  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)
View Full Code Here

Examples of com.vmware.vim25.mo.EnvironmentBrowser

  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() &&
View Full Code Here

Examples of com.vmware.vim25.mo.EnvironmentBrowser

 
  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.");
    }
View Full Code Here

Examples of com.vmware.vim25.mo.EnvironmentBrowser

      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);
   
View Full Code Here

Examples of com.vmware.vim25.mo.EnvironmentBrowser

  static public 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()))
View Full Code Here

Examples of com.vmware.vim25.mo.EnvironmentBrowser

  static  public 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)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.