From fa62f7d67f1f3b8567895206dcdbfd88f5db4287 Mon Sep 17 00:00:00 2001 From: Valery Tschopp Date: Thu, 1 Oct 2020 10:21:52 +0200 Subject: [PATCH] Add 'project_id' to Snapshot query parameters This allow to list volume snapshots filtered by project (as admin). Change-Id: I9372dd139868f726c749b4616acb7d0cdac6643c Task: 41002 Story: 2008214 --- openstack/block_storage/v3/_proxy.py | 1 + openstack/block_storage/v3/snapshot.py | 3 ++- openstack/tests/unit/block_storage/v3/test_snapshot.py | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/openstack/block_storage/v3/_proxy.py b/openstack/block_storage/v3/_proxy.py index 247bf3b2e..d0f07f063 100644 --- a/openstack/block_storage/v3/_proxy.py +++ b/openstack/block_storage/v3/_proxy.py @@ -62,6 +62,7 @@ class Proxy(_base_proxy.BaseBlockStorageProxy): * name: Name of the snapshot as a string. * all_projects: Whether return the snapshots in all projects. + * project_id: Filter the snapshots by project. * volume_id: volume id of a snapshot. * status: Value of the status of the snapshot so that you can filter on "available" for example. diff --git a/openstack/block_storage/v3/snapshot.py b/openstack/block_storage/v3/snapshot.py index 04b8e7181..86e8383a9 100644 --- a/openstack/block_storage/v3/snapshot.py +++ b/openstack/block_storage/v3/snapshot.py @@ -20,7 +20,8 @@ class Snapshot(resource.Resource): base_path = "/snapshots" _query_mapping = resource.QueryParameters( - 'name', 'status', 'volume_id', all_projects='all_tenants') + 'name', 'status', 'volume_id', + 'project_id', all_projects='all_tenants') # capabilities allow_fetch = True diff --git a/openstack/tests/unit/block_storage/v3/test_snapshot.py b/openstack/tests/unit/block_storage/v3/test_snapshot.py index ae980542e..9aa3665eb 100644 --- a/openstack/tests/unit/block_storage/v3/test_snapshot.py +++ b/openstack/tests/unit/block_storage/v3/test_snapshot.py @@ -48,6 +48,7 @@ class TestSnapshot(base.TestCase): self.assertDictEqual({"name": "name", "status": "status", "all_projects": "all_tenants", + "project_id": "project_id", "volume_id": "volume_id", "limit": "limit", "marker": "marker"},