Package org.apache.stratos.cloud.controller.exception

Examples of org.apache.stratos.cloud.controller.exception.InvalidZoneException


        if (zone == null || iaasInfo == null) {
            String msg =
                         "Zone or IaaSProvider is null: zone: " + zone + " - IaaSProvider: " +
                                 iaasInfo;
            log.error(msg);
            throw new InvalidZoneException(msg);
        }
        ComputeServiceContext context = iaasInfo.getComputeService().getContext();
        AvailabilityZoneAndRegionApi zoneRegionApi = context.unwrapApi(AWSEC2Api.class).
            getAvailabilityZoneAndRegionApiForRegion(region).get();
       
        Set<AvailabilityZoneInfo> availabilityZones =
                                                      zoneRegionApi.describeAvailabilityZonesInRegion(region,
                                                              new DescribeAvailabilityZonesOptions[0]);
        for (AvailabilityZoneInfo zoneInfo : availabilityZones) {
            String configuredZone = zoneInfo.getZone();
            if (zone.equalsIgnoreCase(configuredZone)) {
                if (log.isDebugEnabled()) {
                    log.debug("Found a matching zone: " + zone);
                }
                return true;
            }
        }

        String msg = "Invalid zone: " + zone +" in the region: "+region+ " and of the iaas: "+iaasInfo.getType();
        log.error(msg);
        throw new InvalidZoneException(msg);

    }
View Full Code Here


      // jclouds availability zone = stratos zone
      if (region == null || zone == null || iaasInfo == null) {
            String msg = "Host or Zone or IaaSProvider is null: region: " + region + " - zone: " +
                    zone + " - IaaSProvider: " + iaasInfo;
            log.error(msg);
            throw new InvalidZoneException(msg);
        }
        ComputeServiceContext context = iaasInfo.getComputeService().getContext();
        RestContext<NovaApi, NovaAsyncApi> nova = context.unwrap();
        AvailabilityZoneAPI zoneApi = nova.getApi().getAvailabilityZoneApi(region);
        for (AvailabilityZone z : zoneApi.list()) {
     
          if (zone.equalsIgnoreCase(z.getName())) {
            if (log.isDebugEnabled()) {
              log.debug("Found a matching availability zone: " + zone);
            }
            return true;
          }
    }
       
        String msg = "Invalid zone: " + zone +" in the region: "+region+ " and of the iaas: "+iaasInfo.getType();
        log.error(msg);
        throw new InvalidZoneException(msg);
       
    }
View Full Code Here

TOP

Related Classes of org.apache.stratos.cloud.controller.exception.InvalidZoneException

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.