python-openstackclient 9.0.0__py3-none-any.whl → 10.0.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/__init__.py +2 -6
- openstackclient/api/api.py +41 -23
- openstackclient/api/compute_v2.py +44 -25
- openstackclient/api/object_store_v1.py +75 -97
- openstackclient/api/volume_v2.py +2 -1
- openstackclient/api/volume_v3.py +2 -1
- openstackclient/common/availability_zone.py +58 -42
- openstackclient/common/clientmanager.py +56 -29
- openstackclient/common/configuration.py +10 -3
- openstackclient/common/envvars.py +2 -2
- openstackclient/common/extension.py +14 -5
- openstackclient/common/limits.py +10 -5
- openstackclient/common/module.py +14 -6
- openstackclient/common/pagination.py +8 -2
- openstackclient/common/progressbar.py +7 -6
- openstackclient/common/project_cleanup.py +13 -7
- openstackclient/common/quota.py +97 -99
- openstackclient/common/versions.py +8 -2
- openstackclient/compute/client.py +7 -3
- openstackclient/compute/v2/agent.py +17 -10
- openstackclient/compute/v2/aggregate.py +36 -22
- openstackclient/compute/v2/console.py +14 -8
- openstackclient/compute/v2/console_connection.py +11 -3
- openstackclient/compute/v2/flavor.py +39 -21
- openstackclient/compute/v2/host.py +14 -6
- openstackclient/compute/v2/hypervisor.py +14 -5
- openstackclient/compute/v2/hypervisor_stats.py +10 -2
- openstackclient/compute/v2/keypair.py +29 -14
- openstackclient/compute/v2/server.py +249 -169
- openstackclient/compute/v2/server_backup.py +10 -4
- openstackclient/compute/v2/server_event.py +21 -12
- openstackclient/compute/v2/server_group.py +21 -11
- openstackclient/compute/v2/server_image.py +19 -10
- openstackclient/compute/v2/server_migration.py +24 -10
- openstackclient/compute/v2/server_share.py +274 -0
- openstackclient/compute/v2/server_volume.py +10 -4
- openstackclient/compute/v2/service.py +14 -7
- openstackclient/compute/v2/usage.py +26 -21
- openstackclient/identity/client.py +8 -3
- openstackclient/identity/common.py +78 -47
- openstackclient/identity/v2_0/catalog.py +14 -7
- openstackclient/identity/v2_0/ec2creds.py +21 -10
- openstackclient/identity/v2_0/endpoint.py +23 -11
- openstackclient/identity/v2_0/project.py +25 -14
- openstackclient/identity/v2_0/role.py +28 -14
- openstackclient/identity/v2_0/role_assignment.py +9 -3
- openstackclient/identity/v2_0/service.py +23 -11
- openstackclient/identity/v2_0/token.py +12 -5
- openstackclient/identity/v2_0/user.py +26 -15
- openstackclient/identity/v3/access_rule.py +26 -12
- openstackclient/identity/v3/application_credential.py +59 -24
- openstackclient/identity/v3/catalog.py +14 -7
- openstackclient/identity/v3/consumer.py +22 -11
- openstackclient/identity/v3/credential.py +36 -16
- openstackclient/identity/v3/domain.py +37 -18
- openstackclient/identity/v3/ec2creds.py +25 -12
- openstackclient/identity/v3/endpoint.py +42 -20
- openstackclient/identity/v3/endpoint_group.py +28 -17
- openstackclient/identity/v3/federation_protocol.py +38 -16
- openstackclient/identity/v3/group.py +55 -32
- openstackclient/identity/v3/identity_provider.py +92 -57
- openstackclient/identity/v3/implied_role.py +21 -9
- openstackclient/identity/v3/limit.py +38 -16
- openstackclient/identity/v3/mapping.py +26 -13
- openstackclient/identity/v3/policy.py +23 -12
- openstackclient/identity/v3/project.py +43 -23
- openstackclient/identity/v3/region.py +36 -16
- openstackclient/identity/v3/registered_limit.py +40 -16
- openstackclient/identity/v3/role.py +61 -31
- openstackclient/identity/v3/role_assignment.py +23 -6
- openstackclient/identity/v3/service.py +36 -16
- openstackclient/identity/v3/service_provider.py +37 -15
- openstackclient/identity/v3/tag.py +23 -6
- openstackclient/identity/v3/token.py +30 -14
- openstackclient/identity/v3/trust.py +32 -14
- openstackclient/identity/v3/unscoped_saml.py +10 -2
- openstackclient/identity/v3/user.py +49 -26
- openstackclient/image/client.py +7 -3
- openstackclient/image/v1/image.py +33 -26
- openstackclient/image/v2/cache.py +14 -9
- openstackclient/image/v2/image.py +74 -48
- openstackclient/image/v2/info.py +7 -1
- openstackclient/image/v2/metadef_namespaces.py +109 -13
- openstackclient/image/v2/metadef_objects.py +28 -15
- openstackclient/image/v2/metadef_properties.py +24 -13
- openstackclient/image/v2/metadef_resource_type_association.py +14 -7
- openstackclient/image/v2/metadef_resource_types.py +7 -1
- openstackclient/image/v2/task.py +15 -6
- openstackclient/locale/tr_TR/LC_MESSAGES/openstackclient.po +7 -192
- openstackclient/network/client.py +7 -2
- openstackclient/network/common.py +16 -241
- openstackclient/network/utils.py +36 -22
- openstackclient/network/v2/address_group.py +27 -16
- openstackclient/network/v2/address_scope.py +24 -13
- openstackclient/network/v2/bgpvpn/bgpvpn.py +463 -0
- openstackclient/network/v2/bgpvpn/constants.py +30 -0
- openstackclient/network/v2/bgpvpn/network_association.py +214 -0
- openstackclient/network/v2/bgpvpn/port_association.py +490 -0
- openstackclient/network/v2/bgpvpn/router_association.py +288 -0
- openstackclient/network/v2/default_security_group_rule.py +19 -10
- openstackclient/network/v2/floating_ip.py +110 -159
- openstackclient/network/v2/floating_ip_port_forwarding.py +30 -18
- openstackclient/network/v2/fwaas/__init__.py +0 -0
- openstackclient/network/v2/fwaas/group.py +466 -0
- openstackclient/network/v2/fwaas/policy.py +518 -0
- openstackclient/network/v2/fwaas/rule.py +574 -0
- openstackclient/network/v2/ip_availability.py +13 -5
- openstackclient/network/v2/l3_conntrack_helper.py +22 -13
- openstackclient/network/v2/local_ip.py +24 -13
- openstackclient/network/v2/local_ip_association.py +14 -7
- openstackclient/network/v2/ndp_proxy.py +20 -11
- openstackclient/network/v2/network.py +129 -196
- openstackclient/network/v2/network_agent.py +46 -25
- openstackclient/network/v2/network_auto_allocated_topology.py +22 -11
- openstackclient/network/v2/network_flavor.py +27 -16
- openstackclient/network/v2/network_flavor_profile.py +23 -12
- openstackclient/network/v2/network_meter.py +21 -10
- openstackclient/network/v2/network_meter_rule.py +21 -11
- openstackclient/network/v2/network_qos_policy.py +25 -15
- openstackclient/network/v2/network_qos_rule.py +32 -17
- openstackclient/network/v2/network_qos_rule_type.py +13 -5
- openstackclient/network/v2/network_rbac.py +23 -12
- openstackclient/network/v2/network_segment.py +20 -11
- openstackclient/network/v2/network_segment_range.py +56 -29
- openstackclient/network/v2/network_service_provider.py +7 -1
- openstackclient/network/v2/network_trunk.py +38 -22
- openstackclient/network/v2/port.py +54 -29
- openstackclient/network/v2/router.py +75 -52
- openstackclient/network/v2/security_group.py +87 -157
- openstackclient/network/v2/security_group_rule.py +100 -280
- openstackclient/network/v2/subnet.py +49 -28
- openstackclient/network/v2/subnet_pool.py +30 -17
- openstackclient/network/v2/taas/tap_flow.py +22 -11
- openstackclient/network/v2/taas/tap_mirror.py +22 -11
- openstackclient/network/v2/taas/tap_service.py +23 -12
- openstackclient/object/client.py +7 -2
- openstackclient/object/v1/account.py +13 -6
- openstackclient/object/v1/container.py +25 -15
- openstackclient/object/v1/object.py +25 -15
- openstackclient/py.typed +0 -0
- openstackclient/shell.py +46 -10
- openstackclient/tests/functional/base.py +55 -20
- openstackclient/tests/functional/common/test_extension.py +4 -0
- openstackclient/tests/functional/common/test_quota.py +3 -1
- openstackclient/tests/functional/compute/v2/common.py +14 -13
- openstackclient/tests/functional/compute/v2/test_flavor.py +3 -1
- openstackclient/tests/functional/compute/v2/test_server.py +3 -0
- openstackclient/tests/functional/identity/v2/common.py +10 -6
- openstackclient/tests/functional/identity/v2/test_role.py +4 -4
- openstackclient/tests/functional/identity/v3/common.py +25 -19
- openstackclient/tests/functional/identity/v3/test_group.py +20 -20
- openstackclient/tests/functional/identity/v3/test_idp.py +3 -1
- openstackclient/tests/functional/identity/v3/test_project.py +10 -10
- openstackclient/tests/functional/identity/v3/test_role.py +18 -18
- openstackclient/tests/functional/identity/v3/test_role_assignment.py +12 -12
- openstackclient/tests/functional/identity/v3/test_user.py +8 -8
- openstackclient/tests/functional/image/base.py +1 -6
- openstackclient/tests/functional/network/v2/common.py +5 -2
- openstackclient/tests/functional/network/v2/test_floating_ip.py +10 -4
- openstackclient/tests/functional/network/v2/test_ip_availability.py +4 -0
- openstackclient/tests/functional/network/v2/test_network_meter_rule.py +3 -2
- openstackclient/tests/functional/network/v2/test_network_segment.py +5 -0
- openstackclient/tests/functional/network/v2/test_subnet.py +13 -9
- openstackclient/tests/functional/object/v1/common.py +4 -0
- openstackclient/tests/functional/volume/v2/common.py +4 -0
- openstackclient/tests/functional/volume/v2/test_volume_snapshot.py +27 -11
- openstackclient/tests/functional/volume/v2/test_volume_type.py +2 -2
- openstackclient/tests/functional/volume/v3/common.py +4 -0
- openstackclient/tests/functional/volume/v3/test_volume_snapshot.py +11 -7
- openstackclient/tests/functional/volume/v3/test_volume_type.py +2 -2
- openstackclient/tests/unit/common/test_availability_zone.py +35 -49
- openstackclient/tests/unit/common/test_extension.py +2 -2
- openstackclient/tests/unit/common/test_module.py +12 -7
- openstackclient/tests/unit/common/test_project_cleanup.py +3 -1
- openstackclient/tests/unit/common/test_quota.py +6 -26
- openstackclient/tests/unit/compute/v2/fakes.py +25 -0
- openstackclient/tests/unit/compute/v2/test_flavor.py +28 -2
- openstackclient/tests/unit/compute/v2/test_keypair.py +6 -6
- openstackclient/tests/unit/compute/v2/test_server.py +11 -96
- openstackclient/tests/unit/compute/v2/test_server_share.py +287 -0
- openstackclient/tests/unit/identity/v3/fakes.py +3 -0
- openstackclient/tests/unit/identity/v3/test_group.py +4 -14
- openstackclient/tests/unit/identity/v3/test_identity_provider.py +303 -299
- openstackclient/tests/unit/identity/v3/test_user.py +4 -4
- openstackclient/tests/unit/image/v2/test_image.py +11 -11
- openstackclient/tests/unit/image/v2/test_metadef_namespaces.py +105 -6
- openstackclient/tests/unit/network/test_common.py +0 -155
- openstackclient/tests/unit/network/v2/bgpvpn/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/bgpvpn/fakes.py +179 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_bgpvpn.py +584 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_network_association.py +285 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_port_association.py +384 -0
- openstackclient/tests/unit/network/v2/bgpvpn/test_router_association.py +297 -0
- openstackclient/tests/unit/network/v2/fwaas/__init__.py +0 -0
- openstackclient/tests/unit/network/v2/fwaas/test_group.py +897 -0
- openstackclient/tests/unit/network/v2/fwaas/test_policy.py +869 -0
- openstackclient/tests/unit/network/v2/fwaas/test_rule.py +980 -0
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_flow.py → test_tap_flow.py} +18 -25
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_mirror.py → test_tap_mirror.py} +19 -29
- openstackclient/tests/unit/network/v2/taas/{test_osc_tap_service.py → test_tap_service.py} +19 -29
- openstackclient/tests/unit/network/v2/test_address_group.py +2 -2
- openstackclient/tests/unit/network/v2/{test_floating_ip_network.py → test_floating_ip.py} +3 -2
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +13 -13
- openstackclient/tests/unit/network/v2/test_network_agent.py +8 -4
- openstackclient/tests/unit/network/v2/test_network_auto_allocated_topology.py +3 -3
- openstackclient/tests/unit/network/v2/test_network_flavor.py +2 -2
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +2 -2
- openstackclient/tests/unit/network/v2/test_network_rbac.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_segment.py +1 -1
- openstackclient/tests/unit/network/v2/test_network_segment_range.py +7 -10
- openstackclient/tests/unit/network/v2/test_network_trunk.py +1 -1
- openstackclient/tests/unit/network/v2/test_router.py +8 -9
- openstackclient/tests/unit/network/v2/{test_security_group_network.py → test_security_group.py} +1 -20
- openstackclient/tests/unit/network/v2/{test_security_group_rule_network.py → test_security_group_rule.py} +7 -41
- openstackclient/tests/unit/network/v2/test_subnet.py +2 -1
- openstackclient/tests/unit/network/v2/test_subnet_pool.py +2 -1
- openstackclient/tests/unit/object/v1/fakes.py +8 -7
- openstackclient/tests/unit/object/v1/test_container.py +65 -101
- openstackclient/tests/unit/object/v1/test_container_all.py +8 -1
- openstackclient/tests/unit/object/v1/test_object.py +44 -84
- openstackclient/tests/unit/object/v1/test_object_all.py +8 -1
- openstackclient/tests/unit/test_hacking.py +108 -0
- openstackclient/tests/unit/volume/v2/fakes.py +1 -0
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +1 -5
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +2 -1
- openstackclient/tests/unit/volume/v2/test_volume_type.py +2 -4
- openstackclient/tests/unit/volume/v3/fakes.py +1 -0
- openstackclient/tests/unit/volume/v3/test_volume.py +60 -3
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +1 -1
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +1 -5
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +55 -1
- openstackclient/tests/unit/volume/v3/test_volume_type.py +2 -4
- openstackclient/volume/client.py +7 -3
- openstackclient/volume/v2/backup_record.py +15 -6
- openstackclient/volume/v2/consistency_group.py +29 -17
- openstackclient/volume/v2/consistency_group_snapshot.py +25 -10
- openstackclient/volume/v2/qos_specs.py +28 -17
- openstackclient/volume/v2/service.py +17 -6
- openstackclient/volume/v2/volume.py +57 -29
- openstackclient/volume/v2/volume_backend.py +19 -6
- openstackclient/volume/v2/volume_backup.py +46 -20
- openstackclient/volume/v2/volume_host.py +6 -4
- openstackclient/volume/v2/volume_snapshot.py +50 -24
- openstackclient/volume/v2/volume_transfer_request.py +31 -13
- openstackclient/volume/v2/volume_type.py +43 -24
- openstackclient/volume/v3/block_storage_cleanup.py +11 -3
- openstackclient/volume/v3/block_storage_cluster.py +19 -7
- openstackclient/volume/v3/block_storage_log_level.py +15 -6
- openstackclient/volume/v3/block_storage_manage.py +10 -4
- openstackclient/volume/v3/block_storage_resource_filter.py +17 -5
- openstackclient/volume/v3/service.py +16 -6
- openstackclient/volume/v3/volume.py +89 -39
- openstackclient/volume/v3/volume_attachment.py +43 -21
- openstackclient/volume/v3/volume_backup.py +53 -24
- openstackclient/volume/v3/volume_group.py +23 -13
- openstackclient/volume/v3/volume_group_snapshot.py +32 -13
- openstackclient/volume/v3/volume_group_type.py +26 -13
- openstackclient/volume/v3/volume_message.py +15 -7
- openstackclient/volume/v3/volume_snapshot.py +69 -32
- openstackclient/volume/v3/volume_transfer_request.py +31 -13
- openstackclient/volume/v3/volume_type.py +42 -24
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/METADATA +6 -6
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/RECORD +271 -260
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/WHEEL +1 -1
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/entry_points.txt +53 -1
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/AUTHORS +4 -0
- python_openstackclient-10.0.0.dist-info/pbr.json +1 -0
- openstackclient/api/image_v1.py +0 -69
- openstackclient/api/image_v2.py +0 -79
- openstackclient/network/v2/floating_ip_pool.py +0 -38
- openstackclient/tests/functional/image/v1/test_image.py +0 -97
- openstackclient/tests/unit/api/test_image_v1.py +0 -96
- openstackclient/tests/unit/api/test_image_v2.py +0 -96
- openstackclient/tests/unit/network/v2/test_floating_ip_compute.py +0 -248
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_compute.py +0 -49
- openstackclient/tests/unit/network/v2/test_floating_ip_pool_network.py +0 -39
- openstackclient/tests/unit/network/v2/test_network_compute.py +0 -404
- openstackclient/tests/unit/network/v2/test_security_group_compute.py +0 -392
- openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +0 -555
- python_openstackclient-9.0.0.dist-info/pbr.json +0 -1
- /openstackclient/{tests/functional/image/v1 → network/v2/bgpvpn}/__init__.py +0 -0
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/licenses/LICENSE +0 -0
- {python_openstackclient-9.0.0.dist-info → python_openstackclient-10.0.0.dist-info}/top_level.txt +0 -0
openstackclient/volume/client.py
CHANGED
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
# under the License.
|
|
14
14
|
#
|
|
15
15
|
|
|
16
|
+
import argparse
|
|
16
17
|
import logging
|
|
18
|
+
from typing import Any
|
|
17
19
|
|
|
18
20
|
from osc_lib import exceptions
|
|
19
21
|
from osc_lib import utils
|
|
@@ -34,7 +36,7 @@ API_VERSIONS = {
|
|
|
34
36
|
_volume_api_version = None
|
|
35
37
|
|
|
36
38
|
|
|
37
|
-
def make_client(instance):
|
|
39
|
+
def make_client(instance: Any) -> Any:
|
|
38
40
|
"""Returns a volume service client."""
|
|
39
41
|
|
|
40
42
|
# Defer client imports until we actually need them
|
|
@@ -92,7 +94,9 @@ def make_client(instance):
|
|
|
92
94
|
return client
|
|
93
95
|
|
|
94
96
|
|
|
95
|
-
def build_option_parser(
|
|
97
|
+
def build_option_parser(
|
|
98
|
+
parser: argparse.ArgumentParser,
|
|
99
|
+
) -> argparse.ArgumentParser:
|
|
96
100
|
"""Hook to add global options"""
|
|
97
101
|
parser.add_argument(
|
|
98
102
|
'--os-volume-api-version',
|
|
@@ -104,7 +108,7 @@ def build_option_parser(parser):
|
|
|
104
108
|
return parser
|
|
105
109
|
|
|
106
110
|
|
|
107
|
-
def check_api_version(check_version):
|
|
111
|
+
def check_api_version(check_version: str) -> bool:
|
|
108
112
|
"""Validate version supplied by user
|
|
109
113
|
|
|
110
114
|
Returns:
|
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
|
|
15
15
|
"""Volume v2 Backup action implementations"""
|
|
16
16
|
|
|
17
|
+
import argparse
|
|
17
18
|
import logging
|
|
19
|
+
from collections.abc import Iterable, Sequence
|
|
20
|
+
from typing import Any
|
|
18
21
|
|
|
19
22
|
from osc_lib import utils
|
|
20
23
|
|
|
@@ -33,7 +36,7 @@ Backup information can be imported into a new service instance to be able to
|
|
|
33
36
|
restore."""
|
|
34
37
|
)
|
|
35
38
|
|
|
36
|
-
def get_parser(self, prog_name):
|
|
39
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
37
40
|
parser = super().get_parser(prog_name)
|
|
38
41
|
parser.add_argument(
|
|
39
42
|
"backup",
|
|
@@ -42,7 +45,9 @@ restore."""
|
|
|
42
45
|
)
|
|
43
46
|
return parser
|
|
44
47
|
|
|
45
|
-
def take_action(
|
|
48
|
+
def take_action(
|
|
49
|
+
self, parsed_args: argparse.Namespace
|
|
50
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
46
51
|
volume_client = self.app.client_manager.volume
|
|
47
52
|
backup = utils.find_resource(volume_client.backups, parsed_args.backup)
|
|
48
53
|
backup_data = volume_client.backups.export_record(backup.id)
|
|
@@ -53,7 +58,8 @@ restore."""
|
|
|
53
58
|
backup_data['Backup Service'] = backup_data.pop('backup_service')
|
|
54
59
|
backup_data['Metadata'] = backup_data.pop('backup_url')
|
|
55
60
|
|
|
56
|
-
|
|
61
|
+
col_headers, col_data = zip(*sorted(backup_data.items()))
|
|
62
|
+
return col_headers, col_data
|
|
57
63
|
|
|
58
64
|
|
|
59
65
|
class ImportBackupRecord(command.ShowOne):
|
|
@@ -64,7 +70,7 @@ Exported backup details contain the metadata necessary to restore to a new or
|
|
|
64
70
|
rebuilt service instance"""
|
|
65
71
|
)
|
|
66
72
|
|
|
67
|
-
def get_parser(self, prog_name):
|
|
73
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
68
74
|
parser = super().get_parser(prog_name)
|
|
69
75
|
parser.add_argument(
|
|
70
76
|
"backup_service",
|
|
@@ -78,10 +84,13 @@ rebuilt service instance"""
|
|
|
78
84
|
)
|
|
79
85
|
return parser
|
|
80
86
|
|
|
81
|
-
def take_action(
|
|
87
|
+
def take_action(
|
|
88
|
+
self, parsed_args: argparse.Namespace
|
|
89
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
82
90
|
volume_client = self.app.client_manager.volume
|
|
83
91
|
backup_data = volume_client.backups.import_record(
|
|
84
92
|
parsed_args.backup_service, parsed_args.backup_metadata
|
|
85
93
|
)
|
|
86
94
|
backup_data.pop('links', None)
|
|
87
|
-
|
|
95
|
+
col_headers, col_data = zip(*sorted(backup_data.items()))
|
|
96
|
+
return col_headers, col_data
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
|
|
17
17
|
import argparse
|
|
18
18
|
import logging
|
|
19
|
+
from collections.abc import Iterable, Sequence
|
|
20
|
+
from typing import Any
|
|
19
21
|
|
|
20
22
|
from osc_lib.cli import format_columns
|
|
21
23
|
from osc_lib import exceptions
|
|
@@ -28,7 +30,9 @@ from openstackclient.i18n import _
|
|
|
28
30
|
LOG = logging.getLogger(__name__)
|
|
29
31
|
|
|
30
32
|
|
|
31
|
-
def _find_volumes(
|
|
33
|
+
def _find_volumes(
|
|
34
|
+
parsed_args_volumes: list[str], volume_client: Any
|
|
35
|
+
) -> tuple[int, str]:
|
|
32
36
|
result = 0
|
|
33
37
|
uuid = ''
|
|
34
38
|
for volume in parsed_args_volumes:
|
|
@@ -48,7 +52,7 @@ def _find_volumes(parsed_args_volumes, volume_client):
|
|
|
48
52
|
class AddVolumeToConsistencyGroup(command.Command):
|
|
49
53
|
_description = _("Add volume(s) to consistency group")
|
|
50
54
|
|
|
51
|
-
def get_parser(self, prog_name):
|
|
55
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
52
56
|
parser = super().get_parser(prog_name)
|
|
53
57
|
parser.add_argument(
|
|
54
58
|
'consistency_group',
|
|
@@ -66,7 +70,7 @@ class AddVolumeToConsistencyGroup(command.Command):
|
|
|
66
70
|
)
|
|
67
71
|
return parser
|
|
68
72
|
|
|
69
|
-
def take_action(self, parsed_args):
|
|
73
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
70
74
|
volume_client = self.app.client_manager.volume
|
|
71
75
|
result, add_uuid = _find_volumes(parsed_args.volumes, volume_client)
|
|
72
76
|
|
|
@@ -90,7 +94,7 @@ class AddVolumeToConsistencyGroup(command.Command):
|
|
|
90
94
|
class CreateConsistencyGroup(command.ShowOne):
|
|
91
95
|
_description = _("Create new consistency group.")
|
|
92
96
|
|
|
93
|
-
def get_parser(self, prog_name):
|
|
97
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
94
98
|
parser = super().get_parser(prog_name)
|
|
95
99
|
parser.add_argument(
|
|
96
100
|
"name",
|
|
@@ -144,7 +148,9 @@ class CreateConsistencyGroup(command.ShowOne):
|
|
|
144
148
|
)
|
|
145
149
|
return parser
|
|
146
150
|
|
|
147
|
-
def take_action(
|
|
151
|
+
def take_action(
|
|
152
|
+
self, parsed_args: argparse.Namespace
|
|
153
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
148
154
|
volume_client = self.app.client_manager.volume
|
|
149
155
|
if parsed_args.volume_type:
|
|
150
156
|
volume_type_id = utils.find_resource(
|
|
@@ -186,13 +192,14 @@ class CreateConsistencyGroup(command.ShowOne):
|
|
|
186
192
|
)
|
|
187
193
|
)
|
|
188
194
|
|
|
189
|
-
|
|
195
|
+
col_headers, col_data = zip(*sorted(consistency_group._info.items()))
|
|
196
|
+
return col_headers, col_data
|
|
190
197
|
|
|
191
198
|
|
|
192
199
|
class DeleteConsistencyGroup(command.Command):
|
|
193
200
|
_description = _("Delete consistency group(s).")
|
|
194
201
|
|
|
195
|
-
def get_parser(self, prog_name):
|
|
202
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
196
203
|
parser = super().get_parser(prog_name)
|
|
197
204
|
parser.add_argument(
|
|
198
205
|
'consistency_groups',
|
|
@@ -208,7 +215,7 @@ class DeleteConsistencyGroup(command.Command):
|
|
|
208
215
|
)
|
|
209
216
|
return parser
|
|
210
217
|
|
|
211
|
-
def take_action(self, parsed_args):
|
|
218
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
212
219
|
volume_client = self.app.client_manager.volume
|
|
213
220
|
result = 0
|
|
214
221
|
|
|
@@ -241,7 +248,7 @@ class DeleteConsistencyGroup(command.Command):
|
|
|
241
248
|
class ListConsistencyGroup(command.Lister):
|
|
242
249
|
_description = _("List consistency groups.")
|
|
243
250
|
|
|
244
|
-
def get_parser(self, prog_name):
|
|
251
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
245
252
|
parser = super().get_parser(prog_name)
|
|
246
253
|
parser.add_argument(
|
|
247
254
|
'--all-projects',
|
|
@@ -258,7 +265,9 @@ class ListConsistencyGroup(command.Lister):
|
|
|
258
265
|
)
|
|
259
266
|
return parser
|
|
260
267
|
|
|
261
|
-
def take_action(
|
|
268
|
+
def take_action(
|
|
269
|
+
self, parsed_args: argparse.Namespace
|
|
270
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
262
271
|
if parsed_args.long:
|
|
263
272
|
columns = [
|
|
264
273
|
'ID',
|
|
@@ -292,7 +301,7 @@ class ListConsistencyGroup(command.Lister):
|
|
|
292
301
|
class RemoveVolumeFromConsistencyGroup(command.Command):
|
|
293
302
|
_description = _("Remove volume(s) from consistency group")
|
|
294
303
|
|
|
295
|
-
def get_parser(self, prog_name):
|
|
304
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
296
305
|
parser = super().get_parser(prog_name)
|
|
297
306
|
parser.add_argument(
|
|
298
307
|
'consistency_group',
|
|
@@ -310,7 +319,7 @@ class RemoveVolumeFromConsistencyGroup(command.Command):
|
|
|
310
319
|
)
|
|
311
320
|
return parser
|
|
312
321
|
|
|
313
|
-
def take_action(self, parsed_args):
|
|
322
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
314
323
|
volume_client = self.app.client_manager.volume
|
|
315
324
|
result, remove_uuid = _find_volumes(parsed_args.volumes, volume_client)
|
|
316
325
|
|
|
@@ -334,7 +343,7 @@ class RemoveVolumeFromConsistencyGroup(command.Command):
|
|
|
334
343
|
class SetConsistencyGroup(command.Command):
|
|
335
344
|
_description = _("Set consistency group properties")
|
|
336
345
|
|
|
337
|
-
def get_parser(self, prog_name):
|
|
346
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
338
347
|
parser = super().get_parser(prog_name)
|
|
339
348
|
parser.add_argument(
|
|
340
349
|
'consistency_group',
|
|
@@ -353,7 +362,7 @@ class SetConsistencyGroup(command.Command):
|
|
|
353
362
|
)
|
|
354
363
|
return parser
|
|
355
364
|
|
|
356
|
-
def take_action(self, parsed_args):
|
|
365
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
357
366
|
volume_client = self.app.client_manager.volume
|
|
358
367
|
kwargs = {}
|
|
359
368
|
if parsed_args.name:
|
|
@@ -372,7 +381,7 @@ class SetConsistencyGroup(command.Command):
|
|
|
372
381
|
class ShowConsistencyGroup(command.ShowOne):
|
|
373
382
|
_description = _("Display consistency group details.")
|
|
374
383
|
|
|
375
|
-
def get_parser(self, prog_name):
|
|
384
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
376
385
|
parser = super().get_parser(prog_name)
|
|
377
386
|
parser.add_argument(
|
|
378
387
|
"consistency_group",
|
|
@@ -381,9 +390,12 @@ class ShowConsistencyGroup(command.ShowOne):
|
|
|
381
390
|
)
|
|
382
391
|
return parser
|
|
383
392
|
|
|
384
|
-
def take_action(
|
|
393
|
+
def take_action(
|
|
394
|
+
self, parsed_args: argparse.Namespace
|
|
395
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
385
396
|
volume_client = self.app.client_manager.volume
|
|
386
397
|
consistency_group = utils.find_resource(
|
|
387
398
|
volume_client.consistencygroups, parsed_args.consistency_group
|
|
388
399
|
)
|
|
389
|
-
|
|
400
|
+
col_headers, col_data = zip(*sorted(consistency_group._info.items()))
|
|
401
|
+
return col_headers, col_data
|
|
@@ -14,7 +14,10 @@
|
|
|
14
14
|
|
|
15
15
|
"""Volume v2 consistency group snapshot action implementations"""
|
|
16
16
|
|
|
17
|
+
import argparse
|
|
17
18
|
import logging
|
|
19
|
+
from collections.abc import Iterable, Sequence
|
|
20
|
+
from typing import Any
|
|
18
21
|
|
|
19
22
|
from osc_lib import exceptions
|
|
20
23
|
from osc_lib import utils
|
|
@@ -29,7 +32,7 @@ LOG = logging.getLogger(__name__)
|
|
|
29
32
|
class CreateConsistencyGroupSnapshot(command.ShowOne):
|
|
30
33
|
_description = _("Create new consistency group snapshot.")
|
|
31
34
|
|
|
32
|
-
def get_parser(self, prog_name):
|
|
35
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
33
36
|
parser = super().get_parser(prog_name)
|
|
34
37
|
parser.add_argument(
|
|
35
38
|
"snapshot_name",
|
|
@@ -52,7 +55,9 @@ class CreateConsistencyGroupSnapshot(command.ShowOne):
|
|
|
52
55
|
)
|
|
53
56
|
return parser
|
|
54
57
|
|
|
55
|
-
def take_action(
|
|
58
|
+
def take_action(
|
|
59
|
+
self, parsed_args: argparse.Namespace
|
|
60
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
56
61
|
volume_client = self.app.client_manager.volume
|
|
57
62
|
consistency_group = parsed_args.consistency_group
|
|
58
63
|
if not parsed_args.consistency_group:
|
|
@@ -68,13 +73,16 @@ class CreateConsistencyGroupSnapshot(command.ShowOne):
|
|
|
68
73
|
description=parsed_args.description,
|
|
69
74
|
)
|
|
70
75
|
|
|
71
|
-
|
|
76
|
+
col_headers, col_data = zip(
|
|
77
|
+
*sorted(consistency_group_snapshot._info.items())
|
|
78
|
+
)
|
|
79
|
+
return col_headers, col_data
|
|
72
80
|
|
|
73
81
|
|
|
74
82
|
class DeleteConsistencyGroupSnapshot(command.Command):
|
|
75
83
|
_description = _("Delete consistency group snapshot(s).")
|
|
76
84
|
|
|
77
|
-
def get_parser(self, prog_name):
|
|
85
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
78
86
|
parser = super().get_parser(prog_name)
|
|
79
87
|
parser.add_argument(
|
|
80
88
|
"consistency_group_snapshot",
|
|
@@ -84,7 +92,7 @@ class DeleteConsistencyGroupSnapshot(command.Command):
|
|
|
84
92
|
)
|
|
85
93
|
return parser
|
|
86
94
|
|
|
87
|
-
def take_action(self, parsed_args):
|
|
95
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
88
96
|
volume_client = self.app.client_manager.volume
|
|
89
97
|
result = 0
|
|
90
98
|
|
|
@@ -117,7 +125,7 @@ class DeleteConsistencyGroupSnapshot(command.Command):
|
|
|
117
125
|
class ListConsistencyGroupSnapshot(command.Lister):
|
|
118
126
|
_description = _("List consistency group snapshots.")
|
|
119
127
|
|
|
120
|
-
def get_parser(self, prog_name):
|
|
128
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
121
129
|
parser = super().get_parser(prog_name)
|
|
122
130
|
parser.add_argument(
|
|
123
131
|
'--all-projects',
|
|
@@ -153,7 +161,9 @@ class ListConsistencyGroupSnapshot(command.Lister):
|
|
|
153
161
|
)
|
|
154
162
|
return parser
|
|
155
163
|
|
|
156
|
-
def take_action(
|
|
164
|
+
def take_action(
|
|
165
|
+
self, parsed_args: argparse.Namespace
|
|
166
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
157
167
|
if parsed_args.long:
|
|
158
168
|
columns = [
|
|
159
169
|
'ID',
|
|
@@ -194,7 +204,7 @@ class ListConsistencyGroupSnapshot(command.Lister):
|
|
|
194
204
|
class ShowConsistencyGroupSnapshot(command.ShowOne):
|
|
195
205
|
_description = _("Display consistency group snapshot details")
|
|
196
206
|
|
|
197
|
-
def get_parser(self, prog_name):
|
|
207
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
198
208
|
parser = super().get_parser(prog_name)
|
|
199
209
|
parser.add_argument(
|
|
200
210
|
"consistency_group_snapshot",
|
|
@@ -203,9 +213,14 @@ class ShowConsistencyGroupSnapshot(command.ShowOne):
|
|
|
203
213
|
)
|
|
204
214
|
return parser
|
|
205
215
|
|
|
206
|
-
def take_action(
|
|
216
|
+
def take_action(
|
|
217
|
+
self, parsed_args: argparse.Namespace
|
|
218
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
207
219
|
volume_client = self.app.client_manager.volume
|
|
208
220
|
consistency_group_snapshot = utils.find_resource(
|
|
209
221
|
volume_client.cgsnapshots, parsed_args.consistency_group_snapshot
|
|
210
222
|
)
|
|
211
|
-
|
|
223
|
+
col_headers, col_data = zip(
|
|
224
|
+
*sorted(consistency_group_snapshot._info.items())
|
|
225
|
+
)
|
|
226
|
+
return col_headers, col_data
|
|
@@ -15,7 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
"""Volume v2 QoS action implementations"""
|
|
17
17
|
|
|
18
|
+
import argparse
|
|
18
19
|
import logging
|
|
20
|
+
from collections.abc import Iterable, Sequence
|
|
21
|
+
from typing import Any
|
|
19
22
|
|
|
20
23
|
from osc_lib.cli import format_columns
|
|
21
24
|
from osc_lib.cli import parseractions
|
|
@@ -32,7 +35,7 @@ LOG = logging.getLogger(__name__)
|
|
|
32
35
|
class AssociateQos(command.Command):
|
|
33
36
|
_description = _("Associate a QoS specification to a volume type")
|
|
34
37
|
|
|
35
|
-
def get_parser(self, prog_name):
|
|
38
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
36
39
|
parser = super().get_parser(prog_name)
|
|
37
40
|
parser.add_argument(
|
|
38
41
|
'qos_spec',
|
|
@@ -46,7 +49,7 @@ class AssociateQos(command.Command):
|
|
|
46
49
|
)
|
|
47
50
|
return parser
|
|
48
51
|
|
|
49
|
-
def take_action(self, parsed_args):
|
|
52
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
50
53
|
volume_client = self.app.client_manager.volume
|
|
51
54
|
qos_spec = utils.find_resource(
|
|
52
55
|
volume_client.qos_specs, parsed_args.qos_spec
|
|
@@ -61,7 +64,7 @@ class AssociateQos(command.Command):
|
|
|
61
64
|
class CreateQos(command.ShowOne):
|
|
62
65
|
_description = _("Create new QoS specification")
|
|
63
66
|
|
|
64
|
-
def get_parser(self, prog_name):
|
|
67
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
65
68
|
parser = super().get_parser(prog_name)
|
|
66
69
|
parser.add_argument(
|
|
67
70
|
'name',
|
|
@@ -93,7 +96,9 @@ class CreateQos(command.ShowOne):
|
|
|
93
96
|
)
|
|
94
97
|
return parser
|
|
95
98
|
|
|
96
|
-
def take_action(
|
|
99
|
+
def take_action(
|
|
100
|
+
self, parsed_args: argparse.Namespace
|
|
101
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
97
102
|
volume_client = self.app.client_manager.volume
|
|
98
103
|
specs = {}
|
|
99
104
|
specs.update({'consumer': parsed_args.consumer})
|
|
@@ -110,13 +115,14 @@ class CreateQos(command.ShowOne):
|
|
|
110
115
|
)
|
|
111
116
|
}
|
|
112
117
|
)
|
|
113
|
-
|
|
118
|
+
col_headers, col_data = zip(*sorted(qos_spec._info.items()))
|
|
119
|
+
return col_headers, col_data
|
|
114
120
|
|
|
115
121
|
|
|
116
122
|
class DeleteQos(command.Command):
|
|
117
123
|
_description = _("Delete QoS specification")
|
|
118
124
|
|
|
119
|
-
def get_parser(self, prog_name):
|
|
125
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
120
126
|
parser = super().get_parser(prog_name)
|
|
121
127
|
parser.add_argument(
|
|
122
128
|
'qos_specs',
|
|
@@ -132,7 +138,7 @@ class DeleteQos(command.Command):
|
|
|
132
138
|
)
|
|
133
139
|
return parser
|
|
134
140
|
|
|
135
|
-
def take_action(self, parsed_args):
|
|
141
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
136
142
|
volume_client = self.app.client_manager.volume
|
|
137
143
|
result = 0
|
|
138
144
|
|
|
@@ -161,7 +167,7 @@ class DeleteQos(command.Command):
|
|
|
161
167
|
class DisassociateQos(command.Command):
|
|
162
168
|
_description = _("Disassociate a QoS specification from a volume type")
|
|
163
169
|
|
|
164
|
-
def get_parser(self, prog_name):
|
|
170
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
165
171
|
parser = super().get_parser(prog_name)
|
|
166
172
|
parser.add_argument(
|
|
167
173
|
'qos_spec',
|
|
@@ -183,7 +189,7 @@ class DisassociateQos(command.Command):
|
|
|
183
189
|
|
|
184
190
|
return parser
|
|
185
191
|
|
|
186
|
-
def take_action(self, parsed_args):
|
|
192
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
187
193
|
volume_client = self.app.client_manager.volume
|
|
188
194
|
qos_spec = utils.find_resource(
|
|
189
195
|
volume_client.qos_specs, parsed_args.qos_spec
|
|
@@ -201,7 +207,9 @@ class DisassociateQos(command.Command):
|
|
|
201
207
|
class ListQos(command.Lister):
|
|
202
208
|
_description = _("List QoS specifications")
|
|
203
209
|
|
|
204
|
-
def take_action(
|
|
210
|
+
def take_action(
|
|
211
|
+
self, parsed_args: argparse.Namespace
|
|
212
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
205
213
|
volume_client = self.app.client_manager.volume
|
|
206
214
|
qos_specs_list = volume_client.qos_specs.list()
|
|
207
215
|
|
|
@@ -249,7 +257,7 @@ class ListQos(command.Lister):
|
|
|
249
257
|
class SetQos(command.Command):
|
|
250
258
|
_description = _("Set QoS specification properties")
|
|
251
259
|
|
|
252
|
-
def get_parser(self, prog_name):
|
|
260
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
253
261
|
parser = super().get_parser(prog_name)
|
|
254
262
|
parser.add_argument(
|
|
255
263
|
'qos_spec',
|
|
@@ -277,7 +285,7 @@ class SetQos(command.Command):
|
|
|
277
285
|
)
|
|
278
286
|
return parser
|
|
279
287
|
|
|
280
|
-
def take_action(self, parsed_args):
|
|
288
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
281
289
|
volume_client = self.app.client_manager.volume
|
|
282
290
|
qos_spec = utils.find_resource(
|
|
283
291
|
volume_client.qos_specs, parsed_args.qos_spec
|
|
@@ -311,7 +319,7 @@ class SetQos(command.Command):
|
|
|
311
319
|
class ShowQos(command.ShowOne):
|
|
312
320
|
_description = _("Display QoS specification details")
|
|
313
321
|
|
|
314
|
-
def get_parser(self, prog_name):
|
|
322
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
315
323
|
parser = super().get_parser(prog_name)
|
|
316
324
|
parser.add_argument(
|
|
317
325
|
'qos_spec',
|
|
@@ -320,7 +328,9 @@ class ShowQos(command.ShowOne):
|
|
|
320
328
|
)
|
|
321
329
|
return parser
|
|
322
330
|
|
|
323
|
-
def take_action(
|
|
331
|
+
def take_action(
|
|
332
|
+
self, parsed_args: argparse.Namespace
|
|
333
|
+
) -> tuple[Sequence[str], Iterable[Any]]:
|
|
324
334
|
volume_client = self.app.client_manager.volume
|
|
325
335
|
qos_spec = utils.find_resource(
|
|
326
336
|
volume_client.qos_specs, parsed_args.qos_spec
|
|
@@ -342,13 +352,14 @@ class ShowQos(command.ShowOne):
|
|
|
342
352
|
}
|
|
343
353
|
)
|
|
344
354
|
|
|
345
|
-
|
|
355
|
+
col_headers, col_data = zip(*sorted(qos_spec._info.items()))
|
|
356
|
+
return col_headers, col_data
|
|
346
357
|
|
|
347
358
|
|
|
348
359
|
class UnsetQos(command.Command):
|
|
349
360
|
_description = _("Unset QoS specification properties")
|
|
350
361
|
|
|
351
|
-
def get_parser(self, prog_name):
|
|
362
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
352
363
|
parser = super().get_parser(prog_name)
|
|
353
364
|
parser.add_argument(
|
|
354
365
|
'qos_spec',
|
|
@@ -367,7 +378,7 @@ class UnsetQos(command.Command):
|
|
|
367
378
|
)
|
|
368
379
|
return parser
|
|
369
380
|
|
|
370
|
-
def take_action(self, parsed_args):
|
|
381
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
371
382
|
volume_client = self.app.client_manager.volume
|
|
372
383
|
qos_spec = utils.find_resource(
|
|
373
384
|
volume_client.qos_specs, parsed_args.qos_spec
|
|
@@ -14,6 +14,11 @@
|
|
|
14
14
|
|
|
15
15
|
"""Service action implementations"""
|
|
16
16
|
|
|
17
|
+
import argparse
|
|
18
|
+
from collections.abc import Iterable, Sequence
|
|
19
|
+
from typing import Any
|
|
20
|
+
|
|
21
|
+
from openstack import utils as sdk_utils
|
|
17
22
|
from osc_lib import exceptions
|
|
18
23
|
from osc_lib import utils
|
|
19
24
|
|
|
@@ -24,7 +29,7 @@ from openstackclient.i18n import _
|
|
|
24
29
|
class ListService(command.Lister):
|
|
25
30
|
_description = _("List service command")
|
|
26
31
|
|
|
27
|
-
def get_parser(self, prog_name):
|
|
32
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
28
33
|
parser = super().get_parser(prog_name)
|
|
29
34
|
parser.add_argument(
|
|
30
35
|
"--host",
|
|
@@ -44,8 +49,12 @@ class ListService(command.Lister):
|
|
|
44
49
|
)
|
|
45
50
|
return parser
|
|
46
51
|
|
|
47
|
-
def take_action(
|
|
48
|
-
|
|
52
|
+
def take_action(
|
|
53
|
+
self, parsed_args: argparse.Namespace
|
|
54
|
+
) -> tuple[Sequence[str], Iterable[tuple[Any, ...]]]:
|
|
55
|
+
volume_client = sdk_utils.ensure_service_version(
|
|
56
|
+
self.app.client_manager.sdk_connection.volume, '2'
|
|
57
|
+
)
|
|
49
58
|
|
|
50
59
|
columns: tuple[str, ...] = (
|
|
51
60
|
"binary",
|
|
@@ -86,7 +95,7 @@ class ListService(command.Lister):
|
|
|
86
95
|
class SetService(command.Command):
|
|
87
96
|
_description = _("Set volume service properties")
|
|
88
97
|
|
|
89
|
-
def get_parser(self, prog_name):
|
|
98
|
+
def get_parser(self, prog_name: str) -> argparse.ArgumentParser:
|
|
90
99
|
parser = super().get_parser(prog_name)
|
|
91
100
|
parser.add_argument(
|
|
92
101
|
"host",
|
|
@@ -115,7 +124,7 @@ class SetService(command.Command):
|
|
|
115
124
|
)
|
|
116
125
|
return parser
|
|
117
126
|
|
|
118
|
-
def take_action(self, parsed_args):
|
|
127
|
+
def take_action(self, parsed_args: argparse.Namespace) -> None:
|
|
119
128
|
if parsed_args.disable_reason and not parsed_args.disable:
|
|
120
129
|
msg = _(
|
|
121
130
|
"Cannot specify option --disable-reason without "
|
|
@@ -123,7 +132,9 @@ class SetService(command.Command):
|
|
|
123
132
|
)
|
|
124
133
|
raise exceptions.CommandError(msg)
|
|
125
134
|
|
|
126
|
-
volume_client =
|
|
135
|
+
volume_client = sdk_utils.ensure_service_version(
|
|
136
|
+
self.app.client_manager.sdk_connection.volume, '2'
|
|
137
|
+
)
|
|
127
138
|
|
|
128
139
|
service = volume_client.find_service(
|
|
129
140
|
parsed_args.service, ignore_missing=False, host=parsed_args.host
|