Merge "Skip test_schedule_to_all_nodes tempest test on Ironic deployments" into mcp/pike
diff --git a/tempest/api/compute/admin/test_create_server.py b/tempest/api/compute/admin/test_create_server.py
index 08b2d19..711b441 100644
--- a/tempest/api/compute/admin/test_create_server.py
+++ b/tempest/api/compute/admin/test_create_server.py
@@ -56,6 +56,18 @@
             # Create a flavor with ephemeral disk
             flavor = self.create_flavor(name=flavor_name, ram=ram, vcpus=vcpus,
                                         disk=disk, ephemeral=ephem_disk)
+
+            # Set extra specs same as self.flavor_ref for the created flavor,
+            # because the environment may need some special extra specs to
+            # create server which should have been contained in
+            # self.flavor_ref.
+            extra_spec_keys = \
+                self.admin_flavors_client.list_flavor_extra_specs(
+                    self.flavor_ref)['extra_specs']
+            if extra_spec_keys:
+                self.admin_flavors_client.set_flavor_extra_spec(
+                    flavor['id'], **extra_spec_keys)
+
             return flavor['id']
 
         flavor_with_eph_disk_id = create_flavor_with_ephemeral(ephem_disk=1)
diff --git a/tempest/api/compute/admin/test_migrations.py b/tempest/api/compute/admin/test_migrations.py
index 7d5f5eb..a8c96bf 100644
--- a/tempest/api/compute/admin/test_migrations.py
+++ b/tempest/api/compute/admin/test_migrations.py
@@ -77,6 +77,16 @@
         )['flavor']
         self.addCleanup(self._flavor_clean_up, flavor['id'])
 
+        # Set extra specs same as self.flavor_ref for the created flavor,
+        # because the environment may need some special extra specs to
+        # create server which should have been contained in
+        # self.flavor_ref.
+        extra_spec_keys = self.admin_flavors_client.list_flavor_extra_specs(
+            self.flavor_ref)['extra_specs']
+        if extra_spec_keys:
+            self.admin_flavors_client.set_flavor_extra_spec(
+                flavor['id'], **extra_spec_keys)
+
         # Now boot a server with the copied flavor.
         server = self.create_test_server(
             wait_until='ACTIVE', flavor=flavor['id'])
diff --git a/tempest/api/compute/servers/test_server_actions.py b/tempest/api/compute/servers/test_server_actions.py
index bce7524..7a9c09d 100644
--- a/tempest/api/compute/servers/test_server_actions.py
+++ b/tempest/api/compute/servers/test_server_actions.py
@@ -557,6 +557,8 @@
     @decorators.idempotent_id('77eba8e0-036e-4635-944b-f7a8f3b78dc9')
     @testtools.skipUnless(CONF.compute_feature_enabled.shelve,
                           'Shelve is not available.')
+    @testtools.skipIf(getattr(CONF.service_available, 'barbican', False),
+                      'Barbican service is enabled, unshelve will not work')
     @utils.services('image')
     def test_shelve_unshelve_server(self):
         if CONF.image_feature_enabled.api_v2:
diff --git a/tempest/api/compute/servers/test_servers_negative.py b/tempest/api/compute/servers/test_servers_negative.py
index d067bb3..d2c4392 100644
--- a/tempest/api/compute/servers/test_servers_negative.py
+++ b/tempest/api/compute/servers/test_servers_negative.py
@@ -472,6 +472,8 @@
     @decorators.idempotent_id('443e4f9b-e6bf-4389-b601-3a710f15fddd')
     @testtools.skipUnless(CONF.compute_feature_enabled.shelve,
                           'Shelve is not available.')
+    @testtools.skipIf(getattr(CONF.service_available, 'barbican', False),
+                      'Barbican service is enabled, unshelve will not work')
     @decorators.attr(type=['negative'])
     def test_shelve_shelved_server(self):
         # shelve a shelved server.
diff --git a/tempest/api/compute/volumes/test_attach_volume.py b/tempest/api/compute/volumes/test_attach_volume.py
index 9bef80f..ce73d8a 100644
--- a/tempest/api/compute/volumes/test_attach_volume.py
+++ b/tempest/api/compute/volumes/test_attach_volume.py
@@ -13,6 +13,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import testtools
+
 from tempest.api.compute import base
 from tempest.common import compute
 from tempest.common.utils.linux import remote_client
