summaryrefslogtreecommitdiffstats
path: root/nova/compute
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2011-06-03 15:11:01 +0000
committerTarmac <>2011-06-03 15:11:01 +0000
commit2b8863d0da04e4014a33451d27b4b1f210eea7a6 (patch)
treee3315ab30c1f90b4c18dc89534435776ce0a1463 /nova/compute
parent94e5bc0c35b7cd7941fd1102651504763d676a5a (diff)
parent4762aebe4ddc57d8502ed3b5aec56b613d0ec93b (diff)
Changes all uses of utcnow to use the version in utils. This is a simple wrapper for datetime.datetime.utcnow that allows us to use fake values for tests.
There are still a few places in the Zone code that is using datetime.now(), I'd prefer to move this to utils.utcnow() as well but I want to chat with sandy first to make sure that there won't be any issues.
Diffstat (limited to 'nova/compute')
-rw-r--r--nova/compute/api.py3
-rw-r--r--nova/compute/manager.py3
-rw-r--r--nova/compute/monitor.py2
3 files changed, 3 insertions, 5 deletions
diff --git a/nova/compute/api.py b/nova/compute/api.py
index ea4cb8036..4f327fab1 100644
--- a/nova/compute/api.py
+++ b/nova/compute/api.py
@@ -18,7 +18,6 @@
"""Handles all requests relating to instances (guest vms)."""
-import datetime
import eventlet
import re
import time
@@ -407,7 +406,7 @@ class API(base.Base):
instance['id'],
state_description='terminating',
state=0,
- terminated_at=datetime.datetime.utcnow())
+ terminated_at=utils.utcnow())
host = instance['host']
if host:
diff --git a/nova/compute/manager.py b/nova/compute/manager.py
index 7fe5fa2cb..245958de7 100644
--- a/nova/compute/manager.py
+++ b/nova/compute/manager.py
@@ -35,7 +35,6 @@ terminating it.
"""
-import datetime
import os
import socket
import sys
@@ -159,7 +158,7 @@ class ComputeManager(manager.SchedulerDependentManager):
def _update_launched_at(self, context, instance_id, launched_at=None):
"""Update the launched_at parameter of the given instance."""
- data = {'launched_at': launched_at or datetime.datetime.utcnow()}
+ data = {'launched_at': launched_at or utils.utcnow()}
self.db.instance_update(context, instance_id, data)
def _update_image_ref(self, context, instance_id, image_ref):
diff --git a/nova/compute/monitor.py b/nova/compute/monitor.py
index 3bb54a382..613734bef 100644
--- a/nova/compute/monitor.py
+++ b/nova/compute/monitor.py
@@ -86,7 +86,7 @@ RRD_VALUES = {
]}
-utcnow = datetime.datetime.utcnow
+utcnow = utils.utcnow
LOG = logging.getLogger('nova.compute.monitor')