]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fixes potential bugs found by pylint
authorRongze Zhu <zrzhit@gmail.com>
Fri, 7 Sep 2012 03:16:36 +0000 (11:16 +0800)
committerRongze Zhu <zrzhit@gmail.com>
Fri, 7 Sep 2012 03:16:36 +0000 (11:16 +0800)
Partial fixes bug #1043884

* remove _ec2_volume_get_query and _ec2_snapshot_get_query in
cinder.db.sqlalchemy.api, because they no longer be used in cinder.
* import openstack.commmon.utils.timeutils, because notify_usage_exists use it.

Change-Id: I3e989b940b6a99ac7751c940fa766aa13c61607b

cinder/db/sqlalchemy/api.py
cinder/volume/utils.py

index 8310359cffca05fa8052c47d621680d3235d70d3..55834ed0b8b8e8793a8d57f2fe7cf50dfccdb25c 100644 (file)
@@ -1013,18 +1013,6 @@ def _volume_get_query(context, session=None, project_only=False):
                        options(joinedload('volume_type'))
 
 
-@require_context
-def _ec2_volume_get_query(context, session=None, project_only=False):
-    return model_query(context, models.VolumeIdMapping, session=session,
-                       project_only=project_only)
-
-
-@require_context
-def _ec2_snapshot_get_query(context, session=None, project_only=False):
-    return model_query(context, models.SnapshotIdMapping, session=session,
-                       project_only=project_only)
-
-
 @require_context
 def volume_get(context, volume_id, session=None):
     result = _volume_get_query(context, session=session, project_only=True).\
index 9bf46cf16986c7ea41eb8c66b6c0f894ff78826c..d5a7420e0af1e95cfdb25967c4fb12761f4f6d64 100644 (file)
@@ -20,6 +20,7 @@ from cinder import flags
 from cinder import utils
 from cinder.openstack.common.notifier import api as notifier_api
 from cinder.openstack.common import log as logging
+from cinder.openstack.common import timeutils
 
 
 FLAGS = flags.FLAGS
@@ -35,7 +36,7 @@ def notify_usage_exists(context, volume_ref, current_period=False):
     begin, end = utils.last_completed_audit_period()
     if current_period:
         audit_start = end
-        audit_end = utils.utcnow()
+        audit_end = timeutils.utcnow()
     else:
         audit_start = begin
         audit_end = end