@@ -215,6 +217,8 @@
             self.assertEqual(number_of_volumes, counted_volumes)
 
     @decorators.idempotent_id('13a940b6-3474-4c3c-b03f-29b89112bfee')
+    @testtools.skipIf(getattr(CONF.service_available, 'barbican', False),
+                      'Barbican service is enabled, unshelve will not work')
     def test_attach_volume_shelved_or_offload_server(self):
         # Create server, count number of volumes on it, shelve
         # server and attach pre-created volume to shelved server
@@ -241,6 +245,8 @@
         self.assertIsNotNone(volume_attachment['device'])
 
     @decorators.idempotent_id('b54e86dd-a070-49c4-9c07-59ae6dae15aa')
+    @testtools.skipIf(getattr(CONF.service_available, 'barbican', False),
+                      'Barbican service is enabled, unshelve will not work')
     def test_detach_volume_shelved_or_offload_server(self):
         # Count number of volumes on instance, shelve
         # server and attach pre-created volume to shelved server
diff --git a/tempest/common/utils/__init__.py b/tempest/common/utils/__init__.py
index d087cbd..5a86caa 100644
--- a/tempest/common/utils/__init__.py
+++ b/tempest/common/utils/__init__.py
@@ -59,7 +59,6 @@
         # So we should set this True here.
         'identity': True,
         'object_storage': CONF.service_available.swift,
-        'zaqar': False,
     }
     return service_list
 
diff --git a/tempest/scenario/manager.py b/tempest/scenario/manager.py
index 80c9235..52e936f 100644
--- a/tempest/scenario/manager.py
+++ b/tempest/scenario/manager.py
@@ -790,9 +790,9 @@
         # port on instance at once, and use it here
         for pm in port_map:
             try:
-                port = waiters.wait_for_interface_status(self.interface_client,
-                                                         server['id'],
-                                                         pm["id"], p_status)
+                port = waiters.wait_for_interface_status(
+                    self.os_admin.interfaces_client,
+                    server['id'], pm["id"], p_status)
                 pm["status"] = port['port_state']
             except lib_exc.TimeoutException:
                 # NOTE(pas-ha) as server might have several IPv4 ports
diff --git a/tempest/scenario/test_encrypted_cinder_volumes.py b/tempest/scenario/test_encrypted_cinder_volumes.py
index b5220e9..e1a1d70 100644
--- a/tempest/scenario/test_encrypted_cinder_volumes.py
+++ b/tempest/scenario/test_encrypted_cinder_volumes.py
@@ -13,6 +13,8 @@
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
+import testtools
+
 from tempest.common import utils
 from tempest import config
 from tempest.lib import decorators
@@ -54,6 +56,8 @@
 
     @decorators.idempotent_id('79165fb4-5534-4b9d-8429-97ccffb8f86e')
     @decorators.attr(type='slow')
+    @testtools.skipIf(getattr(CONF.service_available, 'barbican', False),
+                      'Image Signature Verification enabled')
     @utils.services('compute', 'volume', 'image')
     def test_encrypted_cinder_volumes_luks(self):
         server = self.launch_instance()
@@ -64,6 +68,8 @@
 
     @decorators.idempotent_id('cbc752ed-b716-4717-910f-956cce965722')
     @decorators.attr(type='slow')
+    @testtools.skipIf(getattr(CONF.service_available, 'barbican', False),
+                      'Image Signature Verification enabled')
     @utils.services('compute', 'volume', 'image')
     def test_encrypted_cinder_volumes_cryptsetup(self):
         server = self.launch_instance()
diff --git a/tempest/scenario/test_minimum_basic.py b/tempest/scenario/test_minimum_basic.py
index 29f1743..c154f6b 100644
--- a/tempest/scenario/test_minimum_basic.py
+++ b/tempest/scenario/test_minimum_basic.py
@@ -105,6 +105,8 @@
                           'The public_network_id option must be specified.')
     @testtools.skipUnless(CONF.network_feature_enabled.floating_ips,
                           'Floating ips are not available')
+    @testtools.skipIf(getattr(CONF.service_available, 'barbican', False),
+                      'Image Signature Verification enabled')
     @utils.services('compute', 'volume', 'image', 'network')
     def test_minimum_basic_scenario(self):
         image = self.glance_image_create()
