Package com.vmware.vim25.mo.samples.vm

Examples of com.vmware.vim25.mo.samples.vm.CreateVM


    super(context, morType, morValue);
  }
 
  public HostHardwareSummary getHostHardwareSummary() throws Exception {
    HostConnectInfo hostInfo = _context.getService().queryHostConnectionInfo(_mor);
    HostHardwareSummary hardwareSummary = hostInfo.getHost().getHardware();
    return hardwareSummary;
  }
View Full Code Here


      s_logger.trace("vCenter API trace - getHyperHostResourceSummary(). target MOR: " + _mor.get_value());
   
    VmwareHypervisorHostResourceSummary summary = new VmwareHypervisorHostResourceSummary();
   
    HostConnectInfo hostInfo = _context.getService().queryHostConnectionInfo(_mor);
    HostHardwareSummary hardwareSummary = hostInfo.getHost().getHardware();
   
    // TODO: not sure how hyper-thread is counted in VMware resource pool
    summary.setCpuCount(hardwareSummary.getNumCpuCores()*hardwareSummary.getNumCpuPkgs());
    summary.setMemoryBytes(hardwareSummary.getMemorySize());
    summary.setCpuSpeed(hardwareSummary.getCpuMhz());

      if(s_logger.isTraceEnabled())
      s_logger.trace("vCenter API trace - getHyperHostResourceSummary() done");
    return summary;
  }
View Full Code Here

    // directly from VMware resource pool
    //
    // When we break cluster hosts into individual hosts used in our resource allocator,
    // we will have to populate ComputeResourceSummary by ourselves here
    //
    HostHardwareSummary hardwareSummary = getHostHardwareSummary();
   
    ComputeResourceSummary resourceSummary = new ComputeResourceSummary();
   
    // TODO: not sure how hyper-threading is counted in VMware
    short totalCores = (short)(hardwareSummary.getNumCpuCores()*hardwareSummary.getNumCpuPkgs());
    resourceSummary.setNumCpuCores(totalCores);
   
    // Note: memory here is in Byte unit
    resourceSummary.setTotalMemory(hardwareSummary.getMemorySize());
   
    // Total CPU is based on socket x core x Mhz
    int totalCpu = hardwareSummary.getCpuMhz() * totalCores;
    resourceSummary.setTotalCpu(totalCpu);

    HostListSummaryQuickStats stats = getHostQuickStats();
    if(stats.getOverallCpuUsage() == null || stats.getOverallMemoryUsage() == null)
      throw new Exception("Unable to get valid overal CPU/Memory usage data, host may be disconnected");
   
    resourceSummary.setEffectiveCpu(totalCpu - stats.getOverallCpuUsage());
   
    // Note effective memory is in MB unit
    resourceSummary.setEffectiveMemory(hardwareSummary.getMemorySize()/(1024*1024) - stats.getOverallMemoryUsage());
   
      if(s_logger.isTraceEnabled())
      s_logger.trace("vCenter API trace - getHyperHostHardwareSummary() done");
     
    return resourceSummary;
View Full Code Here

   
    // Total CPU is based on socket x core x Mhz
    int totalCpu = hardwareSummary.getCpuMhz() * totalCores;
    resourceSummary.setTotalCpu(totalCpu);

    HostListSummaryQuickStats stats = getHostQuickStats();
    if(stats.getOverallCpuUsage() == null || stats.getOverallMemoryUsage() == null)
      throw new Exception("Unable to get valid overal CPU/Memory usage data, host may be disconnected");
   
    resourceSummary.setEffectiveCpu(totalCpu - stats.getOverallCpuUsage());
   
    // Note effective memory is in MB unit
    resourceSummary.setEffectiveMemory(hardwareSummary.getMemorySize()/(1024*1024) - stats.getOverallMemoryUsage());
   
      if(s_logger.isTraceEnabled())
      s_logger.trace("vCenter API trace - getHyperHostHardwareSummary() done");
     
    return resourceSummary;
View Full Code Here

    return (HostNetworkInfo)_context.getServiceUtil().getDynamicProperty(_mor, "config.network");
  }
 
  public HostPortGroupSpec getHostPortGroupSpec(String portGroupName) throws Exception {
   
    HostNetworkInfo hostNetInfo = getHostNetworkInfo();
   
    HostPortGroup[] portGroups = hostNetInfo.getPortgroup();
    if(portGroups != null) {
      for(HostPortGroup portGroup : portGroups) {
        HostPortGroupSpec spec = portGroup.getSpec();
        if(spec.getName().equals(portGroupName))
          return spec;
View Full Code Here

        }

        String morefOfNewVm = null;
       
        /* wait nfc lease */
        HttpNfcLeaseState hls;
    while (true) {
      hls = httpNfcLease.getState();
      if (hls == HttpNfcLeaseState.ready ||
                hls == HttpNfcLeaseState.error) { break; }
    }
View Full Code Here

                return node.getSnapshot();
            } else {
                VirtualMachineSnapshotTree[] childTree =
                    node.getChildSnapshotList();
                if (childTree != null) {
                    ManagedObjectReference mor =
                        findSnapshotInTree(childTree, snapName);
                    if (mor != null) { return mor; }
                }
            }
        }
View Full Code Here

       
        VirtualMachineSnapshotTree[] snapTree =
            vm_.getSnapshot().getRootSnapshotList();
       
        if (snapTree != null) {
            ManagedObjectReference mor = findSnapshotInTree(snapTree, snapName);
            if (mor != null) {
                return new
                    VirtualMachineSnapshot(vm_.getServerConnection(), mor);
            }
        }
View Full Code Here

        if (entityType == null || morefStr == null) {
            return null;
        }

        /* create managed object reference */
        ManagedObjectReference mor = new ManagedObjectReference();
        mor.setType(entityType);
        mor.setVal(morefStr);

        return mor;
    }
View Full Code Here

     */
    protected VirtualMachine generateVirtualMachineWithMoref(String morefStr)
    {
        if (si_ == null || morefStr == null) { return null; }

        ManagedObjectReference mor =
            generateMoref("VirtualMachine", morefStr);
        if (mor == null) { return null; }

        ManagedEntity vm =
            MorUtil.createExactManagedEntity(si_.getServerConnection(), mor);
View Full Code Here

TOP

Related Classes of com.vmware.vim25.mo.samples.vm.CreateVM

Copyright © 2018 www.massapicom. 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.