Package com.vmware.vim.binding.vim

Examples of com.vmware.vim.binding.vim.VirtualMachine


                  Folder folder = MoUtil.getManagedObject(folderRef);
                  for (ManagedObjectReference vmRef : folder.getChildEntity()) {
                     if (VmodlTypeMap.Factory.getTypeMap()
                           .getVmodlType(VirtualMachine.class).getWsdlName()
                           .equals(vmRef.getType())) {
                        VirtualMachine child = MoUtil.getManagedObject(vmRef);
                        if (child._getRef().equals(serverVm.getMoRef())) {
                           return folder;
                        }
                     }
                  }
               }
View Full Code Here


         protected VcVirtualMachine body() throws Exception {
            for (ManagedObjectReference vmRef : parentFolder.getChildEntity()) {
               if (VmodlTypeMap.Factory.getTypeMap()
                     .getVmodlType(VirtualMachine.class).getWsdlName()
                     .equals(vmRef.getType())) {
                  VirtualMachine child = MoUtil.getManagedObject(vmRef);
                  if (child.getConfig().getName().equals(templateVmName)) {
                     return (VcVirtualMachine) VcCache.get(child);
                  }
               }
            }
            return null;
View Full Code Here

         hardwareVersion = -1;
      } 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);
View Full Code Here

   static final String DBVM_CONFIG = "dbvm.config";
   static final long GUEST_VAR_CHECK_INTERVAL = 3000; // in milliseconds

   @Override
   protected void update(ManagedObject mo) throws Exception {
      VirtualMachine vm = (VirtualMachine)mo;
      config = checkReady(vm.getConfig());
      resourcePool = vm.getResourcePool();
      if (!isTemplate()) {
         checkReady(resourcePool);
      }
      parentVApp = vm.getParentVApp();
      datastores = Arrays.asList(checkReady(vm.getDatastore()));
      layoutEx = checkReady(vm.getLayoutEx());
      updateSnapshots(vm);
   }
View Full Code Here

      updateSnapshots(vm);
   }

   @Override
   protected synchronized void updateRuntime(ManagedObject mo) throws Exception {
      VirtualMachine vm = (VirtualMachine)mo;
      this.runtime = checkReady(vm.getRuntime());
      Summary summary = checkReady(vm.getSummary());
      StorageSummary storageSummary = checkReady(summary.getStorage());
      storageUsage = new DiskSize(storageSummary.getUnshared());
      storageCommitted = new DiskSize(storageSummary.getCommitted());
      /* XXX Layout needs to be updated in both update() and updateRuntime()
       * as it contains both configuration & runtime data.
       */
      this.layoutEx = checkReady(vm.getLayoutEx());
      /**
       * VC sometime can get out of sync with hostd on VM's power state.
       * This cachedPowerState is computed base on return values of events
       * and/or VC calls, which may be different from VC's runtime state.
       * We trust cachedPowerState more than runtime state if they are out of sync.
View Full Code Here

            VcContext.getVcLongCallHandler().execute(
                  new VcLongCallHandler.VcLongCall<Void>() {
                     @Override
                     public Void callVc() throws Exception {
                        VirtualMachine vm = getManagedObject();
                        vm.refreshStorageInfo();
                        return null;
                     }
                  });
         } catch (Exception e) {
            setNeedsStorageInfoRefresh(true);
            throw e;
         }

         VirtualMachine vm = getManagedObject();
         Summary summary = checkReady(vm.getSummary());
         StorageSummary storageSummary = checkReady(summary.getStorage());
         storageUsage = new DiskSize(storageSummary.getUnshared());
         storageCommitted = new DiskSize(storageSummary.getCommitted());
         layoutEx = checkReady(vm.getLayoutEx());
      }
   }
View Full Code Here

    */
   @Override
   public DiskChangeInfo queryChangedDiskAreas(VcSnapshot endMarkerSnapshot,
         DeviceId deviceId, long startOffset, String diskChangeId) throws Exception {
      VirtualDisk vmdk = (VirtualDisk) getVirtualDevice(deviceId);
      VirtualMachine vm = getManagedObject();
      return vm.queryChangedDiskAreas(endMarkerSnapshot.getMoRef(), vmdk.getKey(),
            startOffset, diskChangeId);
   }
View Full Code Here

    * Wait in a loop for VC's view of the VM's power state
    * to be back in sync.
    */
   private void waitForPowerStateToSync(PowerState state, int timeout) throws Exception {
      AuAssert.check(Thread.holdsLock(this));
      VirtualMachine vm = getManagedObject();
      try {
         while (timeout > 0) {
            runtime = checkReady(vm.getRuntime());
            // If runtime state matches the claimed power state, done.
            if (runtime.getPowerState() == state) {
               return;
            }
            logger.info("syncing power state " + state + " on " + this);
View Full Code Here

   @Override
   public VcTask powerOn(final VcHost host, final IVcTaskCallback callback) throws Exception {
      VcTask task = VcContext.getTaskMgr().execute(new IVcTaskBody() {
         public VcTask body() throws Exception {
            VirtualMachine vm = getManagedObject();
            return new VcTask(TaskType.PowerOn, vm.powerOn(host == null ? null : host.getMoRef()), callback);
         }
      });

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

    */
   @Override
   public VcTask powerOff(final IVcTaskCallback callback) throws Exception {
      VcTask task = VcContext.getTaskMgr().execute(new IVcTaskBody() {
         public VcTask body() throws Exception {
            VirtualMachine vm = getManagedObject();
            return new VcTask(TaskType.PowerOff, vm.powerOff(), callback);
         }
      });

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

TOP

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

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.