'Test the live-migration of an instance which has a serial console
The serial console feature of an instance uses ports on the host.
These ports need to be updated when they are already in use by
another instance on the target host. This test checks if this
update behavior is correctly done, by connecting to the serial
consoles of the instances before and after the live migration.'

@decorators.idempotent_id('6190af80-513e-4f0f-90f2-9714e84955d7')
@testtools.skipUnless(CONF.compute_feature_enabled.serial_console, 'Serial    console    not    supported.')
@testtools.skipUnless(compute.is_scheduler_filter_enabled('DifferentHostFilter'), 'DifferentHostFilter    is    not    available.')
def test_live_migration_serial_console(self):

    server01_id = self.create_test_server(wait_until='ACTIVE')['id']
    hints = {'different_host': server01_id}
    server02_id = self.create_test_server(scheduler_hints=hints, wait_until='ACTIVE')['id']
    host01_id = self.get_host_for_server(server01_id)
    host02_id = self.get_host_for_server(server02_id)
    self.assertNotEqual(host01_id, host02_id)
    self._verify_console_interaction(server01_id)
    self._verify_console_interaction(server02_id)
    self._migrate_server_to(server01_id, host02_id)
    waiters.wait_for_server_status(self.servers_client, server01_id, 'ACTIVE')
    self.assertEqual(host02_id, self.get_host_for_server(server01_id))
    self._verify_console_interaction(server01_id)
