python-openstackclient 6.1.0__py3-none-any.whl → 6.2.1__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/project_cleanup.py +3 -5
- openstackclient/common/quota.py +4 -6
- openstackclient/compute/v2/host.py +44 -16
- openstackclient/compute/v2/server.py +18 -24
- openstackclient/compute/v2/server_migration.py +53 -29
- openstackclient/compute/v2/server_volume.py +35 -38
- openstackclient/compute/v2/service.py +5 -5
- openstackclient/identity/common.py +12 -0
- openstackclient/identity/v3/access_rule.py +8 -6
- openstackclient/image/v2/image.py +8 -2
- openstackclient/network/v2/floating_ip_port_forwarding.py +70 -32
- openstackclient/network/v2/network_service_provider.py +16 -10
- openstackclient/tests/functional/compute/v2/test_server.py +0 -3
- openstackclient/tests/unit/compute/v2/fakes.py +122 -207
- openstackclient/tests/unit/compute/v2/test_host.py +63 -42
- openstackclient/tests/unit/compute/v2/test_server.py +1 -2
- openstackclient/tests/unit/compute/v2/test_server_migration.py +92 -95
- openstackclient/tests/unit/compute/v2/test_server_volume.py +103 -83
- openstackclient/tests/unit/identity/v3/test_access_rule.py +11 -11
- openstackclient/tests/unit/network/v2/fakes.py +31 -7
- openstackclient/tests/unit/network/v2/test_floating_ip_port_forwarding.py +213 -18
- openstackclient/tests/unit/volume/v1/test_volume.py +48 -3
- openstackclient/tests/unit/volume/v2/test_consistency_group.py +2 -2
- openstackclient/tests/unit/volume/v2/test_volume.py +50 -3
- openstackclient/tests/unit/volume/v3/test_volume_group.py +47 -8
- openstackclient/volume/v1/volume.py +33 -4
- openstackclient/volume/v2/backup_record.py +8 -6
- openstackclient/volume/v2/consistency_group.py +32 -13
- openstackclient/volume/v2/volume.py +33 -4
- openstackclient/volume/v3/volume_group.py +91 -36
- {python_openstackclient-6.1.0.dist-info → python_openstackclient-6.2.1.dist-info}/AUTHORS +5 -0
- {python_openstackclient-6.1.0.dist-info → python_openstackclient-6.2.1.dist-info}/METADATA +1 -1
- {python_openstackclient-6.1.0.dist-info → python_openstackclient-6.2.1.dist-info}/RECORD +38 -38
- {python_openstackclient-6.1.0.dist-info → python_openstackclient-6.2.1.dist-info}/entry_points.txt +1 -0
- python_openstackclient-6.2.1.dist-info/pbr.json +1 -0
- python_openstackclient-6.1.0.dist-info/pbr.json +0 -1
- {python_openstackclient-6.1.0.dist-info → python_openstackclient-6.2.1.dist-info}/LICENSE +0 -0
- {python_openstackclient-6.1.0.dist-info → python_openstackclient-6.2.1.dist-info}/WHEEL +0 -0
- {python_openstackclient-6.1.0.dist-info → python_openstackclient-6.2.1.dist-info}/top_level.txt +0 -0
|
@@ -17,6 +17,7 @@ from unittest import mock
|
|
|
17
17
|
|
|
18
18
|
from openstackclient.compute.v2 import host
|
|
19
19
|
from openstackclient.tests.unit.compute.v2 import fakes as compute_fakes
|
|
20
|
+
from openstackclient.tests.unit import fakes
|
|
20
21
|
from openstackclient.tests.unit import utils as tests_utils
|
|
21
22
|
|
|
22
23
|
|
|
@@ -26,7 +27,10 @@ class TestHost(compute_fakes.TestComputev2):
|
|
|
26
27
|
super(TestHost, self).setUp()
|
|
27
28
|
|
|
28
29
|
# Get a shortcut to the compute client
|
|
29
|
-
self.
|
|
30
|
+
self.app.client_manager.sdk_connection = mock.Mock()
|
|
31
|
+
self.app.client_manager.sdk_connection.compute = mock.Mock()
|
|
32
|
+
self.sdk_client = self.app.client_manager.sdk_connection.compute
|
|
33
|
+
self.sdk_client.get = mock.Mock()
|
|
30
34
|
|
|
31
35
|
|
|
32
36
|
@mock.patch(
|
|
@@ -34,27 +38,29 @@ class TestHost(compute_fakes.TestComputev2):
|
|
|
34
38
|
)
|
|
35
39
|
class TestHostList(TestHost):
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
columns = (
|
|
40
|
-
'Host Name',
|
|
41
|
-
'Service',
|
|
42
|
-
'Zone',
|
|
43
|
-
)
|
|
44
|
-
|
|
45
|
-
data = [(
|
|
46
|
-
host['host_name'],
|
|
47
|
-
host['service'],
|
|
48
|
-
host['zone'],
|
|
49
|
-
)]
|
|
41
|
+
_host = compute_fakes.FakeHost.create_one_host()
|
|
50
42
|
|
|
51
43
|
def setUp(self):
|
|
52
44
|
super(TestHostList, self).setUp()
|
|
53
45
|
|
|
46
|
+
self.sdk_client.get.return_value = fakes.FakeResponse(
|
|
47
|
+
data={'hosts': [self._host]}
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
self.columns = (
|
|
51
|
+
'Host Name', 'Service', 'Zone'
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
self.data = [(
|
|
55
|
+
self._host['host_name'],
|
|
56
|
+
self._host['service'],
|
|
57
|
+
self._host['zone'],
|
|
58
|
+
)]
|
|
59
|
+
|
|
54
60
|
self.cmd = host.ListHost(self.app, None)
|
|
55
61
|
|
|
56
62
|
def test_host_list_no_option(self, h_mock):
|
|
57
|
-
h_mock.return_value = [self.
|
|
63
|
+
h_mock.return_value = [self._host]
|
|
58
64
|
arglist = []
|
|
59
65
|
verifylist = []
|
|
60
66
|
|
|
@@ -62,24 +68,24 @@ class TestHostList(TestHost):
|
|
|
62
68
|
|
|
63
69
|
columns, data = self.cmd.take_action(parsed_args)
|
|
64
70
|
|
|
65
|
-
|
|
71
|
+
self.sdk_client.get.assert_called_with('/os-hosts', microversion='2.1')
|
|
66
72
|
self.assertEqual(self.columns, columns)
|
|
67
73
|
self.assertEqual(self.data, list(data))
|
|
68
74
|
|
|
69
75
|
def test_host_list_with_option(self, h_mock):
|
|
70
|
-
h_mock.return_value = [self.
|
|
76
|
+
h_mock.return_value = [self._host]
|
|
71
77
|
arglist = [
|
|
72
|
-
'--zone', self.
|
|
78
|
+
'--zone', self._host['zone'],
|
|
73
79
|
]
|
|
74
80
|
verifylist = [
|
|
75
|
-
('zone', self.
|
|
81
|
+
('zone', self._host['zone']),
|
|
76
82
|
]
|
|
77
83
|
|
|
78
84
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
79
85
|
|
|
80
86
|
columns, data = self.cmd.take_action(parsed_args)
|
|
81
87
|
|
|
82
|
-
|
|
88
|
+
self.sdk_client.get.assert_called_with('/os-hosts', microversion='2.1')
|
|
83
89
|
self.assertEqual(self.columns, columns)
|
|
84
90
|
self.assertEqual(self.data, list(data))
|
|
85
91
|
|
|
@@ -141,31 +147,43 @@ class TestHostSet(TestHost):
|
|
|
141
147
|
)
|
|
142
148
|
class TestHostShow(TestHost):
|
|
143
149
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
columns = (
|
|
147
|
-
'Host',
|
|
148
|
-
'Project',
|
|
149
|
-
'CPU',
|
|
150
|
-
'Memory MB',
|
|
151
|
-
'Disk GB',
|
|
152
|
-
)
|
|
153
|
-
|
|
154
|
-
data = [(
|
|
155
|
-
host['host'],
|
|
156
|
-
host['project'],
|
|
157
|
-
host['cpu'],
|
|
158
|
-
host['memory_mb'],
|
|
159
|
-
host['disk_gb'],
|
|
160
|
-
)]
|
|
150
|
+
_host = compute_fakes.FakeHost.create_one_host()
|
|
161
151
|
|
|
162
152
|
def setUp(self):
|
|
163
153
|
super(TestHostShow, self).setUp()
|
|
164
154
|
|
|
155
|
+
output_data = {"resource": {
|
|
156
|
+
"host": self._host['host'],
|
|
157
|
+
"project": self._host['project'],
|
|
158
|
+
"cpu": self._host['cpu'],
|
|
159
|
+
"memory_mb": self._host['memory_mb'],
|
|
160
|
+
"disk_gb": self._host['disk_gb']
|
|
161
|
+
}}
|
|
162
|
+
|
|
163
|
+
self.sdk_client.get.return_value = fakes.FakeResponse(
|
|
164
|
+
data={'host': [output_data]}
|
|
165
|
+
)
|
|
166
|
+
|
|
167
|
+
self.columns = (
|
|
168
|
+
'Host',
|
|
169
|
+
'Project',
|
|
170
|
+
'CPU',
|
|
171
|
+
'Memory MB',
|
|
172
|
+
'Disk GB',
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
self.data = [(
|
|
176
|
+
self._host['host'],
|
|
177
|
+
self._host['project'],
|
|
178
|
+
self._host['cpu'],
|
|
179
|
+
self._host['memory_mb'],
|
|
180
|
+
self._host['disk_gb'],
|
|
181
|
+
)]
|
|
182
|
+
|
|
165
183
|
self.cmd = host.ShowHost(self.app, None)
|
|
166
184
|
|
|
167
185
|
def test_host_show_no_option(self, h_mock):
|
|
168
|
-
h_mock.host_show.return_value = [self.
|
|
186
|
+
h_mock.host_show.return_value = [self._host]
|
|
169
187
|
arglist = []
|
|
170
188
|
verifylist = []
|
|
171
189
|
|
|
@@ -174,18 +192,21 @@ class TestHostShow(TestHost):
|
|
|
174
192
|
self.cmd, arglist, verifylist)
|
|
175
193
|
|
|
176
194
|
def test_host_show_with_option(self, h_mock):
|
|
177
|
-
h_mock.return_value = [self.
|
|
195
|
+
h_mock.return_value = [self._host]
|
|
178
196
|
arglist = [
|
|
179
|
-
self.
|
|
197
|
+
self._host['host_name'],
|
|
180
198
|
]
|
|
181
199
|
verifylist = [
|
|
182
|
-
('host', self.
|
|
200
|
+
('host', self._host['host_name']),
|
|
183
201
|
]
|
|
184
202
|
|
|
185
203
|
parsed_args = self.check_parser(self.cmd, arglist, verifylist)
|
|
186
204
|
|
|
187
205
|
columns, data = self.cmd.take_action(parsed_args)
|
|
188
206
|
|
|
189
|
-
|
|
207
|
+
self.sdk_client.get.assert_called_with(
|
|
208
|
+
'/os-hosts/' + self._host['host_name'],
|
|
209
|
+
microversion='2.1'
|
|
210
|
+
)
|
|
190
211
|
self.assertEqual(self.columns, columns)
|
|
191
212
|
self.assertEqual(self.data, list(data))
|
|
@@ -931,8 +931,7 @@ class TestServerVolume(TestServer):
|
|
|
931
931
|
'volume_id': self.volumes[0].id,
|
|
932
932
|
}
|
|
933
933
|
self.volume_attachment = \
|
|
934
|
-
compute_fakes.
|
|
935
|
-
create_one_sdk_volume_attachment(attrs=attrs)
|
|
934
|
+
compute_fakes.create_one_volume_attachment(attrs=attrs)
|
|
936
935
|
|
|
937
936
|
self.sdk_client.create_volume_attachment.return_value = \
|
|
938
937
|
self.volume_attachment
|
|
@@ -40,6 +40,18 @@ class TestServerMigration(compute_fakes.TestComputev2):
|
|
|
40
40
|
self.app.client_manager.sdk_connection.compute = mock.Mock()
|
|
41
41
|
self.sdk_client = self.app.client_manager.sdk_connection.compute
|
|
42
42
|
|
|
43
|
+
patcher = mock.patch.object(
|
|
44
|
+
sdk_utils, 'supports_microversion', return_value=True)
|
|
45
|
+
self.addCleanup(patcher.stop)
|
|
46
|
+
self.supports_microversion_mock = patcher.start()
|
|
47
|
+
|
|
48
|
+
def _set_mock_microversion(self, mock_v):
|
|
49
|
+
"""Set a specific microversion for the mock supports_microversion()."""
|
|
50
|
+
self.supports_microversion_mock.reset_mock(return_value=True)
|
|
51
|
+
self.supports_microversion_mock.side_effect = (
|
|
52
|
+
lambda _, v:
|
|
53
|
+
api_versions.APIVersion(v) <= api_versions.APIVersion(mock_v))
|
|
54
|
+
|
|
43
55
|
|
|
44
56
|
class TestListMigration(TestServerMigration):
|
|
45
57
|
"""Test fetch all migrations."""
|
|
@@ -51,19 +63,20 @@ class TestListMigration(TestServerMigration):
|
|
|
51
63
|
]
|
|
52
64
|
|
|
53
65
|
MIGRATION_FIELDS = [
|
|
54
|
-
'source_node', 'dest_node', 'source_compute',
|
|
55
|
-
'dest_host', 'status', 'server_id', 'old_flavor_id',
|
|
66
|
+
'source_node', 'dest_node', 'source_compute',
|
|
67
|
+
'dest_compute', 'dest_host', 'status', 'server_id', 'old_flavor_id',
|
|
56
68
|
'new_flavor_id', 'created_at', 'updated_at'
|
|
57
69
|
]
|
|
58
70
|
|
|
59
71
|
def setUp(self):
|
|
60
72
|
super().setUp()
|
|
61
73
|
|
|
62
|
-
self.
|
|
74
|
+
self._set_mock_microversion('2.1')
|
|
75
|
+
|
|
76
|
+
self.server = compute_fakes.FakeServer.create_one_sdk_server()
|
|
63
77
|
self.sdk_client.find_server.return_value = self.server
|
|
64
78
|
|
|
65
|
-
self.migrations = compute_fakes.
|
|
66
|
-
count=3)
|
|
79
|
+
self.migrations = compute_fakes.create_migrations(count=3)
|
|
67
80
|
self.sdk_client.migrations.return_value = self.migrations
|
|
68
81
|
|
|
69
82
|
self.data = (common_utils.get_item_properties(
|
|
@@ -72,20 +85,6 @@ class TestListMigration(TestServerMigration):
|
|
|
72
85
|
# Get the command object to test
|
|
73
86
|
self.cmd = server_migration.ListMigration(self.app, None)
|
|
74
87
|
|
|
75
|
-
patcher = mock.patch.object(
|
|
76
|
-
sdk_utils, 'supports_microversion', return_value=True)
|
|
77
|
-
self.addCleanup(patcher.stop)
|
|
78
|
-
self.supports_microversion_mock = patcher.start()
|
|
79
|
-
self._set_mock_microversion(
|
|
80
|
-
self.app.client_manager.compute.api_version.get_string())
|
|
81
|
-
|
|
82
|
-
def _set_mock_microversion(self, mock_v):
|
|
83
|
-
"""Set a specific microversion for the mock supports_microversion()."""
|
|
84
|
-
self.supports_microversion_mock.reset_mock(return_value=True)
|
|
85
|
-
self.supports_microversion_mock.side_effect = (
|
|
86
|
-
lambda _, v:
|
|
87
|
-
api_versions.APIVersion(v) <= api_versions.APIVersion(mock_v))
|
|
88
|
-
|
|
89
88
|
def test_server_migration_list_no_options(self):
|
|
90
89
|
arglist = []
|
|
91
90
|
verifylist = []
|
|
@@ -601,12 +600,15 @@ class TestServerMigrationShow(TestServerMigration):
|
|
|
601
600
|
def setUp(self):
|
|
602
601
|
super().setUp()
|
|
603
602
|
|
|
604
|
-
self.server = compute_fakes.FakeServer.
|
|
605
|
-
self.
|
|
603
|
+
self.server = compute_fakes.FakeServer.create_one_sdk_server()
|
|
604
|
+
self.sdk_client.find_server.return_value = self.server
|
|
606
605
|
|
|
607
|
-
self.server_migration = compute_fakes.
|
|
608
|
-
|
|
609
|
-
|
|
606
|
+
self.server_migration = compute_fakes.create_one_server_migration()
|
|
607
|
+
self.sdk_client.get_server_migration.return_value =\
|
|
608
|
+
self.server_migration
|
|
609
|
+
self.sdk_client.server_migrations.return_value = iter(
|
|
610
|
+
[self.server_migration]
|
|
611
|
+
)
|
|
610
612
|
|
|
611
613
|
self.columns = (
|
|
612
614
|
'ID',
|
|
@@ -629,7 +631,7 @@ class TestServerMigrationShow(TestServerMigration):
|
|
|
629
631
|
|
|
630
632
|
self.data = (
|
|
631
633
|
self.server_migration.id,
|
|
632
|
-
self.server_migration.
|
|
634
|
+
self.server_migration.server_id,
|
|
633
635
|
self.server_migration.status,
|
|
634
636
|
self.server_migration.source_compute,
|
|
635
637
|
self.server_migration.source_node,
|
|
@@ -662,19 +664,18 @@ class TestServerMigrationShow(TestServerMigration):
|
|
|
662
664
|
self.assertEqual(self.columns, columns)
|
|
663
665
|
self.assertEqual(self.data, data)
|
|
664
666
|
|
|
665
|
-
self.
|
|
666
|
-
|
|
667
|
-
|
|
667
|
+
self.sdk_client.find_server.assert_called_with(
|
|
668
|
+
self.server.id, ignore_missing=False)
|
|
669
|
+
self.sdk_client.get_server_migration.assert_called_with(
|
|
670
|
+
self.server.id, '2', ignore_missing=False)
|
|
668
671
|
|
|
669
672
|
def test_server_migration_show(self):
|
|
670
|
-
self.
|
|
671
|
-
'2.24')
|
|
673
|
+
self._set_mock_microversion('2.24')
|
|
672
674
|
|
|
673
675
|
self._test_server_migration_show()
|
|
674
676
|
|
|
675
677
|
def test_server_migration_show_v259(self):
|
|
676
|
-
self.
|
|
677
|
-
'2.59')
|
|
678
|
+
self._set_mock_microversion('2.59')
|
|
678
679
|
|
|
679
680
|
self.columns += ('UUID',)
|
|
680
681
|
self.data += (self.server_migration.uuid,)
|
|
@@ -682,8 +683,7 @@ class TestServerMigrationShow(TestServerMigration):
|
|
|
682
683
|
self._test_server_migration_show()
|
|
683
684
|
|
|
684
685
|
def test_server_migration_show_v280(self):
|
|
685
|
-
self.
|
|
686
|
-
'2.80')
|
|
686
|
+
self._set_mock_microversion('2.80')
|
|
687
687
|
|
|
688
688
|
self.columns += ('UUID', 'User ID', 'Project ID')
|
|
689
689
|
self.data += (
|
|
@@ -695,8 +695,7 @@ class TestServerMigrationShow(TestServerMigration):
|
|
|
695
695
|
self._test_server_migration_show()
|
|
696
696
|
|
|
697
697
|
def test_server_migration_show_pre_v224(self):
|
|
698
|
-
self.
|
|
699
|
-
'2.23')
|
|
698
|
+
self._set_mock_microversion('2.23')
|
|
700
699
|
|
|
701
700
|
arglist = [
|
|
702
701
|
self.server.id,
|
|
@@ -714,9 +713,11 @@ class TestServerMigrationShow(TestServerMigration):
|
|
|
714
713
|
str(ex))
|
|
715
714
|
|
|
716
715
|
def test_server_migration_show_by_uuid(self):
|
|
717
|
-
self.
|
|
718
|
-
|
|
719
|
-
self.
|
|
716
|
+
self._set_mock_microversion('2.59')
|
|
717
|
+
|
|
718
|
+
self.sdk_client.server_migrations.return_value = iter(
|
|
719
|
+
[self.server_migration]
|
|
720
|
+
)
|
|
720
721
|
|
|
721
722
|
self.columns += ('UUID',)
|
|
722
723
|
self.data += (self.server_migration.uuid,)
|
|
@@ -733,14 +734,14 @@ class TestServerMigrationShow(TestServerMigration):
|
|
|
733
734
|
self.assertEqual(self.columns, columns)
|
|
734
735
|
self.assertEqual(self.data, data)
|
|
735
736
|
|
|
736
|
-
self.
|
|
737
|
-
|
|
738
|
-
self.
|
|
737
|
+
self.sdk_client.find_server.assert_called_with(
|
|
738
|
+
self.server.id, ignore_missing=False)
|
|
739
|
+
self.sdk_client.server_migrations.assert_called_with(self.server.id)
|
|
740
|
+
self.sdk_client.get_server_migration.assert_not_called()
|
|
739
741
|
|
|
740
742
|
def test_server_migration_show_by_uuid_no_matches(self):
|
|
741
|
-
self.
|
|
742
|
-
|
|
743
|
-
self.server_migrations_mock.list.return_value = []
|
|
743
|
+
self._set_mock_microversion('2.59')
|
|
744
|
+
self.sdk_client.server_migrations.return_value = iter([])
|
|
744
745
|
|
|
745
746
|
arglist = [
|
|
746
747
|
self.server.id,
|
|
@@ -758,8 +759,7 @@ class TestServerMigrationShow(TestServerMigration):
|
|
|
758
759
|
str(ex))
|
|
759
760
|
|
|
760
761
|
def test_server_migration_show_by_uuid_pre_v259(self):
|
|
761
|
-
self.
|
|
762
|
-
'2.58')
|
|
762
|
+
self._set_mock_microversion('2.58')
|
|
763
763
|
|
|
764
764
|
arglist = [
|
|
765
765
|
self.server.id,
|
|
@@ -777,8 +777,7 @@ class TestServerMigrationShow(TestServerMigration):
|
|
|
777
777
|
str(ex))
|
|
778
778
|
|
|
779
779
|
def test_server_migration_show_invalid_id(self):
|
|
780
|
-
self.
|
|
781
|
-
'2.24')
|
|
780
|
+
self._set_mock_microversion('2.24')
|
|
782
781
|
|
|
783
782
|
arglist = [
|
|
784
783
|
self.server.id,
|
|
@@ -801,17 +800,16 @@ class TestServerMigrationAbort(TestServerMigration):
|
|
|
801
800
|
def setUp(self):
|
|
802
801
|
super().setUp()
|
|
803
802
|
|
|
804
|
-
self.server = compute_fakes.FakeServer.
|
|
803
|
+
self.server = compute_fakes.FakeServer.create_one_sdk_server()
|
|
805
804
|
|
|
806
805
|
# Return value for utils.find_resource for server.
|
|
807
|
-
self.
|
|
806
|
+
self.sdk_client.find_server.return_value = self.server
|
|
808
807
|
|
|
809
808
|
# Get the command object to test
|
|
810
809
|
self.cmd = server_migration.AbortMigration(self.app, None)
|
|
811
810
|
|
|
812
811
|
def test_migration_abort(self):
|
|
813
|
-
self.
|
|
814
|
-
'2.24')
|
|
812
|
+
self._set_mock_microversion('2.24')
|
|
815
813
|
|
|
816
814
|
arglist = [
|
|
817
815
|
self.server.id,
|
|
@@ -822,14 +820,14 @@ class TestServerMigrationAbort(TestServerMigration):
|
|
|
822
820
|
|
|
823
821
|
result = self.cmd.take_action(parsed_args)
|
|
824
822
|
|
|
825
|
-
self.
|
|
826
|
-
|
|
827
|
-
|
|
823
|
+
self.sdk_client.find_server.assert_called_with(
|
|
824
|
+
self.server.id, ignore_missing=False)
|
|
825
|
+
self.sdk_client.abort_server_migration.assert_called_with(
|
|
826
|
+
'2', self.server.id, ignore_missing=False)
|
|
828
827
|
self.assertIsNone(result)
|
|
829
828
|
|
|
830
829
|
def test_migration_abort_pre_v224(self):
|
|
831
|
-
self.
|
|
832
|
-
'2.23')
|
|
830
|
+
self._set_mock_microversion('2.23')
|
|
833
831
|
|
|
834
832
|
arglist = [
|
|
835
833
|
self.server.id,
|
|
@@ -847,12 +845,12 @@ class TestServerMigrationAbort(TestServerMigration):
|
|
|
847
845
|
str(ex))
|
|
848
846
|
|
|
849
847
|
def test_server_migration_abort_by_uuid(self):
|
|
850
|
-
self.
|
|
851
|
-
'2.59')
|
|
848
|
+
self._set_mock_microversion('2.59')
|
|
852
849
|
|
|
853
|
-
self.server_migration = compute_fakes.
|
|
854
|
-
|
|
855
|
-
|
|
850
|
+
self.server_migration = compute_fakes.create_one_server_migration()
|
|
851
|
+
self.sdk_client.server_migrations.return_value = iter(
|
|
852
|
+
[self.server_migration]
|
|
853
|
+
)
|
|
856
854
|
|
|
857
855
|
arglist = [
|
|
858
856
|
self.server.id,
|
|
@@ -863,17 +861,19 @@ class TestServerMigrationAbort(TestServerMigration):
|
|
|
863
861
|
|
|
864
862
|
result = self.cmd.take_action(parsed_args)
|
|
865
863
|
|
|
866
|
-
self.
|
|
867
|
-
|
|
868
|
-
self.
|
|
869
|
-
|
|
864
|
+
self.sdk_client.find_server.assert_called_with(
|
|
865
|
+
self.server.id, ignore_missing=False)
|
|
866
|
+
self.sdk_client.server_migrations.assert_called_with(self.server.id)
|
|
867
|
+
self.sdk_client.abort_server_migration.assert_called_with(
|
|
868
|
+
self.server_migration.id, self.server.id, ignore_missing=False)
|
|
870
869
|
self.assertIsNone(result)
|
|
871
870
|
|
|
872
871
|
def test_server_migration_abort_by_uuid_no_matches(self):
|
|
873
|
-
self.
|
|
874
|
-
'2.59')
|
|
872
|
+
self._set_mock_microversion('2.59')
|
|
875
873
|
|
|
876
|
-
self.
|
|
874
|
+
self.sdk_client.server_migrations.return_value = iter(
|
|
875
|
+
[]
|
|
876
|
+
)
|
|
877
877
|
|
|
878
878
|
arglist = [
|
|
879
879
|
self.server.id,
|
|
@@ -891,8 +891,7 @@ class TestServerMigrationAbort(TestServerMigration):
|
|
|
891
891
|
str(ex))
|
|
892
892
|
|
|
893
893
|
def test_server_migration_abort_by_uuid_pre_v259(self):
|
|
894
|
-
self.
|
|
895
|
-
'2.58')
|
|
894
|
+
self._set_mock_microversion('2.58')
|
|
896
895
|
|
|
897
896
|
arglist = [
|
|
898
897
|
self.server.id,
|
|
@@ -915,17 +914,16 @@ class TestServerMigrationForceComplete(TestServerMigration):
|
|
|
915
914
|
def setUp(self):
|
|
916
915
|
super().setUp()
|
|
917
916
|
|
|
918
|
-
self.server = compute_fakes.FakeServer.
|
|
917
|
+
self.server = compute_fakes.FakeServer.create_one_sdk_server()
|
|
919
918
|
|
|
920
919
|
# Return value for utils.find_resource for server.
|
|
921
|
-
self.
|
|
920
|
+
self.sdk_client.find_server.return_value = self.server
|
|
922
921
|
|
|
923
922
|
# Get the command object to test
|
|
924
923
|
self.cmd = server_migration.ForceCompleteMigration(self.app, None)
|
|
925
924
|
|
|
926
925
|
def test_migration_force_complete(self):
|
|
927
|
-
self.
|
|
928
|
-
'2.22')
|
|
926
|
+
self._set_mock_microversion('2.22')
|
|
929
927
|
|
|
930
928
|
arglist = [
|
|
931
929
|
self.server.id,
|
|
@@ -936,14 +934,14 @@ class TestServerMigrationForceComplete(TestServerMigration):
|
|
|
936
934
|
|
|
937
935
|
result = self.cmd.take_action(parsed_args)
|
|
938
936
|
|
|
939
|
-
self.
|
|
940
|
-
|
|
941
|
-
|
|
937
|
+
self.sdk_client.find_server.assert_called_with(
|
|
938
|
+
self.server.id, ignore_missing=False)
|
|
939
|
+
self.sdk_client.force_complete_server_migration\
|
|
940
|
+
.assert_called_with('2', self.server.id)
|
|
942
941
|
self.assertIsNone(result)
|
|
943
942
|
|
|
944
943
|
def test_migration_force_complete_pre_v222(self):
|
|
945
|
-
self.
|
|
946
|
-
'2.21')
|
|
944
|
+
self._set_mock_microversion('2.21')
|
|
947
945
|
|
|
948
946
|
arglist = [
|
|
949
947
|
self.server.id,
|
|
@@ -961,12 +959,12 @@ class TestServerMigrationForceComplete(TestServerMigration):
|
|
|
961
959
|
str(ex))
|
|
962
960
|
|
|
963
961
|
def test_server_migration_force_complete_by_uuid(self):
|
|
964
|
-
self.
|
|
965
|
-
'2.59')
|
|
962
|
+
self._set_mock_microversion('2.59')
|
|
966
963
|
|
|
967
|
-
self.server_migration = compute_fakes.
|
|
968
|
-
|
|
969
|
-
|
|
964
|
+
self.server_migration = compute_fakes.create_one_server_migration()
|
|
965
|
+
self.sdk_client.server_migrations.return_value = iter(
|
|
966
|
+
[self.server_migration]
|
|
967
|
+
)
|
|
970
968
|
|
|
971
969
|
arglist = [
|
|
972
970
|
self.server.id,
|
|
@@ -977,17 +975,17 @@ class TestServerMigrationForceComplete(TestServerMigration):
|
|
|
977
975
|
|
|
978
976
|
result = self.cmd.take_action(parsed_args)
|
|
979
977
|
|
|
980
|
-
self.
|
|
981
|
-
|
|
982
|
-
self.
|
|
983
|
-
|
|
978
|
+
self.sdk_client.find_server.assert_called_with(
|
|
979
|
+
self.server.id, ignore_missing=False)
|
|
980
|
+
self.sdk_client.server_migrations.assert_called_with(self.server.id)
|
|
981
|
+
self.sdk_client.force_complete_server_migration.\
|
|
982
|
+
assert_called_with(self.server_migration.id, self.server.id)
|
|
984
983
|
self.assertIsNone(result)
|
|
985
984
|
|
|
986
985
|
def test_server_migration_force_complete_by_uuid_no_matches(self):
|
|
987
|
-
self.
|
|
988
|
-
'2.59')
|
|
986
|
+
self._set_mock_microversion('2.59')
|
|
989
987
|
|
|
990
|
-
self.
|
|
988
|
+
self.sdk_client.server_migrations.return_value = iter([])
|
|
991
989
|
|
|
992
990
|
arglist = [
|
|
993
991
|
self.server.id,
|
|
@@ -1005,8 +1003,7 @@ class TestServerMigrationForceComplete(TestServerMigration):
|
|
|
1005
1003
|
str(ex))
|
|
1006
1004
|
|
|
1007
1005
|
def test_server_migration_force_complete_by_uuid_pre_v259(self):
|
|
1008
|
-
self.
|
|
1009
|
-
'2.58')
|
|
1006
|
+
self._set_mock_microversion('2.58')
|
|
1010
1007
|
|
|
1011
1008
|
arglist = [
|
|
1012
1009
|
self.server.id,
|