diff --git a/tempest/scenario/test_network_v6.py b/tempest/scenario/test_network_v6.py
index 9f4e62b..5bdd89f 100644
--- a/tempest/scenario/test_network_v6.py
+++ b/tempest/scenario/test_network_v6.py
@@ -12,13 +12,18 @@
 #    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 #    License for the specific language governing permissions and limitations
 #    under the License.
+
+from oslo_log import log as logging
+
 from tempest.common import utils
 from tempest import config
 from tempest.lib.common.utils import test_utils
 from tempest.lib import decorators
+from tempest.lib import exceptions
 from tempest.scenario import manager
 
 CONF = config.CONF
+LOG = logging.getLogger(__name__)
 
 
 class TestGettingAddress(manager.NetworkScenarioTest):
@@ -154,8 +159,31 @@
                          % (network_id, ports))
         mac6 = ports[0]
         nic = ssh.get_nic_name_by_mac(mac6)
+        # NOTE(slaweq): on RHEL based OS ifcfg file for new interface is
+        # needed to make IPv6 working on it, so if
+        # /etc/sysconfig/network-scripts directory exists ifcfg-%(nic)s file
+        # should be added in it
+        if self._sysconfig_network_scripts_dir_exists(ssh):
+            try:
+                ssh.exec_command(
+                    'echo -e "DEVICE=%(nic)s\\nIPV6INIT=yes" | '
+                    'sudo tee /etc/sysconfig/network-scripts/ifcfg-%(nic)s; '
+                    'sudo /sbin/service network restart' % {'nic': nic})
+            except exceptions.SSHExecCommandFailed as e:
+                # NOTE(slaweq): Sometimes it can happen that this SSH command
+                # will fail because of some error from network manager in
+                # guest os.
+                # But even then doing ip link set up below is fine and
+                # IP address should be configured properly.
+                LOG.debug("Error during restarting %(nic)s interface on "
+                          "instance. Error message: %(error)s",
+                          {'nic': nic, 'error': e})
         ssh.exec_command("sudo ip link set %s up" % nic)
 
+    def _sysconfig_network_scripts_dir_exists(self, ssh):
+        return "False" not in ssh.exec_command(
+            'test -d /etc/sysconfig/network-scripts/ || echo "False"')
+
     def _prepare_and_test(self, address6_mode, n_subnets6=1, dualnet=False):
         net_list = self.prepare_network(address6_mode=address6_mode,
                                         n_subnets6=n_subnets6,
diff --git a/tempest/scenario/test_shelve_instance.py b/tempest/scenario/test_shelve_instance.py
index 68f18d1..cbfc8c6 100644
--- a/tempest/scenario/test_shelve_instance.py
+++ b/tempest/scenario/test_shelve_instance.py
@@ -78,6 +78,8 @@
     @decorators.idempotent_id('1164e700-0af0-4a4c-8792-35909a88743c')
     @testtools.skipUnless(CONF.network.public_network_id,
                           'The public_network_id option must be specified.')
+    @testtools.skipIf(getattr(CONF.service_available, 'barbican', False),
+                      'Barbican service is enabled, unshelve will not work')
     @utils.services('compute', 'network', 'image')
     def test_shelve_instance(self):
         self._create_server_then_shelve_and_unshelve()
@@ -86,6 +88,8 @@
     @decorators.idempotent_id('c1b6318c-b9da-490b-9c67-9339b627271f')
     @testtools.skipUnless(CONF.network.public_network_id,
                           'The public_network_id option must be specified.')
+    @testtools.skipIf(getattr(CONF.service_available, 'barbican', False),
+                      'Barbican service is enabled, unshelve will not work')
     @utils.services('compute', 'volume', 'network', 'image')
     def test_shelve_volume_backed_instance(self):
         self._create_server_then_shelve_and_unshelve(boot_from_volume=True)
diff --git a/tempest/scenario/test_snapshot_pattern.py b/tempest/scenario/test_snapshot_pattern.py
index b51a781..3b987e3 100644
--- a/tempest/scenario/test_snapshot_pattern.py
+++ b/tempest/scenario/test_snapshot_pattern.py
@@ -44,6 +44,8 @@
     @decorators.attr(type='slow')
     @testtools.skipUnless(CONF.network.public_network_id,
                           'The public_network_id option must be specified.')
+    @testtools.skipIf(getattr(CONF.service_available, 'barbican', False),
+                      'Image Signature Verification enabled')
     @utils.services('compute', 'network', 'image')
     def test_snapshot_pattern(self):
         # prepare for booting an instance