Package org.jclouds.virtualbox.domain

Examples of org.jclouds.virtualbox.domain.NetworkSpec$Builder


                                                    .tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder()
                                                                      .addNetworkAdapter(networkAdapter)
                                                                      .build();

      NetworkSpec networkSpec = NetworkSpec.builder()
                                           .addNIC(networkInterfaceCard)
                                           .build();
      machineSpec = MasterSpec.builder()
                              .iso(isoSpec)
                              .vm(instanceVmSpec)
View Full Code Here


              .cleanUpMode(CleanupMode.Full)
              .forceOverwrite(true)
              .build();

      // case 'vbox host is localhost': NAT + HOST-ONLY
      NetworkSpec networkSpec = networkUtils.createNetworkSpecWhenVboxIsLocalhost();

      return CloneSpec.builder()
              .linked(true)
              .master(nodeSpec.getMaster().getMachine())
              .network(networkSpec)
View Full Code Here

               || e.getMessage().contains("Could not find a registered machine with UUID {");
   }

   private IMachine cloneMachine(CloneSpec cloneSpec) {
      VmSpec vmSpec = cloneSpec.getVmSpec();
      NetworkSpec networkSpec = cloneSpec.getNetworkSpec();
      boolean isLinkedClone = cloneSpec.isLinked();
      IMachine master = cloneSpec.getMaster();
      String flags = "";
      List<String> groups = ImmutableList.of();
      String group = "";
      String settingsFile = manager.get().getVBox().composeMachineFilename(vmSpec.getVmName(), group , flags , workingDir);
      IMachine clonedMachine = manager
               .get()
               .getVBox()
               .createMachine(settingsFile, vmSpec.getVmName(), groups, vmSpec.getOsTypeId(), flags);
      List<CloneOptions> options = Lists.newArrayList();
      if (isLinkedClone)
         options.add(CloneOptions.Link);

      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
      manager.get().getVBox().registerMachine(clonedMachine);

      // Networking
      for (NetworkInterfaceCard networkInterfaceCard : networkSpec.getNetworkInterfaceCards()) {
         new AttachNicToMachine(vmSpec.getVmName(), machineUtils).apply(networkInterfaceCard);
      }
     
      // set only once the creds for this machine, same coming from its master
      logger.debug("<< storing guest credentials on vm(%s) as extra data", clonedMachine.getName());
View Full Code Here

      NetworkAdapter networkAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.NAT)
               .tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
               .build();

      NetworkSpec networkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();

      MasterSpec machineSpec = MasterSpec.builder()
               .iso(IsoSpec.builder().sourcePath(operatingSystemIso).installationScript("").build()).vm(vmSpec)
               .network(networkSpec).build();
      IMachine debianNode = view.utils().injector()
View Full Code Here

               .attachISO(1, 1, guestAdditionsIso).build();

      VmSpec vmSpec = VmSpec.builder().id(vmId).name(vmName).memoryMB(512).controller(ideController).cleanUpMode(mode)
               .osTypeId("SomeWeirdUnknownOs").forceOverwrite(true).build();
      IsoSpec isoSpec = IsoSpec.builder().sourcePath(operatingSystemIso).installationScript("").build();
      NetworkSpec networkSpec = NetworkSpec.builder().build();
      MasterSpec machineSpec = MasterSpec.builder().iso(isoSpec).vm(vmSpec).network(networkSpec).build();
      try {
         Injector injector = view.utils().injector();
         injector.getInstance(CreateAndRegisterMachineFromIsoIfNotAlreadyExists.class).apply(machineSpec);
         fail();
View Full Code Here

            .tcpRedirectRule(providerSupplier.get().getHost(), NetworkUtils.MASTER_PORT, "", 22).build();

      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
            .slot(0L).build();

      NetworkSpec networkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();

      String installationSequence = currentImage.keystroke_sequence.replace("HOSTNAME", vmSpecification.getVmName());
      return MasterSpec.builder()
                       .vm(vmSpecification)
                       .iso(IsoSpec.builder()
View Full Code Here

      NetworkAdapter networkAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.NAT)
               .tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
               .build();

      NetworkSpec networkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();
      return MasterSpec.builder().iso(isoSpec).vm(sourceVmSpec).network(networkSpec).build();
   }
View Full Code Here

      NetworkAdapter networkAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.NAT)
               .tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
      NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
               .build();

      NetworkSpec networkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();
      machineSpec = MasterSpec.builder().iso(isoSpec).vm(instanceVmSpec).network(networkSpec).build();

   }
View Full Code Here

      NetworkAdapter networkAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.HostOnly)
               .build();
      NetworkInterfaceCard networkInterfaceCard =  NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
            .addHostInterfaceName("vboxnet0").slot(0L).build();
      NetworkSpec networkSpec = NetworkSpec.builder().addNIC(networkInterfaceCard).build();
      machineSpec = MasterSpec.builder().iso(isoSpec).vm(instanceVmSpec).network(networkSpec).build();
   }
View Full Code Here

      return newMachine;
   }

   private void ensureConfiguration(MasterSpec machineSpec) {
      VmSpec vmSpec = machineSpec.getVmSpec();
      NetworkSpec networkSpec = machineSpec.getNetworkSpec();
      String vmName = vmSpec.getVmName();

      // Change BootOrder
      Map<Long, DeviceType> positionAndDeviceType = ImmutableMap.of(1l, DeviceType.HardDisk);
      ensureMachineHasDesiredBootOrder(vmName, positionAndDeviceType);

      // Change RAM
      ensureMachineHasMemory(vmName, vmSpec.getMemory());

      Set<StorageController> controllers = vmSpec.getControllers();
      if (controllers.isEmpty()) {
         throw new IllegalStateException(missingIDEControllersMessage(vmSpec));
      }
      StorageController controller = controllers.iterator().next();
      ensureMachineHasStorageControllerNamed(vmName, controller);
      setupHardDisksForController(vmName, controller);
      setupDvdsForController(vmSpec, vmName, controller);

      // Networking
      for (NetworkInterfaceCard networkInterfaceCard : networkSpec.getNetworkInterfaceCards()) {
         new AttachNicToMachine(vmName, machineUtils).apply(networkInterfaceCard);
      }
   }
View Full Code Here

TOP

Related Classes of org.jclouds.virtualbox.domain.NetworkSpec$Builder

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.