当前位置: 首页>>代码示例>>Java>>正文


Java RunNodesException类代码示例

本文整理汇总了Java中org.jclouds.compute.RunNodesException的典型用法代码示例。如果您正苦于以下问题:Java RunNodesException类的具体用法?Java RunNodesException怎么用?Java RunNodesException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RunNodesException类属于org.jclouds.compute包,在下文中一共展示了RunNodesException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUpClass

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
@BeforeClass
public static void setUpClass() throws RunNodesException {
    Assume.assumeTrue(HekateTestProps.is("AWS_TEST_ENABLED"));

    Properties props = new Properties();

    props.setProperty(LocationConstants.PROPERTY_REGIONS, REGION);

    ContextBuilder builder = newBuilder("aws-ec2").credentials(
        ACCESS_KEY,
        SECRET_KEY
    ).overrides(props);

    ComputeService compute = builder.modules(ImmutableSet.<Module>of(new SLF4JLoggingModule()))
        .buildView(ComputeServiceContext.class)
        .getComputeService();

    for (int i = 0; i < 4; i++) {
        ensureNodeExists(i, compute);
    }
}
 
开发者ID:hekate-io,项目名称:hekate,代码行数:22,代码来源:AwsCloudSeedNodeProviderTest.java

示例2: testCleanUp

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
public void testCleanUp() throws
    InvalidCredentialsException, RunNodesException, URISyntaxException, KaramelException, InterruptedException {
  int size = 1;
  String clusterName = "c1";
  String groupName = "g1";
  String zone = "europe-west1-b";
  List<MachineRuntime> machines = forkMachines(clusterName, groupName, size, zone);
  List<String> vms = new ArrayList<>(machines.size());
  for (MachineRuntime machine : machines) {
    vms.add(machine.getName());
  }
  Map<String, List<String>> vmZone = new HashMap<>();
  vmZone.put(zone, vms);
  GceLauncher launcher = new GceLauncher(context, new SshKeyPair());
  String networkName = launcher.createFirewall(
      clusterName, groupName, Settings.GCE_DEFAULT_IP_RANGE, ImmutableSet.of("22/tcp"));
  Thread.sleep(60000);
  launcher.cleanup(vmZone, clusterName, ImmutableSet.of(groupName));
  InstanceApi instanceApi = context.getGceApi().instancesInZone(zone);
  for (String vm : vms) {
    assert instanceApi.get(vm) == null;
  }
  NetworkApi netApi = context.getNetworkApi();
  assert netApi.get(networkName) == null;
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:26,代码来源:GceLauncherTest.java

示例3: forkMachines

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
private List<MachineRuntime> forkMachines(String clusterName, String groupName, int size, String zone)
    throws InvalidCredentialsException, RunNodesException, ValidationException {
  SshKeyPair keypair = new SshKeyPair();
  //TODO: read the public key from the configured path.
  keypair.setPublicKey("ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCl4GSkn3cO2pl18ZJiPE9wKmoSJRDuL+JFoVQlrmpcw/"
      + "a2tcvS1Bjf2YlNVdDpDQ8vYNgkQjuZ4f2O7dDeMC/vi9eHOe3xZxBvTGpZREkKrQrUg9VfVYriYo8VvyPlXnRbim4wr9yPGdo"
      + "YPMRBoXkheGQiAI7pk7OG0JjLp8Jm0keBQb/J/Lbe/2zFIi/zQzmOPliNs7HVV/4R/QytmYpJyhZU3mJIhiWC7Hu1lZqMAJco"
      + "GRuhkisQt0VYoOZC8wgAkkthloOXamKztraG2Azseohk7sHiBEHsUdlxgivIM9ItUqa1x/4xI9u/AIztaPJrJiy2Syi3kZc0oe56G9WZ");
  Gce gce = new Gce();
  gce.setImage("ubuntu-1404-trusty-v20150316");
  gce.setZone(zone);
  gce.setType(GceSettings.MachineType.n1_standard_1.toString());
  gce.setUsername("hooman");
  GceLauncher launcher = new GceLauncher(context, keypair);
  ClusterRuntime cluster = new ClusterRuntime(clusterName);
  JsonGroup jsonGroup = new JsonGroup();
  jsonGroup.setName(groupName);
  GroupRuntime group = new GroupRuntime(cluster, jsonGroup);

  List<MachineRuntime> machines = launcher.forkMachines(group, size, gce);

  return machines;
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:24,代码来源:GceLauncherTest.java

示例4: testThatWhenNodesAreCreatedTheyAreQueriedForAndReturnThePublicIpAddresses

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
/**
 * This integration test creates instances in the security group and then runs the
 * {@link AwsSecurityGroupAwareDiscoveryService#getHostsInSecurityGroup()} to retrieve the hosts and check that all
 * host IP addresses have been retrieved.
 * 
 * @throws RunNodesException
 */
@Test
public void testThatWhenNodesAreCreatedTheyAreQueriedForAndReturnThePublicIpAddresses() throws RunNodesException {
	Set<? extends NodeMetadata> nodesInGroup =
			getComputeService().createNodesInGroup(getSecurityGroupId(), 2);
	
	// Run the method to get the hosts in this group
	Set<CachePeerHost> hostsInSecurityGroup = awsSecurityGroupAwareDiscoveryService.getHostsInSecurityGroup();
	Assert.assertEquals(2, hostsInSecurityGroup.size());

	// Make sure that all of the public IP's exist from what was created to what was discovered
	for (NodeMetadata node : nodesInGroup) {
		Iterator<String> publicIpIterator = node.getPublicAddresses().iterator();
		Assert.assertTrue("No public IP addresses available for '" + node.getId() + "'", publicIpIterator.hasNext());
		String publicIp = publicIpIterator.next();
		CachePeerHost hostToMatch = new CachePeerHost(publicIp, RMI_LISTENER_PORT);
		Assert.assertTrue("Could not find created AWS node '" + hostToMatch +
				"' in my hosts list: " + hostsInSecurityGroup,
				hostsInSecurityGroup.contains(hostToMatch));
	}
}
 
开发者ID:brdara,项目名称:ehcache-aws,代码行数:28,代码来源:AwsSecurityGroupAwareDiscoveryServiceIntegrationTest.java

示例5: createServer

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
/**
 * Create a server based on a Template. This method uses Template.fromHardware() and Template.fromImage() to
 * also demonstrate iterating through Hardware and Images. Alternatively you do the same without iterating
 * using the following Template.
 *
 * Template template = computeService.templateBuilder()
 *     .locationId(getLocationId())
 *     .osFamily(OsFamily.UBUNTU)
 *     .osVersionMatches("14.04")
 *     .minRam(1024)
 *     .build();
 */
private void createServer() throws RunNodesException, TimeoutException {
   System.out.format("Create Server%n");

   Template template = computeService.templateBuilder()
         .locationId(REGION)
         .fromHardware(getHardware())
         .fromImage(getImage())
         .build();

   // This method will continue to poll for the server status and won't return until this server is ACTIVE
   // If you want to know what's happening during the polling, enable logging. See
   // /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
   Set<? extends NodeMetadata> nodes = computeService.createNodesInGroup(NAME, 1, template);

   NodeMetadata nodeMetadata = nodes.iterator().next();
   String publicAddress = nodeMetadata.getPublicAddresses().iterator().next();

   System.out.format("  %s%n", nodeMetadata);
   System.out.format("  Login: ssh %[email protected]%s%n", nodeMetadata.getCredentials().getUser(), publicAddress);
   System.out.format("  Password: %s%n", nodeMetadata.getCredentials().getOptionalPassword().get());
}
 
开发者ID:jclouds,项目名称:jclouds-examples,代码行数:34,代码来源:CreateServer.java

示例6: createServer

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
private Set<? extends NodeMetadata> createServer() throws RunNodesException, TimeoutException {
   System.out.format("Create Server%n");

   RegionAndId regionAndId = RegionAndId.fromRegionAndId(REGION, "performance1-1");
   Template template = computeService.templateBuilder()
         .locationId(REGION)
         .osDescriptionMatches(".*Ubuntu 14.04.*")
         .hardwareId(regionAndId.slashEncode())
         .build();

   // This method will continue to poll for the server status and won't return until this server is ACTIVE
   // If you want to know what's happening during the polling, enable logging.
   // See /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
   Set<? extends NodeMetadata> nodes = computeService.createNodesInGroup(NAME, numServers, template);

   for (NodeMetadata nodeMetadata: nodes) {
      System.out.format("  %s%n", nodeMetadata);
   }

   return nodes;
}
 
开发者ID:jclouds,项目名称:jclouds-examples,代码行数:22,代码来源:CloudServersPublish.java

示例7: createServer

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
/**
 * Create a server with the key pair.
 */
private NodeMetadata createServer(KeyPair keyPair) throws RunNodesException, TimeoutException {
   System.out.format("  Create Server%n");

   NovaTemplateOptions options = NovaTemplateOptions.Builder.keyPairName(keyPair.getName());

   RegionAndId regionAndId = RegionAndId.fromRegionAndId(REGION, "performance1-1");
   Template template = computeService.templateBuilder()
         .locationId(REGION)
         .osDescriptionMatches(".*Ubuntu 14.04.*")
         .hardwareId(regionAndId.slashEncode())
         .options(options)
         .build();

   // This method will continue to poll for the server status and won't return until this server is ACTIVE
   // If you want to know what's happening during the polling, enable logging.
   // See /jclouds-example/rackspace/src/main/java/org/jclouds/examples/rackspace/Logging.java
   Set<? extends NodeMetadata> nodes = computeService.createNodesInGroup(NAME, 1, template);
   NodeMetadata node = Iterables.getOnlyElement(nodes);

   System.out.format("    %s%n", node);

   return node;
}
 
开发者ID:jclouds,项目名称:jclouds-examples,代码行数:27,代码来源:CreateServerWithKeyPair.java

示例8: createServer

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
private NodeMetadata createServer() throws RunNodesException, TimeoutException {
   System.out.format("Create Server%n");

   RegionAndId regionAndId = RegionAndId.fromRegionAndId(REGION, "performance1-1");
   Template template = computeService.templateBuilder()
         .locationId(REGION)
         .osDescriptionMatches(".*Ubuntu 12.04.*")
         .hardwareId(regionAndId.slashEncode())
         .build();

   Set<? extends NodeMetadata> nodes = computeService.createNodesInGroup(NAME, 1, template);
   NodeMetadata nodeMetadata = nodes.iterator().next();
   String publicAddress = nodeMetadata.getPublicAddresses().iterator().next();

   // We set the password to something we know so we can login in the DetachVolume example
   novaApi.getServerApi(REGION).changeAdminPass(nodeMetadata.getProviderId(), PASSWORD);

   System.out.format("  %s%n", nodeMetadata);
   System.out.format("  Login: ssh %[email protected]%s%n", nodeMetadata.getCredentials().getUser(), publicAddress);
   System.out.format("  Password: %s%n", PASSWORD);

   return nodeMetadata;
}
 
开发者ID:jclouds,项目名称:jclouds-examples,代码行数:24,代码来源:CreateVolumeAndAttach.java

示例9: testLaunchClusterWithDomainName

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
@Test
    public void testLaunchClusterWithDomainName() throws RunNodesException {
        final String name = "test";

        Template template = view.getComputeService().templateBuilder()
                .osFamily(OsFamily.UBUNTU)
                .locationId("NA9")
                //.minRam(8192)
                //.locationId("NA12")
                .build();

        DimensionDataCloudControllerTemplateOptions options = template.getOptions().as(DimensionDataCloudControllerTemplateOptions.class);
        options
                .inboundPorts(22, 8080, 8081)
                .runScript(AdminAccess.standard())
                .networkDomainId("91f577d2-5812-4e39-a79f-a35e42eb78a6")
                .vlanId("025c59d7-b7e5-4261-95b8-4af067233ee7");

        try {
            Set<? extends NodeMetadata> nodes = view.getComputeService().createNodesInGroup(name, NUM_NODES, template);
            assertThat(nodes).hasSize(NUM_NODES);

            Map<? extends NodeMetadata, ExecResponse> responses = view.getComputeService().runScriptOnNodesMatching(runningInGroup(name), "echo hello");
            assertThat(responses).hasSize(NUM_NODES);

            for (ExecResponse execResponse : responses.values()) {
                assertThat(execResponse.getOutput().trim()).isEqualTo("hello");
            }
        } catch (RunScriptOnNodesException e) {
            Assert.fail();
        } finally {
            view.getComputeService().destroyNodesMatching(inGroup(name));
        }
}
 
开发者ID:cloudsoft,项目名称:amp-dimensiondata,代码行数:35,代码来源:DimensionDataCloudControllerComputeServiceContextLiveTest.java

示例10: createNode

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
/**
 * Create a node with the specified group.
 */
protected void createNode(Exchange exchange) throws CamelException {
    String group = getGroup(exchange);
    String imageId = getImageId(exchange);
    String locationId = getLocationId(exchange);
    String hardwareId = getHardwareId(exchange);

    if (ObjectHelper.isEmpty(group)) {
        throw new CamelExchangeException("Group must be specific in the URI or as exchange property for the destroy node operation.", exchange);
    }
    TemplateBuilder builder = computeService.templateBuilder();
    builder.any();

    if (ObjectHelper.isNotEmpty(locationId)) {
        builder.locationId(locationId);
    }
    if (ObjectHelper.isNotEmpty(imageId)) {
        builder.imageId(imageId);
    }
    if (ObjectHelper.isNotEmpty(hardwareId)) {
        builder.hardwareId(hardwareId);
    }

    try {
        Set<? extends NodeMetadata> nodeMetadatas = computeService.createNodesInGroup(group, 1, builder.build());
        exchange.getOut().setBody(nodeMetadatas);
        exchange.getOut().setHeaders(exchange.getIn().getHeaders());
    } catch (RunNodesException e) {
        throw new CamelExchangeException("Error creating jclouds node.", exchange, e);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:34,代码来源:JcloudsComputeProducer.java

示例11: testVSphereContext

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
public void testVSphereContext() throws RunNodesException {
      ImmutableSet modules = ImmutableSet.of(new ExecutorServiceModule(sameThreadExecutor(), sameThreadExecutor()), new SshjSshClientModule());
      ComputeServiceContext context = ContextBuilder.newBuilder("vsphere")
//                .credentials("root", "master1234")
//                .endpoint("https://10.56.161.100/sdk")
              .credentials("root", "vmware")
              .endpoint("https://10.45.7.70/sdk")
              .modules(modules)
              .buildView(ComputeServiceContext.class);

      TemplateBuilder b = context.getComputeService().templateBuilder();
      TemplateOptions o = context.getComputeService().templateOptions();
      ((VSphereTemplateOptions) o).isoFileName("ISO/UCSInstall_UCOS_3.1.0.0-9914.iso");
      ((VSphereTemplateOptions) o).flpFileName("ISO/image.flp");
      ((VSphereTemplateOptions) o).postConfiguration(false);
      o.tags(ImmutableSet.of("from UnitTest"))
              .nodeNames(ImmutableSet.of("first-vm12"))
              .networks("VLAN537");
//        b.imageId("Cisco Centos 6.5").smallest();
//        b.imageId("Cisco Centos 6.5.0").smallest().options(o);
      //b.imageId("Cisco Centos 6.5").locationId("default").smallest().options(o);
      b.imageId("conductor-mgt").locationId("default").minRam(6000).options(o);

      // Set images = context.getComputeService().listNodesByIds(ImmutableSet.of("junit-test-9b7"));
      Set<? extends NodeMetadata> nodes = context.getComputeService().createNodesInGroup("junit-test", 1, b.build());

      System.out.print("");
   }
 
开发者ID:igreenfield,项目名称:jcloud-vsphere,代码行数:29,代码来源:ContextBuilderTest.java

示例12: addSuccessAndLostNodes

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
private void addSuccessAndLostNodes(RunNodesException rnex, Set<NodeMetadata> successfulNodes, Map<NodeMetadata,
        Throwable> lostNodes) {
  // workaround https://code.google.com/p/jclouds/issues/detail?id=923
  // by ensuring that any nodes in the "NodeErrors" do not get considered
  // successful
  Set<? extends NodeMetadata> reportedSuccessfulNodes = rnex.getSuccessfulNodes();
  Map<? extends NodeMetadata, ? extends Throwable> errorNodesMap = rnex.getNodeErrors();
  Set<? extends NodeMetadata> errorNodes = errorNodesMap.keySet();

  // "actual" successful nodes are ones that don't appear in the errorNodes
  successfulNodes.addAll(Sets.difference(reportedSuccessfulNodes, errorNodes));
  lostNodes.putAll(errorNodesMap);
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:14,代码来源:NovaLauncher.java

示例13: addSuccessAndLostNodes

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
private void addSuccessAndLostNodes(RunNodesException rnex, Set<NodeMetadata> successfulNodes,
    Map<NodeMetadata, Throwable> lostNodes) {
  // workaround https://code.google.com/p/jclouds/issues/detail?id=923 
  // by ensuring that any nodes in the "NodeErrors" do not get considered 
  // successful 
  Set<? extends NodeMetadata> reportedSuccessfulNodes = rnex.getSuccessfulNodes();
  Map<? extends NodeMetadata, ? extends Throwable> errorNodesMap = rnex.getNodeErrors();
  Set<? extends NodeMetadata> errorNodes = errorNodesMap.keySet();

  // "actual" successful nodes are ones that don't appear in the errorNodes  
  successfulNodes.addAll(Sets.difference(reportedSuccessfulNodes, errorNodes));
  lostNodes.putAll(errorNodesMap);
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:14,代码来源:Ec2Launcher.java

示例14: testForkMachines

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
public void testForkMachines()
    throws InvalidCredentialsException, RunNodesException, URISyntaxException, ValidationException {
  int size = 1;
  List<MachineRuntime> machines = forkMachines("c1", "g1", size, "europe-west1-b");
  assert machines.size() == size;
  for (MachineRuntime machine : machines) {
    assert machine.getId() != null && !machine.getId().isEmpty();
    assert machine.getName() != null && !machine.getName().isEmpty();
    assert machine.getPublicIp() != null && !machine.getPublicIp().isEmpty();
    assert machine.getPrivateIp() != null && !machine.getPrivateIp().isEmpty();
  }
}
 
开发者ID:karamelchef,项目名称:karamel,代码行数:13,代码来源:GceLauncherTest.java

示例15: createNode

import org.jclouds.compute.RunNodesException; //导入依赖的package包/类
@Override
public NodeMetadata createNode(Template template) {
  try {
    Set<? extends NodeMetadata> nodesInGroup =
        this.computeServiceContext.getComputeService()
            .createNodesInGroup(cloud.configuration().nodeGroup(), 1, template);
    checkElementIndex(0, nodesInGroup.size());
    checkState(nodesInGroup.size() == 1);
    return nodesInGroup.iterator().next();
  } catch (RunNodesException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:cloudiator,项目名称:sword,代码行数:14,代码来源:JCloudsComputeClientImpl.java


注:本文中的org.jclouds.compute.RunNodesException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。