summaryrefslogtreecommitdiffstats
path: root/nova/db
diff options
context:
space:
mode:
authorMichael H Wilson <geekinutah@gmail.com>2012-10-16 15:47:52 -0600
committerMichael H Wilson <geekinutah@gmail.com>2012-10-25 23:51:48 -0600
commit0bf28bec6097d128aa439b288b249fafcac7dbc0 (patch)
tree348bde399a5efd964741470af9264195899c228e /nova/db
parent5d677e204c99fbcf86e0c721ad2fd327a03c35c2 (diff)
Fix hardcoded topic strings with constants.
Replace hardcoded topic strings like 'volume' or 'compute' with config constants like FLAGS.volume_topic, etc. See bug #1057831 and bug #1061628. Change-Id: I817ecc3cbe3245b51a0c047be58d17edfec8a838
Diffstat (limited to 'nova/db')
-rw-r--r--nova/db/sqlalchemy/api.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index 0946d0b19..2e390a2ff 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -331,7 +331,8 @@ def service_destroy(context, service_id):
service_ref = service_get(context, service_id, session=session)
service_ref.delete(session=session)
- if service_ref.topic == 'compute' and service_ref.compute_node:
+ if (service_ref.topic == FLAGS.compute_topic and
+ service_ref.compute_node):
for c in service_ref.compute_node:
c.delete(session=session)
@@ -387,7 +388,7 @@ def service_get_all_compute_by_host(context, host):
result = model_query(context, models.Service, read_deleted="no").\
options(joinedload('compute_node')).\
filter_by(host=host).\
- filter_by(topic="compute").\
+ filter_by(topic=FLAGS.compute_topic).\
all()
if not result:
@@ -420,7 +421,7 @@ def service_get_all_compute_sorted(context):
# (SELECT host, SUM(instances.vcpus) AS instance_cores
# FROM instances GROUP BY host) AS inst_cores
# ON services.host = inst_cores.host
- topic = 'compute'
+ topic = FLAGS.compute_topic
label = 'instance_cores'
subq = model_query(context, models.Instance.host,
func.sum(models.Instance.vcpus).label(label),
@@ -438,7 +439,7 @@ def service_get_all_compute_sorted(context):
def service_get_all_volume_sorted(context):
session = get_session()
with session.begin():
- topic = 'volume'
+ topic = FLAGS.volume_topic
label = 'volume_gigabytes'
subq = model_query(context, models.Volume.host,
func.sum(models.Volume.size).label(label),