blob: 89b9fddb6163ad1e9a4d02f65376df90a056ab55 [file] [log] [blame]
ZhiQiang Fan39f97222013-09-20 04:49:44 +08001# Copyright 2012 OpenStack Foundation
Jay Pipes051075a2012-04-28 17:39:37 -04002# All Rights Reserved.
3#
4# Licensed under the Apache License, Version 2.0 (the "License"); you may
5# not use this file except in compliance with the License. You may obtain
6# a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13# License for the specific language governing permissions and limitations
14# under the License.
15
Doug Hellmann583ce2c2015-03-11 14:55:46 +000016from oslo_log import log as logging
armando-migliaccio9e5eac02014-03-24 10:55:31 -070017import testtools
18
Andrea Frittolicd368412017-08-14 21:37:56 +010019from tempest.common import utils
Ken'ichi Ohmichi0eb153c2015-07-13 02:18:25 +000020from tempest.common import waiters
Matthew Treinish6c072292014-01-29 19:15:52 +000021from tempest import config
Ken'ichi Ohmichic85a9512017-01-27 18:34:24 -080022from tempest.lib import decorators
Sean Dague6dbc6da2013-05-08 17:49:46 -040023from tempest.scenario import manager
Jay Pipes051075a2012-04-28 17:39:37 -040024
Matthew Treinish6c072292014-01-29 19:15:52 +000025CONF = config.CONF
26
Jay Pipes051075a2012-04-28 17:39:37 -040027LOG = logging.getLogger(__name__)
28
29
Ghanshyamaadf0362014-08-27 16:51:26 +090030class TestServerAdvancedOps(manager.ScenarioTest):
Jay Pipes051075a2012-04-28 17:39:37 -040031
Ken'ichi Ohmichic4e4f1c2015-11-17 08:16:12 +000032 """The test suite for server advanced operations
Jay Pipes051075a2012-04-28 17:39:37 -040033
Ken'ichi Ohmichic4e4f1c2015-11-17 08:16:12 +000034 This test case stresses some advanced server instance operations:
Matt Riedemann6506f902016-05-10 20:37:15 -040035 * Resizing a volume-backed instance
Tatyana Leontovich58ab5312013-04-22 16:48:33 +030036 * Sequence suspend resume
Jay Pipes051075a2012-04-28 17:39:37 -040037 """
38
39 @classmethod
Emily Hugenbruch5e2d2a22015-02-25 21:35:45 +000040 def setup_credentials(cls):
Masayuki Igawa60ea6c52014-10-15 17:32:14 +090041 cls.set_network_resources()
Emily Hugenbruch5e2d2a22015-02-25 21:35:45 +000042 super(TestServerAdvancedOps, cls).setup_credentials()
Jay Pipes051075a2012-04-28 17:39:37 -040043
Jordan Pittier3b46d272017-04-12 16:17:28 +020044 @decorators.attr(type='slow')
Ken'ichi Ohmichic85a9512017-01-27 18:34:24 -080045 @decorators.idempotent_id('949da7d5-72c8-4808-8802-e3d70df98e2c')
armando-migliaccio9e5eac02014-03-24 10:55:31 -070046 @testtools.skipUnless(CONF.compute_feature_enabled.suspend,
47 'Suspend is not available.')
Andrea Frittolicd368412017-08-14 21:37:56 +010048 @utils.services('compute')
Tatyana Leontovich58ab5312013-04-22 16:48:33 +030049 def test_server_sequence_suspend_resume(self):
50 # We create an instance for use in this test
zhufl96daca72017-02-22 17:59:56 +080051 instance_id = self.create_server()['id']
52
53 for _ in range(2):
54 LOG.debug("Suspending instance %s", instance_id)
55 self.servers_client.suspend_server(instance_id)
56 waiters.wait_for_server_status(self.servers_client, instance_id,
57 'SUSPENDED')
58
59 LOG.debug("Resuming instance %s", instance_id)
60 self.servers_client.resume_server(instance_id)
61 waiters.wait_for_server_status(self.servers_client, instance_id,
62 'ACTIVE')