Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.NodeMetadata


            } else {
               logger.error("maximum pool size reached (%s)", maxSize);
               throw new IllegalStateException(String.format("maximum pool size reached (%s)", maxSize));
            }
         }
         NodeMetadata userNode = Iterables.get(availableNodes, 0);
         NodeMetadata node = metadataStore.store(userNode, options, group);
         logger.info("pool node assigned");
         return new NodeWithInitialCredentials(node);
      }
   }
View Full Code Here


               new AdminAccess.Builder());
   }

   @Override
   public NodeMetadata getNode(String id) {
      NodeMetadata backendMetadata = backendComputeService.get().getNodeMetadata(id);
      if (backendMetadata == null) {
         return null;
      }
      return metadataStore.load(backendMetadata);
   }
View Full Code Here

      if (backendNodes == null || backendNodes.isEmpty()) {
         return ImmutableSet.of();
      }
      final Set<NodeMetadata> loadedSet = Sets.newLinkedHashSet();
      for (NodeMetadata input : backendNodes) {
         NodeMetadata loaded = load(input);
         if (loaded != null) {
            loadedSet.add(loaded);
         }

      }
View Full Code Here

   }

   @Test(groups = "live")
   public void testCanRunCommandAsCurrentUser() throws Exception {
      Set<? extends NodeMetadata> nodes = view.getComputeService().createNodesInGroup("goo", 1);
      NodeMetadata node = Iterables.get(nodes, 0);

      try {
         ExecResponse response = view.getComputeService().runScriptOnNode(node.getId(), exec("id"),
                  wrapInInitScript(false).runAsRoot(false));
         assert response.getOutput().trim().contains(System.getProperty("user.name")) : node + ": " + response;
      } finally {
         view.getComputeService().destroyNode(node.getId());
      }
   }
View Full Code Here

               + "\"user\":\"testuser\",\"password\":\"testpass\",\"privateKey\":\"pk\",\"authenticateSudo\":true}");
   }

   @Test(groups = "unit", dependsOnMethods = "testStore")
   public void testLoad() {
      NodeMetadata loaded = store.load(nodeMeta1);
      assertEquals(loaded.getId(), nodeMeta1.getId());
      assertTrue(loaded.getTags().contains("tag1"));
      assertTrue(loaded.getTags().contains("tag2"));
      assertTrue(loaded.getUserMetadata().containsKey("testmetakey")
               && loaded.getUserMetadata().get("testmetakey").equals("testmetavalue"));
      assertTrue(loaded.getUserMetadata().containsKey("testmetakey2")
               && loaded.getUserMetadata().get("testmetakey2").equals("testmetavalue2"));
      assertEquals(loaded.getCredentials().getUser(), "testuser");
      assertEquals(loaded.getCredentials().getPassword(), "testpass");
      assertEquals(loaded.getCredentials().getPrivateKey(), "pk");
      assertEquals(loaded.getCredentials().shouldAuthenticateSudo(), true);
      assertEquals(loaded.getGroup(), "testgroup");
   }
View Full Code Here

      TemplateOptions options = apiThatCreatesNode.templateOptions().blockUntilRunning(false);
     
      assertTrue(options.as(JoyentCloudTemplateOptions.class).shouldGenerateKey().get());

      NodeMetadata node = Iterables.getOnlyElement(apiThatCreatesNode.createNodesInGroup("test", 1, options));
     
      assertEquals(node.getCredentials().getPrivateKey(), keyPair.get("private"));
   }
