Merge "Use admin creds for waiting"
diff --git a/patrole_tempest_plugin/tests/api/compute/test_attach_interfaces_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_attach_interfaces_rbac.py
index 05a41ba..1ad8861 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_attach_interfaces_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_attach_interfaces_rbac.py
@@ -60,8 +60,8 @@
             'ACTIVE')
         self.addCleanup(
             test_utils.call_and_ignore_notfound_exc,
-            self.interfaces_client.delete_interface, self.server['id'],
-            interface['port_id'])
+            self.os_admin.interfaces_client.delete_interface,
+            self.server['id'], interface['port_id'])
         return interface
 
     @decorators.idempotent_id('ddf53cb6-4a0a-4e5a-91e3-6c32aaa3b9b6')
diff --git a/patrole_tempest_plugin/tests/api/compute/test_server_actions_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_server_actions_rbac.py
index 516a143..ffbc530 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_server_actions_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_server_actions_rbac.py
@@ -116,36 +116,36 @@
             flavorRef=CONF.compute.flavor_ref,
             **device_mapping)['server']
 
-        waiters.wait_for_server_status(self.servers_client, server['id'],
-                                       'ACTIVE')
+        waiters.wait_for_server_status(
+            self.os_admin.servers_client, server['id'], 'ACTIVE')
 
         self.servers.append(server)
         return server
 
     def _test_start_server(self):
         self.servers_client.start_server(self.server_id)
-        waiters.wait_for_server_status(self.servers_client, self.server_id,
-                                       'ACTIVE')
+        waiters.wait_for_server_status(
+            self.os_admin.servers_client, self.server_id, 'ACTIVE')
 
     def _test_stop_server(self):
         self.servers_client.stop_server(self.server_id)
-        waiters.wait_for_server_status(self.servers_client, self.server_id,
-                                       'SHUTOFF')
+        waiters.wait_for_server_status(
+            self.os_admin.servers_client, self.server_id, 'SHUTOFF')
 
     def _test_resize_server(self, flavor):
         self.servers_client.resize_server(self.server_id, flavor)
-        waiters.wait_for_server_status(self.servers_client, self.server_id,
-                                       'VERIFY_RESIZE')
+        waiters.wait_for_server_status(
+            self.os_admin.servers_client, self.server_id, 'VERIFY_RESIZE')
 
     def _test_revert_resize_server(self):
         self.servers_client.revert_resize_server(self.server_id)
-        waiters.wait_for_server_status(self.servers_client, self.server_id,
-                                       'ACTIVE')
+        waiters.wait_for_server_status(
+            self.os_admin.servers_client, self.server_id, 'ACTIVE')
 
     def _test_confirm_resize_server(self):
         self.servers_client.confirm_resize_server(self.server_id)
