Merge "Add reboot_server() helper"
diff --git a/tempest/api/compute/base.py b/tempest/api/compute/base.py
index 8d249ff..922a14c 100644
--- a/tempest/api/compute/base.py
+++ b/tempest/api/compute/base.py
@@ -454,6 +454,12 @@
server = self.servers_client.show_server(server_id)['server']
self.assert_flavor_equal(new_flavor_id, server['flavor'])
+ def reboot_server(self, server_id, type):
+ """Reboot a server and wait for it to be ACTIVE."""
+ self.servers_client.reboot_server(server_id, type=type)
+ waiters.wait_for_server_status(
+ self.servers_client, server_id, 'ACTIVE')
+
@classmethod
def delete_volume(cls, volume_id):
"""Deletes the given volume and waits for it to be gone."""
diff --git a/tempest/api/compute/security_groups/test_security_groups.py b/tempest/api/compute/security_groups/test_security_groups.py
index 671a779..a1f3514 100644
--- a/tempest/api/compute/security_groups/test_security_groups.py
+++ b/tempest/api/compute/security_groups/test_security_groups.py
@@ -109,9 +109,7 @@
sg['id'])
# Reboot and add the other security group
- self.servers_client.reboot_server(server_id, type='HARD')
- waiters.wait_for_server_status(self.servers_client, server_id,
- 'ACTIVE')
+ self.reboot_server(server_id, type='HARD')
self.servers_client.add_security_group(server_id, name=sg2['name'])
# Check that we are not able to delete the other security
diff --git a/tempest/api/compute/servers/test_instance_actions.py b/tempest/api/compute/servers/test_instance_actions.py
index 5ab592a..028da68 100644
--- a/tempest/api/compute/servers/test_instance_actions.py
+++ b/tempest/api/compute/servers/test_instance_actions.py
@@ -37,9 +37,7 @@
@decorators.idempotent_id('77ca5cc5-9990-45e0-ab98-1de8fead201a')
def test_list_instance_actions(self):
"""Test listing actions of the provided server"""
- self.client.reboot_server(self.server['id'], type='HARD')
- waiters.wait_for_server_status(self.client,
- self.server['id'], 'ACTIVE')
+ self.reboot_server(self.server['id'], type='HARD')
body = (self.client.list_instance_actions(self.server['id'])
['instanceActions'])
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index deb21c7..152e7e8 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -136,8 +136,7 @@
# in a server
linux_client.exec_command("sync")
- self.client.reboot_server(self.server_id, type=reboot_type)
- waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
+ self.reboot_server(self.server_id, type=reboot_type)
if CONF.validation.run_validation:
# Log in and verify the boot time has changed
@@ -607,8 +606,7 @@
# log file is truncated and we cannot get any console log through
# "console-log" API.
# The detail is https://bugs.launchpad.net/nova/+bug/1251920
- self.client.reboot_server(self.server_id, type='HARD')
- waiters.wait_for_server_status(self.client, self.server_id, 'ACTIVE')
+ self.reboot_server(self.server_id, type='HARD')
self.wait_for(self._get_output)
@decorators.idempotent_id('89104062-69d8-4b19-a71b-f47b7af093d7')