Package org.virtualbox_4_0

Examples of org.virtualbox_4_0.IProgress.waitForCompletion()


   public ISession ensureMachineHasPowerDown(String vmName) {
      ISession session = machineUtils.sharedLockMachineAndApplyToSession(vmName, new Function<ISession, ISession>() {
         @Override
         public ISession apply(ISession session) {
            IProgress powerdownIProgress = session.getConsole().powerDown();
            powerdownIProgress.waitForCompletion(-1);
            return session;
         }
      });
      return checkNotNull(session, "session");
   }
View Full Code Here


                     session.getConsole().pause();
                     paused = true;
                  }

                  IProgress progress = session.getConsole().takeSnapshot(snapshotName, snapshotDesc);
                  progress.waitForCompletion(-1);

                  if (paused) {
                     session.getConsole().resume();
                  }
View Full Code Here

      }
   }

   private void launchVMProcess(IMachine machine, ISession session) {
      IProgress prog = machine.launchVMProcess(session, "gui", "");
      prog.waitForCompletion(-1);
      session.unlockMachine();
   }

   private void powerDownMachine(IMachine machine) {
      try {
View Full Code Here

   public ISession apply(IMachine machine) {
      ISession session = manager.getSessionObject();
      try {
         final IProgress progress = machine
                 .launchVMProcess(session, type.stringValue(), environment);
         progress.waitForCompletion(-1);
      } catch (VBoxException e) {
         ErrorCode errorCode = ErrorCode.valueOf(e);
         switch (errorCode) {
            case VBOX_E_INVALID_OBJECT_STATE:
               logger.warn(e, "Could not start machine. Got error code %s from launchMachine(). "
View Full Code Here

      List<IMedium> filteredMediaToBeDeleted = Lists.newArrayList(transform(mediaToBeDeleted,
               new DeleteChildrenOfMedium()));
      if (!filteredMediaToBeDeleted.isEmpty()) {
         try {
            IProgress deletion = machine.delete(filteredMediaToBeDeleted);
            deletion.waitForCompletion(100);
         } catch (Exception e) {
            logger.error(e, "Problem in deleting the media attached to %s", machine.getName());
            Throwables.propagate(e);
         }
      }
View Full Code Here

         checkNotNull(medium.getChildren());
         if (medium.getDeviceType().equals(DeviceType.HardDisk)) {
            for (IMedium child : medium.getChildren()) {
               try {
                  IProgress deletion = child.deleteStorage();
                  deletion.waitForCompletion(-1);
               } catch (Exception e) {
                  // work around media that are still attached to other vm's. this can happen when a
                  // running node is used to create a new image and then an attempt at deleting it
                  // is made
                  if (e.getMessage().contains("is still attached to the following")) {
View Full Code Here

               filter(mediaToBeDeleted, new AutoDeleteHardDiskPredicate(vmSpec)), new DeleteChildrenOfMedium()));

      if (!filteredMediaToBeDeleted.isEmpty()) {
         try {
            IProgress deletion = machine.delete(filteredMediaToBeDeleted);
            deletion.waitForCompletion(-1);
         } catch (Exception e) {
            logger.error(e, "Problem in deleting the media attached to %s", machine.getName());
            Throwables.propagate(e);
         }
      }
View Full Code Here

      public IMedium apply(IMedium medium) {
         checkNotNull(medium.getChildren());
         if (medium.getDeviceType().equals(DeviceType.HardDisk)) {
            for (IMedium child : medium.getChildren()) {
               IProgress deletion = child.deleteStorage();
               deletion.waitForCompletion(-1);
            }
         }
         return medium;
      }
View Full Code Here

         ISession session;
         try {
            session = manager.get().getSessionObject();
            master.getMachine().lockMachine(session, LockType.Write);
            IProgress progress = session.getConsole().deleteSnapshot(master.getMachine().getCurrentSnapshot().getId());
            progress.waitForCompletion(-1);
            session.unlockMachine();
         } catch (Exception e) {
            throw new RuntimeException("error opening vbox machine session: " + e.getMessage(), e);
         }
         logger.debug("<< deleted an existing snapshot of vm(%s)", master.getMachine().getName());
View Full Code Here

      ISnapshot currentSnapshot = new TakeSnapshotIfNotAlreadyAttached(manager,
            "snapshotName", "snapshotDesc", logger).apply(master);
      IProgress progress = currentSnapshot.getMachine().cloneTo(clonedMachine,
            CloneMode.MachineState, options);
      progress.waitForCompletion(-1);

      // memory may not be the same as the master vm
      clonedMachine.setMemorySize(cloneSpec.getVmSpec().getMemory());

      // registering
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.