Add tests for Nova SR-IOV cold migrate
Logic for testing are the same as for test_cold_migration,
but server are created witn SR-IOV neuron port.
Test are available if the following config variables are set:
[compute]
min_compute_nodes = 2
fixed_network_name = <network>
[compute-feature-enabled]
sriov_cold_migration = true
Change-Id: Ia6fe4cd4a4f12b71a532cfcded20b8f9098c42b2
PROD: https://mirantis.jira.com/browse/PROD-17425,PROD-18630
(cherry picked from commit 7f3a7b520680b2a33aeb2245abf2bf525cd17dfe)
diff --git a/tempest/api/compute/admin/test_migrations.py b/tempest/api/compute/admin/test_migrations.py
index a6b71b2..a8c96bf 100644
--- a/tempest/api/compute/admin/test_migrations.py
+++ b/tempest/api/compute/admin/test_migrations.py
@@ -108,12 +108,13 @@
server = self.servers_client.show_server(server['id'])['server']
self.assertEqual(flavor['id'], server['flavor']['id'])
- def _test_cold_migrate_server(self, revert=False):
+ def _test_cold_migrate_server(self, revert=False, server=None):
if CONF.compute.min_compute_nodes < 2:
msg = "Less than 2 compute nodes, skipping multinode tests."
raise self.skipException(msg)
- server = self.create_test_server(wait_until="ACTIVE")
+ if server is None:
+ server = self.create_test_server(wait_until="ACTIVE")
src_host = self.admin_servers_client.show_server(
server['id'])['server']['OS-EXT-SRV-ATTR:host']
@@ -141,6 +142,33 @@
def test_cold_migration(self):
self._test_cold_migrate_server(revert=False)
+ def _create_sriov_server(self):
+ network = self.get_tenant_network()
+ port_params = {
+ 'binding:vnic_type': 'direct',
+ 'name': 'tempest-sriov-port-%s' % data_utils.rand_uuid(),
+ 'network_id': network['id']
+ }
+ ports_client = self.os_primary.ports_client
+ port = ports_client.create_port(**port_params)['port']
+ self.addCleanup(ports_client.delete_port, port['id'])
+
+ self.create_test_server(
+ wait_until="ACTIVE", networks=[{'port': port['id']}])
+
+ @decorators.idempotent_id('159ac313-2838-405c-9c43-65bd72f3810b')
+ @testtools.skipUnless(CONF.compute_feature_enabled.sriov_cold_migration,
+ 'SR-IOV cold migration not available.')
+ def test_sriov_cold_migration(self):
+ self._test_cold_migrate_server(server=self._create_sriov_server())
+
+ @decorators.idempotent_id('38893be5-3a6d-4222-a315-608e6e40ae6a')
+ @testtools.skipUnless(CONF.compute_feature_enabled.sriov_cold_migration,
+ 'SR-IOV cold migration not available.')
+ def test_revert_sriov_cold_migration(self):
+ self._test_cold_migrate_server(
+ server=self._create_sriov_server(), revert=True)
+
@decorators.idempotent_id('caa1aa8b-f4ef-4374-be0d-95f001c2ac2d')
@testtools.skipUnless(CONF.compute_feature_enabled.cold_migration,
'Cold migration not available.')
diff --git a/tempest/config.py b/tempest/config.py
index 8a6370a..59b8aad 100644
--- a/tempest/config.py
+++ b/tempest/config.py
@@ -379,6 +379,10 @@
cfg.BoolOpt('cold_migration',
default=True,
help="Does the test environment support cold migration?"),
+ cfg.BoolOpt('sriov_cold_migration',
+ default=False,
+ help="Does the test environment "
+ "support SR-IOV cold migration?"),
cfg.BoolOpt('live_migration',
default=True,
help="Does the test environment support live migration?"),