python-openstackclient 6.3.0__py3-none-any.whl → 6.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- openstackclient/common/availability_zone.py +4 -4
- openstackclient/common/pagination.py +82 -0
- openstackclient/compute/v2/flavor.py +2 -16
- openstackclient/compute/v2/hypervisor.py +2 -21
- openstackclient/compute/v2/keypair.py +2 -9
- openstackclient/compute/v2/server.py +220 -131
- openstackclient/compute/v2/server_event.py +30 -19
- openstackclient/compute/v2/server_group.py +2 -23
- openstackclient/compute/v2/server_migration.py +2 -22
- openstackclient/compute/v2/usage.py +4 -6
- openstackclient/identity/v3/mapping.py +25 -3
- openstackclient/identity/v3/policy.py +3 -1
- openstackclient/image/v2/cache.py +218 -0
- openstackclient/image/v2/image.py +40 -17
- openstackclient/image/v2/metadef_namespaces.py +25 -21
- openstackclient/image/v2/metadef_objects.py +189 -0
- openstackclient/image/v2/metadef_properties.py +284 -0
- openstackclient/network/utils.py +100 -0
- openstackclient/network/v2/default_security_group_rule.py +418 -0
- openstackclient/network/v2/local_ip_association.py +1 -1
- openstackclient/network/v2/ndp_proxy.py +7 -3
- openstackclient/network/v2/network.py +2 -2
- openstackclient/network/v2/port.py +65 -19
- openstackclient/network/v2/security_group_rule.py +18 -111
- openstackclient/network/v2/subnet.py +1 -0
- openstackclient/object/v1/container.py +2 -12
- openstackclient/object/v1/object.py +2 -11
- openstackclient/tests/functional/base.py +13 -6
- openstackclient/tests/functional/identity/v3/test_role.py +11 -3
- openstackclient/tests/functional/network/v2/common.py +7 -1
- openstackclient/tests/functional/network/v2/test_address_group.py +2 -4
- openstackclient/tests/functional/network/v2/test_address_scope.py +0 -6
- openstackclient/tests/functional/network/v2/test_default_security_group_rule.py +67 -0
- openstackclient/tests/functional/network/v2/test_floating_ip.py +3 -6
- openstackclient/tests/functional/network/v2/test_ip_availability.py +3 -8
- openstackclient/tests/functional/network/v2/test_l3_conntrack_helper.py +3 -4
- openstackclient/tests/functional/network/v2/test_local_ip.py +2 -4
- openstackclient/tests/functional/network/v2/test_network.py +18 -17
- openstackclient/tests/functional/network/v2/test_network_agent.py +24 -21
- openstackclient/tests/functional/network/v2/test_network_flavor.py +0 -6
- openstackclient/tests/functional/network/v2/test_network_flavor_profile.py +0 -6
- openstackclient/tests/functional/network/v2/test_network_meter.py +6 -6
- openstackclient/tests/functional/network/v2/test_network_meter_rule.py +7 -8
- openstackclient/tests/functional/network/v2/test_network_ndp_proxy.py +1 -3
- openstackclient/tests/functional/network/v2/test_network_qos_policy.py +4 -4
- openstackclient/tests/functional/network/v2/test_network_qos_rule.py +16 -20
- openstackclient/tests/functional/network/v2/test_network_qos_rule_type.py +4 -4
- openstackclient/tests/functional/network/v2/test_network_rbac.py +1 -4
- openstackclient/tests/functional/network/v2/test_network_segment.py +7 -12
- openstackclient/tests/functional/network/v2/test_network_segment_range.py +3 -4
- openstackclient/tests/functional/network/v2/test_network_service_provider.py +2 -4
- openstackclient/tests/functional/network/v2/test_network_trunk.py +3 -3
- openstackclient/tests/functional/network/v2/test_port.py +2 -8
- openstackclient/tests/functional/network/v2/test_router.py +0 -6
- openstackclient/tests/functional/network/v2/test_security_group.py +1 -4
- openstackclient/tests/functional/network/v2/test_security_group_rule.py +1 -4
- openstackclient/tests/functional/network/v2/test_subnet.py +4 -22
- openstackclient/tests/functional/network/v2/test_subnet_pool.py +0 -6
- openstackclient/tests/unit/common/test_availability_zone.py +28 -30
- openstackclient/tests/unit/common/test_extension.py +1 -4
- openstackclient/tests/unit/common/test_limits.py +2 -4
- openstackclient/tests/unit/common/test_project_cleanup.py +3 -10
- openstackclient/tests/unit/common/test_quota.py +18 -24
- openstackclient/tests/unit/compute/v2/fakes.py +24 -11
- openstackclient/tests/unit/compute/v2/test_agent.py +1 -1
- openstackclient/tests/unit/compute/v2/test_aggregate.py +62 -72
- openstackclient/tests/unit/compute/v2/test_console.py +18 -30
- openstackclient/tests/unit/compute/v2/test_flavor.py +85 -89
- openstackclient/tests/unit/compute/v2/test_host.py +12 -19
- openstackclient/tests/unit/compute/v2/test_hypervisor.py +23 -25
- openstackclient/tests/unit/compute/v2/test_hypervisor_stats.py +2 -6
- openstackclient/tests/unit/compute/v2/test_keypair.py +25 -39
- openstackclient/tests/unit/compute/v2/test_server.py +316 -365
- openstackclient/tests/unit/compute/v2/test_server_backup.py +5 -17
- openstackclient/tests/unit/compute/v2/test_server_event.py +23 -25
- openstackclient/tests/unit/compute/v2/test_server_group.py +41 -33
- openstackclient/tests/unit/compute/v2/test_server_image.py +6 -18
- openstackclient/tests/unit/compute/v2/test_server_migration.py +45 -45
- openstackclient/tests/unit/compute/v2/test_server_volume.py +15 -31
- openstackclient/tests/unit/compute/v2/test_service.py +51 -56
- openstackclient/tests/unit/compute/v2/test_usage.py +10 -13
- openstackclient/tests/unit/fakes.py +4 -0
- openstackclient/tests/unit/identity/v3/test_mappings.py +9 -4
- openstackclient/tests/unit/identity/v3/test_trust.py +0 -2
- openstackclient/tests/unit/image/v1/fakes.py +2 -1
- openstackclient/tests/unit/image/v1/test_image.py +1 -1
- openstackclient/tests/unit/image/v2/fakes.py +82 -0
- openstackclient/tests/unit/image/v2/test_cache.py +214 -0
- openstackclient/tests/unit/image/v2/test_image.py +62 -4
- openstackclient/tests/unit/image/v2/test_metadef_namespaces.py +5 -19
- openstackclient/tests/unit/image/v2/test_metadef_objects.py +162 -0
- openstackclient/tests/unit/image/v2/test_metadef_properties.py +227 -0
- openstackclient/tests/unit/integ/cli/test_shell.py +0 -2
- openstackclient/tests/unit/network/test_common.py +3 -3
- openstackclient/tests/unit/network/v2/fakes.py +1 -0
- openstackclient/tests/unit/network/v2/test_default_security_group_rule.py +1133 -0
- openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +5 -13
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +1 -9
- openstackclient/tests/unit/network/v2/test_network.py +33 -0
- openstackclient/tests/unit/network/v2/test_network_compute.py +5 -11
- openstackclient/tests/unit/network/v2/test_network_trunk.py +6 -8
- openstackclient/tests/unit/network/v2/test_port.py +83 -38
- openstackclient/tests/unit/network/v2/test_security_group_compute.py +7 -15
- openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +19 -27
- openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +3 -6
- openstackclient/tests/unit/network/v2/test_subnet.py +92 -0
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +11 -13
- openstackclient/tests/unit/test_shell.py +1 -7
- openstackclient/tests/unit/utils.py +10 -4
- openstackclient/tests/unit/volume/v1/fakes.py +7 -1
- openstackclient/tests/unit/volume/v1/test_qos_specs.py +2 -2
- openstackclient/tests/unit/volume/v1/test_service.py +1 -1
- openstackclient/tests/unit/volume/v1/test_transfer_request.py +2 -2
- openstackclient/tests/unit/volume/v1/test_type.py +2 -4
- openstackclient/tests/unit/volume/v1/test_volume.py +5 -7
- openstackclient/tests/unit/volume/v1/test_volume_backup.py +4 -4
- openstackclient/tests/unit/volume/v2/fakes.py +32 -12
- openstackclient/tests/unit/volume/v2/test_backup_record.py +1 -1
- openstackclient/tests/unit/volume/v2/test_consistency_group.py +4 -6
- openstackclient/tests/unit/volume/v2/test_consistency_group_snapshot.py +2 -4
- openstackclient/tests/unit/volume/v2/test_qos_specs.py +2 -2
- openstackclient/tests/unit/volume/v2/test_service.py +1 -1
- openstackclient/tests/unit/volume/v2/test_volume.py +78 -16
- openstackclient/tests/unit/volume/v2/test_volume_backend.py +10 -22
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +76 -89
- openstackclient/tests/unit/volume/v2/test_volume_host.py +1 -1
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +5 -7
- openstackclient/tests/unit/volume/v2/test_volume_transfer_request.py +4 -8
- openstackclient/tests/unit/volume/v2/test_volume_type.py +164 -24
- openstackclient/tests/unit/volume/v3/fakes.py +91 -15
- openstackclient/tests/unit/volume/v3/test_block_storage_cleanup.py +3 -7
- openstackclient/tests/unit/volume/v3/test_block_storage_cluster.py +11 -31
- openstackclient/tests/unit/volume/v3/test_block_storage_log_level.py +6 -16
- openstackclient/tests/unit/volume/v3/test_block_storage_manage.py +219 -157
- openstackclient/tests/unit/volume/v3/test_block_storage_resource_filter.py +32 -23
- openstackclient/tests/unit/volume/v3/test_volume.py +50 -48
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +17 -47
- openstackclient/tests/unit/volume/v3/test_volume_group.py +23 -65
- openstackclient/tests/unit/volume/v3/test_volume_group_snapshot.py +88 -77
- openstackclient/tests/unit/volume/v3/test_volume_group_type.py +14 -42
- openstackclient/tests/unit/volume/v3/test_volume_message.py +10 -28
- openstackclient/volume/v1/volume.py +2 -14
- openstackclient/volume/v2/volume.py +30 -15
- openstackclient/volume/v2/volume_backend.py +10 -18
- openstackclient/volume/v2/volume_backup.py +18 -15
- openstackclient/volume/v2/volume_snapshot.py +2 -12
- openstackclient/volume/v2/volume_type.py +211 -14
- openstackclient/volume/v3/block_storage_manage.py +72 -11
- openstackclient/volume/v3/block_storage_resource_filter.py +33 -11
- openstackclient/volume/v3/volume_attachment.py +2 -14
- openstackclient/volume/v3/volume_group_snapshot.py +27 -27
- openstackclient/volume/v3/volume_message.py +2 -13
- {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/AUTHORS +11 -0
- {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/METADATA +6 -5
- {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/RECORD +160 -151
- {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/entry_points.txt +23 -5
- python_openstackclient-6.5.0.dist-info/pbr.json +1 -0
- openstackclient/tests/unit/common/test_parseractions.py +0 -233
- python_openstackclient-6.3.0.dist-info/pbr.json +0 -1
- {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/LICENSE +0 -0
- {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/WHEEL +0 -0
- {python_openstackclient-6.3.0.dist-info → python_openstackclient-6.5.0.dist-info}/top_level.txt +0 -0
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
10
10
|
# License for the specific language governing permissions and limitations
|
|
11
11
|
# under the License.
|
|
12
|
-
|
|
12
|
+
|
|
13
|
+
from unittest import mock
|
|
13
14
|
|
|
14
15
|
from cinderclient import api_versions
|
|
15
16
|
from osc_lib import exceptions
|
|
@@ -24,9 +25,9 @@ class TestBlockStorageManage(v2_volume_fakes.TestVolume):
|
|
|
24
25
|
def setUp(self):
|
|
25
26
|
super().setUp()
|
|
26
27
|
|
|
27
|
-
self.volumes_mock = self.
|
|
28
|
+
self.volumes_mock = self.volume_client.volumes
|
|
28
29
|
self.volumes_mock.reset_mock()
|
|
29
|
-
self.snapshots_mock = self.
|
|
30
|
+
self.snapshots_mock = self.volume_client.volume_snapshots
|
|
30
31
|
self.snapshots_mock.reset_mock()
|
|
31
32
|
|
|
32
33
|
|
|
@@ -46,15 +47,12 @@ class TestBlockStorageVolumeManage(TestBlockStorageManage):
|
|
|
46
47
|
)
|
|
47
48
|
|
|
48
49
|
def test_block_storage_volume_manage_list(self):
|
|
49
|
-
self.
|
|
50
|
-
'3.8'
|
|
51
|
-
)
|
|
52
|
-
host = 'fake_host'
|
|
50
|
+
self.volume_client.api_version = api_versions.APIVersion('3.8')
|
|
53
51
|
arglist = [
|
|
54
|
-
|
|
52
|
+
'fake_host',
|
|
55
53
|
]
|
|
56
54
|
verifylist = [
|
|
57
|
-
('host',
|
|
55
|
+
('host', 'fake_host'),
|
|
58
56
|
]
|
|
59
57
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
60
58
|
|
|
@@ -64,48 +62,37 @@ class TestBlockStorageVolumeManage(TestBlockStorageManage):
|
|
|
64
62
|
'reference',
|
|
65
63
|
'size',
|
|
66
64
|
'safe_to_manage',
|
|
67
|
-
'reason_not_safe',
|
|
68
|
-
'cinder_id',
|
|
69
|
-
'extra_info',
|
|
70
65
|
]
|
|
71
|
-
|
|
72
|
-
# confirming if all expected columns are present in the result.
|
|
73
|
-
self.assertEqual(expected_columns, columns)
|
|
74
|
-
|
|
75
66
|
datalist = []
|
|
76
67
|
for volume_record in self.volume_manage_list:
|
|
77
68
|
manage_details = (
|
|
78
69
|
volume_record.reference,
|
|
79
70
|
volume_record.size,
|
|
80
71
|
volume_record.safe_to_manage,
|
|
81
|
-
volume_record.reason_not_safe,
|
|
82
|
-
volume_record.cinder_id,
|
|
83
|
-
volume_record.extra_info,
|
|
84
72
|
)
|
|
85
73
|
datalist.append(manage_details)
|
|
86
74
|
datalist = tuple(datalist)
|
|
87
75
|
|
|
88
|
-
|
|
76
|
+
self.assertEqual(expected_columns, columns)
|
|
89
77
|
self.assertEqual(datalist, tuple(data))
|
|
90
78
|
|
|
91
79
|
# checking if proper call was made to get volume manageable list
|
|
92
80
|
self.volumes_mock.list_manageable.assert_called_with(
|
|
93
|
-
host=
|
|
94
|
-
detailed=
|
|
95
|
-
marker=
|
|
96
|
-
limit=
|
|
97
|
-
offset=
|
|
98
|
-
sort=
|
|
99
|
-
cluster=
|
|
81
|
+
host='fake_host',
|
|
82
|
+
detailed=False,
|
|
83
|
+
marker=None,
|
|
84
|
+
limit=None,
|
|
85
|
+
offset=None,
|
|
86
|
+
sort=None,
|
|
87
|
+
cluster=None,
|
|
100
88
|
)
|
|
101
89
|
|
|
102
|
-
def
|
|
103
|
-
host = 'fake_host'
|
|
90
|
+
def test_block_storage_volume_manage_list__pre_v38(self):
|
|
104
91
|
arglist = [
|
|
105
|
-
|
|
92
|
+
'fake_host',
|
|
106
93
|
]
|
|
107
94
|
verifylist = [
|
|
108
|
-
('host',
|
|
95
|
+
('host', 'fake_host'),
|
|
109
96
|
]
|
|
110
97
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
111
98
|
|
|
@@ -116,17 +103,14 @@ class TestBlockStorageVolumeManage(TestBlockStorageManage):
|
|
|
116
103
|
'--os-volume-api-version 3.8 or greater is required', str(exc)
|
|
117
104
|
)
|
|
118
105
|
|
|
119
|
-
def
|
|
120
|
-
self.
|
|
121
|
-
'3.16'
|
|
122
|
-
)
|
|
123
|
-
cluster = 'fake_cluster'
|
|
106
|
+
def test_block_storage_volume_manage_list__pre_v317(self):
|
|
107
|
+
self.volume_client.api_version = api_versions.APIVersion('3.16')
|
|
124
108
|
arglist = [
|
|
125
109
|
'--cluster',
|
|
126
|
-
|
|
110
|
+
'fake_cluster',
|
|
127
111
|
]
|
|
128
112
|
verifylist = [
|
|
129
|
-
('cluster',
|
|
113
|
+
('cluster', 'fake_cluster'),
|
|
130
114
|
]
|
|
131
115
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
132
116
|
|
|
@@ -138,20 +122,16 @@ class TestBlockStorageVolumeManage(TestBlockStorageManage):
|
|
|
138
122
|
)
|
|
139
123
|
self.assertIn('--cluster', str(exc))
|
|
140
124
|
|
|
141
|
-
def
|
|
142
|
-
self.
|
|
143
|
-
'3.17'
|
|
144
|
-
)
|
|
145
|
-
host = 'fake_host'
|
|
146
|
-
cluster = 'fake_cluster'
|
|
125
|
+
def test_block_storage_volume_manage_list__host_and_cluster(self):
|
|
126
|
+
self.volume_client.api_version = api_versions.APIVersion('3.17')
|
|
147
127
|
arglist = [
|
|
148
|
-
|
|
128
|
+
'fake_host',
|
|
149
129
|
'--cluster',
|
|
150
|
-
|
|
130
|
+
'fake_cluster',
|
|
151
131
|
]
|
|
152
132
|
verifylist = [
|
|
153
|
-
('host',
|
|
154
|
-
('cluster',
|
|
133
|
+
('host', 'fake_host'),
|
|
134
|
+
('cluster', 'fake_cluster'),
|
|
155
135
|
]
|
|
156
136
|
exc = self.assertRaises(
|
|
157
137
|
tests_utils.ParserException,
|
|
@@ -164,36 +144,91 @@ class TestBlockStorageVolumeManage(TestBlockStorageManage):
|
|
|
164
144
|
'argument --cluster: not allowed with argument <host>', str(exc)
|
|
165
145
|
)
|
|
166
146
|
|
|
167
|
-
def
|
|
147
|
+
def test_block_storage_volume_manage_list__detailed(self):
|
|
148
|
+
"""This option is deprecated."""
|
|
149
|
+
self.volume_client.api_version = api_versions.APIVersion('3.8')
|
|
150
|
+
arglist = [
|
|
151
|
+
'--detailed',
|
|
152
|
+
'True',
|
|
153
|
+
'fake_host',
|
|
154
|
+
]
|
|
155
|
+
verifylist = [
|
|
156
|
+
('host', 'fake_host'),
|
|
157
|
+
('detailed', 'True'),
|
|
158
|
+
('marker', None),
|
|
159
|
+
('limit', None),
|
|
160
|
+
('offset', None),
|
|
161
|
+
('sort', None),
|
|
162
|
+
]
|
|
163
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
164
|
+
|
|
165
|
+
with mock.patch.object(self.cmd.log, 'warning') as mock_warning:
|
|
166
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
167
|
+
|
|
168
|
+
expected_columns = [
|
|
169
|
+
'reference',
|
|
170
|
+
'size',
|
|
171
|
+
'safe_to_manage',
|
|
172
|
+
'reason_not_safe',
|
|
173
|
+
'cinder_id',
|
|
174
|
+
'extra_info',
|
|
175
|
+
]
|
|
176
|
+
datalist = []
|
|
177
|
+
for volume_record in self.volume_manage_list:
|
|
178
|
+
manage_details = (
|
|
179
|
+
volume_record.reference,
|
|
180
|
+
volume_record.size,
|
|
181
|
+
volume_record.safe_to_manage,
|
|
182
|
+
volume_record.reason_not_safe,
|
|
183
|
+
volume_record.cinder_id,
|
|
184
|
+
volume_record.extra_info,
|
|
185
|
+
)
|
|
186
|
+
datalist.append(manage_details)
|
|
187
|
+
datalist = tuple(datalist)
|
|
188
|
+
|
|
189
|
+
self.assertEqual(expected_columns, columns)
|
|
190
|
+
self.assertEqual(datalist, tuple(data))
|
|
191
|
+
|
|
192
|
+
# checking if proper call was made to get volume manageable list
|
|
193
|
+
self.volumes_mock.list_manageable.assert_called_with(
|
|
194
|
+
host='fake_host',
|
|
195
|
+
detailed=True,
|
|
196
|
+
marker=None,
|
|
197
|
+
limit=None,
|
|
198
|
+
offset=None,
|
|
199
|
+
sort=None,
|
|
200
|
+
cluster=None,
|
|
201
|
+
)
|
|
202
|
+
mock_warning.assert_called_once()
|
|
203
|
+
self.assertIn(
|
|
204
|
+
"The --detailed option has been deprecated.",
|
|
205
|
+
str(mock_warning.call_args[0][0]),
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
def test_block_storage_volume_manage_list__all_args(self):
|
|
168
209
|
self.app.client_manager.volume.api_version = api_versions.APIVersion(
|
|
169
210
|
'3.8'
|
|
170
211
|
)
|
|
171
|
-
host = 'fake_host'
|
|
172
|
-
detailed = True
|
|
173
|
-
marker = 'fake_marker'
|
|
174
|
-
limit = '5'
|
|
175
|
-
offset = '3'
|
|
176
|
-
sort = 'size:asc'
|
|
177
212
|
arglist = [
|
|
178
|
-
|
|
179
|
-
'--
|
|
180
|
-
str(detailed),
|
|
213
|
+
'fake_host',
|
|
214
|
+
'--long',
|
|
181
215
|
'--marker',
|
|
182
|
-
|
|
216
|
+
'fake_marker',
|
|
183
217
|
'--limit',
|
|
184
|
-
|
|
218
|
+
'5',
|
|
185
219
|
'--offset',
|
|
186
|
-
|
|
220
|
+
'3',
|
|
187
221
|
'--sort',
|
|
188
|
-
|
|
222
|
+
'size:asc',
|
|
189
223
|
]
|
|
190
224
|
verifylist = [
|
|
191
|
-
('host',
|
|
192
|
-
('detailed',
|
|
193
|
-
('
|
|
194
|
-
('
|
|
195
|
-
('
|
|
196
|
-
('
|
|
225
|
+
('host', 'fake_host'),
|
|
226
|
+
('detailed', None),
|
|
227
|
+
('long', True),
|
|
228
|
+
('marker', 'fake_marker'),
|
|
229
|
+
('limit', '5'),
|
|
230
|
+
('offset', '3'),
|
|
231
|
+
('sort', 'size:asc'),
|
|
197
232
|
]
|
|
198
233
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
199
234
|
|
|
@@ -207,10 +242,6 @@ class TestBlockStorageVolumeManage(TestBlockStorageManage):
|
|
|
207
242
|
'cinder_id',
|
|
208
243
|
'extra_info',
|
|
209
244
|
]
|
|
210
|
-
|
|
211
|
-
# confirming if all expected columns are present in the result.
|
|
212
|
-
self.assertEqual(expected_columns, columns)
|
|
213
|
-
|
|
214
245
|
datalist = []
|
|
215
246
|
for volume_record in self.volume_manage_list:
|
|
216
247
|
manage_details = (
|
|
@@ -224,18 +255,18 @@ class TestBlockStorageVolumeManage(TestBlockStorageManage):
|
|
|
224
255
|
datalist.append(manage_details)
|
|
225
256
|
datalist = tuple(datalist)
|
|
226
257
|
|
|
227
|
-
|
|
258
|
+
self.assertEqual(expected_columns, columns)
|
|
228
259
|
self.assertEqual(datalist, tuple(data))
|
|
229
260
|
|
|
230
261
|
# checking if proper call was made to get volume manageable list
|
|
231
262
|
self.volumes_mock.list_manageable.assert_called_with(
|
|
232
|
-
host=
|
|
233
|
-
detailed=
|
|
234
|
-
marker=
|
|
235
|
-
limit=
|
|
236
|
-
offset=
|
|
237
|
-
sort=
|
|
238
|
-
cluster=
|
|
263
|
+
host='fake_host',
|
|
264
|
+
detailed=True,
|
|
265
|
+
marker='fake_marker',
|
|
266
|
+
limit='5',
|
|
267
|
+
offset='3',
|
|
268
|
+
sort='size:asc',
|
|
269
|
+
cluster=None,
|
|
239
270
|
)
|
|
240
271
|
|
|
241
272
|
|
|
@@ -255,15 +286,12 @@ class TestBlockStorageSnapshotManage(TestBlockStorageManage):
|
|
|
255
286
|
)
|
|
256
287
|
|
|
257
288
|
def test_block_storage_snapshot_manage_list(self):
|
|
258
|
-
self.
|
|
259
|
-
'3.8'
|
|
260
|
-
)
|
|
261
|
-
host = 'fake_host'
|
|
289
|
+
self.volume_client.api_version = api_versions.APIVersion('3.8')
|
|
262
290
|
arglist = [
|
|
263
|
-
|
|
291
|
+
'fake_host',
|
|
264
292
|
]
|
|
265
293
|
verifylist = [
|
|
266
|
-
('host',
|
|
294
|
+
('host', 'fake_host'),
|
|
267
295
|
]
|
|
268
296
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
269
297
|
|
|
@@ -274,14 +302,7 @@ class TestBlockStorageSnapshotManage(TestBlockStorageManage):
|
|
|
274
302
|
'size',
|
|
275
303
|
'safe_to_manage',
|
|
276
304
|
'source_reference',
|
|
277
|
-
'reason_not_safe',
|
|
278
|
-
'cinder_id',
|
|
279
|
-
'extra_info',
|
|
280
305
|
]
|
|
281
|
-
|
|
282
|
-
# confirming if all expected columns are present in the result.
|
|
283
|
-
self.assertEqual(expected_columns, columns)
|
|
284
|
-
|
|
285
306
|
datalist = []
|
|
286
307
|
for snapshot_record in self.snapshot_manage_list:
|
|
287
308
|
manage_details = (
|
|
@@ -289,34 +310,30 @@ class TestBlockStorageSnapshotManage(TestBlockStorageManage):
|
|
|
289
310
|
snapshot_record.size,
|
|
290
311
|
snapshot_record.safe_to_manage,
|
|
291
312
|
snapshot_record.source_reference,
|
|
292
|
-
snapshot_record.reason_not_safe,
|
|
293
|
-
snapshot_record.cinder_id,
|
|
294
|
-
snapshot_record.extra_info,
|
|
295
313
|
)
|
|
296
314
|
datalist.append(manage_details)
|
|
297
315
|
datalist = tuple(datalist)
|
|
298
316
|
|
|
299
|
-
|
|
317
|
+
self.assertEqual(expected_columns, columns)
|
|
300
318
|
self.assertEqual(datalist, tuple(data))
|
|
301
319
|
|
|
302
320
|
# checking if proper call was made to get snapshot manageable list
|
|
303
321
|
self.snapshots_mock.list_manageable.assert_called_with(
|
|
304
|
-
host=
|
|
305
|
-
detailed=
|
|
306
|
-
marker=
|
|
307
|
-
limit=
|
|
308
|
-
offset=
|
|
309
|
-
sort=
|
|
310
|
-
cluster=
|
|
322
|
+
host='fake_host',
|
|
323
|
+
detailed=False,
|
|
324
|
+
marker=None,
|
|
325
|
+
limit=None,
|
|
326
|
+
offset=None,
|
|
327
|
+
sort=None,
|
|
328
|
+
cluster=None,
|
|
311
329
|
)
|
|
312
330
|
|
|
313
|
-
def
|
|
314
|
-
host = 'fake_host'
|
|
331
|
+
def test_block_storage_snapshot_manage_list__pre_v38(self):
|
|
315
332
|
arglist = [
|
|
316
|
-
|
|
333
|
+
'fake_host',
|
|
317
334
|
]
|
|
318
335
|
verifylist = [
|
|
319
|
-
('host',
|
|
336
|
+
('host', 'fake_host'),
|
|
320
337
|
]
|
|
321
338
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
322
339
|
|
|
@@ -327,17 +344,14 @@ class TestBlockStorageSnapshotManage(TestBlockStorageManage):
|
|
|
327
344
|
'--os-volume-api-version 3.8 or greater is required', str(exc)
|
|
328
345
|
)
|
|
329
346
|
|
|
330
|
-
def
|
|
331
|
-
self.
|
|
332
|
-
'3.16'
|
|
333
|
-
)
|
|
334
|
-
cluster = 'fake_cluster'
|
|
347
|
+
def test_block_storage_snapshot_manage_list__pre_v317(self):
|
|
348
|
+
self.volume_client.api_version = api_versions.APIVersion('3.16')
|
|
335
349
|
arglist = [
|
|
336
350
|
'--cluster',
|
|
337
|
-
|
|
351
|
+
'fake_cluster',
|
|
338
352
|
]
|
|
339
353
|
verifylist = [
|
|
340
|
-
('cluster',
|
|
354
|
+
('cluster', 'fake_cluster'),
|
|
341
355
|
]
|
|
342
356
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
343
357
|
|
|
@@ -349,20 +363,16 @@ class TestBlockStorageSnapshotManage(TestBlockStorageManage):
|
|
|
349
363
|
)
|
|
350
364
|
self.assertIn('--cluster', str(exc))
|
|
351
365
|
|
|
352
|
-
def
|
|
353
|
-
self.
|
|
354
|
-
'3.17'
|
|
355
|
-
)
|
|
356
|
-
host = 'fake_host'
|
|
357
|
-
cluster = 'fake_cluster'
|
|
366
|
+
def test_block_storage_snapshot_manage_list__host_and_cluster(self):
|
|
367
|
+
self.volume_client.api_version = api_versions.APIVersion('3.17')
|
|
358
368
|
arglist = [
|
|
359
|
-
|
|
369
|
+
'fake_host',
|
|
360
370
|
'--cluster',
|
|
361
|
-
|
|
371
|
+
'fake_cluster',
|
|
362
372
|
]
|
|
363
373
|
verifylist = [
|
|
364
|
-
('host',
|
|
365
|
-
('cluster',
|
|
374
|
+
('host', 'fake_host'),
|
|
375
|
+
('cluster', 'fake_cluster'),
|
|
366
376
|
]
|
|
367
377
|
exc = self.assertRaises(
|
|
368
378
|
tests_utils.ParserException,
|
|
@@ -375,36 +385,92 @@ class TestBlockStorageSnapshotManage(TestBlockStorageManage):
|
|
|
375
385
|
'argument --cluster: not allowed with argument <host>', str(exc)
|
|
376
386
|
)
|
|
377
387
|
|
|
378
|
-
def
|
|
388
|
+
def test_block_storage_snapshot_manage_list__detailed(self):
|
|
389
|
+
self.volume_client.api_version = api_versions.APIVersion('3.8')
|
|
390
|
+
arglist = [
|
|
391
|
+
'--detailed',
|
|
392
|
+
'True',
|
|
393
|
+
'fake_host',
|
|
394
|
+
]
|
|
395
|
+
verifylist = [
|
|
396
|
+
('host', 'fake_host'),
|
|
397
|
+
('detailed', 'True'),
|
|
398
|
+
('marker', None),
|
|
399
|
+
('limit', None),
|
|
400
|
+
('offset', None),
|
|
401
|
+
('sort', None),
|
|
402
|
+
]
|
|
403
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
404
|
+
|
|
405
|
+
with mock.patch.object(self.cmd.log, 'warning') as mock_warning:
|
|
406
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
407
|
+
|
|
408
|
+
expected_columns = [
|
|
409
|
+
'reference',
|
|
410
|
+
'size',
|
|
411
|
+
'safe_to_manage',
|
|
412
|
+
'source_reference',
|
|
413
|
+
'reason_not_safe',
|
|
414
|
+
'cinder_id',
|
|
415
|
+
'extra_info',
|
|
416
|
+
]
|
|
417
|
+
datalist = []
|
|
418
|
+
for snapshot_record in self.snapshot_manage_list:
|
|
419
|
+
manage_details = (
|
|
420
|
+
snapshot_record.reference,
|
|
421
|
+
snapshot_record.size,
|
|
422
|
+
snapshot_record.safe_to_manage,
|
|
423
|
+
snapshot_record.source_reference,
|
|
424
|
+
snapshot_record.reason_not_safe,
|
|
425
|
+
snapshot_record.cinder_id,
|
|
426
|
+
snapshot_record.extra_info,
|
|
427
|
+
)
|
|
428
|
+
datalist.append(manage_details)
|
|
429
|
+
datalist = tuple(datalist)
|
|
430
|
+
|
|
431
|
+
self.assertEqual(expected_columns, columns)
|
|
432
|
+
self.assertEqual(datalist, tuple(data))
|
|
433
|
+
|
|
434
|
+
# checking if proper call was made to get snapshot manageable list
|
|
435
|
+
self.snapshots_mock.list_manageable.assert_called_with(
|
|
436
|
+
host='fake_host',
|
|
437
|
+
detailed=True,
|
|
438
|
+
marker=None,
|
|
439
|
+
limit=None,
|
|
440
|
+
offset=None,
|
|
441
|
+
sort=None,
|
|
442
|
+
cluster=None,
|
|
443
|
+
)
|
|
444
|
+
mock_warning.assert_called_once()
|
|
445
|
+
self.assertIn(
|
|
446
|
+
"The --detailed option has been deprecated.",
|
|
447
|
+
str(mock_warning.call_args[0][0]),
|
|
448
|
+
)
|
|
449
|
+
|
|
450
|
+
def test_block_storage_snapshot_manage_list__all_args(self):
|
|
379
451
|
self.app.client_manager.volume.api_version = api_versions.APIVersion(
|
|
380
452
|
'3.8'
|
|
381
453
|
)
|
|
382
|
-
host = 'fake_host'
|
|
383
|
-
detailed = True
|
|
384
|
-
marker = 'fake_marker'
|
|
385
|
-
limit = '5'
|
|
386
|
-
offset = '3'
|
|
387
|
-
sort = 'size:asc'
|
|
388
454
|
arglist = [
|
|
389
|
-
|
|
390
|
-
'--detailed',
|
|
391
|
-
str(detailed),
|
|
455
|
+
'--long',
|
|
392
456
|
'--marker',
|
|
393
|
-
|
|
457
|
+
'fake_marker',
|
|
394
458
|
'--limit',
|
|
395
|
-
|
|
459
|
+
'5',
|
|
396
460
|
'--offset',
|
|
397
|
-
|
|
461
|
+
'3',
|
|
398
462
|
'--sort',
|
|
399
|
-
|
|
463
|
+
'size:asc',
|
|
464
|
+
'fake_host',
|
|
400
465
|
]
|
|
401
466
|
verifylist = [
|
|
402
|
-
('host',
|
|
403
|
-
('detailed',
|
|
404
|
-
('
|
|
405
|
-
('
|
|
406
|
-
('
|
|
407
|
-
('
|
|
467
|
+
('host', 'fake_host'),
|
|
468
|
+
('detailed', None),
|
|
469
|
+
('long', True),
|
|
470
|
+
('marker', 'fake_marker'),
|
|
471
|
+
('limit', '5'),
|
|
472
|
+
('offset', '3'),
|
|
473
|
+
('sort', 'size:asc'),
|
|
408
474
|
]
|
|
409
475
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
410
476
|
|
|
@@ -419,10 +485,6 @@ class TestBlockStorageSnapshotManage(TestBlockStorageManage):
|
|
|
419
485
|
'cinder_id',
|
|
420
486
|
'extra_info',
|
|
421
487
|
]
|
|
422
|
-
|
|
423
|
-
# confirming if all expected columns are present in the result.
|
|
424
|
-
self.assertEqual(expected_columns, columns)
|
|
425
|
-
|
|
426
488
|
datalist = []
|
|
427
489
|
for snapshot_record in self.snapshot_manage_list:
|
|
428
490
|
manage_details = (
|
|
@@ -437,16 +499,16 @@ class TestBlockStorageSnapshotManage(TestBlockStorageManage):
|
|
|
437
499
|
datalist.append(manage_details)
|
|
438
500
|
datalist = tuple(datalist)
|
|
439
501
|
|
|
440
|
-
|
|
502
|
+
self.assertEqual(expected_columns, columns)
|
|
441
503
|
self.assertEqual(datalist, tuple(data))
|
|
442
504
|
|
|
443
505
|
# checking if proper call was made to get snapshot manageable list
|
|
444
506
|
self.snapshots_mock.list_manageable.assert_called_with(
|
|
445
|
-
host=
|
|
446
|
-
detailed=
|
|
447
|
-
marker=
|
|
448
|
-
limit=
|
|
449
|
-
offset=
|
|
450
|
-
sort=
|
|
451
|
-
cluster=
|
|
507
|
+
host='fake_host',
|
|
508
|
+
detailed=True,
|
|
509
|
+
marker='fake_marker',
|
|
510
|
+
limit='5',
|
|
511
|
+
offset='3',
|
|
512
|
+
sort='size:asc',
|
|
513
|
+
cluster=None,
|
|
452
514
|
)
|