Package org.virtualbox_4_2

Examples of org.virtualbox_4_2.IProgress.waitForCompletion()


      IVirtualBox vbox = vboxMgr.getVBox();
      ISession s = vboxMgr.getSessionObject();
      IMachine machine = this.importAppliance(vbox, s);
      /* TODO Headless */
      IProgress p = machine.launchVMProcess(s, "gui", "");
      p.waitForCompletion(-1);
      Thread.sleep(3000);
      IConsole c = s.getConsole();
      String opt = "microcore home=hda1\n";
      send(opt, c.getKeyboard());
      Client oc = this.getOutpost(s, vbox);
View Full Code Here


        long ref = System.currentTimeMillis();
        try {
          List<IMedium> media = m
              .unregister(CleanupMode.DetachAllReturnHardDisksOnly);
          IProgress p = m.delete(media);
          p.waitForCompletion(-1);
        } catch (Exception e) {
          LOGGER.error("cleaning up " + m.getName() + " failed", e);
        }
        long elapsed = System.currentTimeMillis() - ref;
        LOGGER.debug("cleaned up {} in {} ms",
View Full Code Here

  }

  private IMachine importAppliance(IVirtualBox vbox, ISession s) {
    IAppliance app = vbox.createAppliance();
    IProgress p = app.read(appliance.getAbsolutePath());
    p.waitForCompletion(-1);
    app.interpret();
    Set<String> oids = this.getMachineIds(vbox);
    p = app.importMachines();
    p.waitForCompletion(-1);
    IMachine machine = null;
View Full Code Here

    IProgress p = app.read(appliance.getAbsolutePath());
    p.waitForCompletion(-1);
    app.interpret();
    Set<String> oids = this.getMachineIds(vbox);
    p = app.importMachines();
    p.waitForCompletion(-1);
    IMachine machine = null;
    for (IMachine m : vbox.getMachines()) {
      if (!oids.contains(m.getId())) {
        machine = m;
        break;
View Full Code Here

      s = vboxMgr.openMachineSession(m);
    } catch (Exception e) {
      throw new IOException(e);
    }
    IProgress p = s.getConsole().powerDown();
    p.waitForCompletion(-1);
    vboxMgr.closeMachineSession(s);
  }
}
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

      assertTrue(mediumDeleted);
   }

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

}
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

         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.