-        waiters.wait_for_server_status(self.servers_client, self.server_id,
-                                       'ACTIVE')
+        waiters.wait_for_server_status(
+            self.os_admin.servers_client, self.server_id, 'ACTIVE')
 
     @rbac_rule_validation.action(
         service="nova",
@@ -211,8 +211,8 @@
     def test_rebuild_server(self):
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
         self.servers_client.rebuild_server(self.server_id, self.image_ref)
-        waiters.wait_for_server_status(self.servers_client, self.server_id,
-                                       'ACTIVE')
+        waiters.wait_for_server_status(
+            self.os_admin.servers_client, self.server_id, 'ACTIVE')
 
     @rbac_rule_validation.action(
         service="nova",
@@ -221,8 +221,8 @@
     def test_reboot_server(self):
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
         self.servers_client.reboot_server(self.server_id, type='HARD')
-        waiters.wait_for_server_status(self.servers_client, self.server_id,
-                                       'ACTIVE')
+        waiters.wait_for_server_status(
+            self.os_admin.servers_client, self.server_id, 'ACTIVE')
 
     @rbac_rule_validation.action(
         service="nova",
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 3a2b5ec..c6ac1c5 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_server_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_server_rbac.py
@@ -97,8 +97,8 @@
             flavorRef=CONF.compute.flavor_ref,
             **device_mapping)['server']
 
-        waiters.wait_for_server_status(self.servers_client, server['id'],
-                                       'ACTIVE')
+        waiters.wait_for_server_status(
+            self.os_admin.servers_client, server['id'], 'ACTIVE')
 
         self.servers.append(server)
         return server
@@ -164,7 +164,8 @@
         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.servers_client, server['id'])
+        waiters.wait_for_server_termination(
+            self.os_admin.servers_client, server['id'])
 
     @rbac_rule_validation.action(
         service="nova",
diff --git a/patrole_tempest_plugin/tests/api/compute/test_suspend_server_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_suspend_server_rbac.py
index 64ffea6..06ae4cf 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_suspend_server_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_suspend_server_rbac.py
@@ -68,8 +68,9 @@
         self.servers_client.suspend_server(self.server['id'])
         waiters.wait_for_server_status(self.servers_client, self.server['id'],
                                        'SUSPENDED')
+
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
         self.servers_client.resume_server(self.server['id'])
-        waiters.wait_for_server_status(self.servers_client,
+        waiters.wait_for_server_status(self.os_admin.servers_client,
                                        self.server['id'],
                                        'ACTIVE')
diff --git a/patrole_tempest_plugin/tests/api/compute/test_volume_rbac.py b/patrole_tempest_plugin/tests/api/compute/test_volume_rbac.py
index 23dbf1b..b775872 100644
--- a/patrole_tempest_plugin/tests/api/compute/test_volume_rbac.py
+++ b/patrole_tempest_plugin/tests/api/compute/test_volume_rbac.py
@@ -43,7 +43,7 @@
             self.os_admin.snapshots_extensions_client, snapshot_id,
             'available')
         self.snapshots_extensions_client.delete_snapshot(snapshot_id)
-        self.snapshots_extensions_client.wait_for_resource_deletion(
+        self.os_admin.snapshots_extensions_client.wait_for_resource_deletion(
             snapshot_id)
 
     @decorators.idempotent_id('2402013e-a624-43e3-9518-44a5d1dbb32d')
diff --git a/patrole_tempest_plugin/tests/api/image/test_images_rbac.py b/patrole_tempest_plugin/tests/api/image/test_images_rbac.py
index 78ba9e5..340323e 100644
--- a/patrole_tempest_plugin/tests/api/image/test_images_rbac.py
+++ b/patrole_tempest_plugin/tests/api/image/test_images_rbac.py
@@ -27,7 +27,8 @@
     @classmethod
     def setup_clients(cls):
         super(BasicOperationsImagesRbacTest, cls).setup_clients()
-        cls.client = cls.os_primary.image_client_v2
+        cls.image_client = cls.os_primary.image_client_v2
+        cls.admin_image_client = cls.os_admin.image_client_v2
 
     def _create_image(self, **kwargs):
         image_name = data_utils.rand_name(self.__class__.__name__ + '-Image')
@@ -39,7 +40,7 @@
 
     def _upload_image(self, image_id):
         image_file = six.BytesIO(data_utils.random_bytes())
-        return self.client.store_image_file(image_id, image_file)
+        return self.image_client.store_image_file(image_id, image_file)
 
     @rbac_rule_validation.action(service="glance",
                                  rule="add_image")
@@ -80,7 +81,7 @@
         self._upload_image(image['id'])
 
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
-        self.client.show_image_file(image['id'])
+        self.image_client.show_image_file(image['id'])
 
     @rbac_rule_validation.action(service="glance",
                                  rule="delete_image")
@@ -94,8 +95,8 @@
         image = self._create_image()
 
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
-        self.client.delete_image(image['id'])
-        self.client.wait_for_resource_deletion(image['id'])
+        self.image_client.delete_image(image['id'])
+        self.admin_image_client.wait_for_resource_deletion(image['id'])
 
     @rbac_rule_validation.action(service="glance",
                                  rule="get_image")
@@ -109,7 +110,7 @@
         image = self._create_image()
 
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
-        self.client.show_image(image['id'])
+        self.image_client.show_image(image['id'])
 
     @rbac_rule_validation.action(service="glance",
                                  rule="get_images")
@@ -121,7 +122,7 @@
         RBAC test for the glance list_images endpoint
         """
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
-        self.client.list_images()['images']
+        self.image_client.list_images()['images']
 
     @rbac_rule_validation.action(service="glance",
                                  rule="modify_image")
@@ -137,7 +138,7 @@
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
         updated_image_name = data_utils.rand_name(
             self.__class__.__name__ + '-image')
-        self.client.update_image(image['id'], [
+        self.image_client.update_image(image['id'], [
             dict(replace='/name', value=updated_image_name)])
 
     @decorators.idempotent_id('244050d9-1b9a-446a-b3c5-f26f3ba8eb75')
@@ -152,7 +153,7 @@
         image = self._create_image()
 
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
-        self.client.add_image_tag(
+        self.image_client.add_image_tag(
             image['id'],
             data_utils.rand_name(self.__class__.__name__ + '-tag'))
 
@@ -167,10 +168,10 @@
         """
         image = self._create_image()
         tag_name = data_utils.rand_name(self.__class__.__name__ + '-tag')
-        self.client.add_image_tag(image['id'], tag_name)
+        self.image_client.add_image_tag(image['id'], tag_name)
 
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
-        self.client.delete_image_tag(image['id'], tag_name)
+        self.image_client.delete_image_tag(image['id'], tag_name)
 
     @rbac_rule_validation.action(service="glance",
                                  rule="publicize_image")
@@ -209,7 +210,7 @@
         self._upload_image(image['id'])
 
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
-        self.client.deactivate_image(image['id'])
+        self.image_client.deactivate_image(image['id'])
 
     @rbac_rule_validation.action(service="glance",
                                  rule="reactivate")
@@ -224,4 +225,4 @@
         self._upload_image(image['id'])
 
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
-        self.client.reactivate_image(image['id'])
+        self.image_client.reactivate_image(image['id'])
diff --git a/patrole_tempest_plugin/tests/api/volume/test_qos_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_qos_rbac.py
index cc24fd4..8118bca 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_qos_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_qos_rbac.py
@@ -98,7 +98,7 @@
         keys = ['iops_bytes']
         self.qos_client.unset_qos_key(qos['id'], keys)
         operation = 'qos-key-unset'
-        waiters.wait_for_qos_operations(self.qos_client, qos['id'],
+        waiters.wait_for_qos_operations(self.os_admin.qos_client, qos['id'],
                                         operation, args=keys)
 
     @rbac_rule_validation.action(
@@ -143,7 +143,7 @@
         # disassociate a volume-type with qos-specs
         self.qos_client.disassociate_qos(qos['id'], vol_type)
         operation = 'disassociate'
-        waiters.wait_for_qos_operations(self.qos_client, qos['id'],
+        waiters.wait_for_qos_operations(self.os_admin.qos_client, qos['id'],
                                         operation, args=vol_type)
 
     @rbac_rule_validation.action(
@@ -161,5 +161,5 @@
         # disassociate all volume-types from qos-specs
         self.qos_client.disassociate_all_qos(qos['id'])
         operation = 'disassociate-all'
-        waiters.wait_for_qos_operations(self.qos_client, qos['id'],
+        waiters.wait_for_qos_operations(self.os_admin.qos_client, qos['id'],
                                         operation)
diff --git a/patrole_tempest_plugin/tests/api/volume/test_user_messages_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_user_messages_rbac.py
index 813d978..d2a5452 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_user_messages_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_user_messages_rbac.py
@@ -33,6 +33,7 @@
     def setup_clients(cls):
         super(MessagesV3RbacTest, cls).setup_clients()
         cls.messages_client = cls.os_primary.volume_v3_messages_client
+        cls.admin_messages_client = cls.os_admin.volume_v3_messages_client
 
     def _create_user_message(self):
         """Trigger a 'no valid host' situation to generate a message."""
@@ -90,4 +91,4 @@
 
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
         self.messages_client.delete_message(message_id)
-        self.messages_client.wait_for_resource_deletion(message_id)
+        self.admin_messages_client.wait_for_resource_deletion(message_id)
diff --git a/patrole_tempest_plugin/tests/api/volume/test_volume_actions_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_volume_actions_rbac.py
index 7916c8c..8bb92f4 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_volume_actions_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_volume_actions_rbac.py
@@ -54,7 +54,7 @@
             server['id'], volumeId=volume_id,
             device='/dev/%s' % CONF.compute.volume_device_name)
         waiters.wait_for_volume_resource_status(
-            self.volumes_client, volume_id, 'in-use')
+            self.os_admin.volumes_client, volume_id, 'in-use')
         self.addCleanup(self._detach_volume, volume_id)
 
     def _detach_volume(self, volume_id=None):
@@ -63,7 +63,7 @@
 
         self.volumes_client.detach_volume(volume_id)
         waiters.wait_for_volume_resource_status(
-            self.volumes_client, volume_id, 'available')
+            self.os_admin.volumes_client, volume_id, 'available')
 
     @test.services('compute')
     @rbac_rule_validation.action(service="cinder", rule="volume:attach")
diff --git a/patrole_tempest_plugin/tests/api/volume/test_volumes_backup_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_volumes_backup_rbac.py
index 2861531..dfe6495 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_volumes_backup_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_volumes_backup_rbac.py
@@ -86,7 +86,7 @@
         self.rbac_utils.switch_role(self, toggle_rbac_role=True)
         restore = self.backups_client.restore_backup(backup['id'])['restore']
         waiters.wait_for_volume_resource_status(
-            self.backups_client, restore['backup_id'], 'available')
+            self.os_admin.backups_client, restore['backup_id'], 'available')
 
     @test.attr(type=["slow"])
     @rbac_rule_validation.action(service="cinder",
diff --git a/patrole_tempest_plugin/tests/api/volume/test_volumes_extend_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_volumes_extend_rbac.py
index 72afd69..5709669 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_volumes_extend_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_volumes_extend_rbac.py
@@ -40,7 +40,7 @@
         self.volumes_client.extend_volume(self.volume['id'],
                                           new_size=extend_size)
         waiters.wait_for_volume_resource_status(
-            self.volumes_client, self.volume['id'], 'available')
+            self.os_admin.volumes_client, self.volume['id'], 'available')
 
 
 class VolumesExtendV3RbacTest(VolumesExtendRbacTest):
diff --git a/patrole_tempest_plugin/tests/api/volume/test_volumes_manage_rbac.py b/patrole_tempest_plugin/tests/api/volume/test_volumes_manage_rbac.py
index 7a9d7ba..8e71ee8 100644
--- a/patrole_tempest_plugin/tests/api/volume/test_volumes_manage_rbac.py
+++ b/patrole_tempest_plugin/tests/api/volume/test_volumes_manage_rbac.py
@@ -59,7 +59,7 @@
         new_volume_id = self.volume_manage_client.manage_volume(
             **new_volume_ref)['volume']['id']
 
-        waiters.wait_for_volume_resource_status(self.volumes_client,
+        waiters.wait_for_volume_resource_status(self.os_admin.volumes_client,
                                                 new_volume_id, 'available')
         self.addCleanup(self.delete_volume,
                         self.volumes_client, new_volume_id)