ZhiQiang Fan | 39f9722 | 2013-09-20 04:49:44 +0800 | [diff] [blame] | 1 | # Copyright 2012 OpenStack Foundation |
Jay Pipes | 051075a | 2012-04-28 17:39:37 -0400 | [diff] [blame] | 2 | # 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 Hellmann | 583ce2c | 2015-03-11 14:55:46 +0000 | [diff] [blame] | 16 | from oslo_log import log as logging |
armando-migliaccio | 9e5eac0 | 2014-03-24 10:55:31 -0700 | [diff] [blame] | 17 | |
Andrea Frittoli | cd36841 | 2017-08-14 21:37:56 +0100 | [diff] [blame] | 18 | from tempest.common import utils |
Ken'ichi Ohmichi | 0eb153c | 2015-07-13 02:18:25 +0000 | [diff] [blame] | 19 | from tempest.common import waiters |
Matthew Treinish | 6c07229 | 2014-01-29 19:15:52 +0000 | [diff] [blame] | 20 | from tempest import config |
Ken'ichi Ohmichi | c85a951 | 2017-01-27 18:34:24 -0800 | [diff] [blame] | 21 | from tempest.lib import decorators |
Sean Dague | 6dbc6da | 2013-05-08 17:49:46 -0400 | [diff] [blame] | 22 | from tempest.scenario import manager |
Jay Pipes | 051075a | 2012-04-28 17:39:37 -0400 | [diff] [blame] | 23 | |
Matthew Treinish | 6c07229 | 2014-01-29 19:15:52 +0000 | [diff] [blame] | 24 | CONF = config.CONF |
| 25 | |
Jay Pipes | 051075a | 2012-04-28 17:39:37 -0400 | [diff] [blame] | 26 | LOG = logging.getLogger(__name__) |
| 27 | |
| 28 | |
Ghanshyam | aadf036 | 2014-08-27 16:51:26 +0900 | [diff] [blame] | 29 | class TestServerAdvancedOps(manager.ScenarioTest): |
Jay Pipes | 051075a | 2012-04-28 17:39:37 -0400 | [diff] [blame] | 30 | |
Ken'ichi Ohmichi | c4e4f1c | 2015-11-17 08:16:12 +0000 | [diff] [blame] | 31 | """The test suite for server advanced operations |
Jay Pipes | 051075a | 2012-04-28 17:39:37 -0400 | [diff] [blame] | 32 | |
Ken'ichi Ohmichi | c4e4f1c | 2015-11-17 08:16:12 +0000 | [diff] [blame] | 33 | This test case stresses some advanced server instance operations: |
Tatyana Leontovich | 58ab531 | 2013-04-22 16:48:33 +0300 | [diff] [blame] | 34 | * Sequence suspend resume |
Jay Pipes | 051075a | 2012-04-28 17:39:37 -0400 | [diff] [blame] | 35 | """ |
| 36 | |
| 37 | @classmethod |
Ghanshyam Mann | fd90dac | 2023-08-03 16:26:44 -0700 | [diff] [blame] | 38 | def skip_checks(cls): |
| 39 | super(TestServerAdvancedOps, cls).skip_checks() |
| 40 | if not CONF.service_available.nova: |
| 41 | skip_msg = ("%s skipped as Nova is not available" % cls.__name__) |
| 42 | raise cls.skipException(skip_msg) |
| 43 | if not CONF.compute_feature_enabled.suspend: |
| 44 | raise cls.skipException("Suspend is not available.") |
| 45 | |
| 46 | @classmethod |
Emily Hugenbruch | 5e2d2a2 | 2015-02-25 21:35:45 +0000 | [diff] [blame] | 47 | def setup_credentials(cls): |
Ghanshyam Mann | f5aef7b | 2021-02-08 16:58:07 -0600 | [diff] [blame] | 48 | cls.set_network_resources(network=True, subnet=True) |
Emily Hugenbruch | 5e2d2a2 | 2015-02-25 21:35:45 +0000 | [diff] [blame] | 49 | super(TestServerAdvancedOps, cls).setup_credentials() |
Jay Pipes | 051075a | 2012-04-28 17:39:37 -0400 | [diff] [blame] | 50 | |
Jordan Pittier | 3b46d27 | 2017-04-12 16:17:28 +0200 | [diff] [blame] | 51 | @decorators.attr(type='slow') |
Ken'ichi Ohmichi | c85a951 | 2017-01-27 18:34:24 -0800 | [diff] [blame] | 52 | @decorators.idempotent_id('949da7d5-72c8-4808-8802-e3d70df98e2c') |
Andrea Frittoli | cd36841 | 2017-08-14 21:37:56 +0100 | [diff] [blame] | 53 | @utils.services('compute') |
Tatyana Leontovich | 58ab531 | 2013-04-22 16:48:33 +0300 | [diff] [blame] | 54 | def test_server_sequence_suspend_resume(self): |
| 55 | # We create an instance for use in this test |
zhufl | 96daca7 | 2017-02-22 17:59:56 +0800 | [diff] [blame] | 56 | instance_id = self.create_server()['id'] |
| 57 | |
| 58 | for _ in range(2): |
| 59 | LOG.debug("Suspending instance %s", instance_id) |
| 60 | self.servers_client.suspend_server(instance_id) |
| 61 | waiters.wait_for_server_status(self.servers_client, instance_id, |
| 62 | 'SUSPENDED') |
| 63 | |
| 64 | LOG.debug("Resuming instance %s", instance_id) |
| 65 | self.servers_client.resume_server(instance_id) |
| 66 | waiters.wait_for_server_status(self.servers_client, instance_id, |
| 67 | 'ACTIVE') |