blob: 7d69e137e44376681443858adcafed52223936d5 [file] [log] [blame]
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +09001# 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
15import testtools
16
17from tempest.api.compute import base
Ken'ichi Ohmichi0eb153c2015-07-13 02:18:25 +000018from tempest.common import waiters
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090019from tempest import config
20from tempest import test
21
22CONF = config.CONF
23
24
25class MigrationsAdminTest(base.BaseV2ComputeAdminTest):
26
27 @classmethod
Rohan Kanade60b73092015-02-04 17:58:19 +053028 def setup_clients(cls):
29 super(MigrationsAdminTest, cls).setup_clients()
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090030 cls.client = cls.os_adm.migrations_client
31
Chris Hoge7579c1a2015-02-26 14:12:15 -080032 @test.idempotent_id('75c0b83d-72a0-4cf8-a153-631e83e7d53f')
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090033 def test_list_migrations(self):
34 # Admin can get the migrations list
David Kranz5cf4ba42015-02-10 14:00:50 -050035 self.client.list_migrations()
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090036
Chris Hoge7579c1a2015-02-26 14:12:15 -080037 @test.idempotent_id('1b512062-8093-438e-b47a-37d2f597cd64')
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090038 @testtools.skipUnless(CONF.compute_feature_enabled.resize,
39 'Resize not available.')
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090040 def test_list_migrations_in_flavor_resize_situation(self):
41 # Admin can get the migrations list which contains the resized server
David Kranz0fb14292015-02-11 15:55:20 -050042 server = self.create_test_server(wait_until="ACTIVE")
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090043 server_id = server['id']
44
Ken'ichi Ohmichi5271b0f2015-08-10 07:53:27 +000045 self.servers_client.resize_server(server_id, self.flavor_ref_alt)
Ken'ichi Ohmichi0eb153c2015-07-13 02:18:25 +000046 waiters.wait_for_server_status(self.servers_client,
47 server_id, 'VERIFY_RESIZE')
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090048 self.servers_client.confirm_resize(server_id)
Ken'ichi Ohmichi0eb153c2015-07-13 02:18:25 +000049 waiters.wait_for_server_status(self.servers_client,
50 server_id, 'ACTIVE')
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090051
David Kranz5cf4ba42015-02-10 14:00:50 -050052 body = self.client.list_migrations()
Ken'ichi Ohmichi2fdc1822014-03-18 09:10:57 +090053
54 instance_uuids = [x['instance_uuid'] for x in body]
55 self.assertIn(server_id, instance_uuids)