From 0ce533e0e194741b6ade7eed12c107628d0e6d3d Mon Sep 17 00:00:00 2001 From: Craig Vyvial Date: Thu, 24 May 2012 13:16:08 -0500 Subject: fixing issue with db.volume_update not returning the volume_ref fixes bug #1003664 - changed the sqlalchemy db api code to return the volume_ref from the volume_update method. This was causing the volume notifications to have the incorrect information in the payload. - Fixed up the unit tests because they started failing badly. - fixed the volume-usage-audit reading the default config values - fix hacking issue with volume-usage-audit Change-Id: Iba5634b0c351a6cc0c48b697217a6f85533de93e --- nova/db/sqlalchemy/api.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'nova/db') diff --git a/nova/db/sqlalchemy/api.py b/nova/db/sqlalchemy/api.py index 39b26a759..e00e1ef81 100644 --- a/nova/db/sqlalchemy/api.py +++ b/nova/db/sqlalchemy/api.py @@ -2848,6 +2848,7 @@ def volume_data_get_for_project(context, project_id, session=None): def volume_destroy(context, volume_id): session = get_session() with session.begin(): + volume_ref = volume_get(context, volume_id, session=session) session.query(models.Volume).\ filter_by(id=volume_id).\ update({'deleted': True, @@ -2861,6 +2862,7 @@ def volume_destroy(context, volume_id): update({'deleted': True, 'deleted_at': utils.utcnow(), 'updated_at': literal_column('updated_at')}) + return volume_ref @require_admin_context @@ -2952,6 +2954,7 @@ def volume_get_iscsi_target_num(context, volume_id): @require_context def volume_update(context, volume_id, values): session = get_session() + volume_ref = volume_get(context, volume_id, session=session) metadata = values.get('metadata') if metadata is not None: volume_metadata_update(context, @@ -2959,10 +2962,11 @@ def volume_update(context, volume_id, values): values.pop('metadata'), delete=True) with session.begin(): - volume_ref = volume_get(context, volume_id, session=session) volume_ref.update(values) volume_ref.save(session=session) + return volume_ref + @require_context def ec2_volume_create(context, volume_uuid, id=None): -- cgit