From: Rongze Zhu Date: Fri, 7 Sep 2012 03:16:36 +0000 (+0800) Subject: Fixes potential bugs found by pylint X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=590d3e7b0f74524093725a2e28150b083a77cf96;p=openstack-build%2Fcinder-build.git Fixes potential bugs found by pylint 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 --- diff --git a/cinder/db/sqlalchemy/api.py b/cinder/db/sqlalchemy/api.py index 8310359cf..55834ed0b 100644 --- a/cinder/db/sqlalchemy/api.py +++ b/cinder/db/sqlalchemy/api.py @@ -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).\ diff --git a/cinder/volume/utils.py b/cinder/volume/utils.py index 9bf46cf16..d5a7420e0 100644 --- a/cinder/volume/utils.py +++ b/cinder/volume/utils.py @@ -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