Package com.vmware.vim.binding.vim

Examples of com.vmware.vim.binding.vim.ResourcePool


   @Override
   public String getPath() { return path; }

   @Override
   protected void update(ManagedObject mo) throws Exception {
      ResourcePool rp = (ResourcePool)mo;
      childVMs = Arrays.asList(rp.getVm());
      owner = rp.getOwner();
      parent = rp.getParent();
      name = rp.getName();
      isVApp = (rp instanceof VirtualApp);
      if (isVApp) {
         VirtualApp vapp = (VirtualApp)mo;
         ProductInfo[] pInfo = vapp.getVAppConfig().getProduct();
         version = pInfo[0].getVersion();
         fullVersion = pInfo[0].getFullVersion();
      }
      ResourceConfigSpec config = rp.getConfig();
      cpuAlloc = config.getCpuAllocation();
      memAlloc = config.getMemoryAllocation();

      // XXX: The cpuUsgae and memUsgae should really belong
      // to the runtime info. We putting them into configuration category is
      // to temporarily fix bug 865341 in Borealis. Should be refactorred later.
      ResourcePool.RuntimeInfo runtime = rp.getRuntime();
      cpuUsage = runtime.getCpu();
      memUsage = runtime.getMemory();

      for (ManagedObjectReference vmRef : childVMs) {
         VcCache.putVmRpPair(vmRef, getMoRef());
View Full Code Here


      updatePath();
   }

   @Override
   protected void updateRuntime(ManagedObject mo) throws Exception {
      ResourcePool rp = (ResourcePool)mo;
      ResourcePool.RuntimeInfo runtime = rp.getRuntime();
      cpuUsage = runtime.getCpu();
      memUsage = runtime.getMemory();
   }
View Full Code Here

      return String.format("RP[%s](cpu:R=%d,L=%d,mem:R=%d,L=%d,#vm=%d)", path,
            cpuReservation, cpuLimit, memReservation, memLimit, childVMs.size());
   }

   private List<ManagedObjectReference> getChildRps() {
      ResourcePool rp = null;
      if (VcContext.isInSession()) {
         rp = getManagedObject();
      } else {
         rp = VcContext.inVcSessionDo(new VcSession<ResourcePool>() {
            @Override
            protected ResourcePool body() throws Exception {
               return getManagedObject();
            }
         });
      }
      return Arrays.asList(rp.getResourcePool());
   }
View Full Code Here

         VcContext.getTaskMgr().execPseudoTask("ResourcePool.createResourcePool",
            VcEventType.ResourcePoolCreated, getMoRef(),
            new IVcPseudoTaskBody() {
         @Override
         public final ManagedObjectReference body() throws Exception {
            final ResourcePool rp = getManagedObject();
            ManagedObjectReference child = null;
            //at least execute once
            while (true) {
               try {
                  child = rp.createResourcePool(name, spec);
                  break;
               } catch (DuplicateName ex) {
                  if (force) {
                     //suppress this exception, and remove duplicated RP, then retry.
                     update();
View Full Code Here

    * @see com.vmware.aurora.vc.VcResourcePool#importVApp(com.vmware.vim.binding.vim.ImportSpec)
    */
   @Override
   public HttpNfcLease importVApp(ImportSpec spec) throws Exception {
      AuAssert.check(VcContext.isInTaskSession());
      ResourcePool rp = getManagedObject();
      VcDatacenter dc = getVcCluster().getDatacenter();
      return MoUtil.getManagedObject(rp.importVApp(spec, dc.getVmFolderMoRef(), null));
   }
View Full Code Here

    * @see com.vmware.aurora.vc.VcResourcePool#destroyChildren()
    */
   @Override
   public void destroyChildren() throws Exception {
      AuAssert.check(VcContext.isInTaskSession());
      ResourcePool rp = getManagedObject();
      rp.destroyChildren();
      for (ManagedObjectReference rpRef : getChildRps()) {
         VcCache.purge(rpRef);
      }
      update();
   }
View Full Code Here

    * @throws Exception
    */
   private VcTask destroy(final IVcTaskCallback callback) throws Exception {
      VcTask task = VcContext.getTaskMgr().execute(new IVcTaskBody() {
         public VcTask body() throws Exception {
            final ResourcePool rp = getManagedObject();
            return new VcTask(TaskType.DestroyRp, rp.destroy(), callback);
         }
      });

      logger.debug("destroy_rp task RP " + this + " created");
      return task;
View Full Code Here

      VcContext.getTaskMgr().execPseudoTask("ResourcePool.updateConfig",
            VcEventType.ResourcePoolReconfigured, getMoRef(),
            new IVcPseudoTaskBody() {
         @Override
         public ManagedObjectReference body() throws Exception {
            final ResourcePool rp = getManagedObject();
            ResourceConfigSpec spec = null;
            if (cpuAllocation != null || memAllocation != null) {
               spec = new ResourceConfigSpecImpl(
                     null, null, null, cpuAllocation, memAllocation);
               }
            rp.updateConfig(MoUtil.toURLString(name), spec);
            update();
            VcCache.refresh(parent)// to refresh its parent's cpu/mem usage
            return getMoRef();
         }
      });
View Full Code Here

TOP

Related Classes of com.vmware.vim.binding.vim.ResourcePool

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.