Trigger volume deletes only on volume deleted

It was possible to create a volume and to do the following operations
with the volume; at the end, the volume itself is marked as ended, but
the volume is still available.

openstack volume create --size x foo
openstack volume snapshot create --volume <id> foo_snap
openstack volume create --snapshot <id_of_snap> clone
openstack volume delete --purge <id_of_foo>

openstack metric resource show <id_of_foo>

This commit fixes that issue.

Change-Id: I55f0667c71ba4f3a33959a44bef43c3b05bc097c
This commit is contained in:
Matthias Runge 2020-06-18 08:10:33 +02:00
parent c3b0a808af
commit f8992d40a1
2 changed files with 5 additions and 5 deletions

View File

@ -248,8 +248,8 @@ resources:
image_id: resource_metadata.image_id image_id: resource_metadata.image_id
instance_id: resource_metadata.instance_id instance_id: resource_metadata.instance_id
event_delete: event_delete:
- volume.delete.start - volume.delete.end
- snapshot.delete.start - snapshot.delete.end
event_attributes: event_attributes:
id: resource_id id: resource_id

View File

@ -111,8 +111,8 @@ IMAGE_DELETE_START = models.Event(
) )
VOLUME_DELETE_START = models.Event( VOLUME_DELETE_END = models.Event(
event_type=u'volume.delete.start', event_type=u'volume.delete.end',
traits=[models.Trait(u'availability_zone', 1, u'nova'), traits=[models.Trait(u'availability_zone', 1, u'nova'),
models.Trait(u'created_at', 1, u'2016-11-28T13:19:53+00:00'), models.Trait(u'created_at', 1, u'2016-11-28T13:19:53+00:00'),
models.Trait(u'display_name', 1, u'vol-001'), models.Trait(u'display_name', 1, u'vol-001'),
@ -549,7 +549,7 @@ class PublisherWorkflowTest(base.BaseTestCase,
self.publisher.publish_events([INSTANCE_DELETE_START, self.publisher.publish_events([INSTANCE_DELETE_START,
IMAGE_DELETE_START, IMAGE_DELETE_START,
VOLUME_DELETE_START, VOLUME_DELETE_END,
FLOATINGIP_DELETE_END]) FLOATINGIP_DELETE_END])
self.assertEqual(8, len(fakeclient.mock_calls)) self.assertEqual(8, len(fakeclient.mock_calls))
for call in expected_calls: for call in expected_calls: