Liu, Zhi Kun | b0ac0b8 | 2013-06-20 16:20:21 +0800 | [diff] [blame] | 1 | # Copyright 2013 IBM Corp. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 4 | # not use this file except in compliance with the License. You may obtain |
| 5 | # a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 11 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 12 | # License for the specific language governing permissions and limitations |
| 13 | # under the License. |
| 14 | |
| 15 | from tempest.api.compute import base |
Ken'ichi Ohmichi | 0eb153c | 2015-07-13 02:18:25 +0000 | [diff] [blame] | 16 | from tempest.common import waiters |
Stephen Finucane | 39fa9c1 | 2020-09-03 17:47:19 +0100 | [diff] [blame] | 17 | from tempest import config |
Ken'ichi Ohmichi | 757833a | 2017-03-10 10:30:30 -0800 | [diff] [blame] | 18 | from tempest.lib.common.utils import data_utils |
Andrea Frittoli (andreaf) | db9672e | 2016-02-23 14:07:24 -0500 | [diff] [blame] | 19 | from tempest.lib import decorators |
zhufl | 34b5503 | 2018-03-29 17:07:32 +0800 | [diff] [blame] | 20 | from tempest.lib import exceptions as lib_exc |
Liu, Zhi Kun | b0ac0b8 | 2013-06-20 16:20:21 +0800 | [diff] [blame] | 21 | |
Stephen Finucane | 39fa9c1 | 2020-09-03 17:47:19 +0100 | [diff] [blame] | 22 | CONF = config.CONF |
| 23 | |
Liu, Zhi Kun | b0ac0b8 | 2013-06-20 16:20:21 +0800 | [diff] [blame] | 24 | |
ivan-zhu | f2b0050 | 2013-10-18 10:06:52 +0800 | [diff] [blame] | 25 | class ServersAdminTestJSON(base.BaseV2ComputeAdminTest): |
Ken'ichi Ohmichi | 9e3dac0 | 2015-11-19 07:01:07 +0000 | [diff] [blame] | 26 | """Tests Servers API using admin privileges""" |
Liu, Zhi Kun | b0ac0b8 | 2013-06-20 16:20:21 +0800 | [diff] [blame] | 27 | |
Liu, Zhi Kun | b0ac0b8 | 2013-06-20 16:20:21 +0800 | [diff] [blame] | 28 | @classmethod |
Rohan Kanade | 60b7309 | 2015-02-04 17:58:19 +0530 | [diff] [blame] | 29 | def setup_clients(cls): |
| 30 | super(ServersAdminTestJSON, cls).setup_clients() |
Jordan Pittier | 8160d31 | 2017-04-18 11:52:23 +0200 | [diff] [blame] | 31 | cls.client = cls.os_admin.servers_client |
Zhi Kun Liu | e540176 | 2013-09-11 20:45:48 +0800 | [diff] [blame] | 32 | cls.non_admin_client = cls.servers_client |
Liu, Zhi Kun | b0ac0b8 | 2013-06-20 16:20:21 +0800 | [diff] [blame] | 33 | |
Rohan Kanade | 60b7309 | 2015-02-04 17:58:19 +0530 | [diff] [blame] | 34 | @classmethod |
| 35 | def resource_setup(cls): |
| 36 | super(ServersAdminTestJSON, cls).resource_setup() |
| 37 | |
zhufl | c6ce539 | 2016-08-17 14:34:37 +0800 | [diff] [blame] | 38 | cls.s1_name = data_utils.rand_name(cls.__name__ + '-server') |
zhufl | b4c484e | 2017-04-05 15:05:15 +0800 | [diff] [blame] | 39 | server = cls.create_test_server(name=cls.s1_name) |
LingxianKong | c26e607 | 2013-09-28 21:16:52 +0800 | [diff] [blame] | 40 | cls.s1_id = server['id'] |
| 41 | |
zhufl | c6ce539 | 2016-08-17 14:34:37 +0800 | [diff] [blame] | 42 | cls.s2_name = data_utils.rand_name(cls.__name__ + '-server') |
David Kranz | 0fb1429 | 2015-02-11 15:55:20 -0500 | [diff] [blame] | 43 | server = cls.create_test_server(name=cls.s2_name, |
| 44 | wait_until='ACTIVE') |
ChenZheng | 5b62f65 | 2014-01-03 15:03:33 +0800 | [diff] [blame] | 45 | cls.s2_id = server['id'] |
zhufl | b4c484e | 2017-04-05 15:05:15 +0800 | [diff] [blame] | 46 | waiters.wait_for_server_status(cls.non_admin_client, |
| 47 | cls.s1_id, 'ACTIVE') |
Liu, Zhi Kun | b0ac0b8 | 2013-06-20 16:20:21 +0800 | [diff] [blame] | 48 | |
Ken'ichi Ohmichi | ebbfd1c | 2017-01-27 16:37:00 -0800 | [diff] [blame] | 49 | @decorators.idempotent_id('06f960bb-15bb-48dc-873d-f96e89be7870') |
ChenZheng | 5b62f65 | 2014-01-03 15:03:33 +0800 | [diff] [blame] | 50 | def test_list_servers_filter_by_error_status(self): |
zhufl | 4e726a6 | 2020-08-10 16:30:28 +0800 | [diff] [blame] | 51 | """Test filtering the list of servers by server error status""" |
ChenZheng | 5b62f65 | 2014-01-03 15:03:33 +0800 | [diff] [blame] | 52 | params = {'status': 'error'} |
David Kranz | ae99b9a | 2015-02-16 13:37:01 -0500 | [diff] [blame] | 53 | self.client.reset_state(self.s1_id, state='error') |
Ken'ichi Ohmichi | cbc26a8 | 2015-07-03 08:18:04 +0000 | [diff] [blame] | 54 | body = self.non_admin_client.list_servers(**params) |
ChenZheng | 5b62f65 | 2014-01-03 15:03:33 +0800 | [diff] [blame] | 55 | # Reset server's state to 'active' |
David Kranz | ae99b9a | 2015-02-16 13:37:01 -0500 | [diff] [blame] | 56 | self.client.reset_state(self.s1_id, state='active') |
ChenZheng | 5b62f65 | 2014-01-03 15:03:33 +0800 | [diff] [blame] | 57 | # Verify server's state |
ghanshyam | 0f82525 | 2015-08-25 16:02:50 +0900 | [diff] [blame] | 58 | server = self.client.show_server(self.s1_id)['server'] |
ChenZheng | 5b62f65 | 2014-01-03 15:03:33 +0800 | [diff] [blame] | 59 | self.assertEqual(server['status'], 'ACTIVE') |
| 60 | servers = body['servers'] |
| 61 | # Verify error server in list result |
| 62 | self.assertIn(self.s1_id, map(lambda x: x['id'], servers)) |
| 63 | self.assertNotIn(self.s2_id, map(lambda x: x['id'], servers)) |
| 64 | |
Ken'ichi Ohmichi | ebbfd1c | 2017-01-27 16:37:00 -0800 | [diff] [blame] | 65 | @decorators.idempotent_id('d56e9540-73ed-45e0-9b88-98fc419087eb') |
Ken'ichi Ohmichi | 68be16f | 2016-06-03 13:19:26 -0700 | [diff] [blame] | 66 | def test_list_servers_detailed_filter_by_invalid_status(self): |
zhufl | 4e726a6 | 2020-08-10 16:30:28 +0800 | [diff] [blame] | 67 | """Test filtering the list of servers by invalid server status""" |
Ken'ichi Ohmichi | 68be16f | 2016-06-03 13:19:26 -0700 | [diff] [blame] | 68 | params = {'status': 'invalid_status'} |
zhufl | 34b5503 | 2018-03-29 17:07:32 +0800 | [diff] [blame] | 69 | if self.is_requested_microversion_compatible('2.37'): |
| 70 | body = self.client.list_servers(detail=True, **params) |
| 71 | servers = body['servers'] |
| 72 | self.assertEmpty(servers) |
| 73 | else: |
| 74 | self.assertRaises(lib_exc.BadRequest, self.client.list_servers, |
| 75 | detail=True, **params) |
Ken'ichi Ohmichi | 68be16f | 2016-06-03 13:19:26 -0700 | [diff] [blame] | 76 | |
Ken'ichi Ohmichi | ebbfd1c | 2017-01-27 16:37:00 -0800 | [diff] [blame] | 77 | @decorators.idempotent_id('51717b38-bdc1-458b-b636-1cf82d99f62f') |
Ken'ichi Ohmichi | 3f9cd0c | 2016-09-01 14:52:03 -0700 | [diff] [blame] | 78 | def test_list_servers_by_admin(self): |
zhufl | 4e726a6 | 2020-08-10 16:30:28 +0800 | [diff] [blame] | 79 | """Test listing servers by admin without other projects |
| 80 | |
| 81 | Listing servers by admin user returns a list which doesn't |
| 82 | contain the other projects' server by default. |
| 83 | """ |
Ken'ichi Ohmichi | 3f9cd0c | 2016-09-01 14:52:03 -0700 | [diff] [blame] | 84 | body = self.client.list_servers(detail=True) |
| 85 | servers = body['servers'] |
| 86 | |
| 87 | # This case is for the test environments which contain |
| 88 | # the existing servers before testing |
| 89 | servers_name = [server['name'] for server in servers] |
| 90 | self.assertNotIn(self.s1_name, servers_name) |
| 91 | self.assertNotIn(self.s2_name, servers_name) |
| 92 | |
Ken'ichi Ohmichi | ebbfd1c | 2017-01-27 16:37:00 -0800 | [diff] [blame] | 93 | @decorators.idempotent_id('9f5579ae-19b4-4985-a091-2a5d56106580') |
Liu, Zhi Kun | b0ac0b8 | 2013-06-20 16:20:21 +0800 | [diff] [blame] | 94 | def test_list_servers_by_admin_with_all_tenants(self): |
zhufl | 4e726a6 | 2020-08-10 16:30:28 +0800 | [diff] [blame] | 95 | """Test listing servers by admin with all tenants |
| 96 | |
| 97 | Listing servers by admin user with all tenants parameter, |
| 98 | all servers should be listed. |
| 99 | """ |
Liu, Zhi Kun | b0ac0b8 | 2013-06-20 16:20:21 +0800 | [diff] [blame] | 100 | params = {'all_tenants': ''} |
Ken'ichi Ohmichi | cbc26a8 | 2015-07-03 08:18:04 +0000 | [diff] [blame] | 101 | body = self.client.list_servers(detail=True, **params) |
Liu, Zhi Kun | b0ac0b8 | 2013-06-20 16:20:21 +0800 | [diff] [blame] | 102 | servers = body['servers'] |
Sirushti Murugesan | 935f2cc | 2016-07-12 19:48:24 +0530 | [diff] [blame] | 103 | servers_name = [server['name'] for server in servers] |
Liu, Zhi Kun | b0ac0b8 | 2013-06-20 16:20:21 +0800 | [diff] [blame] | 104 | |
| 105 | self.assertIn(self.s1_name, servers_name) |
| 106 | self.assertIn(self.s2_name, servers_name) |
| 107 | |
Jordan Pittier | c5665a6 | 2017-04-12 16:42:53 +0200 | [diff] [blame] | 108 | @decorators.related_bug('1659811') |
Ken'ichi Ohmichi | ebbfd1c | 2017-01-27 16:37:00 -0800 | [diff] [blame] | 109 | @decorators.idempotent_id('7e5d6b8f-454a-4ba1-8ae2-da857af8338b') |
David Kranz | b28b418 | 2015-01-05 16:07:19 -0500 | [diff] [blame] | 110 | def test_list_servers_by_admin_with_specified_tenant(self): |
zhufl | 4e726a6 | 2020-08-10 16:30:28 +0800 | [diff] [blame] | 111 | """Test listing servers by admin with specified project |
David Kranz | b28b418 | 2015-01-05 16:07:19 -0500 | [diff] [blame] | 112 | |
zhufl | 4e726a6 | 2020-08-10 16:30:28 +0800 | [diff] [blame] | 113 | In nova v2, tenant_id is ignored unless all_tenants is specified. |
| 114 | """ |
David Kranz | b28b418 | 2015-01-05 16:07:19 -0500 | [diff] [blame] | 115 | # List the primary tenant but get nothing due to odd specified behavior |
| 116 | tenant_id = self.non_admin_client.tenant_id |
| 117 | params = {'tenant_id': tenant_id} |
Ken'ichi Ohmichi | cbc26a8 | 2015-07-03 08:18:04 +0000 | [diff] [blame] | 118 | body = self.client.list_servers(detail=True, **params) |
David Kranz | b28b418 | 2015-01-05 16:07:19 -0500 | [diff] [blame] | 119 | servers = body['servers'] |
Davanum Srinivas | 816607c | 2017-01-17 16:01:31 -0500 | [diff] [blame] | 120 | servers_name = [x['name'] for x in servers] |
zhufl | 80b8d0a | 2016-09-22 14:35:27 +0800 | [diff] [blame] | 121 | self.assertNotIn(self.s1_name, servers_name) |
| 122 | self.assertNotIn(self.s2_name, servers_name) |
David Kranz | b28b418 | 2015-01-05 16:07:19 -0500 | [diff] [blame] | 123 | |
guo yunxian | 88a7e09 | 2016-09-28 17:36:57 +0800 | [diff] [blame] | 124 | # List the primary tenant with all_tenants is specified |
| 125 | params = {'all_tenants': '', 'tenant_id': tenant_id} |
| 126 | body = self.client.list_servers(detail=True, **params) |
| 127 | servers = body['servers'] |
Davanum Srinivas | 816607c | 2017-01-17 16:01:31 -0500 | [diff] [blame] | 128 | servers_name = [x['name'] for x in servers] |
guo yunxian | 88a7e09 | 2016-09-28 17:36:57 +0800 | [diff] [blame] | 129 | self.assertIn(self.s1_name, servers_name) |
| 130 | self.assertIn(self.s2_name, servers_name) |
| 131 | |
zhufl | 80b8d0a | 2016-09-22 14:35:27 +0800 | [diff] [blame] | 132 | # List the admin tenant shouldn't get servers created by other tenants |
David Kranz | b28b418 | 2015-01-05 16:07:19 -0500 | [diff] [blame] | 133 | admin_tenant_id = self.client.tenant_id |
| 134 | params = {'all_tenants': '', 'tenant_id': admin_tenant_id} |
Ken'ichi Ohmichi | cbc26a8 | 2015-07-03 08:18:04 +0000 | [diff] [blame] | 135 | body = self.client.list_servers(detail=True, **params) |
David Kranz | b28b418 | 2015-01-05 16:07:19 -0500 | [diff] [blame] | 136 | servers = body['servers'] |
Davanum Srinivas | 816607c | 2017-01-17 16:01:31 -0500 | [diff] [blame] | 137 | servers_name = [x['name'] for x in servers] |
zhufl | 80b8d0a | 2016-09-22 14:35:27 +0800 | [diff] [blame] | 138 | self.assertNotIn(self.s1_name, servers_name) |
| 139 | self.assertNotIn(self.s2_name, servers_name) |
David Kranz | b28b418 | 2015-01-05 16:07:19 -0500 | [diff] [blame] | 140 | |
Ken'ichi Ohmichi | ebbfd1c | 2017-01-27 16:37:00 -0800 | [diff] [blame] | 141 | @decorators.idempotent_id('86c7a8f7-50cf-43a9-9bac-5b985317134f') |
ChenZheng | d4acec4 | 2014-01-03 15:22:31 +0800 | [diff] [blame] | 142 | def test_list_servers_filter_by_exist_host(self): |
zhufl | 4e726a6 | 2020-08-10 16:30:28 +0800 | [diff] [blame] | 143 | """Test filtering the list of servers by existent host""" |
zhufl | 6491738 | 2017-08-11 13:55:25 +0800 | [diff] [blame] | 144 | server = self.client.show_server(self.s1_id)['server'] |
Ken'ichi Ohmichi | 7045689 | 2016-08-12 14:31:19 -0700 | [diff] [blame] | 145 | hostname = server['OS-EXT-SRV-ATTR:host'] |
zhufl | 6491738 | 2017-08-11 13:55:25 +0800 | [diff] [blame] | 146 | params = {'host': hostname, 'all_tenants': '1'} |
| 147 | servers = self.client.list_servers(**params)['servers'] |
| 148 | self.assertIn(server['id'], map(lambda x: x['id'], servers)) |
| 149 | |
| 150 | nonexistent_params = {'host': 'nonexistent_host', |
| 151 | 'all_tenants': '1'} |
Ken'ichi Ohmichi | cbc26a8 | 2015-07-03 08:18:04 +0000 | [diff] [blame] | 152 | nonexistent_body = self.client.list_servers(**nonexistent_params) |
ChenZheng | d4acec4 | 2014-01-03 15:22:31 +0800 | [diff] [blame] | 153 | nonexistent_servers = nonexistent_body['servers'] |
zhufl | 6491738 | 2017-08-11 13:55:25 +0800 | [diff] [blame] | 154 | self.assertNotIn(server['id'], |
ChenZheng | d4acec4 | 2014-01-03 15:22:31 +0800 | [diff] [blame] | 155 | map(lambda x: x['id'], nonexistent_servers)) |
| 156 | |
Ken'ichi Ohmichi | ebbfd1c | 2017-01-27 16:37:00 -0800 | [diff] [blame] | 157 | @decorators.idempotent_id('ee8ae470-db70-474d-b752-690b7892cab1') |
LingxianKong | c26e607 | 2013-09-28 21:16:52 +0800 | [diff] [blame] | 158 | def test_reset_state_server(self): |
zhufl | 4e726a6 | 2020-08-10 16:30:28 +0800 | [diff] [blame] | 159 | """Test resetting server state to error/active""" |
LingxianKong | c26e607 | 2013-09-28 21:16:52 +0800 | [diff] [blame] | 160 | # Reset server's state to 'error' |
Ken'ichi Ohmichi | 36b714c | 2015-12-09 08:12:47 +0000 | [diff] [blame] | 161 | self.client.reset_state(self.s1_id, state='error') |
LingxianKong | c26e607 | 2013-09-28 21:16:52 +0800 | [diff] [blame] | 162 | |
| 163 | # Verify server's state |
ghanshyam | 0f82525 | 2015-08-25 16:02:50 +0900 | [diff] [blame] | 164 | server = self.client.show_server(self.s1_id)['server'] |
LingxianKong | c26e607 | 2013-09-28 21:16:52 +0800 | [diff] [blame] | 165 | self.assertEqual(server['status'], 'ERROR') |
| 166 | |
| 167 | # Reset server's state to 'active' |
David Kranz | ae99b9a | 2015-02-16 13:37:01 -0500 | [diff] [blame] | 168 | self.client.reset_state(self.s1_id, state='active') |
LingxianKong | c26e607 | 2013-09-28 21:16:52 +0800 | [diff] [blame] | 169 | |
| 170 | # Verify server's state |
ghanshyam | 0f82525 | 2015-08-25 16:02:50 +0900 | [diff] [blame] | 171 | server = self.client.show_server(self.s1_id)['server'] |
LingxianKong | c26e607 | 2013-09-28 21:16:52 +0800 | [diff] [blame] | 172 | self.assertEqual(server['status'], 'ACTIVE') |
| 173 | |
Ken'ichi Ohmichi | ebbfd1c | 2017-01-27 16:37:00 -0800 | [diff] [blame] | 174 | @decorators.idempotent_id('682cb127-e5bb-4f53-87ce-cb9003604442') |
Zhi Kun Liu | e540176 | 2013-09-11 20:45:48 +0800 | [diff] [blame] | 175 | def test_rebuild_server_in_error_state(self): |
zhufl | 4e726a6 | 2020-08-10 16:30:28 +0800 | [diff] [blame] | 176 | """Test rebuilding server in error state |
Zhi Kun Liu | e540176 | 2013-09-11 20:45:48 +0800 | [diff] [blame] | 177 | |
zhufl | 4e726a6 | 2020-08-10 16:30:28 +0800 | [diff] [blame] | 178 | The server in error state should be rebuilt using the provided |
| 179 | image and changed to ACTIVE state. |
| 180 | """ |
Marc Solanas | b15d8b6 | 2014-02-07 00:04:15 -0800 | [diff] [blame] | 181 | # resetting vm state require admin privilege |
David Kranz | ae99b9a | 2015-02-16 13:37:01 -0500 | [diff] [blame] | 182 | self.client.reset_state(self.s1_id, state='error') |
Ken'ichi Ohmichi | 5271b0f | 2015-08-10 07:53:27 +0000 | [diff] [blame] | 183 | rebuilt_server = self.non_admin_client.rebuild_server( |
ghanshyam | 0f82525 | 2015-08-25 16:02:50 +0900 | [diff] [blame] | 184 | self.s1_id, self.image_ref_alt)['server'] |
Ken'ichi Ohmichi | 0eb153c | 2015-07-13 02:18:25 +0000 | [diff] [blame] | 185 | self.addCleanup(waiters.wait_for_server_status, self.non_admin_client, |
Zhi Kun Liu | e540176 | 2013-09-11 20:45:48 +0800 | [diff] [blame] | 186 | self.s1_id, 'ACTIVE') |
Ken'ichi Ohmichi | 5271b0f | 2015-08-10 07:53:27 +0000 | [diff] [blame] | 187 | self.addCleanup(self.non_admin_client.rebuild_server, self.s1_id, |
Zhi Kun Liu | e540176 | 2013-09-11 20:45:48 +0800 | [diff] [blame] | 188 | self.image_ref) |
| 189 | |
| 190 | # Verify the properties in the initial response are correct |
| 191 | self.assertEqual(self.s1_id, rebuilt_server['id']) |
| 192 | rebuilt_image_id = rebuilt_server['image']['id'] |
| 193 | self.assertEqual(self.image_ref_alt, rebuilt_image_id) |
zhufl | bcb7117 | 2018-03-29 13:49:31 +0800 | [diff] [blame] | 194 | self.assert_flavor_equal(self.flavor_ref, rebuilt_server['flavor']) |
Ken'ichi Ohmichi | 0eb153c | 2015-07-13 02:18:25 +0000 | [diff] [blame] | 195 | waiters.wait_for_server_status(self.non_admin_client, |
| 196 | rebuilt_server['id'], 'ACTIVE', |
| 197 | raise_on_error=False) |
Zhi Kun Liu | e540176 | 2013-09-11 20:45:48 +0800 | [diff] [blame] | 198 | # Verify the server properties after rebuilding |
ghanshyam | 0f82525 | 2015-08-25 16:02:50 +0900 | [diff] [blame] | 199 | server = (self.non_admin_client.show_server(rebuilt_server['id']) |
| 200 | ['server']) |
Zhi Kun Liu | e540176 | 2013-09-11 20:45:48 +0800 | [diff] [blame] | 201 | rebuilt_image_id = server['image']['id'] |
| 202 | self.assertEqual(self.image_ref_alt, rebuilt_image_id) |
| 203 | |
Ken'ichi Ohmichi | ebbfd1c | 2017-01-27 16:37:00 -0800 | [diff] [blame] | 204 | @decorators.idempotent_id('7a1323b4-a6a2-497a-96cb-76c07b945c71') |
Ghanshyam Mann | 79f4a09 | 2014-02-27 21:01:31 +0900 | [diff] [blame] | 205 | def test_reset_network_inject_network_info(self): |
zhufl | 4e726a6 | 2020-08-10 16:30:28 +0800 | [diff] [blame] | 206 | """Test resetting and injecting network info of a server""" |
Stephen Finucane | 39fa9c1 | 2020-09-03 17:47:19 +0100 | [diff] [blame] | 207 | if not CONF.compute_feature_enabled.xenapi_apis: |
| 208 | raise self.skipException( |
| 209 | 'The resetNetwork server action is not supported.') |
| 210 | |
Ghanshyam Mann | 79f4a09 | 2014-02-27 21:01:31 +0900 | [diff] [blame] | 211 | # Reset Network of a Server |
David Kranz | 0fb1429 | 2015-02-11 15:55:20 -0500 | [diff] [blame] | 212 | server = self.create_test_server(wait_until='ACTIVE') |
David Kranz | ae99b9a | 2015-02-16 13:37:01 -0500 | [diff] [blame] | 213 | self.client.reset_network(server['id']) |
Ghanshyam Mann | 79f4a09 | 2014-02-27 21:01:31 +0900 | [diff] [blame] | 214 | # Inject the Network Info into Server |
David Kranz | ae99b9a | 2015-02-16 13:37:01 -0500 | [diff] [blame] | 215 | self.client.inject_network_info(server['id']) |
Ghanshyam Mann | 79f4a09 | 2014-02-27 21:01:31 +0900 | [diff] [blame] | 216 | |
Ken'ichi Ohmichi | ebbfd1c | 2017-01-27 16:37:00 -0800 | [diff] [blame] | 217 | @decorators.idempotent_id('fdcd9b33-0903-4e00-a1f7-b5f6543068d6') |
raiesmh08 | cbe21b0 | 2014-03-12 17:04:44 +0530 | [diff] [blame] | 218 | def test_create_server_with_scheduling_hint(self): |
zhufl | 4e726a6 | 2020-08-10 16:30:28 +0800 | [diff] [blame] | 219 | """Test creating server with scheduling hint""" |
raiesmh08 | cbe21b0 | 2014-03-12 17:04:44 +0530 | [diff] [blame] | 220 | # Create a server with scheduler hints. |
| 221 | hints = { |
| 222 | 'same_host': self.s1_id |
| 223 | } |
Ken'ichi Ohmichi | f2d436e | 2015-09-03 01:13:16 +0000 | [diff] [blame] | 224 | self.create_test_server(scheduler_hints=hints, |
David Kranz | 0fb1429 | 2015-02-11 15:55:20 -0500 | [diff] [blame] | 225 | wait_until='ACTIVE') |
Ghanshyam Mann | 1a65c4f | 2022-03-03 22:03:26 -0600 | [diff] [blame^] | 226 | |
| 227 | |
| 228 | class ServersAdmin275Test(base.BaseV2ComputeAdminTest): |
| 229 | """Test compute server with microversion greater than 2.75 |
| 230 | |
| 231 | # NOTE(gmann): This test tests the Server APIs response schema |
| 232 | # for 2.75 microversion. No specific assert or behaviour verification |
| 233 | # is needed. |
| 234 | """ |
| 235 | |
| 236 | min_microversion = '2.75' |
| 237 | |
| 238 | @decorators.idempotent_id('bf2b4a00-73a3-4d53-81fa-acbcd97d6339') |
| 239 | def test_rebuild_update_server_275(self): |
| 240 | server = self.create_test_server() |
| 241 | # Checking update response schema. |
| 242 | self.servers_client.update_server(server['id']) |
| 243 | waiters.wait_for_server_status(self.servers_client, server['id'], |
| 244 | 'ACTIVE') |
| 245 | # Checking rebuild API response schema |
| 246 | self.servers_client.rebuild_server(server['id'], self.image_ref_alt) |
| 247 | waiters.wait_for_server_status(self.servers_client, |
| 248 | server['id'], 'ACTIVE') |
| 249 | # Checking rebuild server with admin response schema. |
| 250 | self.os_admin.servers_client.rebuild_server( |
| 251 | server['id'], self.image_ref) |
| 252 | self.addCleanup(waiters.wait_for_server_status, |
| 253 | self.os_admin.servers_client, |
| 254 | server['id'], 'ACTIVE') |