Examples of ServerApi


Examples of org.jclouds.openstack.nova.v2_0.features.ServerApi

  }

  @Override
  public Void doRequest(NovaApi api) {
    // look for victim server in all regions
    ServerApi serverApi = api.getServerApiForZone(getAccount().getRegion());
    Server victimServer = serverApi.get(this.victimId);
    if (victimServer != null) {
      releaseFloatingIps(api, getAccount().getRegion(), victimServer);
      boolean wasDeleted = serverApi.delete(this.victimId);
      if (!wasDeleted) {
        throw new ScalingGroupException(
            "failed to delete victim server " + this.victimId);
      }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.features.ServerApi

  }

  private String assignFloatingIp(NovaApi api, Server server)
      throws Exception {
    LOG.debug("assigning a floating IP address to {} ...", server.getId());
    ServerApi serverApi = api.getServerApiForZone(getAccount().getRegion());
    // server must have a private IP address before a floating IP can be
    // assigned
    waitForPrivateIpAddress(serverApi, server);

    FloatingIPApi floatingIPApi = api.getFloatingIPExtensionForZone(
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.features.ServerApi

   @Override
   public void setup() {
      super.setup();
      zones = api.getConfiguredZones();
      for (String zone : zones) {
         ServerApi serverApi = api.getServerApiForZone(zone);
         for (Resource server : serverApi.list().concat()) {
            if (server.getName().equals(hostName))
               serverApi.delete(server.getId());
         }
      }
   }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.features.ServerApi

      setIfTestSystemPropertyPresent(props, NovaProperties.AUTO_ALLOCATE_FLOATING_IPS);
      return props;
   }
  
   protected Server createServerInZone(String zoneId) {
      ServerApi serverApi = api.getServerApiForZone(zoneId);
      ServerCreated server = serverApi.create(hostName, imageIdForZone(zoneId), flavorRefForZone(zoneId));
      blockUntilServerInState(server.getId(), serverApi, Status.ACTIVE);
      return serverApi.get(server.getId());
   }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.features.ServerApi

      for (String zoneId : api.getConfiguredZones()) {
         Optional<? extends FloatingIPApi> apiOption = api.getFloatingIPExtensionForZone(zoneId);
         if (!apiOption.isPresent())
            continue;
         FloatingIPApi api = apiOption.get();
         ServerApi serverApi = this.api.getServerApiForZone(zoneId);
         Server server = createServerInZone(zoneId);
         FloatingIP floatingIP = api.create();
         assertNotNull(floatingIP);
         try {
            api.addToServer(floatingIP.getIp(), server.getId());
            assertEventually(new ServerHasFloatingIP(serverApi, server.getId(), floatingIP.getIp()));
         } finally {
            api.removeFromServer(floatingIP.getIp(), server.getId());
            serverApi.delete(server.getId());
         }
      }
   }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.features.ServerApi

      }

      @Override
      protected Function<Object, IterableWithMarker<Resource>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.get().toString();
         final ServerApi serverApi = api.getServerApiForZone(zone);
         return new Function<Object, IterableWithMarker<Resource>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<Resource> apply(Object input) {
               PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
               return IterableWithMarker.class.cast(serverApi.list(paginationOptions));
            }

            @Override
            public String toString() {
               return "list()";
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.features.ServerApi

      }

      @Override
      protected Function<Object, IterableWithMarker<Server>> markerToNextForArg0(Optional<Object> arg0) {
         String zone = arg0.get().toString();
         final ServerApi serverApi = api.getServerApiForZone(zone);
         return new Function<Object, IterableWithMarker<Server>>() {

            @SuppressWarnings("unchecked")
            @Override
            public IterableWithMarker<Server> apply(Object input) {
               PaginationOptions paginationOptions = PaginationOptions.class.cast(input);
               return IterableWithMarker.class.cast(serverApi.listInDetail(paginationOptions));
            }

            @Override
            public String toString() {
               return "listInDetail()";
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.features.ServerApi

      Template template = computeService.templateBuilder().smallest().build();
      NodeMetadata nodeMetadata = computeService.createNodesInGroup("jclouds-reverse-dns-test", 1, template).iterator().next();
      serverId = nodeMetadata.getId();
      serverURI = nodeMetadata.getUri();

      ServerApi serverApi = nova.getApi().getServerApiForZone(nodeMetadata.getLocation().getParent().getId());
      Server server = serverApi.get(nodeMetadata.getProviderId());
      serverIPv4 = server.getAccessIPv4();
      serverIPv6 = server.getAccessIPv6();
     
      System.out.println("serverURI = " + serverURI);
      System.out.println("serverIPv4 = " + serverIPv4);
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.features.ServerApi

      String serverDetailsActive = stringFromResource("/server_details.json").replace("BUILD(scheduling)", ACTIVE.value());
      server.enqueue(new MockResponse().setBody(serverDetailsActive));

      try {
         NovaApi novaApi = api(server.getUrl("/").toString(), "openstack-nova");
         ServerApi serverApi = novaApi.getServerApiForZone("RegionOne");

         boolean result = awaitActive(serverApi).apply("71752");

         assertTrue(result);
         assertEquals(server.getRequestCount(), 5);
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.features.ServerApi

      String serverDetailsShutoff = stringFromResource("/server_details.json").replace("BUILD(scheduling)", SHUTOFF.value());
      server.enqueue(new MockResponse().setBody(serverDetailsShutoff));

      try {
         NovaApi novaApi = api(server.getUrl("/").toString(), "openstack-nova");
         ServerApi serverApi = novaApi.getServerApiForZone("RegionOne");

         boolean result = awaitShutoff(serverApi).apply("71752");

         assertTrue(result);
         assertEquals(server.getRequestCount(), 7);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.