diff --git a/patrole_tempest_plugin/tests/api/compute/test_server_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_server_rbac.py
index 10ea801..4a105d7 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_server_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_server_rbac.py
@@ -41,69 +41,12 @@
         cls.networks_client = cls.os_primary.networks_client
         cls.ports_client = cls.os_primary.ports_client
         cls.subnets_client = cls.os_primary.subnets_client
+        cls.admin_servers_client = cls.os_admin.servers_client
 
     @classmethod
     def resource_setup(cls):
         super(ComputeServersRbacTest, cls).resource_setup()
         cls.server = cls.create_test_server(wait_until='ACTIVE')
-        # Create a volume
-        volume_name = data_utils.rand_name(cls.__name__ + '-volume')
-        name_field = 'name'
-        if not CONF.volume_feature_enabled.api_v2:
-            name_field = 'display_name'
-
-        params = {name_field: volume_name,
-                  'imageRef': CONF.compute.image_ref,
-                  'size': CONF.volume.volume_size}
-
-        volume = cls.volumes_client.create_volume(**params)['volume']
-        waiters.wait_for_volume_resource_status(cls.volumes_client,
-                                                volume['id'], 'available')
-        cls.volumes.append(volume)
-        cls.volume_id = volume['id']
-
-    def _create_network_resources(self):
-        # Create network
-        network_name = data_utils.rand_name(
-            self.__class__.__name__ + '-network')
-
-        network = self.networks_client.create_network(
-            name=network_name, port_security_enabled=True)['network']
-        self.addCleanup(self.networks_client.delete_network, network['id'])
-
-        # Create subnet for the network
-        subnet_name = data_utils.rand_name(self.__class__.__name__ + '-subnet')
-        subnet = self.subnets_client.create_subnet(
-            name=subnet_name,
-            network_id=network['id'],
-            cidr=CONF.network.project_network_cidr,
-            ip_version=4)['subnet']
-        self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
-
-        return network
-
-    def _create_test_server_with_volume(self, volume_id):
-        # Create a server with the volume created earlier
-        server_name = data_utils.rand_name(self.__class__.__name__ + "-server")
-        bd_map_v2 = [{'uuid': volume_id,
-                      'source_type': 'volume',
-                      'destination_type': 'volume',
-                      'boot_index': 0,
-                      'delete_on_termination': True}]
-        device_mapping = {'block_device_mapping_v2': bd_map_v2}
-
-        # Since the server is booted from volume, the imageRef does not need
-        # to be specified.
-        server = self.servers_client.create_server(
-            name=server_name, imageRef='',
-            flavorRef=CONF.compute.flavor_ref,
-            **device_mapping)['server']
-
-        waiters.wait_for_server_status(
-            self.os_admin.servers_client, server['id'], 'ACTIVE')
-
-        self.servers.append(server)
-        return server
 
     @rbac_rule_validation.action(
         service="nova",
@@ -139,8 +82,25 @@
         rule="os_compute_api:servers:create:attach_volume")
     @decorators.idempotent_id('eeddac5e-15aa-454f-838d-db608aae4dd8')
     def test_create_server_attach_volume(self):
+        # To create a bootable volume, the UUID of the image from which
+        # to create the volume must be included as the imageRef attribute in
+        # the request body.
+        volume_id = self.create_volume(
+            imageRef=CONF.compute.image_ref,
+            size=CONF.volume.volume_size)['id']
+
+        server_name = data_utils.rand_name(self.__class__.__name__ + "-server")
+        bd_map_v2 = [{'uuid': volume_id,
+                      'source_type': 'volume',
+                      'destination_type': 'volume',
+                      'boot_index': 0,
+                      'delete_on_termination': True}]
+        device_mapping = {'block_device_mapping_v2': bd_map_v2}
+
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
-        self._create_test_server_with_volume(self.volume_id)
+        # Use image_id='' to avoid using the default image in tempest.conf.
+        self.create_test_server(name=server_name, image_id='',
+                                **device_mapping)
 
     @test.services('network')
     @rbac_rule_validation.action(
@@ -148,12 +108,33 @@
         rule="os_compute_api:servers:create:attach_network")
     @decorators.idempotent_id('b44cd4ff-50a4-42ce-ada3-724e213cd540')
     def test_create_server_attach_network(self):
-        network = self._create_network_resources()
-        self.rbac_utils.switch_role(self, toggle_rbac_role=True)
+        def _create_network_resources():
+            # Create network
+            network_name = data_utils.rand_name(
+                self.__class__.__name__ + '-network')
+
+            network = self.networks_client.create_network(
+                name=network_name, port_security_enabled=True)['network']
+            self.addCleanup(self.networks_client.delete_network, network['id'])
+
+            # Create subnet for the network
+            subnet_name = data_utils.rand_name(
+                self.__class__.__name__ + '-subnet')
+            subnet = self.subnets_client.create_subnet(
+                name=subnet_name,
+                network_id=network['id'],
+                cidr=CONF.network.project_network_cidr,
+                ip_version=4)['subnet']
+            self.addCleanup(self.subnets_client.delete_subnet, subnet['id'])
+
+            return network
+
+        network = _create_network_resources()
         network_id = {'uuid': network['id']}
+
+        self.rbac_utils.switch_role(self, toggle_rbac_role=True)
         server = self.create_test_server(wait_until='ACTIVE',
                                          networks=[network_id])
-
         self.addCleanup(waiters.wait_for_server_termination,
                         self.servers_client, server['id'])
         self.addCleanup(self.servers_client.delete_server, server['id'])
@@ -164,10 +145,11 @@
     @decorators.idempotent_id('062e3440-e873-4b41-9317-bf6d8be50c12')
     def test_delete_server(self):
         server = self.create_test_server(wait_until='ACTIVE')
+
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
         self.servers_client.delete_server(server['id'])
         waiters.wait_for_server_termination(
-            self.os_admin.servers_client, server['id'])
+            self.admin_servers_client, server['id'])
 
     @rbac_rule_validation.action(
         service="nova",
@@ -178,7 +160,7 @@
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
         try:
             self.servers_client.update_server(self.server['id'], name=new_name)
-            waiters.wait_for_server_status(self.os_admin.servers_client,
+            waiters.wait_for_server_status(self.admin_servers_client,
                                            self.server['id'], 'ACTIVE')
         except exceptions.ServerFault as e:
             # Some other policy may have blocked it.