View Full Code Here

      MachineInDatacenterToNodeMetadata converter = new MachineInDatacenterToNodeMetadata(
            JoyentCloudComputeServiceContextModule.toPortableNodeStatus, locationIndex,
            Suppliers.<Set<? extends Image>> ofInstance(images),
            Suppliers.<Set<? extends Hardware>> ofInstance(hardwares), namingConvention);

      NodeMetadata convertedNodeMetadata = converter.apply(machineInDatacenterToConvert);

      assertEquals(machineInDatacenterToConvert.slashEncode(), convertedNodeMetadata.getId());
      assertEquals(machineToConvert.getId(), convertedNodeMetadata.getProviderId());

      assertEquals(convertedNodeMetadata.getLocation().getScope(), LocationScope.ZONE);
      assertEquals(convertedNodeMetadata.getLocation().getId(), "us-sw-1");

      assertEquals(machineToConvert.getName(), convertedNodeMetadata.getName());
      assertEquals(convertedNodeMetadata.getGroup(), "sample");

      assertEquals(convertedNodeMetadata.getImageId(), expectedImageId);
      assertEquals(convertedNodeMetadata.getOperatingSystem(), expectedOs);

      assertEquals(convertedNodeMetadata.getHardware(), expectedHardware);

      assertEquals(JoyentCloudComputeServiceContextModule.toPortableNodeStatus.get(machineToConvert.getState()),
            convertedNodeMetadata.getStatus());

      assertNotNull(convertedNodeMetadata.getPrivateAddresses());
      assertEquals(convertedNodeMetadata.getPrivateAddresses(), ImmutableSet.of("10.224.0.63"));

      assertNotNull(convertedNodeMetadata.getPublicAddresses());
      assertEquals(convertedNodeMetadata.getPublicAddresses(), ImmutableSet.of("37.153.96.62"));

      assertNotNull(convertedNodeMetadata.getUserMetadata());
      // ensure filtered out root_authorized_keys!
      assertEquals(convertedNodeMetadata.getUserMetadata(), ImmutableMap.<String, String> of());
   }
View Full Code Here

    * @param clone the target machine
    * @param guestOsUser the user to access the target machine
    * @param guestOsPassword the password to access the target machine
    */
   private void postConfigurations(IMachine clone, String guestOsUser, String guestOsPassword) {
      NodeMetadata partialNodeMetadata = buildPartialNodeMetadata(clone, guestOsUser, guestOsPassword);
      machineUtils.runScriptOnNode(partialNodeMetadata, new DeleteGShadowLock(), RunScriptOptions.NONE);
      machineUtils.runScriptOnNode(partialNodeMetadata, new PasswordlessSudo(partialNodeMetadata.getCredentials().identity), RunScriptOptions.Builder.runAsRoot(true));
   }
View Full Code Here

      final String folder = "redHatAndDerivatives";
      if (osTypeId.contains("RedHat")) {
         File scriptFile = copyScriptToWorkingDir(folder, scriptName);
         copyToNodeAndExecScript(guestOsUser, guestOsPassword, clone.getName(), scriptFile);
      } else if (osTypeId.contains("Ubuntu") || osTypeId.contains("Debian")) {
         NodeMetadata partialNodeMetadata = buildPartialNodeMetadata(clone, guestOsUser, guestOsPassword);

         Optional<NetworkInterfaceCard> optionalNatIfaceCard = Iterables.tryFind(
                 networkSpec.getNetworkInterfaceCards(),
                 new Predicate<NetworkInterfaceCard>() {
View Full Code Here

      String hostOnlyIfIpAddress = iHostNetworkInterfaceWithHostOnlyIfName.getIPAddress();
      String dhcpIpAddress = hostOnlyIfIpAddress.substring(0, hostOnlyIfIpAddress.lastIndexOf(".")) + ".254";
      String dhcpNetmask = "255.255.255.0";
      String dhcpLowerIp = hostOnlyIfIpAddress.substring(0, hostOnlyIfIpAddress.lastIndexOf(".")) + ".2";
      String dhcpUpperIp = hostOnlyIfIpAddress.substring(0, hostOnlyIfIpAddress.lastIndexOf(".")) + ".253";
      NodeMetadata hostNodeMetadata = getHostNodeMetadata();

      ExecResponse response = scriptRunnerFactory
            .create(
                  hostNodeMetadata,
                  Statements.exec(String
View Full Code Here

TOP

Related Classes of org.jclouds.compute.domain.NodeMetadata

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.