From bed827642e6e867e8f3fc71a3436dcfbc943eb8b Mon Sep 17 00:00:00 2001 From: ghanshyam Date: Tue, 21 Jul 2015 16:03:11 +0900 Subject: [PATCH] Logging migrations for particular server if migration failed Sometimes, test_live_block_migration fails on multinode job (gate-tempest-dsvm-multinode-full). http://logs.openstack.org/91/202391/5/check/gate-tempest-dsvm-multinode-full/f838b41/logs/testr_results.html.gz If live migration is failed, server status become Active from Migrating but host is not changed. In that case, test_live_block_migration fails for target host does not match with server host. But from Tempest failure logs, we do not know whether migration is failed or something else happened. It will be better for debugging if this tests logs migrations information for that server if live migration is failed. Closes-Bug: 1476478 Change-Id: I0f7ba31e44e6d5508483a6552641f59828af20e1 --- tempest/api/compute/admin/test_live_migration.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tempest/api/compute/admin/test_live_migration.py b/tempest/api/compute/admin/test_live_migration.py index 6ffa4e9ed4..e2f1025fd2 100644 --- a/tempest/api/compute/admin/test_live_migration.py +++ b/tempest/api/compute/admin/test_live_migration.py @@ -32,6 +32,7 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest): super(LiveBlockMigrationTestJSON, cls).setup_clients() cls.admin_hosts_client = cls.os_adm.hosts_client cls.admin_servers_client = cls.os_adm.servers_client + cls.admin_migration_client = cls.os_adm.migrations_client @classmethod def resource_setup(cls): @@ -109,7 +110,16 @@ class LiveBlockMigrationTestJSON(base.BaseV2ComputeAdminTest): self._migrate_server_to(server_id, target_host) waiters.wait_for_server_status(self.servers_client, server_id, state) - self.assertEqual(target_host, self._get_host_for_server(server_id)) + migration_list = self.admin_migration_client.list_migrations() + + msg = ("Live Migration failed. Migrations list for Instance " + "%s: [" % server_id) + for live_migration in migration_list: + if (live_migration['instance_uuid'] == server_id): + msg += "\n%s" % live_migration + msg += "]" + self.assertEqual(target_host, self._get_host_for_server(server_id), + msg) @test.idempotent_id('1dce86b8-eb04-4c03-a9d8-9c1dc3ee0c7b') @testtools.skipUnless(CONF.compute_feature_enabled.live_migration,