Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 1 | # Copyright 2014 NEC Corporation. All rights reserved. |
| 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 | import testtools |
| 16 | |
| 17 | from tempest.api.compute import base |
Ken'ichi Ohmichi | 0eb153c | 2015-07-13 02:18:25 +0000 | [diff] [blame] | 18 | from tempest.common import waiters |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 19 | from tempest import config |
| 20 | from tempest import test |
| 21 | |
| 22 | CONF = config.CONF |
| 23 | |
| 24 | |
| 25 | class MigrationsAdminTest(base.BaseV2ComputeAdminTest): |
| 26 | |
| 27 | @classmethod |
Rohan Kanade | 60b7309 | 2015-02-04 17:58:19 +0530 | [diff] [blame] | 28 | def setup_clients(cls): |
| 29 | super(MigrationsAdminTest, cls).setup_clients() |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 30 | cls.client = cls.os_adm.migrations_client |
| 31 | |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 32 | @test.idempotent_id('75c0b83d-72a0-4cf8-a153-631e83e7d53f') |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 33 | def test_list_migrations(self): |
| 34 | # Admin can get the migrations list |
David Kranz | 5cf4ba4 | 2015-02-10 14:00:50 -0500 | [diff] [blame] | 35 | self.client.list_migrations() |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 36 | |
Chris Hoge | 7579c1a | 2015-02-26 14:12:15 -0800 | [diff] [blame] | 37 | @test.idempotent_id('1b512062-8093-438e-b47a-37d2f597cd64') |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 38 | @testtools.skipUnless(CONF.compute_feature_enabled.resize, |
| 39 | 'Resize not available.') |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 40 | def test_list_migrations_in_flavor_resize_situation(self): |
| 41 | # Admin can get the migrations list which contains the resized server |
David Kranz | 0fb1429 | 2015-02-11 15:55:20 -0500 | [diff] [blame] | 42 | server = self.create_test_server(wait_until="ACTIVE") |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 43 | server_id = server['id'] |
| 44 | |
Ken'ichi Ohmichi | 5271b0f | 2015-08-10 07:53:27 +0000 | [diff] [blame] | 45 | self.servers_client.resize_server(server_id, self.flavor_ref_alt) |
Ken'ichi Ohmichi | 0eb153c | 2015-07-13 02:18:25 +0000 | [diff] [blame] | 46 | waiters.wait_for_server_status(self.servers_client, |
| 47 | server_id, 'VERIFY_RESIZE') |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 48 | self.servers_client.confirm_resize(server_id) |
Ken'ichi Ohmichi | 0eb153c | 2015-07-13 02:18:25 +0000 | [diff] [blame] | 49 | waiters.wait_for_server_status(self.servers_client, |
| 50 | server_id, 'ACTIVE') |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 51 | |
David Kranz | 5cf4ba4 | 2015-02-10 14:00:50 -0500 | [diff] [blame] | 52 | body = self.client.list_migrations() |
Ken'ichi Ohmichi | 2fdc182 | 2014-03-18 09:10:57 +0900 | [diff] [blame] | 53 | |
| 54 | instance_uuids = [x['instance_uuid'] for x in body] |
| 55 | self.assertIn(server_id, instance_uuids) |