summaryrefslogtreecommitdiffstats
path: root/nova/scheduler
diff options
context:
space:
mode:
authorJoe Gordon <jogo@cloudscaling.com>2012-12-20 03:13:01 +0000
committerJoe Gordon <jogo@cloudscaling.com>2013-01-08 14:01:30 -0800
commit1ab2fc6477c402e29a95fbc93fe4a67950c083df (patch)
treeed42c15787905fe9e42ca3058bc8db3737d2fcbb /nova/scheduler
parent9f4534ab584faeee1e24d4c1bb38a2b194f24626 (diff)
downloadnova-1ab2fc6477c402e29a95fbc93fe4a67950c083df.tar.gz
nova-1ab2fc6477c402e29a95fbc93fe4a67950c083df.tar.xz
nova-1ab2fc6477c402e29a95fbc93fe4a67950c083df.zip
Remove availability_zones from service table
This is the final step in enabling availability_zones using aggregate metadata. Previously all services had an availability_zone, but the availability_zone is only used for nova-compute. Services such as nova-scheduler, nova-network, nova-conductor have always spanned all availability_zones. After this change only compute nodes (nova-compute), will have an availability_zone. In order to preserve current APIs, when running: * nova host-list (os-hosts) * euca-describe-availability-zones verbose * nova-manage service list Internal services will appear in there own internal availability_zone (CONF.internal_service_availability_zone) Internal zone is hidden in euca-describe-availability_zones (non-verbose) CONF.node_availability_zone has been renamed to CONF.default_availability_zone and is only used by the nova-api and nova-scheduler. CONF.node_availability_zone still works but is deprecated DocImpact Completes blueprint aggregate-based-availability-zones Change-Id: Ib772df5f9ac2865f20df479f8ddce575a9ce3aff
Diffstat (limited to 'nova/scheduler')
-rw-r--r--nova/scheduler/filters/availability_zone_filter.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/nova/scheduler/filters/availability_zone_filter.py b/nova/scheduler/filters/availability_zone_filter.py
index 24ea0dd35..585acbaf8 100644
--- a/nova/scheduler/filters/availability_zone_filter.py
+++ b/nova/scheduler/filters/availability_zone_filter.py
@@ -14,15 +14,21 @@
# under the License.
+from nova import availability_zones
from nova import db
+from nova.openstack.common import cfg
from nova.scheduler import filters
+CONF = cfg.CONF
+CONF.import_opt('default_availability_zone', 'nova.availability_zones')
+
+
class AvailabilityZoneFilter(filters.BaseHostFilter):
"""Filters Hosts by availability zone.
- Works with both service and aggregate metadata.
- For aggregate metadata uses the key 'availability_zone'
+ Works with aggregate metadata availability zones, using the key
+ 'availability_zone'
Note: in theory a compute node can be part of multiple availability_zones
"""
@@ -32,12 +38,12 @@ class AvailabilityZoneFilter(filters.BaseHostFilter):
availability_zone = props.get('availability_zone')
if availability_zone:
- if availability_zone == host_state.service['availability_zone']:
- return True
context = filter_properties['context'].elevated()
metadata = db.aggregate_metadata_get_by_host(
context, host_state.host, key='availability_zone')
if 'availability_zone' in metadata:
return availability_zone in metadata['availability_zone']
+ else:
+ return availability_zone == CONF.default_availability_zone
return False
return True