Merge "API: os-reset_status notification fix"
This commit is contained in:
commit
7987a7cca6
@ -31,6 +31,7 @@ from cinder.i18n import _
|
||||
from cinder import objects
|
||||
from cinder import rpc
|
||||
from cinder import volume
|
||||
from cinder.volume import volume_utils
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
@ -63,6 +64,9 @@ class AdminController(wsgi.Controller):
|
||||
def validate_update(self, req, body):
|
||||
raise NotImplementedError()
|
||||
|
||||
def _notify_reset_status(self, context, id, message):
|
||||
raise NotImplementedError()
|
||||
|
||||
def authorize(self, context, action_name, target_obj=None):
|
||||
context.authorize(
|
||||
'volume_extension:%(resource)s_admin_actions:%(action)s' %
|
||||
@ -97,10 +101,13 @@ class AdminController(wsgi.Controller):
|
||||
LOG.debug(msg, {'resource': self.resource_name, 'id': id,
|
||||
'update': update})
|
||||
|
||||
# calling notifier here for volumeStatusUpdate is deprecated.
|
||||
# Will be replaced with _notify_reset_status()
|
||||
notifier_info = dict(id=id, update=update)
|
||||
notifier = rpc.get_notifier('volumeStatusUpdate')
|
||||
notifier.info(context, self.collection + '.reset_status.start',
|
||||
notifier_info)
|
||||
self._notify_reset_status(context, id, 'reset_status.start')
|
||||
|
||||
# Not found exception will be handled at the wsgi level
|
||||
self._update(context, id, update)
|
||||
@ -110,6 +117,7 @@ class AdminController(wsgi.Controller):
|
||||
|
||||
notifier.info(context, self.collection + '.reset_status.end',
|
||||
notifier_info)
|
||||
self._notify_reset_status(context, id, 'reset_status.end')
|
||||
|
||||
@wsgi.response(http_client.ACCEPTED)
|
||||
@wsgi.action('os-force_delete')
|
||||
@ -127,6 +135,11 @@ class VolumeAdminController(AdminController):
|
||||
|
||||
collection = 'volumes'
|
||||
|
||||
def _notify_reset_status(self, context, id, message):
|
||||
volume = objects.Volume.get_by_id(context, id)
|
||||
volume_utils.notify_about_volume_usage(context, volume,
|
||||
message)
|
||||
|
||||
def _update(self, *args, **kwargs):
|
||||
context = args[0]
|
||||
volume_id = args[1]
|
||||
@ -242,6 +255,11 @@ class SnapshotAdminController(AdminController):
|
||||
|
||||
collection = 'snapshots'
|
||||
|
||||
def _notify_reset_status(self, context, id, message):
|
||||
snapshot = objects.Snapshot.get_by_id(context, id)
|
||||
volume_utils.notify_about_snapshot_usage(context, snapshot,
|
||||
message)
|
||||
|
||||
@validation.schema(admin_actions.reset_status_snapshot)
|
||||
def validate_update(self, req, body):
|
||||
status = body['os-reset_status']['status']
|
||||
@ -269,6 +287,11 @@ class BackupAdminController(AdminController):
|
||||
|
||||
collection = 'backups'
|
||||
|
||||
def _notify_reset_status(self, context, id, message):
|
||||
backup = objects.Backup.get_by_id(context, id)
|
||||
volume_utils.notify_about_backup_usage(context, backup,
|
||||
message)
|
||||
|
||||
def _get(self, *args, **kwargs):
|
||||
return self.backup_api.get(*args, **kwargs)
|
||||
|
||||
@ -291,6 +314,7 @@ class BackupAdminController(AdminController):
|
||||
notifier = rpc.get_notifier('backupStatusUpdate')
|
||||
notifier.info(context, self.collection + '.reset_status.start',
|
||||
notifier_info)
|
||||
self._notify_reset_status(context, id, 'reset_status.start')
|
||||
|
||||
# Not found exception will be handled at the wsgi level
|
||||
self.backup_api.reset_status(context=context, backup_id=id,
|
||||
|
@ -978,6 +978,8 @@ class BackupManager(manager.SchedulerDependentManager):
|
||||
notifier = rpc.get_notifier('backupStatusUpdate')
|
||||
notifier.info(context, "backups.reset_status.end",
|
||||
notifier_info)
|
||||
volume_utils.notify_about_backup_usage(context, backup,
|
||||
'reset_status.end')
|
||||
|
||||
def check_support_to_force_delete(self, context):
|
||||
"""Check if the backup driver supports force delete operation.
|
||||
|
@ -0,0 +1,26 @@
|
||||
---
|
||||
deprecations:
|
||||
- |
|
||||
In this release, sending ``os-reset_status`` notifications to the
|
||||
following *nonstandard* publisher_ids is DEPRECATED:
|
||||
|
||||
* 'volumeStatusUpdate' for volume status resets
|
||||
* 'volumeStatusUpdate' for snapshot status resets
|
||||
* 'backupStatusUpdate' for backup status resets
|
||||
|
||||
The notifications continue to be published to the above during the
|
||||
deprecation period. Beginning with this release, the ``os-reset_status``
|
||||
notifications are also sent to the following *standard* publisher_ids:
|
||||
|
||||
* 'volume' for volume status resets
|
||||
* 'snapshot' for snapshot status resets
|
||||
* 'backup' for backup status resets
|
||||
|
||||
This will allow consumers of these notifications to make a smooth
|
||||
transition. In the Victoria release, ``os-reset_status`` notifications
|
||||
will *only* be sent to the standard publisher_ids.
|
||||
fixes:
|
||||
- |
|
||||
``os-reset_status`` notifications for volumes, snapshots and backups will
|
||||
now go to the standard publisher id for volume, snapshot and backup like
|
||||
all other notifications for volume, snapshot and backup.
|
Loading…
Reference in New Issue
Block a user