diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index 870c6f5..99469e7 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -38,46 +38,17 @@
     """Test server actions"""
 
     def setUp(self):
-        # NOTE(afazekas): Normally we use the same server with all test cases,
-        # but if it has an issue, we build a new one
         super(ServerActionsTestJSON, self).setUp()
-        # Check if the server is in a clean state after test
-        try:
-            validation_resources = self.get_class_validation_resources(
-                self.os_primary)
-            # _test_rebuild_server test compares ip address attached to the
-            # server before and after the rebuild, in order to avoid
-            # a situation when a newly created server doesn't have a floating
-            # ip attached at the beginning of the test_rebuild_server let's
-            # make sure right here the floating ip is attached
-            waiters.wait_for_server_floating_ip(
-                self.client,
-                self.client.show_server(self.server_id)['server'],
-                validation_resources['floating_ip'])
-            waiters.wait_for_server_status(self.client,
-                                           self.server_id, 'ACTIVE')
-        except lib_exc.NotFound:
-            # The server was deleted by previous test, create a new one
-            # Use class level validation resources to avoid them being
-            # deleted once a test is over
-            validation_resources = self.get_class_validation_resources(
-                self.os_primary)
-            server = self.create_test_server(
-                validatable=True,
-                validation_resources=validation_resources,
-                wait_until='ACTIVE')
-            self.__class__.server_id = server['id']
-        except Exception:
-            # Rebuild server if something happened to it during a test
-            self.__class__.server_id = self.recreate_server(
-                self.server_id, validatable=True)
-
-    def tearDown(self):
-        super(ServerActionsTestJSON, self).tearDown()
-        # NOTE(zhufl): Because server_check_teardown will raise Exception
-        # which will prevent other cleanup steps from being executed, so
-        # server_check_teardown should be called after super's tearDown.
-        self.server_check_teardown()
+        # Instead of reusing an instance which had been created before a new
+        # instance is created in favour of increasing stability of tests.
+        self.validation_resources = self.get_test_validation_resources(
+            self.os_primary)
+        server = self.create_test_server(
+            validatable=True,
+            validation_resources=self.validation_resources,
+            wait_until='ACTIVE')
+        self.server_id = server['id']
+        self.addCleanup(self.delete_server, self.server_id)
 
     @classmethod
     def setup_credentials(cls):
@@ -89,11 +60,6 @@
         super(ServerActionsTestJSON, cls).setup_clients()
         cls.client = cls.servers_client
 
-    @classmethod
-    def resource_setup(cls):
-        super(ServerActionsTestJSON, cls).resource_setup()
-        cls.server_id = cls.recreate_server(None, validatable=True)
-
     @decorators.idempotent_id('6158df09-4b82-4ab3-af6d-29cf36af858d')
     @testtools.skipUnless(CONF.compute_feature_enabled.change_password,
                           'Change password not available.')
