Package org.jclouds.openstack.nova.v2_0.features

Examples of org.jclouds.openstack.nova.v2_0.features.ServerApi.create()


      ip = Iterables.getLast(unassignedIps).getIp();
    }

    // if no unassigned IP is available, we'll try to allocate an IP.
    if (ip == null || ip.isEmpty()) {
      FloatingIP allocatedFloatingIP = floatingIp.create();
      if (allocatedFloatingIP == null) {
        String msg = "Failed to allocate an IP address.";
        log.error(msg);
        throw new CloudControllerException(msg);
      }
View Full Code Here


      ip = Iterables.getLast(unassignedIps).getIp();
    }

    // if no unassigned IP is available, we'll try to allocate an IP.
    if (ip == null || ip.isEmpty()) {
      FloatingIP allocatedFloatingIP = floatingIp.create();
      if (allocatedFloatingIP == null) {
        String msg = "Failed to allocate an IP address.";
        log.error(msg);
        throw new CloudControllerException(msg);
      }
View Full Code Here

    FloatingIPApi floatingIPApi = api.getFloatingIPExtensionForZone(
        getAccount().getRegion()).get();
    List<FloatingIP> floatingIps = newArrayList(floatingIPApi.list());
    List<FloatingIP> freeFloatingIps = getFreeFloatingIps(floatingIps);
    if (freeFloatingIps.isEmpty()) {
      freeFloatingIps.add(floatingIPApi.create());
    }
    if (freeFloatingIps.isEmpty()) {
      throw new FloatingIpAddressException(
          "no floating IP address(es) available");
    }
View Full Code Here

      FloatingIPApi floatingIpApi = novaApi.getFloatingIPExtensionForZone(zoneId).get();

      FloatingIP ip = null;
      try {
         logger.debug(">> allocating or reassigning floating ip for node(%s)", node.getId());
         ip = floatingIpApi.create();
      } catch (InsufficientResourcesException e) {
         logger.trace("<< [%s] allocating a new floating ip for node(%s)", e.getMessage(), node.getId());
         logger.trace(">> searching for existing, unassigned floating ip for node(%s)", node.getId());
         ArrayList<FloatingIP> unassignedIps = Lists.newArrayList(Iterables.filter(floatingIpApi.list(),
                  new Predicate<FloatingIP>() {
View Full Code Here

      FloatingIPApi floatingIpApi = novaApi.getFloatingIPExtensionForZone(zoneId).get();

      FloatingIP ip = null;
      try {
         logger.debug(">> allocating or reassigning floating ip for node(%s)", node.getId());
         ip = floatingIpApi.create();
      } catch (InsufficientResourcesException e) {
         logger.trace("<< [%s] allocating a new floating ip for node(%s)", e.getMessage(), node.getId());
         logger.trace(">> searching for existing, unassigned floating ip for node(%s)", node.getId());
         ArrayList<FloatingIP> unassignedIps = Lists.newArrayList(Iterables.filter(floatingIpApi.list(),
                  new Predicate<FloatingIP>() {
View Full Code Here

      Optional optKeyApi = Optional.of(keyApi);
     
      expect(api.getKeyPairExtensionForZone("zone")).andReturn(optKeyApi).atLeastOnce();

      expect(keyApi.create("group-1")).andReturn(pair);

      replay(api, keyApi);

      CreateUniqueKeyPair parser = Guice.createInjector(new AbstractModule() {
View Full Code Here

      KeyPair pair = createMock(KeyPair.class);

      expect(api.getKeyPairExtensionForZone("zone")).andReturn((Optional) Optional.of(keyApi)).atLeastOnce();

      expect(uniqueIdSupplier.get()).andReturn("1");
      expect(keyApi.create("group-1")).andThrow(new IllegalStateException());
      expect(uniqueIdSupplier.get()).andReturn("2");
      expect(keyApi.create("group-2")).andReturn(pair);

      replay(api, keyApi, uniqueIdSupplier);
View Full Code Here

      expect(api.getKeyPairExtensionForZone("zone")).andReturn((Optional) Optional.of(keyApi)).atLeastOnce();

      expect(uniqueIdSupplier.get()).andReturn("1");
      expect(keyApi.create("group-1")).andThrow(new IllegalStateException());
      expect(uniqueIdSupplier.get()).andReturn("2");
      expect(keyApi.create("group-2")).andReturn(pair);

      replay(api, keyApi, uniqueIdSupplier);

      CreateUniqueKeyPair parser = Guice.createInjector(new AbstractModule() {
View Full Code Here

      Optional optKeyApi = Optional.of(keyApi);
     
      expect(api.getKeyPairExtensionForZone("zone")).andReturn(optKeyApi).atLeastOnce();

      expect(keyApi.create("group-1")).andReturn(pair);

      replay(api, keyApi);

      CreateUniqueKeyPair parser = Guice.createInjector(new AbstractModule() {
View Full Code Here

      KeyPair pair = createMock(KeyPair.class);

      expect(api.getKeyPairExtensionForZone("zone")).andReturn((Optional) Optional.of(keyApi)).atLeastOnce();

      expect(uniqueIdSupplier.get()).andReturn("1");
      expect(keyApi.create("group-1")).andThrow(new IllegalStateException());
      expect(uniqueIdSupplier.get()).andReturn("2");
      expect(keyApi.create("group-2")).andReturn(pair);

      replay(api, keyApi, uniqueIdSupplier);
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.