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
|
@@ -17,9 +17,13 @@ import random
|
|
|
17
17
|
from unittest import mock
|
|
18
18
|
import uuid
|
|
19
19
|
|
|
20
|
+
# FIXME(stephenfin): We are using v3 resource versions despite being v2 fakes
|
|
20
21
|
from cinderclient import api_versions
|
|
22
|
+
from openstack.block_storage.v2 import _proxy as block_storage_v2_proxy
|
|
21
23
|
from openstack.block_storage.v3 import backup as _backup
|
|
22
|
-
from openstack.block_storage.v3 import
|
|
24
|
+
from openstack.block_storage.v3 import capabilities as _capabilities
|
|
25
|
+
from openstack.block_storage.v3 import stats as _stats
|
|
26
|
+
from openstack.block_storage.v3 import volume as _volume
|
|
23
27
|
from openstack.image.v2 import _proxy as image_v2_proxy
|
|
24
28
|
from osc_lib.cli import format_columns
|
|
25
29
|
|
|
@@ -87,13 +91,26 @@ class FakeVolumeClient:
|
|
|
87
91
|
self.volumes.resource_class = fakes.FakeResource(None, {})
|
|
88
92
|
|
|
89
93
|
|
|
90
|
-
class
|
|
94
|
+
class FakeClientMixin:
|
|
91
95
|
def setUp(self):
|
|
92
96
|
super().setUp()
|
|
93
97
|
|
|
94
98
|
self.app.client_manager.volume = FakeVolumeClient(
|
|
95
99
|
endpoint=fakes.AUTH_URL, token=fakes.AUTH_TOKEN
|
|
96
100
|
)
|
|
101
|
+
self.volume_client = self.app.client_manager.volume
|
|
102
|
+
|
|
103
|
+
# TODO(stephenfin): Rename to 'volume_client' once all commands are
|
|
104
|
+
# migrated to SDK
|
|
105
|
+
self.app.client_manager.sdk_connection.volume = mock.Mock(
|
|
106
|
+
spec=block_storage_v2_proxy.Proxy,
|
|
107
|
+
)
|
|
108
|
+
self.volume_sdk_client = self.app.client_manager.sdk_connection.volume
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
class TestVolume(FakeClientMixin, utils.TestCommand):
|
|
112
|
+
def setUp(self):
|
|
113
|
+
super().setUp()
|
|
97
114
|
|
|
98
115
|
self.app.client_manager.identity = identity_fakes.FakeIdentityv3Client(
|
|
99
116
|
endpoint=fakes.AUTH_URL, token=fakes.AUTH_TOKEN
|
|
@@ -286,7 +303,7 @@ def create_one_capability(attrs=None):
|
|
|
286
303
|
# Overwrite default attributes if there are some attributes set
|
|
287
304
|
capability_info.update(attrs or {})
|
|
288
305
|
|
|
289
|
-
capability =
|
|
306
|
+
capability = _capabilities.Capabilities(**capability_info)
|
|
290
307
|
|
|
291
308
|
return capability
|
|
292
309
|
|
|
@@ -302,19 +319,21 @@ def create_one_pool(attrs=None):
|
|
|
302
319
|
# Set default attribute
|
|
303
320
|
pool_info = {
|
|
304
321
|
'name': 'host@lvmdriver-1#lvmdriver-1',
|
|
305
|
-
'
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
322
|
+
'capabilities': {
|
|
323
|
+
'storage_protocol': 'iSCSI',
|
|
324
|
+
'thick_provisioning_support': False,
|
|
325
|
+
'thin_provisioning_support': True,
|
|
326
|
+
'total_volumes': 99,
|
|
327
|
+
'total_capacity_gb': 1000.00,
|
|
328
|
+
'allocated_capacity_gb': 100,
|
|
329
|
+
'max_over_subscription_ratio': 200.0,
|
|
330
|
+
},
|
|
312
331
|
}
|
|
313
332
|
|
|
314
333
|
# Overwrite default attributes if there are some attributes set
|
|
315
334
|
pool_info.update(attrs or {})
|
|
316
335
|
|
|
317
|
-
pool =
|
|
336
|
+
pool = _stats.Pools(**pool_info)
|
|
318
337
|
|
|
319
338
|
return pool
|
|
320
339
|
|
|
@@ -413,7 +432,7 @@ def create_one_sdk_volume(attrs=None):
|
|
|
413
432
|
|
|
414
433
|
# Overwrite default attributes if there are some attributes set
|
|
415
434
|
volume_info.update(attrs)
|
|
416
|
-
return
|
|
435
|
+
return _volume.Volume(**volume_info)
|
|
417
436
|
|
|
418
437
|
|
|
419
438
|
def create_sdk_volumes(attrs=None, count=2):
|
|
@@ -520,6 +539,7 @@ def create_one_backup(attrs=None):
|
|
|
520
539
|
"object_count": None,
|
|
521
540
|
"container": 'container-' + uuid.uuid4().hex,
|
|
522
541
|
"size": random.randint(1, 20),
|
|
542
|
+
"is_incremental": False,
|
|
523
543
|
"status": "error",
|
|
524
544
|
"availability_zone": 'zone' + uuid.uuid4().hex,
|
|
525
545
|
}
|
|
@@ -28,18 +28,16 @@ class TestConsistencyGroup(volume_fakes.TestVolume):
|
|
|
28
28
|
super().setUp()
|
|
29
29
|
|
|
30
30
|
# Get a shortcut to the TransferManager Mock
|
|
31
|
-
self.consistencygroups_mock =
|
|
32
|
-
self.app.client_manager.volume.consistencygroups
|
|
33
|
-
)
|
|
31
|
+
self.consistencygroups_mock = self.volume_client.consistencygroups
|
|
34
32
|
self.consistencygroups_mock.reset_mock()
|
|
35
33
|
|
|
36
|
-
self.cgsnapshots_mock = self.
|
|
34
|
+
self.cgsnapshots_mock = self.volume_client.cgsnapshots
|
|
37
35
|
self.cgsnapshots_mock.reset_mock()
|
|
38
36
|
|
|
39
|
-
self.volumes_mock = self.
|
|
37
|
+
self.volumes_mock = self.volume_client.volumes
|
|
40
38
|
self.volumes_mock.reset_mock()
|
|
41
39
|
|
|
42
|
-
self.types_mock = self.
|
|
40
|
+
self.types_mock = self.volume_client.volume_types
|
|
43
41
|
self.types_mock.reset_mock()
|
|
44
42
|
|
|
45
43
|
|
|
@@ -23,11 +23,9 @@ class TestConsistencyGroupSnapshot(volume_fakes.TestVolume):
|
|
|
23
23
|
super(TestConsistencyGroupSnapshot, self).setUp()
|
|
24
24
|
|
|
25
25
|
# Get a shortcut to the TransferManager Mock
|
|
26
|
-
self.cgsnapshots_mock = self.
|
|
26
|
+
self.cgsnapshots_mock = self.volume_client.cgsnapshots
|
|
27
27
|
self.cgsnapshots_mock.reset_mock()
|
|
28
|
-
self.consistencygroups_mock =
|
|
29
|
-
self.app.client_manager.volume.consistencygroups
|
|
30
|
-
)
|
|
28
|
+
self.consistencygroups_mock = self.volume_client.consistencygroups
|
|
31
29
|
self.consistencygroups_mock.reset_mock()
|
|
32
30
|
|
|
33
31
|
|
|
@@ -29,10 +29,10 @@ class TestQos(volume_fakes.TestVolume):
|
|
|
29
29
|
def setUp(self):
|
|
30
30
|
super(TestQos, self).setUp()
|
|
31
31
|
|
|
32
|
-
self.qos_mock = self.
|
|
32
|
+
self.qos_mock = self.volume_client.qos_specs
|
|
33
33
|
self.qos_mock.reset_mock()
|
|
34
34
|
|
|
35
|
-
self.types_mock = self.
|
|
35
|
+
self.types_mock = self.volume_client.volume_types
|
|
36
36
|
self.types_mock.reset_mock()
|
|
37
37
|
|
|
38
38
|
|
|
@@ -23,7 +23,7 @@ class TestService(volume_fakes.TestVolume):
|
|
|
23
23
|
super().setUp()
|
|
24
24
|
|
|
25
25
|
# Get a shortcut to the ServiceManager Mock
|
|
26
|
-
self.service_mock = self.
|
|
26
|
+
self.service_mock = self.volume_client.services
|
|
27
27
|
self.service_mock.reset_mock()
|
|
28
28
|
|
|
29
29
|
|
|
@@ -10,9 +10,7 @@
|
|
|
10
10
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
11
11
|
# License for the specific language governing permissions and limitations
|
|
12
12
|
# under the License.
|
|
13
|
-
#
|
|
14
13
|
|
|
15
|
-
import argparse
|
|
16
14
|
from unittest import mock
|
|
17
15
|
from unittest.mock import call
|
|
18
16
|
|
|
@@ -23,7 +21,7 @@ from osc_lib import utils
|
|
|
23
21
|
|
|
24
22
|
from openstackclient.tests.unit.identity.v3 import fakes as identity_fakes
|
|
25
23
|
from openstackclient.tests.unit.image.v2 import fakes as image_fakes
|
|
26
|
-
from openstackclient.tests.unit import utils as
|
|
24
|
+
from openstackclient.tests.unit import utils as test_utils
|
|
27
25
|
from openstackclient.tests.unit.volume.v2 import fakes as volume_fakes
|
|
28
26
|
from openstackclient.volume.v2 import volume
|
|
29
27
|
|
|
@@ -32,7 +30,7 @@ class TestVolume(volume_fakes.TestVolume):
|
|
|
32
30
|
def setUp(self):
|
|
33
31
|
super().setUp()
|
|
34
32
|
|
|
35
|
-
self.volumes_mock = self.
|
|
33
|
+
self.volumes_mock = self.volume_client.volumes
|
|
36
34
|
self.volumes_mock.reset_mock()
|
|
37
35
|
|
|
38
36
|
self.projects_mock = self.app.client_manager.identity.projects
|
|
@@ -41,18 +39,16 @@ class TestVolume(volume_fakes.TestVolume):
|
|
|
41
39
|
self.users_mock = self.app.client_manager.identity.users
|
|
42
40
|
self.users_mock.reset_mock()
|
|
43
41
|
|
|
44
|
-
self.snapshots_mock = self.
|
|
42
|
+
self.snapshots_mock = self.volume_client.volume_snapshots
|
|
45
43
|
self.snapshots_mock.reset_mock()
|
|
46
44
|
|
|
47
|
-
self.backups_mock = self.
|
|
45
|
+
self.backups_mock = self.volume_client.backups
|
|
48
46
|
self.backups_mock.reset_mock()
|
|
49
47
|
|
|
50
|
-
self.types_mock = self.
|
|
48
|
+
self.types_mock = self.volume_client.volume_types
|
|
51
49
|
self.types_mock.reset_mock()
|
|
52
50
|
|
|
53
|
-
self.consistencygroups_mock =
|
|
54
|
-
self.app.client_manager.volume.consistencygroups
|
|
55
|
-
)
|
|
51
|
+
self.consistencygroups_mock = self.volume_client.consistencygroups
|
|
56
52
|
self.consistencygroups_mock.reset_mock()
|
|
57
53
|
|
|
58
54
|
def setup_volumes_mock(self, count):
|
|
@@ -365,9 +361,7 @@ class TestVolumeCreate(TestVolume):
|
|
|
365
361
|
|
|
366
362
|
self.backups_mock.get.return_value = backup
|
|
367
363
|
|
|
368
|
-
self.
|
|
369
|
-
'3.47'
|
|
370
|
-
)
|
|
364
|
+
self.volume_client.api_version = api_versions.APIVersion('3.47')
|
|
371
365
|
|
|
372
366
|
# In base command class ShowOne in cliff, abstract method take_action()
|
|
373
367
|
# returns a two-part tuple with a tuple of column names and a tuple of
|
|
@@ -679,13 +673,81 @@ class TestVolumeCreate(TestVolume):
|
|
|
679
673
|
]
|
|
680
674
|
|
|
681
675
|
self.assertRaises(
|
|
682
|
-
|
|
676
|
+
test_utils.ParserException,
|
|
683
677
|
self.check_parser,
|
|
684
678
|
self.cmd,
|
|
685
679
|
arglist,
|
|
686
680
|
verifylist,
|
|
687
681
|
)
|
|
688
682
|
|
|
683
|
+
def test_volume_create_hints(self):
|
|
684
|
+
"""--hint needs to behave differently based on the given hint
|
|
685
|
+
|
|
686
|
+
different_host and same_host need to append to a list if given multiple
|
|
687
|
+
times. All other parameter are strings.
|
|
688
|
+
"""
|
|
689
|
+
arglist = [
|
|
690
|
+
'--size',
|
|
691
|
+
str(self.new_volume.size),
|
|
692
|
+
'--hint',
|
|
693
|
+
'k=v',
|
|
694
|
+
'--hint',
|
|
695
|
+
'k=v2',
|
|
696
|
+
'--hint',
|
|
697
|
+
'same_host=v3',
|
|
698
|
+
'--hint',
|
|
699
|
+
'same_host=v4',
|
|
700
|
+
'--hint',
|
|
701
|
+
'different_host=v5',
|
|
702
|
+
'--hint',
|
|
703
|
+
'local_to_instance=v6',
|
|
704
|
+
'--hint',
|
|
705
|
+
'different_host=v7',
|
|
706
|
+
self.new_volume.name,
|
|
707
|
+
]
|
|
708
|
+
verifylist = [
|
|
709
|
+
('size', self.new_volume.size),
|
|
710
|
+
(
|
|
711
|
+
'hint',
|
|
712
|
+
{
|
|
713
|
+
'k': 'v2',
|
|
714
|
+
'same_host': ['v3', 'v4'],
|
|
715
|
+
'local_to_instance': 'v6',
|
|
716
|
+
'different_host': ['v5', 'v7'],
|
|
717
|
+
},
|
|
718
|
+
),
|
|
719
|
+
('name', self.new_volume.name),
|
|
720
|
+
]
|
|
721
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
722
|
+
|
|
723
|
+
# In base command class ShowOne in cliff, abstract method take_action()
|
|
724
|
+
# returns a two-part tuple with a tuple of column names and a tuple of
|
|
725
|
+
# data to be shown.
|
|
726
|
+
columns, data = self.cmd.take_action(parsed_args)
|
|
727
|
+
|
|
728
|
+
self.volumes_mock.create.assert_called_with(
|
|
729
|
+
size=self.new_volume.size,
|
|
730
|
+
snapshot_id=None,
|
|
731
|
+
name=self.new_volume.name,
|
|
732
|
+
description=None,
|
|
733
|
+
volume_type=None,
|
|
734
|
+
availability_zone=None,
|
|
735
|
+
metadata=None,
|
|
736
|
+
imageRef=None,
|
|
737
|
+
source_volid=None,
|
|
738
|
+
consistencygroup_id=None,
|
|
739
|
+
scheduler_hints={
|
|
740
|
+
'k': 'v2',
|
|
741
|
+
'same_host': ['v3', 'v4'],
|
|
742
|
+
'local_to_instance': 'v6',
|
|
743
|
+
'different_host': ['v5', 'v7'],
|
|
744
|
+
},
|
|
745
|
+
backup_id=None,
|
|
746
|
+
)
|
|
747
|
+
|
|
748
|
+
self.assertEqual(self.columns, columns)
|
|
749
|
+
self.assertCountEqual(self.datalist, data)
|
|
750
|
+
|
|
689
751
|
|
|
690
752
|
class TestVolumeDelete(TestVolume):
|
|
691
753
|
def setUp(self):
|
|
@@ -1283,7 +1345,7 @@ class TestVolumeList(TestVolume):
|
|
|
1283
1345
|
("limit", -2),
|
|
1284
1346
|
]
|
|
1285
1347
|
self.assertRaises(
|
|
1286
|
-
|
|
1348
|
+
test_utils.ParserException,
|
|
1287
1349
|
self.check_parser,
|
|
1288
1350
|
self.cmd,
|
|
1289
1351
|
arglist,
|
|
@@ -1394,7 +1456,7 @@ class TestVolumeMigrate(TestVolume):
|
|
|
1394
1456
|
]
|
|
1395
1457
|
|
|
1396
1458
|
self.assertRaises(
|
|
1397
|
-
|
|
1459
|
+
test_utils.ParserException,
|
|
1398
1460
|
self.check_parser,
|
|
1399
1461
|
self.cmd,
|
|
1400
1462
|
arglist,
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
# under the License.
|
|
13
13
|
#
|
|
14
14
|
|
|
15
|
+
from osc_lib.cli import format_columns
|
|
16
|
+
|
|
15
17
|
from openstackclient.tests.unit.volume.v2 import fakes as volume_fakes
|
|
16
18
|
from openstackclient.volume.v2 import volume_backend
|
|
17
19
|
|
|
@@ -25,9 +27,8 @@ class TestShowVolumeCapability(volume_fakes.TestVolume):
|
|
|
25
27
|
def setUp(self):
|
|
26
28
|
super().setUp()
|
|
27
29
|
|
|
28
|
-
#
|
|
29
|
-
self.
|
|
30
|
-
self.capability_mock.get.return_value = self.capability
|
|
30
|
+
# Assign return value to capabilities mock
|
|
31
|
+
self.volume_sdk_client.get_capabilities.return_value = self.capability
|
|
31
32
|
|
|
32
33
|
# Get the command object to test
|
|
33
34
|
self.cmd = volume_backend.ShowCapability(self.app, None)
|
|
@@ -68,7 +69,7 @@ class TestShowVolumeCapability(volume_fakes.TestVolume):
|
|
|
68
69
|
self.assertIn(cap[0], capabilities)
|
|
69
70
|
|
|
70
71
|
# checking if proper call was made to get capabilities
|
|
71
|
-
self.
|
|
72
|
+
self.volume_sdk_client.get_capabilities.assert_called_with(
|
|
72
73
|
'fake',
|
|
73
74
|
)
|
|
74
75
|
|
|
@@ -82,8 +83,7 @@ class TestListVolumePool(volume_fakes.TestVolume):
|
|
|
82
83
|
def setUp(self):
|
|
83
84
|
super().setUp()
|
|
84
85
|
|
|
85
|
-
self.
|
|
86
|
-
self.pool_mock.list.return_value = [self.pools]
|
|
86
|
+
self.volume_sdk_client.backend_pools.return_value = [self.pools]
|
|
87
87
|
|
|
88
88
|
# Get the command object to test
|
|
89
89
|
self.cmd = volume_backend.ListPool(self.app, None)
|
|
@@ -111,7 +111,7 @@ class TestListVolumePool(volume_fakes.TestVolume):
|
|
|
111
111
|
self.assertEqual(datalist, tuple(data))
|
|
112
112
|
|
|
113
113
|
# checking if proper call was made to list pools
|
|
114
|
-
self.
|
|
114
|
+
self.volume_sdk_client.backend_pools.assert_called_with(
|
|
115
115
|
detailed=False,
|
|
116
116
|
)
|
|
117
117
|
|
|
@@ -131,13 +131,7 @@ class TestListVolumePool(volume_fakes.TestVolume):
|
|
|
131
131
|
|
|
132
132
|
expected_columns = [
|
|
133
133
|
'Name',
|
|
134
|
-
'
|
|
135
|
-
'Thick',
|
|
136
|
-
'Thin',
|
|
137
|
-
'Volumes',
|
|
138
|
-
'Capacity',
|
|
139
|
-
'Allocated',
|
|
140
|
-
'Max Over Ratio',
|
|
134
|
+
'Capabilities',
|
|
141
135
|
]
|
|
142
136
|
|
|
143
137
|
# confirming if all expected columns are present in the result.
|
|
@@ -146,19 +140,13 @@ class TestListVolumePool(volume_fakes.TestVolume):
|
|
|
146
140
|
datalist = (
|
|
147
141
|
(
|
|
148
142
|
self.pools.name,
|
|
149
|
-
self.pools.
|
|
150
|
-
self.pools.thick_provisioning_support,
|
|
151
|
-
self.pools.thin_provisioning_support,
|
|
152
|
-
self.pools.total_volumes,
|
|
153
|
-
self.pools.total_capacity_gb,
|
|
154
|
-
self.pools.allocated_capacity_gb,
|
|
155
|
-
self.pools.max_over_subscription_ratio,
|
|
143
|
+
format_columns.DictColumn(self.pools.capabilities),
|
|
156
144
|
),
|
|
157
145
|
)
|
|
158
146
|
|
|
159
147
|
# confirming if all expected values are present in the result.
|
|
160
148
|
self.assertEqual(datalist, tuple(data))
|
|
161
149
|
|
|
162
|
-
self.
|
|
150
|
+
self.volume_sdk_client.backend_pools.assert_called_with(
|
|
163
151
|
detailed=True,
|
|
164
152
|
)
|