summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTodd Willey <todd@ansolabs.com>2011-01-10 20:29:42 +0000
committerTarmac <>2011-01-10 20:29:42 +0000
commit16c420ee156f8c7716c7e84b66af35cbccf5090c (patch)
treef45ae4b30d9e80a80d3f746c4bea65f688dac961
parent5e9eab1d477189fb3283842375d0665370cc5a1a (diff)
parentec8e7773b79ed52aa2950db185ead881c77632f7 (diff)
downloadnova-16c420ee156f8c7716c7e84b66af35cbccf5090c.tar.gz
nova-16c420ee156f8c7716c7e84b66af35cbccf5090c.tar.xz
nova-16c420ee156f8c7716c7e84b66af35cbccf5090c.zip
Bugfix.
-rw-r--r--nova/api/ec2/cloud.py3
-rw-r--r--nova/db/api.py5
-rw-r--r--nova/db/sqlalchemy/api.py12
3 files changed, 19 insertions, 1 deletions
diff --git a/nova/api/ec2/cloud.py b/nova/api/ec2/cloud.py
index 7f1a414f3..99a9677c4 100644
--- a/nova/api/ec2/cloud.py
+++ b/nova/api/ec2/cloud.py
@@ -42,6 +42,7 @@ from nova.compute import instance_types
FLAGS = flags.FLAGS
+flags.DECLARE('service_down_time', 'nova.scheduler.driver')
LOG = logging.getLogger("nova.api.cloud")
@@ -198,7 +199,7 @@ class CloudController(object):
'zoneState': 'available'}]}
services = db.service_get_all(context)
- now = db.get_time()
+ now = datetime.datetime.utcnow()
hosts = []
for host in [service['host'] for service in services]:
if not host in hosts:
diff --git a/nova/db/api.py b/nova/db/api.py
index 8b0242c9a..a4d26ec85 100644
--- a/nova/db/api.py
+++ b/nova/db/api.py
@@ -81,6 +81,11 @@ def service_get(context, service_id):
return IMPL.service_get(context, service_id)
+def service_get_all(context):
+ """Get a list of all services on any machine on any topic of any type"""
+ return IMPL.service_get_all(context)
+
+
def service_get_all_by_topic(context, topic):
"""Get all compute services for a given topic."""
return IMPL.service_get_all_by_topic(context, topic)
diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py
index eb87355b6..e475b4d8c 100644
--- a/nova/db/sqlalchemy/api.py
+++ b/nova/db/sqlalchemy/api.py
@@ -135,6 +135,18 @@ def service_get(context, service_id, session=None):
@require_admin_context
+def service_get_all(context, session=None):
+ if not session:
+ session = get_session()
+
+ result = session.query(models.Service).\
+ filter_by(deleted=can_read_deleted(context)).\
+ all()
+
+ return result
+
+
+@require_admin_context
def service_get_all_by_topic(context, topic):
session = get_session()
return session.query(models.Service).\