Package org.jclouds.compute.domain

Examples of org.jclouds.compute.domain.Template


    // TODO extract this logic elsewhere
    if (clusterSpec.getProvider().equals("ec2"))
      templateBuilder.imageNameMatches(".*10\\.?04.*").osDescriptionMatches(
          "^ubuntu-images.*").architecture(Architecture.X86_32);

    Template template = templateBuilder.build();

    InstanceTemplate instanceTemplate = clusterSpec
        .getInstanceTemplate(CASSANDRA_ROLE);
    checkNotNull(instanceTemplate);
    int clusterSize = instanceTemplate.getNumberOfInstances();
View Full Code Here


   public void testCorrectExceptionRunningNodesNotFound() throws Exception {
      client.runScriptOnNodesMatching(runningInGroup("zebras-are-awesome"), InstallJDK.fromOpenJDK());
   }

   public void testImageById() {
      Template defaultTemplate = view.getComputeService().templateBuilder().build();
      assertEquals(view.getComputeService().getImage(defaultTemplate.getImage().getId()), defaultTemplate.getImage());
   }
View Full Code Here

   }

   @Test(enabled = true, dependsOnMethods = { "testImagesCache" })
   public void testTemplateMatch() throws Exception {
      template = buildTemplate(client.templateBuilder());
      Template toMatch = client.templateBuilder().imageId(template.getImage().getId()).build();
      assertEquals(toMatch.getImage(), template.getImage());
   }
View Full Code Here

               .put(createServer, createServerResponse)
               .put(serverDetail, serverDetailResponse).build();

      Injector forNetworks = requestsSendResponses(requestResponseMap);

      Template template = forNetworks.getInstance(TemplateBuilder.class).build();
      template.getOptions().as(NovaTemplateOptions.class).networks("4ebd35cf-bfe7-4d93-b0d8-eb468ce2245a");
     
      NovaComputeServiceAdapter adapter = forNetworks.getInstance(NovaComputeServiceAdapter.class);

      NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92", template);
      assertNotNull(server);
View Full Code Here

               .put(createServer, createServerResponse)
               .put(serverDetail, serverDetailResponse).build();

      Injector forDiskConfig = requestsSendResponses(requestResponseMap);

      Template template = forDiskConfig.getInstance(TemplateBuilder.class).build();
      template.getOptions().as(NovaTemplateOptions.class).diskConfig(Server.DISK_CONFIG_AUTO);
     
      NovaComputeServiceAdapter adapter = forDiskConfig.getInstance(NovaComputeServiceAdapter.class);

      NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92", template);
      assertNotNull(server);
View Full Code Here

               .put(createServer, createServerResponse)
               .put(serverDetail, serverDetailResponse).build();

      Injector forSecurityGroups = requestsSendResponses(requestResponseMap);

      Template template = forSecurityGroups.getInstance(TemplateBuilder.class).build();
      template.getOptions().as(NovaTemplateOptions.class).securityGroupNames("group1", "group2");
     
      NovaComputeServiceAdapter adapter = forSecurityGroups.getInstance(NovaComputeServiceAdapter.class);

      NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92",
               template);
