When we update a snapshot status in the db, we need to
use the newly updated snapshot-ref object in the following
notification method call. Otherwise we're sending a
notifciation message with the old/outdated status
information.
NOTE: This also fixes the unit test that was written to
pass with the bug that existed in the notification.
Closes-Bug: #
1349805
Change-Id: I32b86d7edd836310c6da7adffa46e915361668f0
self.assertDictMatch(msg['payload'], expected)
msg = fake_notifier.NOTIFICATIONS[3]
self.assertEqual(msg['event_type'], 'snapshot.create.end')
+ expected['status'] = 'available'
self.assertDictMatch(msg['payload'], expected)
self.volume.delete_snapshot(self.context, snapshot_id)
{'status': 'error'})
raise exception.MetadataCopyFailure(reason=ex)
- self.db.snapshot_update(context,
- snapshot_ref['id'], {'status': 'available',
- 'progress': '100%'})
+ snapshot_ref = self.db.snapshot_update(context,
+ snapshot_ref['id'],
+ {'status': 'available',
+ 'progress': '100%'})
LOG.info(_("snapshot %s: created successfully"), snapshot_ref['id'])
self._notify_about_snapshot_usage(context, snapshot_ref, "create.end")