from cinder.i18n import _, _LI
from cinder import utils
from cinder import volume
+from cinder.volume import utils as volume_utils
LOG = logging.getLogger(__name__)
try:
snapshot = self.volume_api.get_snapshot(context, id)
+ volume_utils.notify_about_snapshot_usage(context, snapshot,
+ 'update.start')
self.volume_api.update_snapshot(context, snapshot, update_dict)
except exception.NotFound:
msg = _("Snapshot could not be found")
snapshot.update(update_dict)
req.cache_db_snapshot(snapshot)
+ volume_utils.notify_about_snapshot_usage(context, snapshot,
+ 'update.end')
return {'snapshot': _translate_snapshot_detail_view(context, snapshot)}
'status': 'available',
'volume_size': 100,
'created_at': None,
+ 'user_id': 'bcb7746c7a41472d88a1ffac89ba6a9b',
+ 'project_id': '7ffe17a15c724e2aa79fc839540aec15',
'display_name': 'Default name',
'display_description': 'Default description',
+ 'deleted': None,
+ 'volume': {'availability_zone': 'test_zone'}
}
}
}
self.assertEqual(expected, res_dict)
+ self.assertEqual(2, len(self.notifier.notifications))
def test_snapshot_update_missing_body(self):
body = {}
fake_volume_obj = fake_volume.fake_volume_obj(ctx)
snapshot_get_by_id.return_value = snapshot_obj
volume_get_by_id.return_value = fake_volume_obj
-
req = fakes.HTTPRequest.blank('/v2/snapshots/%s' % UUID)
resp_dict = self.controller.show(req, UUID)
# admin case
list_snapshots_with_limit_and_offset(is_admin=True)
- # non_admin case
+ # non-admin case
list_snapshots_with_limit_and_offset(is_admin=False)
@mock.patch('cinder.db.snapshot_metadata_get', return_value=dict())