View Full Code Here

               .put(createServer, createServerResponse)
               .put(serverDetail, serverDetailResponse).build();

      Injector forSecurityGroups = requestsSendResponses(requestResponseMap);

      Template template = forSecurityGroups.getInstance(TemplateBuilder.class).build();
      template.getOptions().as(NovaTemplateOptions.class).keyPairName("foo");
     
      NovaComputeServiceAdapter adapter = forSecurityGroups.getInstance(NovaComputeServiceAdapter.class);
     
      // we expect to have already an entry in the cache for the key
      LoadingCache<ZoneAndName, KeyPair> keyPairCache = forSecurityGroups.getInstance(Key
View Full Code Here

               .put(createServer, createServerResponse)
               .put(serverDetail, serverDetailResponse).build();

      Injector forSecurityGroups = requestsSendResponses(requestResponseMap);

      Template template = forSecurityGroups.getInstance(TemplateBuilder.class).build();
     
      NovaComputeServiceAdapter adapter = forSecurityGroups.getInstance(NovaComputeServiceAdapter.class);
     
      NodeAndInitialCredentials<ServerInZone> server = adapter.createNodeWithGroupEncodedIntoName("test", "test-e92",
            template);
View Full Code Here

    if (clusterSpec.getProvider().equals("ec2"))
      masterTemplateBuilder.imageNameMatches(".*10\\.?04.*")
      .osDescriptionMatches("^ubuntu-images.*")
      .architecture(Architecture.X86_32);
   
    Template masterTemplate = masterTemplateBuilder.build();
   
    InstanceTemplate instanceTemplate = clusterSpec.getInstanceTemplate(MASTER_ROLE);
    checkNotNull(instanceTemplate);
    checkArgument(instanceTemplate.getNumberOfInstances() == 1);
    Set<? extends NodeMetadata> nodes;
    try {
      nodes = computeService.runNodesWithTag(
          clusterSpec.getClusterName(), 1, masterTemplate);
    } catch (RunNodesException e) {
      // TODO: can we do better here (retry?)
      throw new IOException(e);
    }
    NodeMetadata node = Iterables.getOnlyElement(nodes);
    InetAddress namenodePublicAddress = InetAddress.getByName(Iterables.get(node.getPublicAddresses(),0));
    InetAddress jobtrackerPublicAddress = InetAddress.getByName(Iterables.get(node.getPublicAddresses(),0));
   
    FirewallSettings.authorizeIngress(computeServiceContext, node, clusterSpec,
        WEB_PORT);
    FirewallSettings.authorizeIngress(computeServiceContext, node, clusterSpec,
        NAMENODE_WEB_UI_PORT);
    FirewallSettings.authorizeIngress(computeServiceContext, node, clusterSpec,
        JOBTRACKER_WEB_UI_PORT);
    FirewallSettings.authorizeIngress(computeServiceContext, node, clusterSpec,
        namenodePublicAddress.getHostAddress(), NAMENODE_PORT);
    FirewallSettings.authorizeIngress(computeServiceContext, node, clusterSpec,
        namenodePublicAddress.getHostAddress(), JOBTRACKER_PORT);
    if (!namenodePublicAddress.equals(jobtrackerPublicAddress)) {
      FirewallSettings.authorizeIngress(computeServiceContext, node, clusterSpec,
          jobtrackerPublicAddress.getHostAddress(), NAMENODE_PORT);
      FirewallSettings.authorizeIngress(computeServiceContext, node, clusterSpec,
          jobtrackerPublicAddress.getHostAddress(), JOBTRACKER_PORT);
    }

    // Launch slaves (DN and TT)
    byte[] slaveBootScript = RunUrlBuilder.runUrls(
      "sun/java/install",
      String.format("%s dn,tt -n %s -j %s",
          hadoopInstallRunUrl,
          namenodePublicAddress.getHostName(),
          jobtrackerPublicAddress.getHostName()));

    TemplateBuilder slaveTemplateBuilder = computeService.templateBuilder()
      .osFamily(UBUNTU)
      .options(runScript(slaveBootScript)
      .installPrivateKey(clusterSpec.readPrivateKey())
      .authorizePublicKey(clusterSpec.readPublicKey()));

    // TODO extract this logic elsewhere
    if (clusterSpec.getProvider().equals("ec2"))
      slaveTemplateBuilder.imageNameMatches(".*10\\.?04.*")
      .osDescriptionMatches("^ubuntu-images.*")
      .architecture(Architecture.X86_32);
   
    Template slaveTemplate = slaveTemplateBuilder.build();
   
    instanceTemplate = clusterSpec.getInstanceTemplate(WORKER_ROLE);
    checkNotNull(instanceTemplate);

    Set<? extends NodeMetadata> workerNodes;
View Full Code Here

    TemplateBuilder templateBuilder = mock(TemplateBuilder.class);
    when(computeService.templateBuilder()).thenReturn(templateBuilder);
    when(templateBuilder.from((TemplateBuilderSpec)any())).thenReturn(templateBuilder);
    when(templateBuilder.options((TemplateOptions)any())).thenReturn(templateBuilder);

    Template template = mock(Template.class);
    TemplateOptions options = mock(TemplateOptions.class);
    Image image = mock(Image.class);
    when(templateBuilder.build()).thenReturn(template);
    when(template.getOptions()).thenReturn(options);
    when(template.getImage()).thenReturn(image);

    AWSEC2TemplateOptions awsEec2TemplateOptions = mock(AWSEC2TemplateOptions.class);
    when(options.as((Class<TemplateOptions>) any())).thenReturn(awsEec2TemplateOptions);

    BootstrapTemplate.build(clusterSpec, computeService,
View Full Code Here

TOP

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

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.