Examples of ISession


Examples of org.virtualbox_4_2.ISession

               + nodeSpec.getTag() + VIRTUALBOX_NODE_NAME_SEPARATOR + nodeSpec.getName();
   }

   private void deleteExistingSnapshot(Master master) {
      if (master.getMachine().getCurrentSnapshot() != null) {
         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

Examples of org.virtualbox_4_2.ISession

   }

   @Override
   public void resumeNode(String vmName) {
      IMachine machine = manager.get().getVBox().findMachine(vmName);
      ISession machineSession;
      try {
         machineSession = manager.get().openMachineSession(machine);
         machineSession.getConsole().resume();
         machineSession.unlockMachine();
      } catch (Exception e) {
         throw Throwables.propagate(e);
      }
   }
View Full Code Here

Examples of org.virtualbox_4_2.ISession

   }

   @Override
   public void suspendNode(String vmName) {
      IMachine machine = manager.get().getVBox().findMachine(vmName);
      ISession machineSession;
      try {
         machineSession = manager.get().openMachineSession(machine);
         machineSession.getConsole().pause();
         machineSession.unlockMachine();
      } catch (Exception e) {
         throw Throwables.propagate(e);
      }
   }
View Full Code Here

Examples of org.virtualbox_4_2.ISession

      this.environment = environment;
   }

   @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(). "
                       + "The machine might already be running.", errorCode);
               break;
            default:
               propagate(e);
         }
      } finally {
         if (session.getState() == SessionState.Locked) {
            // Remove session lock taken by launchVmProcess()
            session.unlockMachine();
            // TODO this unlock is not IMMEDIATELY visible outside (vbox doc)
         }
      }
      return session;
   }
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.