Package org.virtualbox_4_0

Examples of org.virtualbox_4_0.IMachine


         return masters.get(key.getId());
      }
      checkState(!key.getId().contains(VIRTUALBOX_NODE_NAME_SEPARATOR), "master image names cannot contain \""
            + VIRTUALBOX_NODE_NAME_SEPARATOR + "\"");
      String vmName = VIRTUALBOX_IMAGE_PREFIX + key.getId();
      IMachine masterMachine;
      Master master;
      // ready the preseed file server
      PreseedCfgServer server = new PreseedCfgServer();
      try {
         // try and find a master machine in vbox
View Full Code Here


      }
   }
  
   @Override
   public Image getImage(String vmName) {
      IMachine image = getNode(vmName);
      if (image == null)
         return null;
      return imachineToImage.apply(image);
   }
View Full Code Here

      return imachineToImage.apply(image);
   }

   @Override
   public synchronized void destroyNode(String vmName) {
      IMachine machine = manager.get().getVBox().findMachine(vmName);
      powerDownMachine(machine);
      try {
         new UnregisterMachineIfExistsAndForceDeleteItsMedia().apply(machine);
      } catch (Exception e) {
         logger.error("Machine (%s) not unregistered!", vmName);
View Full Code Here

      }
   }

   @Override
   public void rebootNode(String vmName) {
      IMachine machine = manager.get().getVBox().findMachine(vmName);
      powerDownMachine(machine);
      launchVMProcess(machine, manager.get().getSessionObject());
   }
View Full Code Here

      launchVMProcess(machine, manager.get().getSessionObject());
   }

   @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();
View Full Code Here

      }
   }

   @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();
View Full Code Here

   private void onAlreadyAttachedExceptionDetachOrPropagate(IVirtualBox vBox, final IMedium medium, VBoxException e) {
      Matcher matcher = ATTACHED_PATTERN.matcher(e.getMessage());
      if (matcher.find()) {
         String machineId = matcher.group(1);
         IMachine immutableMachine = vBox.findMachine(machineId);
         IMediumAttachment mediumAttachment = Iterables.find(immutableMachine.getMediumAttachments(),
                  new Predicate<IMediumAttachment>() {
                     public boolean apply(IMediumAttachment in) {
                        return in.getMedium().getId().equals(medium.getId());
                     }
                  });
         machineUtils.writeLockMachineAndApply(immutableMachine.getName(), new DetachDistroMediumFromMachine(
               mediumAttachment.getController(), mediumAttachment.getPort(), mediumAttachment.getDevice()));
         deleteMediumAndBlockUntilComplete(medium);
      } else {
         throw e;
      }
View Full Code Here

         throw new RuntimeException("error reading default-keystroke-sequence file");
      }
   }

   protected void undoVm(String vmNameOrId) {
      IMachine vm = null;
      try {
         vm = manager.get().getVBox().findMachine(vmNameOrId);
         VmSpec vmSpec = new IMachineToVmSpec().apply(vm);
         int attempts = 0;
         while (attempts < 10 && !vm.getSessionState().equals(SessionState.Unlocked)) {
            attempts++;
            Uninterruptibles.sleepUninterruptibly(200, TimeUnit.MILLISECONDS);
         }
         machineUtils.applyForMachine(vmNameOrId, new UnregisterMachineIfExistsAndDeleteItsMedia(vmSpec));
View Full Code Here

public class ApplyBootOrderToMachineTest {

   @Test
   public void testSetBootOrderSuccessful() throws Exception {
      Map<Long, DeviceType> positionAndDeviceType = ImmutableMap.of(1l, DeviceType.HardDisk);
      IMachine machine = createMock(IMachine.class);
      for(long position : positionAndDeviceType.keySet()) {
         machine.setBootOrder(position, positionAndDeviceType.get(position));
      }
      machine.saveSettings();
      replay(machine);
      new ApplyBootOrderToMachine(positionAndDeviceType).apply(machine);
      verify(machine);
   }
View Full Code Here

   }
  
   @Test
   public void testCloneMachineFromAnotherMachine() {
      IMachine source = getVmWithGuestAdditionsInstalled();
      CloneSpec cloneSpec = CloneSpec.builder().vm(machineSpec.getVmSpec()).network(machineSpec.getNetworkSpec())
               .master(source).linked(true).build();
      IMachine clone = new CloneAndRegisterMachineFromIMachineIfNotAlreadyExists(manager, workingDir, machineUtils)
               .apply(cloneSpec);
      assertTrue(isLinkedClone().apply(clone));
   }
View Full Code Here

TOP

Related Classes of org.virtualbox_4_0.IMachine

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.