Package org.virtualbox_4_0

Examples of org.virtualbox_4_0.IProgress


         throw e;
      }
   }

   void deleteMediumAndBlockUntilComplete(IMedium medium) {
      final IProgress progress = medium.deleteStorage();
      progress.waitForCompletion(-1);
   }
View Full Code Here


   }

   private void createBaseStorage(IMedium hardDisk) {
      try {
         long size = 4L * 1024L * 1024L * 1024L - 4L;
         IProgress storageCreation = hardDisk.createBaseStorage(size,
                  (long) org.virtualbox_4_2.jaxws.MediumVariant.STANDARD.ordinal());
         storageCreation.waitForCompletion(-1);
      } catch (VBoxException e) {
         if (fileNotFoundException(e)) {
            // File for medium could not be found. Something wrong with
            // creation.
            hardDisk.deleteStorage();
View Full Code Here

   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

                  if (machine.getState() == MachineState.Running) {
                     session.getConsole().pause();
                     paused = true;
                  }

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

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

         throw Throwables.propagate(e);
      }
   }

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

   @Override
   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

      public IMedium apply(IMedium medium) {
         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

      List<IMedium> filteredMediaToBeDeleted = Lists.newArrayList(transform(
               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

      @Override
      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

TOP

Related Classes of org.virtualbox_4_0.IProgress

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.