@@ -103,15 +69,7 @@
         The server's password should be set to the provided password and
         the user can authenticate with the new password.
         """
-        # Since this test messes with the password and makes the
-        # server unreachable, it should create its own server
-        validation_resources = self.get_test_validation_resources(
-            self.os_primary)
-        newserver = self.create_test_server(
-            validatable=True,
-            validation_resources=validation_resources,
-            wait_until='ACTIVE')
-        self.addCleanup(self.delete_server, newserver['id'])
+        newserver = self.client.show_server(self.server_id)['server']
         # The server's password should be set to the provided password
         new_password = 'Newpass1234'
         self.client.change_password(newserver['id'], adminPass=new_password)
@@ -121,7 +79,7 @@
             # Verify that the user can authenticate with the new password
             server = self.client.show_server(newserver['id'])['server']
             linux_client = remote_client.RemoteClient(
-                self.get_server_ip(server, validation_resources),
+                self.get_server_ip(server, self.validation_resources),
                 self.ssh_user,
                 new_password,
                 server=server,
@@ -130,15 +88,13 @@
 
     def _test_reboot_server(self, reboot_type):
         if CONF.validation.run_validation:
-            validation_resources = self.get_class_validation_resources(
-                self.os_primary)
             # Get the time the server was last rebooted,
             server = self.client.show_server(self.server_id)['server']
             linux_client = remote_client.RemoteClient(
-                self.get_server_ip(server, validation_resources),
+                self.get_server_ip(server, self.validation_resources),
                 self.ssh_user,
-                self.password,
-                validation_resources['keypair']['private_key'],
+                getattr(self, "password", None),
+                self.validation_resources['keypair']['private_key'],
                 server=server,
                 servers_client=self.client)
             boot_time = linux_client.get_boot_time()
@@ -152,10 +108,10 @@
         if CONF.validation.run_validation:
             # Log in and verify the boot time has changed
             linux_client = remote_client.RemoteClient(
-                self.get_server_ip(server, validation_resources),
+                self.get_server_ip(server, self.validation_resources),
                 self.ssh_user,
-                self.password,
-                validation_resources['keypair']['private_key'],
+                getattr(self, "password", None),
+                self.validation_resources['keypair']['private_key'],
                 server=server,
                 servers_client=self.client)
             new_boot_time = linux_client.get_boot_time()
@@ -174,7 +130,7 @@
     @decorators.idempotent_id('1d1c9104-1b0a-11e7-a3d4-fa163e65f5ce')
     def test_remove_server_all_security_groups(self):
         """Test removing all security groups from server"""
-        server = self.create_test_server(wait_until='ACTIVE')
+        server = self.client.show_server(self.server_id)['server']
 
         # Remove all Security group
         self.client.remove_security_group(
@@ -194,6 +150,22 @@
         self.assertEqual(image_ref, rebuilt_server['image']['id'], msg)
 
     def _test_rebuild_server(self):
+
+        def floating_ip_ready():
+            addresses = self.client.show_server(
+                self.server_id)['server']['addresses']
+            self.assertTrue(
+                self.validation_resources["floating_ip"]["ip"] in
+                [addr["addr"] for net in addresses.values() for addr in net]
+            )
+
+        # NOTE(pas-ha) we now always create 'validating' server
+        # create_server only waits for ACTIVE state, but floating ip
+        # may be assigned a bit later.
+        # as we compare network addresses before and after rebuild,
+        # need to ensure we remember the floating one too.
+        self.wait_for(floating_ip_ready)
+
         # Get the IPs the server has before rebuilding it
         original_addresses = (self.client.show_server(self.server_id)['server']
                               ['addresses'])
@@ -208,11 +180,6 @@
             metadata=meta,
             adminPass=password)['server']
 
-        # If the server was rebuilt on a different image, restore it to the
-        # original image once the test ends
-        if self.image_ref_alt != self.image_ref:
-            self.addCleanup(self._rebuild_server_and_check, self.image_ref)
-
         # Verify the properties in the initial response are correct
         self.assertEqual(self.server_id, rebuilt_server['id'])
         rebuilt_image_id = rebuilt_server['image']['id']
@@ -229,8 +196,6 @@
         self.assertEqual(original_addresses, server['addresses'])
 
         if CONF.validation.run_validation:
-            validation_resources = self.get_class_validation_resources(
-                self.os_primary)
             # Authentication is attempted in the following order of priority:
             # 1.The key passed in, if one was passed in.
             # 2.Any key we can find through an SSH agent (if allowed).
@@ -238,10 +203,10 @@
             #   ~/.ssh/ (if allowed).
             # 4.Plain username/password auth, if a password was given.
             linux_client = remote_client.RemoteClient(
-                self.get_server_ip(rebuilt_server, validation_resources),
+                self.get_server_ip(rebuilt_server, self.validation_resources),
                 self.ssh_alt_user,
                 password,
-                validation_resources['keypair']['private_key'],
+                self.validation_resources['keypair']['private_key'],
                 server=rebuilt_server,
                 servers_client=self.client)
             linux_client.validate_authentication()
@@ -317,13 +282,11 @@
         self.assertEqual(self.server_id,
                          vol_after_rebuild['attachments'][0]['server_id'])
         if CONF.validation.run_validation:
-            validation_resources = self.get_class_validation_resources(
-                self.os_primary)
             linux_client = remote_client.RemoteClient(
-                self.get_server_ip(server, validation_resources),
+                self.get_server_ip(server, self.validation_resources),
                 self.ssh_alt_user,
                 password=None,
-                pkey=validation_resources['keypair']['private_key'],
+                pkey=self.validation_resources['keypair']['private_key'],
                 server=server,
                 servers_client=self.client)
             linux_client.validate_authentication()
@@ -380,7 +343,7 @@
             kwargs.update({'validatable': True,
                            'validation_resources': validation_resources})
         server = self.create_test_server(**kwargs)
-
+        self.addCleanup(self.delete_server, server['id'])
         # NOTE(mgoddard): Get detailed server to ensure addresses are present
         # in fixed IP case.
         server = self.servers_client.show_server(server['id'])['server']
@@ -394,10 +357,10 @@
             self.client.get_console_output(server['id'])
         if CONF.validation.run_validation:
             linux_client = remote_client.RemoteClient(
-                self.get_server_ip(server, validation_resources),
+                self.get_server_ip(server, self.validation_resources),
                 self.ssh_user,
                 password=None,
-                pkey=validation_resources['keypair']['private_key'],
+                pkey=self.validation_resources['keypair']['private_key'],
                 server=server,
                 servers_client=self.client)
             linux_client.validate_authentication()
@@ -629,7 +592,7 @@
         The console output lines length should be bigger than the one
         of test_get_console_output.
         """
-        server = self.create_test_server(wait_until='ACTIVE')
+        server = self.client.show_server(self.server_id)['server']
 
         def _check_full_length_console_log():
             output = self.client.get_console_output(server['id'])['output']
@@ -653,14 +616,8 @@
         in SHUTOFF status.
         """
 
-        # NOTE: SHUTOFF is irregular status. To avoid test instability,
-        #       one server is created only for this test without using
-        #       the server that was created in setUpClass.
-        server = self.create_test_server(wait_until='ACTIVE')
-        temp_server_id = server['id']
-
-        self.client.stop_server(temp_server_id)
-        waiters.wait_for_server_status(self.client, temp_server_id, 'SHUTOFF')
+        self.client.stop_server(self.server_id)
+        waiters.wait_for_server_status(self.client, self.server_id, 'SHUTOFF')
         self.wait_for(self._get_output)
 
     @decorators.idempotent_id('bd61a9fd-062f-4670-972b-2d6c3e3b9e73')
@@ -730,11 +687,10 @@
                           'Pause is not available.')
     def test_shelve_paused_server(self):
         """Test shelving a paused server"""
-        server = self.create_test_server(wait_until='ACTIVE')
-        self.client.pause_server(server['id'])
-        waiters.wait_for_server_status(self.client, server['id'], 'PAUSED')
+        self.client.pause_server(self.server_id)
+        waiters.wait_for_server_status(self.client, self.server_id, 'PAUSED')
         # Check if Shelve operation is successful on paused server.
-        compute.shelve_server(self.client, server['id'],
+        compute.shelve_server(self.client, self.server_id,
                               force_shelve_offload=True)
 
     @decorators.idempotent_id('af8eafd4-38a7-4a4b-bdbc-75145a580560')
