Esempio n. 1
0
 def _check_wildcard(self, aggregate_list):
     if '*' in aggregate_list:
         if len(aggregate_list) == 1:
             return True
         else:
             raise exception.WildcardCharacterIsUsed(
                 resource="host aggregates")
     return False
Esempio n. 2
0
 def _collect_zones(self, availability_zones, allowed_nodes):
     zone_list = self.wrapper.get_availability_zone_list()
     zone_names = [zone['name'] for zone in availability_zones]
     include_all_nodes = False
     if '*' in zone_names:
         if len(zone_names) == 1:
             include_all_nodes = True
         else:
             raise exception.WildcardCharacterIsUsed(
                 resource="availability zones")
     for zone in zone_list:
         if zone.zoneName in zone_names or include_all_nodes:
             allowed_nodes.extend(zone.hosts.keys())
Esempio n. 3
0
    def _collect_vtype(self, volume_types, allowed_nodes):
        service_list = self.wrapper.get_storage_node_list()

        vt_names = [volume_type['name'] for volume_type in volume_types]
        include_all_nodes = False
        if '*' in vt_names:
            if len(vt_names) == 1:
                include_all_nodes = True
            else:
                raise exception.WildcardCharacterIsUsed(
                    resource="volume_types")
        for service in service_list:
            if include_all_nodes:
                allowed_nodes.append(service.host)
                continue
            backend = service.host.split('@')[1]
            v_types = self.wrapper.get_volume_type_by_backendname(backend)
            for volume_type in v_types:
                if volume_type in vt_names:
                    # Note(adisky): It can generate duplicate values
                    # but it will later converted to set
                    allowed_nodes.append(service.host)