Share a server in ServersOnMultiNodesTest

In ServersOnMultiNodesTest, server01 can be safely shared among
testcases, so we can save two create_test_server.

Change-Id: I2b9165a26feeb5ce5fa7442872b2212d22d7f575
diff --git a/tempest/api/compute/admin/test_servers_on_multinodes.py b/tempest/api/compute/admin/test_servers_on_multinodes.py
index 6a2e5e9..858998a 100644
--- a/tempest/api/compute/admin/test_servers_on_multinodes.py
+++ b/tempest/api/compute/admin/test_servers_on_multinodes.py
@@ -25,6 +25,12 @@
 class ServersOnMultiNodesTest(base.BaseV2ComputeAdminTest):
 
     @classmethod
+    def resource_setup(cls):
+        super(ServersOnMultiNodesTest, cls).resource_setup()
+        cls.server01 = cls.create_test_server(wait_until='ACTIVE')['id']
+        cls.host01 = cls._get_host(cls.server01)
+
+    @classmethod
     def skip_checks(cls):
         super(ServersOnMultiNodesTest, cls).skip_checks()
 
@@ -32,8 +38,9 @@
             raise cls.skipException(
                 "Less than 2 compute nodes, skipping multi-nodes test.")
 
-    def _get_host(self, server_id):
-        return self.os_admin.servers_client.show_server(
+    @classmethod
+    def _get_host(cls, server_id):
+        return cls.os_admin.servers_client.show_server(
             server_id)['server']['OS-EXT-SRV-ATTR:host']
 
     @decorators.idempotent_id('26a9d5df-6890-45f2-abc4-a659290cb130')
@@ -41,40 +48,31 @@
         test.is_scheduler_filter_enabled("SameHostFilter"),
         'SameHostFilter is not available.')
     def test_create_servers_on_same_host(self):
-        server01 = self.create_test_server(wait_until='ACTIVE')['id']
-
-        hints = {'same_host': server01}
+        hints = {'same_host': self.server01}
         server02 = self.create_test_server(scheduler_hints=hints,
                                            wait_until='ACTIVE')['id']
-        host01 = self._get_host(server01)
         host02 = self._get_host(server02)
-        self.assertEqual(host01, host02)
+        self.assertEqual(self.host01, host02)
 
     @decorators.idempotent_id('cc7ca884-6e3e-42a3-a92f-c522fcf25e8e')
     @testtools.skipUnless(
         test.is_scheduler_filter_enabled("DifferentHostFilter"),
         'DifferentHostFilter is not available.')
     def test_create_servers_on_different_hosts(self):
-        server01 = self.create_test_server(wait_until='ACTIVE')['id']
-
-        hints = {'different_host': server01}
+        hints = {'different_host': self.server01}
         server02 = self.create_test_server(scheduler_hints=hints,
                                            wait_until='ACTIVE')['id']
-        host01 = self._get_host(server01)
         host02 = self._get_host(server02)
-        self.assertNotEqual(host01, host02)
+        self.assertNotEqual(self.host01, host02)
 
     @decorators.idempotent_id('7869cc84-d661-4e14-9f00-c18cdc89cf57')
     @testtools.skipUnless(
         test.is_scheduler_filter_enabled("DifferentHostFilter"),
         'DifferentHostFilter is not available.')
     def test_create_servers_on_different_hosts_with_list_of_servers(self):
-        server01 = self.create_test_server(wait_until='ACTIVE')['id']
-
         # This scheduler-hint supports list of servers also.
-        hints = {'different_host': [server01]}
+        hints = {'different_host': [self.server01]}
         server02 = self.create_test_server(scheduler_hints=hints,
                                            wait_until='ACTIVE')['id']
-        host01 = self._get_host(server01)
         host02 = self._get_host(server02)
-        self.assertNotEqual(host01, host02)
+        self.assertNotEqual(self.host01, host02)