diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-06-20 19:54:56 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-06-20 19:54:56 +0000 |
| commit | 6e0db0d25ba6689126c8d3479c3ef8bf5a534538 (patch) | |
| tree | 59ad8877c4da76c9a1264530b856650eb220ea4c /nova/db | |
| parent | f40154db38d728609c9706ce57f4360ee0b0bd71 (diff) | |
| parent | 824b49d5bd6262b2b16103a850d3e58b9ee14009 (diff) | |
| download | nova-6e0db0d25ba6689126c8d3479c3ef8bf5a534538.tar.gz nova-6e0db0d25ba6689126c8d3479c3ef8bf5a534538.tar.xz nova-6e0db0d25ba6689126c8d3479c3ef8bf5a534538.zip | |
Merge "Remove db session hack from conductor's vol_usage_update()"
Diffstat (limited to 'nova/db')
| -rw-r--r-- | nova/db/api.py | 5 | ||||
| -rw-r--r-- | nova/db/sqlalchemy/api.py | 7 |
2 files changed, 6 insertions, 6 deletions
diff --git a/nova/db/api.py b/nova/db/api.py index ceab5fcd8..973be1a26 100644 --- a/nova/db/api.py +++ b/nova/db/api.py @@ -1561,7 +1561,7 @@ def vol_get_usage_by_time(context, begin): def vol_usage_update(context, id, rd_req, rd_bytes, wr_req, wr_bytes, instance_id, project_id, user_id, availability_zone, - update_totals=False, session=None): + update_totals=False): """Update cached volume usage for a volume Creates new record if needed. @@ -1569,8 +1569,7 @@ def vol_usage_update(context, id, rd_req, rd_bytes, wr_req, wr_bytes, return IMPL.vol_usage_update(context, id, rd_req, rd_bytes, wr_req, wr_bytes, instance_id, project_id, user_id, availability_zone, - update_totals=update_totals, - session=session) + update_totals=update_totals) ################### diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 69157a86a..fd79ae215 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -4396,9 +4396,8 @@ def vol_get_usage_by_time(context, begin): @require_context def vol_usage_update(context, id, rd_req, rd_bytes, wr_req, wr_bytes, instance_id, project_id, user_id, availability_zone, - update_totals=False, session=None): - if not session: - session = get_session() + update_totals=False): + session = get_session() refreshed = timeutils.utcnow() @@ -4471,6 +4470,8 @@ def vol_usage_update(context, id, rd_req, rd_bytes, wr_req, wr_bytes, current_usage['curr_write_bytes'] + wr_bytes) current_usage.update(values) + current_usage.save(session=session) + session.refresh(current_usage) return current_usage vol_usage = models.VolumeUsage() |
