From 3fd70ddc0522bea26986694113c7df7fd260c5bf Mon Sep 17 00:00:00 2001 From: Ryan Zimmerman Date: Tue, 11 May 2021 23:05:52 -0700 Subject: [PATCH] Add compute microversion 2.79 Compute 2.79 [1] added support for specifying the delete_on_termination field in the request body, which configures whether a volume is deleted when the server is destroyed. [1] https://docs.openstack.org/nova/latest/reference/api-microversion-history.html#maximum-in-train Change-Id: I52e9f5d888a242ec564b90c8caac86ae02e8f596 --- openstack/compute/v2/volume_attachment.py | 6 ++++-- openstack/tests/unit/compute/v2/test_volume_attachment.py | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/openstack/compute/v2/volume_attachment.py b/openstack/compute/v2/volume_attachment.py index 770395c7d..45fc45bc2 100644 --- a/openstack/compute/v2/volume_attachment.py +++ b/openstack/compute/v2/volume_attachment.py @@ -39,5 +39,7 @@ class VolumeAttachment(resource.Resource): attachment_id = resource.Body('attachment_id', alternate_id=True) #: Virtual device tags for the attachment. tag = resource.Body('tag') - # tag introduced in 2.70 - _max_microversion = '2.70' + #: Indicates whether to delete the volume when server is destroyed + delete_on_termination = resource.Body('delete_on_termination') + # delete_on_termination introduced in 2.79 + _max_microversion = '2.79' diff --git a/openstack/tests/unit/compute/v2/test_volume_attachment.py b/openstack/tests/unit/compute/v2/test_volume_attachment.py index 2eb473d4a..03d031c1f 100644 --- a/openstack/tests/unit/compute/v2/test_volume_attachment.py +++ b/openstack/tests/unit/compute/v2/test_volume_attachment.py @@ -19,6 +19,7 @@ EXAMPLE = { 'id': '2', 'volume_id': '3', 'tag': '4', + 'delete_on_termination': 'true', } @@ -46,3 +47,5 @@ class TestServerInterface(base.TestCase): self.assertEqual(EXAMPLE['id'], sot.id) self.assertEqual(EXAMPLE['volume_id'], sot.volume_id) self.assertEqual(EXAMPLE['tag'], sot.tag) + self.assertEqual(EXAMPLE['delete_on_termination'], + sot.delete_on_termination)