python-openstackclient 8.0.0__py3-none-any.whl → 8.1.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/compute/client.py +5 -0
- openstackclient/compute/v2/console.py +7 -0
- openstackclient/compute/v2/console_connection.py +48 -0
- openstackclient/compute/v2/keypair.py +10 -3
- openstackclient/compute/v2/server.py +75 -10
- openstackclient/compute/v2/server_event.py +1 -1
- openstackclient/identity/common.py +79 -0
- openstackclient/identity/v3/application_credential.py +2 -2
- openstackclient/identity/v3/domain.py +62 -43
- openstackclient/identity/v3/group.py +113 -68
- openstackclient/identity/v3/project.py +17 -0
- openstackclient/identity/v3/user.py +38 -5
- openstackclient/image/client.py +5 -0
- openstackclient/image/v2/image.py +11 -11
- openstackclient/network/client.py +0 -6
- openstackclient/network/v2/floating_ip.py +58 -29
- openstackclient/network/v2/network_qos_rule.py +3 -11
- openstackclient/network/v2/router.py +1 -1
- openstackclient/network/v2/security_group.py +5 -4
- openstackclient/network/v2/security_group_rule.py +1 -1
- openstackclient/shell.py +1 -1
- openstackclient/tests/functional/base.py +5 -1
- openstackclient/tests/functional/compute/v2/test_keypair.py +41 -5
- openstackclient/tests/unit/compute/v2/fakes.py +81 -305
- openstackclient/tests/unit/compute/v2/test_console.py +18 -1
- openstackclient/tests/unit/compute/v2/test_console_connection.py +72 -0
- openstackclient/tests/unit/compute/v2/test_flavor.py +1 -1
- openstackclient/tests/unit/compute/v2/test_keypair.py +12 -5
- openstackclient/tests/unit/compute/v2/test_server.py +169 -46
- openstackclient/tests/unit/compute/v2/test_server_backup.py +32 -71
- openstackclient/tests/unit/compute/v2/test_server_event.py +2 -2
- openstackclient/tests/unit/compute/v2/test_server_image.py +33 -72
- openstackclient/tests/unit/compute/v2/test_server_migration.py +4 -4
- openstackclient/tests/unit/identity/v3/test_application_credential.py +47 -25
- openstackclient/tests/unit/identity/v3/test_domain.py +115 -105
- openstackclient/tests/unit/identity/v3/test_group.py +353 -202
- openstackclient/tests/unit/identity/v3/test_project.py +16 -0
- openstackclient/tests/unit/identity/v3/test_user.py +86 -6
- openstackclient/tests/unit/image/v1/test_image.py +8 -9
- openstackclient/tests/unit/image/v2/test_image.py +49 -49
- openstackclient/tests/unit/network/v2/fakes.py +405 -485
- openstackclient/tests/unit/network/v2/test_floating_ip_network.py +13 -19
- openstackclient/tests/unit/network/v2/test_l3_conntrack_helper.py +2 -2
- openstackclient/tests/unit/network/v2/test_ndp_proxy.py +1 -3
- openstackclient/tests/unit/network/v2/test_network.py +4 -4
- openstackclient/tests/unit/network/v2/test_network_agent.py +15 -29
- openstackclient/tests/unit/network/v2/test_network_qos_policy.py +16 -19
- openstackclient/tests/unit/network/v2/test_network_qos_rule.py +79 -152
- openstackclient/tests/unit/network/v2/test_network_qos_rule_type.py +4 -6
- openstackclient/tests/unit/network/v2/test_network_rbac.py +2 -2
- openstackclient/tests/unit/network/v2/test_port.py +17 -17
- openstackclient/tests/unit/network/v2/test_router.py +73 -57
- openstackclient/tests/unit/network/v2/test_security_group_network.py +25 -27
- openstackclient/tests/unit/network/v2/test_security_group_rule_compute.py +1 -3
- openstackclient/tests/unit/network/v2/test_security_group_rule_network.py +33 -39
- openstackclient/tests/unit/volume/v2/fakes.py +1 -2
- openstackclient/tests/unit/volume/v2/test_service.py +57 -91
- openstackclient/tests/unit/volume/v2/test_volume.py +108 -105
- openstackclient/tests/unit/volume/v2/test_volume_backup.py +141 -148
- openstackclient/tests/unit/volume/v2/test_volume_snapshot.py +293 -283
- openstackclient/tests/unit/volume/v3/test_block_storage_log_level.py +61 -71
- openstackclient/tests/unit/volume/v3/test_service.py +221 -141
- openstackclient/tests/unit/volume/v3/test_volume.py +130 -119
- openstackclient/tests/unit/volume/v3/test_volume_attachment.py +1 -1
- openstackclient/tests/unit/volume/v3/test_volume_backup.py +198 -203
- openstackclient/tests/unit/volume/v3/test_volume_snapshot.py +682 -47
- openstackclient/volume/v2/service.py +41 -38
- openstackclient/volume/v2/volume.py +63 -37
- openstackclient/volume/v2/volume_backup.py +9 -3
- openstackclient/volume/v2/volume_snapshot.py +121 -84
- openstackclient/volume/v3/block_storage_log_level.py +22 -28
- openstackclient/volume/v3/service.py +105 -14
- openstackclient/volume/v3/volume.py +200 -39
- openstackclient/volume/v3/volume_backup.py +24 -19
- openstackclient/volume/v3/volume_snapshot.py +485 -10
- {python_openstackclient-8.0.0.dist-info → python_openstackclient-8.1.0.dist-info}/AUTHORS +8 -0
- python_openstackclient-8.1.0.dist-info/METADATA +264 -0
- {python_openstackclient-8.0.0.dist-info → python_openstackclient-8.1.0.dist-info}/RECORD +83 -81
- {python_openstackclient-8.0.0.dist-info → python_openstackclient-8.1.0.dist-info}/entry_points.txt +7 -6
- python_openstackclient-8.1.0.dist-info/pbr.json +1 -0
- python_openstackclient-8.0.0.dist-info/METADATA +0 -166
- python_openstackclient-8.0.0.dist-info/pbr.json +0 -1
- {python_openstackclient-8.0.0.dist-info → python_openstackclient-8.1.0.dist-info}/LICENSE +0 -0
- {python_openstackclient-8.0.0.dist-info → python_openstackclient-8.1.0.dist-info}/WHEEL +0 -0
- {python_openstackclient-8.0.0.dist-info → python_openstackclient-8.1.0.dist-info}/top_level.txt +0 -0
|
@@ -17,6 +17,7 @@ from unittest import mock
|
|
|
17
17
|
from openstack.block_storage.v3 import block_storage_summary as _summary
|
|
18
18
|
from openstack.block_storage.v3 import snapshot as _snapshot
|
|
19
19
|
from openstack.block_storage.v3 import volume as _volume
|
|
20
|
+
from openstack import exceptions as sdk_exceptions
|
|
20
21
|
from openstack.test import fakes as sdk_fakes
|
|
21
22
|
from osc_lib.cli import format_columns
|
|
22
23
|
from osc_lib import exceptions
|
|
@@ -179,7 +180,7 @@ class TestVolumeCreateLegacy(volume_fakes.TestVolume):
|
|
|
179
180
|
self.new_volume.name,
|
|
180
181
|
]
|
|
181
182
|
verifylist = [
|
|
182
|
-
('
|
|
183
|
+
('properties', {'Alpha': 'a', 'Beta': 'b'}),
|
|
183
184
|
('size', self.new_volume.size),
|
|
184
185
|
('name', self.new_volume.name),
|
|
185
186
|
]
|
|
@@ -440,9 +441,7 @@ class TestVolumeCreateLegacy(volume_fakes.TestVolume):
|
|
|
440
441
|
]
|
|
441
442
|
verifylist = [
|
|
442
443
|
('bootable', True),
|
|
443
|
-
('non_bootable', False),
|
|
444
444
|
('read_only', True),
|
|
445
|
-
('read_write', False),
|
|
446
445
|
('size', self.new_volume.size),
|
|
447
446
|
('name', self.new_volume.name),
|
|
448
447
|
]
|
|
@@ -486,9 +485,7 @@ class TestVolumeCreateLegacy(volume_fakes.TestVolume):
|
|
|
486
485
|
]
|
|
487
486
|
verifylist = [
|
|
488
487
|
('bootable', False),
|
|
489
|
-
('non_bootable', True),
|
|
490
488
|
('read_only', False),
|
|
491
|
-
('read_write', True),
|
|
492
489
|
('size', self.new_volume.size),
|
|
493
490
|
('name', self.new_volume.name),
|
|
494
491
|
]
|
|
@@ -541,9 +538,7 @@ class TestVolumeCreateLegacy(volume_fakes.TestVolume):
|
|
|
541
538
|
]
|
|
542
539
|
verifylist = [
|
|
543
540
|
('bootable', True),
|
|
544
|
-
('non_bootable', False),
|
|
545
541
|
('read_only', True),
|
|
546
|
-
('read_write', False),
|
|
547
542
|
('size', self.new_volume.size),
|
|
548
543
|
('name', self.new_volume.name),
|
|
549
544
|
]
|
|
@@ -593,9 +588,7 @@ class TestVolumeCreateLegacy(volume_fakes.TestVolume):
|
|
|
593
588
|
]
|
|
594
589
|
verifylist = [
|
|
595
590
|
('bootable', False),
|
|
596
|
-
('non_bootable', True),
|
|
597
591
|
('read_only', True),
|
|
598
|
-
('read_write', False),
|
|
599
592
|
('size', self.new_volume.size),
|
|
600
593
|
('name', self.new_volume.name),
|
|
601
594
|
]
|
|
@@ -838,7 +831,7 @@ class TestVolumeCreate(volume_fakes.TestVolume):
|
|
|
838
831
|
description=parsed_args.description,
|
|
839
832
|
volume_type=parsed_args.type,
|
|
840
833
|
availability_zone=parsed_args.availability_zone,
|
|
841
|
-
metadata=parsed_args.
|
|
834
|
+
metadata=parsed_args.properties,
|
|
842
835
|
bootable=parsed_args.bootable,
|
|
843
836
|
cluster=getattr(parsed_args, 'cluster', None),
|
|
844
837
|
)
|
|
@@ -962,16 +955,17 @@ class TestVolumeCreate(volume_fakes.TestVolume):
|
|
|
962
955
|
)
|
|
963
956
|
|
|
964
957
|
|
|
965
|
-
class
|
|
958
|
+
class TestVolumeDelete(volume_fakes.TestVolume):
|
|
966
959
|
def setUp(self):
|
|
967
960
|
super().setUp()
|
|
968
961
|
|
|
969
962
|
self.volumes_mock = self.volume_client.volumes
|
|
970
963
|
self.volumes_mock.reset_mock()
|
|
971
964
|
|
|
972
|
-
self.
|
|
973
|
-
self.
|
|
974
|
-
self.
|
|
965
|
+
self.volumes = list(sdk_fakes.generate_fake_resources(_volume.Volume))
|
|
966
|
+
self.volume_sdk_client.find_volume.side_effect = self.volumes
|
|
967
|
+
self.volume_sdk_client.delete_volume.return_value = None
|
|
968
|
+
self.volume_sdk_client.unmanage_volume.return_value = None
|
|
975
969
|
|
|
976
970
|
# Get the command object to mock
|
|
977
971
|
self.cmd = volume.DeleteVolume(self.app, None)
|
|
@@ -986,11 +980,14 @@ class TestVolumeDeleteLegacy(volume_fakes.TestVolume):
|
|
|
986
980
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
987
981
|
|
|
988
982
|
result = self.cmd.take_action(parsed_args)
|
|
983
|
+
self.assertIsNone(result)
|
|
989
984
|
|
|
990
|
-
self.
|
|
991
|
-
self.volumes[0].id,
|
|
985
|
+
self.volume_sdk_client.find_volume.assert_called_once_with(
|
|
986
|
+
self.volumes[0].id, ignore_missing=False
|
|
987
|
+
)
|
|
988
|
+
self.volume_sdk_client.delete_volume.assert_called_once_with(
|
|
989
|
+
self.volumes[0].id, cascade=False, force=False
|
|
992
990
|
)
|
|
993
|
-
self.assertIsNone(result)
|
|
994
991
|
|
|
995
992
|
def test_volume_delete_multi_volumes(self):
|
|
996
993
|
arglist = [v.id for v in self.volumes]
|
|
@@ -1002,12 +999,21 @@ class TestVolumeDeleteLegacy(volume_fakes.TestVolume):
|
|
|
1002
999
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1003
1000
|
|
|
1004
1001
|
result = self.cmd.take_action(parsed_args)
|
|
1005
|
-
|
|
1006
|
-
calls = [mock.call(v.id, cascade=False) for v in self.volumes]
|
|
1007
|
-
self.volumes_mock.delete.assert_has_calls(calls)
|
|
1008
1002
|
self.assertIsNone(result)
|
|
1009
1003
|
|
|
1004
|
+
self.volume_sdk_client.find_volume.assert_has_calls(
|
|
1005
|
+
[mock.call(v.id, ignore_missing=False) for v in self.volumes]
|
|
1006
|
+
)
|
|
1007
|
+
self.volume_sdk_client.delete_volume.assert_has_calls(
|
|
1008
|
+
[mock.call(v.id, cascade=False, force=False) for v in self.volumes]
|
|
1009
|
+
)
|
|
1010
|
+
|
|
1010
1011
|
def test_volume_delete_multi_volumes_with_exception(self):
|
|
1012
|
+
self.volume_sdk_client.find_volume.side_effect = [
|
|
1013
|
+
self.volumes[0],
|
|
1014
|
+
sdk_exceptions.NotFoundException(),
|
|
1015
|
+
]
|
|
1016
|
+
|
|
1011
1017
|
arglist = [
|
|
1012
1018
|
self.volumes[0].id,
|
|
1013
1019
|
'unexist_volume',
|
|
@@ -1015,27 +1021,28 @@ class TestVolumeDeleteLegacy(volume_fakes.TestVolume):
|
|
|
1015
1021
|
verifylist = [
|
|
1016
1022
|
('force', False),
|
|
1017
1023
|
('purge', False),
|
|
1018
|
-
('volumes',
|
|
1024
|
+
('volumes', [self.volumes[0].id, 'unexist_volume']),
|
|
1019
1025
|
]
|
|
1020
1026
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1021
1027
|
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
self.volumes[0].id, cascade=False
|
|
1038
|
-
|
|
1028
|
+
exc = self.assertRaises(
|
|
1029
|
+
exceptions.CommandError,
|
|
1030
|
+
self.cmd.take_action,
|
|
1031
|
+
parsed_args,
|
|
1032
|
+
)
|
|
1033
|
+
self.assertEqual('1 of 2 volumes failed to delete.', str(exc))
|
|
1034
|
+
|
|
1035
|
+
self.volume_sdk_client.find_volume.assert_has_calls(
|
|
1036
|
+
[
|
|
1037
|
+
mock.call(self.volumes[0].id, ignore_missing=False),
|
|
1038
|
+
mock.call('unexist_volume', ignore_missing=False),
|
|
1039
|
+
]
|
|
1040
|
+
)
|
|
1041
|
+
self.volume_sdk_client.delete_volume.assert_has_calls(
|
|
1042
|
+
[
|
|
1043
|
+
mock.call(self.volumes[0].id, cascade=False, force=False),
|
|
1044
|
+
]
|
|
1045
|
+
)
|
|
1039
1046
|
|
|
1040
1047
|
def test_volume_delete_with_purge(self):
|
|
1041
1048
|
arglist = [
|
|
@@ -1050,11 +1057,14 @@ class TestVolumeDeleteLegacy(volume_fakes.TestVolume):
|
|
|
1050
1057
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1051
1058
|
|
|
1052
1059
|
result = self.cmd.take_action(parsed_args)
|
|
1060
|
+
self.assertIsNone(result)
|
|
1053
1061
|
|
|
1054
|
-
self.
|
|
1055
|
-
self.volumes[0].id,
|
|
1062
|
+
self.volume_sdk_client.find_volume.assert_called_once_with(
|
|
1063
|
+
self.volumes[0].id, ignore_missing=False
|
|
1064
|
+
)
|
|
1065
|
+
self.volume_sdk_client.delete_volume.assert_called_once_with(
|
|
1066
|
+
self.volumes[0].id, cascade=True, force=False
|
|
1056
1067
|
)
|
|
1057
|
-
self.assertIsNone(result)
|
|
1058
1068
|
|
|
1059
1069
|
def test_volume_delete_with_force(self):
|
|
1060
1070
|
arglist = [
|
|
@@ -1069,49 +1079,38 @@ class TestVolumeDeleteLegacy(volume_fakes.TestVolume):
|
|
|
1069
1079
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1070
1080
|
|
|
1071
1081
|
result = self.cmd.take_action(parsed_args)
|
|
1072
|
-
|
|
1073
|
-
self.volumes_mock.force_delete.assert_called_once_with(
|
|
1074
|
-
self.volumes[0].id
|
|
1075
|
-
)
|
|
1076
1082
|
self.assertIsNone(result)
|
|
1077
1083
|
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
self.volumes_mock.reset_mock()
|
|
1085
|
-
self.volume_sdk_client.unmanage_volume.return_value = None
|
|
1086
|
-
|
|
1087
|
-
# Get the command object to mock
|
|
1088
|
-
self.cmd = volume.DeleteVolume(self.app, None)
|
|
1084
|
+
self.volume_sdk_client.find_volume.assert_called_once_with(
|
|
1085
|
+
self.volumes[0].id, ignore_missing=False
|
|
1086
|
+
)
|
|
1087
|
+
self.volume_sdk_client.delete_volume.assert_called_once_with(
|
|
1088
|
+
self.volumes[0].id, cascade=False, force=True
|
|
1089
|
+
)
|
|
1089
1090
|
|
|
1090
1091
|
def test_volume_delete_remote(self):
|
|
1091
|
-
|
|
1092
|
-
self.volumes_mock.get.return_value = vol
|
|
1093
|
-
|
|
1094
|
-
arglist = ['--remote', vol.id]
|
|
1092
|
+
arglist = ['--remote', self.volumes[0].id]
|
|
1095
1093
|
verifylist = [
|
|
1096
1094
|
("remote", True),
|
|
1097
1095
|
("force", False),
|
|
1098
1096
|
("purge", False),
|
|
1099
|
-
("volumes", [
|
|
1097
|
+
("volumes", [self.volumes[0].id]),
|
|
1100
1098
|
]
|
|
1101
1099
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1102
1100
|
|
|
1103
1101
|
result = self.cmd.take_action(parsed_args)
|
|
1104
|
-
|
|
1105
|
-
self.volume_sdk_client.unmanage_volume.assert_called_once_with(vol.id)
|
|
1106
1102
|
self.assertIsNone(result)
|
|
1107
1103
|
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1104
|
+
self.volume_sdk_client.find_volume.assert_called_once_with(
|
|
1105
|
+
self.volumes[0].id, ignore_missing=False
|
|
1106
|
+
)
|
|
1107
|
+
self.volume_sdk_client.delete_volume.assert_not_called()
|
|
1108
|
+
self.volume_sdk_client.unmanage_volume.assert_called_once_with(
|
|
1109
|
+
self.volumes[0].id
|
|
1111
1110
|
)
|
|
1112
1111
|
|
|
1113
|
-
|
|
1114
|
-
arglist
|
|
1112
|
+
def test_volume_delete_multi_volumes_remote(self):
|
|
1113
|
+
arglist = ['--remote'] + [v.id for v in self.volumes]
|
|
1115
1114
|
verifylist = [
|
|
1116
1115
|
('remote', True),
|
|
1117
1116
|
('force', False),
|
|
@@ -1121,24 +1120,27 @@ class TestVolumeDelete(volume_fakes.TestVolume):
|
|
|
1121
1120
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1122
1121
|
|
|
1123
1122
|
result = self.cmd.take_action(parsed_args)
|
|
1124
|
-
|
|
1125
|
-
calls = [mock.call(v.id) for v in volumes]
|
|
1126
|
-
self.volume_sdk_client.unmanage_volume.assert_has_calls(calls)
|
|
1127
1123
|
self.assertIsNone(result)
|
|
1128
1124
|
|
|
1129
|
-
|
|
1130
|
-
|
|
1125
|
+
self.volume_sdk_client.find_volume.assert_has_calls(
|
|
1126
|
+
[mock.call(v.id, ignore_missing=False) for v in self.volumes]
|
|
1127
|
+
)
|
|
1128
|
+
self.volume_sdk_client.delete_volume.assert_not_called()
|
|
1129
|
+
self.volume_sdk_client.unmanage_volume.assert_has_calls(
|
|
1130
|
+
[mock.call(v.id) for v in self.volumes]
|
|
1131
|
+
)
|
|
1131
1132
|
|
|
1133
|
+
def test_volume_delete_remote_with_purge(self):
|
|
1132
1134
|
arglist = [
|
|
1133
1135
|
'--remote',
|
|
1134
1136
|
'--purge',
|
|
1135
|
-
|
|
1137
|
+
self.volumes[0].id,
|
|
1136
1138
|
]
|
|
1137
1139
|
verifylist = [
|
|
1138
1140
|
('remote', True),
|
|
1139
1141
|
('force', False),
|
|
1140
1142
|
('purge', True),
|
|
1141
|
-
('volumes', [
|
|
1143
|
+
('volumes', [self.volumes[0].id]),
|
|
1142
1144
|
]
|
|
1143
1145
|
|
|
1144
1146
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -1151,19 +1153,21 @@ class TestVolumeDelete(volume_fakes.TestVolume):
|
|
|
1151
1153
|
str(exc),
|
|
1152
1154
|
)
|
|
1153
1155
|
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
+
self.volume_sdk_client.find_volume.assert_not_called()
|
|
1157
|
+
self.volume_sdk_client.delete_volume.assert_not_called()
|
|
1158
|
+
self.volume_sdk_client.unmanage_volume.assert_not_called()
|
|
1156
1159
|
|
|
1160
|
+
def test_volume_delete_remote_with_force(self):
|
|
1157
1161
|
arglist = [
|
|
1158
1162
|
'--remote',
|
|
1159
1163
|
'--force',
|
|
1160
|
-
|
|
1164
|
+
self.volumes[0].id,
|
|
1161
1165
|
]
|
|
1162
1166
|
verifylist = [
|
|
1163
1167
|
('remote', True),
|
|
1164
1168
|
('force', True),
|
|
1165
1169
|
('purge', False),
|
|
1166
|
-
('volumes', [
|
|
1170
|
+
('volumes', [self.volumes[0].id]),
|
|
1167
1171
|
]
|
|
1168
1172
|
|
|
1169
1173
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
@@ -1176,6 +1180,10 @@ class TestVolumeDelete(volume_fakes.TestVolume):
|
|
|
1176
1180
|
str(exc),
|
|
1177
1181
|
)
|
|
1178
1182
|
|
|
1183
|
+
self.volume_sdk_client.find_volume.assert_not_called()
|
|
1184
|
+
self.volume_sdk_client.delete_volume.assert_not_called()
|
|
1185
|
+
self.volume_sdk_client.unmanage_volume.assert_not_called()
|
|
1186
|
+
|
|
1179
1187
|
|
|
1180
1188
|
class TestVolumeList(volume_fakes.TestVolume):
|
|
1181
1189
|
project = identity_fakes.FakeProject.create_one_project()
|
|
@@ -1815,16 +1823,16 @@ class TestVolumeSet(volume_fakes.TestVolume):
|
|
|
1815
1823
|
self.new_volume.id,
|
|
1816
1824
|
]
|
|
1817
1825
|
verifylist = [
|
|
1818
|
-
('
|
|
1826
|
+
('properties', {'a': 'b', 'c': 'd'}),
|
|
1827
|
+
('read_only', None),
|
|
1828
|
+
('bootable', None),
|
|
1819
1829
|
('volume', self.new_volume.id),
|
|
1820
|
-
('bootable', False),
|
|
1821
|
-
('non_bootable', False),
|
|
1822
1830
|
]
|
|
1823
1831
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1824
1832
|
|
|
1825
1833
|
self.cmd.take_action(parsed_args)
|
|
1826
1834
|
self.volumes_mock.set_metadata.assert_called_with(
|
|
1827
|
-
self.new_volume.id, parsed_args.
|
|
1835
|
+
self.new_volume.id, parsed_args.properties
|
|
1828
1836
|
)
|
|
1829
1837
|
|
|
1830
1838
|
def test_volume_set_image_property(self):
|
|
@@ -1836,10 +1844,10 @@ class TestVolumeSet(volume_fakes.TestVolume):
|
|
|
1836
1844
|
self.new_volume.id,
|
|
1837
1845
|
]
|
|
1838
1846
|
verifylist = [
|
|
1839
|
-
('
|
|
1847
|
+
('image_properties', {'Alpha': 'a', 'Beta': 'b'}),
|
|
1848
|
+
('read_only', None),
|
|
1849
|
+
('bootable', None),
|
|
1840
1850
|
('volume', self.new_volume.id),
|
|
1841
|
-
('bootable', False),
|
|
1842
|
-
('non_bootable', False),
|
|
1843
1851
|
]
|
|
1844
1852
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1845
1853
|
|
|
@@ -1847,15 +1855,15 @@ class TestVolumeSet(volume_fakes.TestVolume):
|
|
|
1847
1855
|
# returns nothing
|
|
1848
1856
|
self.cmd.take_action(parsed_args)
|
|
1849
1857
|
self.volumes_mock.set_image_metadata.assert_called_with(
|
|
1850
|
-
self.new_volume.id, parsed_args.
|
|
1858
|
+
self.new_volume.id, parsed_args.image_properties
|
|
1851
1859
|
)
|
|
1852
1860
|
|
|
1853
1861
|
def test_volume_set_state(self):
|
|
1854
1862
|
arglist = ['--state', 'error', self.new_volume.id]
|
|
1855
1863
|
verifylist = [
|
|
1856
|
-
('read_only', False),
|
|
1857
|
-
('read_write', False),
|
|
1858
1864
|
('state', 'error'),
|
|
1865
|
+
('read_only', None),
|
|
1866
|
+
('bootable', None),
|
|
1859
1867
|
('volume', self.new_volume.id),
|
|
1860
1868
|
]
|
|
1861
1869
|
|
|
@@ -1919,36 +1927,40 @@ class TestVolumeSet(volume_fakes.TestVolume):
|
|
|
1919
1927
|
|
|
1920
1928
|
def test_volume_set_bootable(self):
|
|
1921
1929
|
arglist = [
|
|
1922
|
-
|
|
1923
|
-
|
|
1930
|
+
'--bootable',
|
|
1931
|
+
self.new_volume.id,
|
|
1924
1932
|
]
|
|
1925
1933
|
verifylist = [
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
],
|
|
1931
|
-
[
|
|
1932
|
-
('bootable', False),
|
|
1933
|
-
('non_bootable', True),
|
|
1934
|
-
('volume', self.new_volume.id),
|
|
1935
|
-
],
|
|
1936
|
-
]
|
|
1937
|
-
for index in range(len(arglist)):
|
|
1938
|
-
parsed_args = self.check_parser(
|
|
1939
|
-
self.cmd, arglist[index], verifylist[index]
|
|
1940
|
-
)
|
|
1934
|
+
('bootable', True),
|
|
1935
|
+
('volume', self.new_volume.id),
|
|
1936
|
+
]
|
|
1937
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1941
1938
|
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1939
|
+
self.cmd.take_action(parsed_args)
|
|
1940
|
+
self.volumes_mock.set_bootable.assert_called_with(
|
|
1941
|
+
self.new_volume.id, verifylist[0][1]
|
|
1942
|
+
)
|
|
1943
|
+
|
|
1944
|
+
def test_volume_set_non_bootable(self):
|
|
1945
|
+
arglist = [
|
|
1946
|
+
'--non-bootable',
|
|
1947
|
+
self.new_volume.id,
|
|
1948
|
+
]
|
|
1949
|
+
verifylist = [
|
|
1950
|
+
('bootable', False),
|
|
1951
|
+
('volume', self.new_volume.id),
|
|
1952
|
+
]
|
|
1953
|
+
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
1954
|
+
|
|
1955
|
+
self.cmd.take_action(parsed_args)
|
|
1956
|
+
self.volumes_mock.set_bootable.assert_called_with(
|
|
1957
|
+
self.new_volume.id, verifylist[0][1]
|
|
1958
|
+
)
|
|
1946
1959
|
|
|
1947
1960
|
def test_volume_set_readonly(self):
|
|
1948
1961
|
arglist = ['--read-only', self.new_volume.id]
|
|
1949
1962
|
verifylist = [
|
|
1950
1963
|
('read_only', True),
|
|
1951
|
-
('read_write', False),
|
|
1952
1964
|
('volume', self.new_volume.id),
|
|
1953
1965
|
]
|
|
1954
1966
|
|
|
@@ -1964,7 +1976,6 @@ class TestVolumeSet(volume_fakes.TestVolume):
|
|
|
1964
1976
|
arglist = ['--read-write', self.new_volume.id]
|
|
1965
1977
|
verifylist = [
|
|
1966
1978
|
('read_only', False),
|
|
1967
|
-
('read_write', True),
|
|
1968
1979
|
('volume', self.new_volume.id),
|
|
1969
1980
|
]
|
|
1970
1981
|
|
|
@@ -2100,7 +2111,7 @@ class TestVolumeUnset(volume_fakes.TestVolume):
|
|
|
2100
2111
|
self.new_volume.id,
|
|
2101
2112
|
]
|
|
2102
2113
|
verifylist = [
|
|
2103
|
-
('
|
|
2114
|
+
('image_properties', {'Alpha': 'a', 'Beta': 'b'}),
|
|
2104
2115
|
('volume', self.new_volume.id),
|
|
2105
2116
|
]
|
|
2106
2117
|
parsed_args = self.check_parser(self.cmd_set, arglist, verifylist)
|
|
@@ -2116,7 +2127,7 @@ class TestVolumeUnset(volume_fakes.TestVolume):
|
|
|
2116
2127
|
self.new_volume.id,
|
|
2117
2128
|
]
|
|
2118
2129
|
verifylist_unset = [
|
|
2119
|
-
('
|
|
2130
|
+
('image_properties', ['Alpha']),
|
|
2120
2131
|
('volume', self.new_volume.id),
|
|
2121
2132
|
]
|
|
2122
2133
|
parsed_args_unset = self.check_parser(
|
|
@@ -2128,7 +2139,7 @@ class TestVolumeUnset(volume_fakes.TestVolume):
|
|
|
2128
2139
|
self.cmd_unset.take_action(parsed_args_unset)
|
|
2129
2140
|
|
|
2130
2141
|
self.volumes_mock.delete_image_metadata.assert_called_with(
|
|
2131
|
-
self.new_volume.id, parsed_args_unset.
|
|
2142
|
+
self.new_volume.id, parsed_args_unset.image_properties
|
|
2132
2143
|
)
|
|
2133
2144
|
|
|
2134
2145
|
def test_volume_unset_image_property_fail(self):
|
|
@@ -2143,8 +2154,8 @@ class TestVolumeUnset(volume_fakes.TestVolume):
|
|
|
2143
2154
|
self.new_volume.id,
|
|
2144
2155
|
]
|
|
2145
2156
|
verifylist = [
|
|
2146
|
-
('
|
|
2147
|
-
('
|
|
2157
|
+
('image_properties', ['Alpha']),
|
|
2158
|
+
('properties', ['Beta']),
|
|
2148
2159
|
('volume', self.new_volume.id),
|
|
2149
2160
|
]
|
|
2150
2161
|
parsed_args = self.check_parser(self.cmd_unset, arglist, verifylist)
|
|
@@ -2157,10 +2168,10 @@ class TestVolumeUnset(volume_fakes.TestVolume):
|
|
|
2157
2168
|
'One or more of the unset operations failed', str(e)
|
|
2158
2169
|
)
|
|
2159
2170
|
self.volumes_mock.delete_image_metadata.assert_called_with(
|
|
2160
|
-
self.new_volume.id, parsed_args.
|
|
2171
|
+
self.new_volume.id, parsed_args.image_properties
|
|
2161
2172
|
)
|
|
2162
2173
|
self.volumes_mock.delete_metadata.assert_called_with(
|
|
2163
|
-
self.new_volume.id, parsed_args.
|
|
2174
|
+
self.new_volume.id, parsed_args.properties
|
|
2164
2175
|
)
|
|
2165
2176
|
|
|
2166
2177
|
|
|
@@ -28,7 +28,7 @@ class TestVolumeAttachment(volume_fakes.TestVolume):
|
|
|
28
28
|
|
|
29
29
|
class TestVolumeAttachmentCreate(TestVolumeAttachment):
|
|
30
30
|
volume = volume_fakes.create_one_volume()
|
|
31
|
-
server = compute_fakes.
|
|
31
|
+
server = compute_fakes.create_one_server()
|
|
32
32
|
volume_attachment = volume_fakes.create_one_volume_attachment(
|
|
33
33
|
attrs={'instance': server.id, 'volume_id': volume.id},
|
|
34
34
|
)
|