Merge "Add update capabilities to Snapshots"

This commit is contained in:
Zuul 2022-06-20 18:01:31 +00:00 committed by Gerrit Code Review
commit af86313c83
2 changed files with 30 additions and 0 deletions

View File

@ -93,6 +93,19 @@ class Proxy(_base_proxy.BaseBlockStorageProxy):
"""
return self._create(_snapshot.Snapshot, **attrs)
def update_snapshot(self, snapshot, **attrs):
"""Update a snapshot
:param snapshot: Either the ID of a snapshot or a
:class:`~openstack.block_storage.v3.snapshot.Snapshot` instance.
:attrs kwargs: The attributes to update on the snapshot represented
by ``snapshot``.
:returns: The updated snapshot
:rtype: :class:`~openstack.block_storage.v3.snapshot.Snapshot`
"""
return self._update(_snapshot.Snapshot, snapshot, **attrs)
def delete_snapshot(self, snapshot, ignore_missing=True, force=False):
"""Delete a snapshot

View File

@ -70,6 +70,23 @@ class TestVolume(TestVolumeProxy):
expected_args=[self.proxy]
)
def test_snapshot_create_attrs(self):
self.verify_create(self.proxy.create_snapshot, snapshot.Snapshot)
def test_snapshot_update(self):
self.verify_update(self.proxy.update_snapshot, snapshot.Snapshot)
def test_snapshot_delete(self):
self.verify_delete(self.proxy.delete_snapshot,
snapshot.Snapshot, False)
def test_snapshot_delete_ignore(self):
self.verify_delete(self.proxy.delete_snapshot,
snapshot.Snapshot, True)
def test_type_get(self):
self.verify_get(self.proxy.get_type, type.Type)
def test_backend_pools(self):
self.verify_list(self.proxy.backend_pools, stats.Pools)