Package org.jclouds.openstack.nova.v2_0.domain.zonescoped

Examples of org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId


      return server == null ? null : new ServerInZone(server, zoneAndId.getZone());
   }

   @Override
   public ImageInZone getImage(String id) {
      ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
      Image image = novaApi.getImageApiForZone(zoneAndId.getZone()).get(zoneAndId.getId());
      return image == null ? null : new ImageInZone(image, zoneAndId.getZone());
   }
View Full Code Here


      return image == null ? null : new ImageInZone(image, zoneAndId.getZone());
   }

   @Override
   public void destroyNode(String id) {
      ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
      if (novaApi.getFloatingIPExtensionForZone(zoneAndId.getZone()).isPresent()) {
         try {
            removeFloatingIpFromNodeAndDeallocate.apply(zoneAndId);
         } catch (RuntimeException e) {
            logger.warn(e, "<< error removing and deallocating ip from node(%s): %s", id, e.getMessage());
         }
      }
      novaApi.getServerApiForZone(zoneAndId.getZone()).delete(zoneAndId.getId());
   }
View Full Code Here

      novaApi.getServerApiForZone(zoneAndId.getZone()).delete(zoneAndId.getId());
   }

   @Override
   public void rebootNode(String id) {
      ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
      novaApi.getServerApiForZone(zoneAndId.getZone()).reboot(zoneAndId.getId(), RebootType.HARD);
   }
View Full Code Here

      novaApi.getServerApiForZone(zoneAndId.getZone()).reboot(zoneAndId.getId(), RebootType.HARD);
   }

   @Override
   public void resumeNode(String id) {
      ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
      if (novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).isPresent()) {
         novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).get().resume(zoneAndId.getId());
      }
      throw new UnsupportedOperationException("resume requires installation of the Admin Actions extension");
   }
View Full Code Here

      throw new UnsupportedOperationException("resume requires installation of the Admin Actions extension");
   }

   @Override
   public void suspendNode(String id) {
      ZoneAndId zoneAndId = ZoneAndId.fromSlashEncoded(id);
      if (novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).isPresent()) {
         novaApi.getServerAdminExtensionForZone(zoneAndId.getZone()).get().suspend(zoneAndId.getId());
      }
      throw new UnsupportedOperationException("suspend requires installation of the Admin Actions extension");
   }
View Full Code Here

   private NodeMetadata createServer(KeyPair keyPair) throws RunNodesException, TimeoutException {
      System.out.format("  Create Server%n");

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

      ZoneAndId zoneAndId = ZoneAndId.fromZoneAndId(ZONE, "performance1-1");
      Template template = computeService.templateBuilder()
            .locationId(ZONE)
            .osDescriptionMatches(".*Ubuntu 12.04.*")
            .hardwareId(zoneAndId.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.
View Full Code Here

   }

   private Set<? extends NodeMetadata> createServer() throws RunNodesException, TimeoutException {
      System.out.format("Create Server%n");

      ZoneAndId zoneAndId = ZoneAndId.fromZoneAndId(ZONE, "performance1-1");
      Template template = computeService.templateBuilder()
            .locationId(ZONE)
            .osDescriptionMatches(".*Ubuntu 12.04.*")
            .hardwareId(zoneAndId.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
View Full Code Here

   }

   private NodeMetadata createServer() throws RunNodesException, TimeoutException {
      System.out.format("Create Server%n");

      ZoneAndId zoneAndId = ZoneAndId.fromZoneAndId(ZONE, "performance1-1");
      Template template = computeService.templateBuilder()
            .locationId(ZONE)
            .osDescriptionMatches(".*Ubuntu 12.04.*")
            .hardwareId(zoneAndId.slashEncode())
            .build();

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

      RunScriptOptions options = RunScriptOptions.Builder
            .overrideLoginUser(ROOT)
            .overrideLoginPassword(PASSWORD)
            .blockOnComplete(true);

      ZoneAndId zoneAndId = ZoneAndId.fromZoneAndId(ZONE, volumeAttachment.getServerId());
      ExecResponse response = computeService.runScriptOnNode(zoneAndId.slashEncode(), script, options);

      if (response.getExitStatus() == 0) {
         System.out.format("  Exit Status: %s%n", response.getExitStatus());
      }
      else {
View Full Code Here

            return true;
         }
        
      };

      ZoneAndName input = ZoneAndName.fromZoneAndName("zone", "groupName");

      Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone> groupCreator = new Function<ZoneSecurityGroupNameAndPorts, SecurityGroupInZone>() {

         @Override
         public SecurityGroupInZone apply(ZoneSecurityGroupNameAndPorts input) {
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.nova.v2_0.domain.zonescoped.ZoneAndId

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.