summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--nova/compute/api.py7
-rw-r--r--nova/db/api.py18
-rw-r--r--nova/db/sqlalchemy/api.py39
-rw-r--r--nova/network/manager.py2
4 files changed, 3 insertions, 63 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index 06ce2e07e..6022e2730 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -91,7 +91,6 @@ compute_opts = [
CONF = cfg.CONF
CONF.register_opts(compute_opts)
CONF.import_opt('compute_topic', 'nova.compute.rpcapi')
-CONF.import_opt('consoleauth_topic', 'nova.consoleauth')
CONF.import_opt('enable', 'nova.cells.opts', group='cells')
MAX_USERDATA_SIZE = 65535
@@ -877,9 +876,9 @@ class API(base.Base):
def trigger_provider_fw_rules_refresh(self, context):
"""Called when a rule is added/removed from a provider firewall."""
- host_names = [x['host'] for (x, idx)
- in self.db.service_get_all_compute_sorted(context)]
- for host_name in host_names:
+ for service in self.db.service_get_all_by_topic(context,
+ CONF.compute_topic):
+ host_name = service['host']
self.compute_rpcapi.refresh_provider_fw_rules(context, host_name)
def update_state(self, context, instance, new_state):
diff --git a/nova/db/api.py b/nova/db/api.py
index d8a16c52d..0663c8d9c 100644
--- a/nova/db/api.py
+++ b/nova/db/api.py
@@ -132,15 +132,6 @@ def service_get_all(context, disabled=None):
return IMPL.service_get_all(context, disabled)
-def service_does_host_exist(context, host_name, include_disabled=False):
- """Returns True if 'host_name' is found in the services table, False
- otherwise
- :param: host_name - the name of the host we want to check if it exists
- :param: include_disabled - Set to True to include hosts from disabled
- services"""
- return IMPL.service_does_host_exist(context, host_name, include_disabled)
-
-
def service_get_all_by_topic(context, topic):
"""Get all services for a given topic."""
return IMPL.service_get_all_by_topic(context, topic)
@@ -159,15 +150,6 @@ def service_get_by_compute_host(context, host):
return IMPL.service_get_by_compute_host(context, host)
-def service_get_all_compute_sorted(context):
- """Get all compute services sorted by instance count.
-
- :returns: a list of (Service, instance_count) tuples.
-
- """
- return IMPL.service_get_all_compute_sorted(context)
-
-
def service_get_by_args(context, host, binary):
"""Get the state of a service by node name and binary."""
return IMPL.service_get_by_args(context, host, binary)
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index 1980c22ad..5f2333acf 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -397,45 +397,6 @@ def service_get_by_compute_host(context, host):
@require_admin_context
-def _service_get_all_topic_subquery(context, session, topic, subq, label):
- sort_value = getattr(subq.c, label)
- return model_query(context, models.Service,
- func.coalesce(sort_value, 0),
- session=session, read_deleted="no").\
- filter_by(topic=topic).\
- filter_by(disabled=False).\
- outerjoin((subq, models.Service.host == subq.c.host)).\
- order_by(sort_value).\
- all()
-
-
-@require_admin_context
-def service_get_all_compute_sorted(context):
- session = get_session()
- with session.begin():
- # NOTE(vish): The intended query is below
- # SELECT services.*, COALESCE(inst_cores.instance_cores,
- # 0)
- # FROM services LEFT OUTER JOIN
- # (SELECT host, SUM(instances.vcpus) AS instance_cores
- # FROM instances GROUP BY host) AS inst_cores
- # ON services.host = inst_cores.host
- topic = CONF.compute_topic
- label = 'instance_cores'
- subq = model_query(context, models.Instance.host,
- func.sum(models.Instance.vcpus).label(label),
- base_model=models.Instance, session=session,
- read_deleted="no").\
- group_by(models.Instance.host).\
- subquery()
- return _service_get_all_topic_subquery(context,
- session,
- topic,
- subq,
- label)
-
-
-@require_admin_context
def service_get_by_args(context, host, binary):
result = model_query(context, models.Service).\
filter_by(host=host).\
diff --git a/nova/network/manager.py b/nova/network/manager.py
index 96f17a855..c0635b3af 100644
--- a/nova/network/manager.py
+++ b/nova/network/manager.py
@@ -954,8 +954,6 @@ class NetworkManager(manager.SchedulerDependentManager):
self.network_api = network_api.API()
self.network_rpcapi = network_rpcapi.NetworkAPI()
self.security_group_api = compute_api.SecurityGroupAPI()
- self.compute_api = compute_api.API(
- security_group_api=self.security_group_api)
self.servicegroup_api = servicegroup.API()
# NOTE(tr3buchet: unless manager subclassing NetworkManager has