Add 'all-projects' option to 'volume backup list'
Similar to what 'volume list --all-projects' does, 'volume backup list --all-projects' list volume backups accross all projects. Change-Id: Id5dda9b5adc822c4ddfb2dda339946d3322858e2
This commit is contained in:
parent
e07b0e0919
commit
55669b90c0
@ -94,6 +94,7 @@ List volume backups
|
||||
[--volume <volume>]
|
||||
[--marker <marker>]
|
||||
[--limit <limit>]
|
||||
[--all-projects]
|
||||
|
||||
.. _volume_backup_list-backup:
|
||||
.. option:: --long
|
||||
@ -125,6 +126,10 @@ List volume backups
|
||||
|
||||
*Volume version 2 only*
|
||||
|
||||
.. option:: --all-projects
|
||||
|
||||
Include all projects (admin only)
|
||||
|
||||
volume backup restore
|
||||
---------------------
|
||||
|
||||
|
@ -260,6 +260,7 @@ class TestBackupList(TestBackup):
|
||||
("name", None),
|
||||
("status", None),
|
||||
("volume", None),
|
||||
('all_projects', False),
|
||||
]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
@ -269,8 +270,9 @@ class TestBackupList(TestBackup):
|
||||
"name": None,
|
||||
"status": None,
|
||||
"volume_id": None,
|
||||
"all_tenants": False,
|
||||
}
|
||||
self.volumes_mock.get.assert_not_called
|
||||
self.volumes_mock.get.assert_not_called()
|
||||
self.backups_mock.list.assert_called_with(
|
||||
search_opts=search_opts,
|
||||
)
|
||||
@ -283,12 +285,14 @@ class TestBackupList(TestBackup):
|
||||
"--name", self.backups[0].name,
|
||||
"--status", "error",
|
||||
"--volume", self.volume.id,
|
||||
"--all-projects"
|
||||
]
|
||||
verifylist = [
|
||||
("long", True),
|
||||
("name", self.backups[0].name),
|
||||
("status", "error"),
|
||||
("volume", self.volume.id),
|
||||
('all_projects', True),
|
||||
]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
@ -298,6 +302,7 @@ class TestBackupList(TestBackup):
|
||||
"name": self.backups[0].name,
|
||||
"status": "error",
|
||||
"volume_id": self.volume.id,
|
||||
"all_tenants": True,
|
||||
}
|
||||
self.volumes_mock.get.assert_called_once_with(self.volume.id)
|
||||
self.backups_mock.list.assert_called_with(
|
||||
|
@ -294,6 +294,7 @@ class TestBackupList(TestBackup):
|
||||
("volume", None),
|
||||
("marker", None),
|
||||
("limit", None),
|
||||
('all_projects', False),
|
||||
]
|
||||
|
||||
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
||||
@ -303,9 +304,10 @@ class TestBackupList(TestBackup):
|
||||
"name": None,
|
||||
"status": None,
|
||||
"volume_id": None,
|
||||
'all_tenants': False,
|
||||
}
|
||||
self.volumes_mock.get.assert_not_called
|
||||
self.backups_mock.get.assert_not_called
|
||||
self.volumes_mock.get.assert_not_called()
|
||||
self.backups_mock.get.assert_not_called()
|
||||
self.backups_mock.list.assert_called_with(
|
||||
search_opts=search_opts,
|
||||
marker=None,
|
||||
@ -321,6 +323,7 @@ class TestBackupList(TestBackup):
|
||||
"--status", "error",
|
||||
"--volume", self.volume.id,
|
||||
"--marker", self.backups[0].id,
|
||||
"--all-projects",
|
||||
"--limit", "3",
|
||||
]
|
||||
verifylist = [
|
||||
@ -329,6 +332,7 @@ class TestBackupList(TestBackup):
|
||||
("status", "error"),
|
||||
("volume", self.volume.id),
|
||||
("marker", self.backups[0].id),
|
||||
('all_projects', True),
|
||||
("limit", 3),
|
||||
]
|
||||
|
||||
@ -339,6 +343,7 @@ class TestBackupList(TestBackup):
|
||||
"name": self.backups[0].name,
|
||||
"status": "error",
|
||||
"volume_id": self.volume.id,
|
||||
'all_tenants': True,
|
||||
}
|
||||
self.volumes_mock.get.assert_called_once_with(self.volume.id)
|
||||
self.backups_mock.get.assert_called_once_with(self.backups[0].id)
|
||||
|
@ -172,6 +172,12 @@ class ListVolumeBackup(command.Lister):
|
||||
help=_("Filters results by the volume which they "
|
||||
"backup (name or ID)")
|
||||
)
|
||||
parser.add_argument(
|
||||
'--all-projects',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help=_('Include all projects (admin only)'),
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
@ -215,6 +221,7 @@ class ListVolumeBackup(command.Lister):
|
||||
'name': parsed_args.name,
|
||||
'status': parsed_args.status,
|
||||
'volume_id': filter_volume_id,
|
||||
'all_tenants': parsed_args.all_projects,
|
||||
}
|
||||
data = volume_client.backups.list(
|
||||
search_opts=search_opts,
|
||||
|
@ -212,6 +212,12 @@ class ListVolumeBackup(command.Lister):
|
||||
metavar='<limit>',
|
||||
help=_('Maximum number of backups to display'),
|
||||
)
|
||||
parser.add_argument(
|
||||
'--all-projects',
|
||||
action='store_true',
|
||||
default=False,
|
||||
help=_('Include all projects (admin only)'),
|
||||
)
|
||||
return parser
|
||||
|
||||
def take_action(self, parsed_args):
|
||||
@ -259,6 +265,7 @@ class ListVolumeBackup(command.Lister):
|
||||
'name': parsed_args.name,
|
||||
'status': parsed_args.status,
|
||||
'volume_id': filter_volume_id,
|
||||
'all_tenants': parsed_args.all_projects,
|
||||
}
|
||||
data = volume_client.backups.list(
|
||||
search_opts=search_opts,
|
||||
|
@ -0,0 +1,4 @@
|
||||
---
|
||||
features:
|
||||
- The ``openstack volume backup list`` command now supports the
|
||||
``all-projects`` option to list volume backups accross all projects.
|
Loading…
Reference in New Issue
Block a user