Exemplo n.º 1
0
def run_case(params):
    src_host_ip = params.get('src_host_ip')
    dst_host_ip = params.get('dst_host_ip')
    qmp_port = int(params.get('qmp_port'))
    serial_port = int(params.get('serial_port'))
    incoming_port = params.get('incoming_port')
    share_images_dir = params.get('share_images_dir')
    matrix = params.get('matrix')
    disk1_name = params.get('disk1_name').split('.')[0]
    disk1_format = params.get('disk1_name').split('.')[1]
    disk2_name = params.get('disk2_name').split('.')[0]
    disk2_format = params.get('disk2_name').split('.')[1]
    disk3_name = params.get('disk3_name').split('.')[0]
    disk3_format = params.get('disk3_name').split('.')[1]
    disk4_name = params.get('disk4_name').split('.')[0]
    disk4_format = params.get('disk4_name').split('.')[1]
    disk5_name = params.get('disk5_name').split('.')[0]
    disk5_format = params.get('disk5_name').split('.')[1]
    iso = params.get('cdrom1_name')

    test = CreateTest(case_id='rhel7_120633', params=params)
    id = test.get_id()
    src_host_session = HostSession(id, params)
    test.test_print('=======Create test environment=======')
    test.sub_step_log('~~~~1. Create 5 data disks~~~~')
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk1_name,
                                disk_format=disk1_format,
                                disk_size=2048)
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk2_name,
                                disk_format=disk2_format,
                                disk_size=2048)
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk3_name,
                                disk_format=disk3_format,
                                disk_size=2048)
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk4_name,
                                disk_format=disk4_format,
                                disk_size=2048)
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk5_name,
                                disk_format=disk5_format,
                                disk_size=2048)

    test.sub_step_log('~~~~2. Create 1 iso~~~~')
    utils_stable_abi_ppc.create_iso(host_session=src_host_session,
                                    disk_dir=share_images_dir,
                                    iso=iso)

    test.sub_step_log('~~~~3. Configure host hugepage~~~~')
    utils_stable_abi_ppc.configure_host_hugepage(
        host_session=src_host_session,
        matrix=matrix,
        dst_ip=dst_host_ip,
        mount_point='/mnt/kvm_hugepage')

    test.sub_step_log('~~~~4. Check matrix~~~~')
    flag = utils_stable_abi_ppc.check_matrix(host_session=src_host_session,
                                             dst_ip=dst_host_ip,
                                             matrix=matrix)
    test.main_step_log('1. start guest on Source Host  host must have '
                       'following devices')
    if (flag == 'p9_to_p8'):
        params.vm_base_cmd_update('machine', 'pseries',
                                  'pseries-rhel7.3.0,max-cpu-compat=power8')
    else:
        params.vm_base_cmd_update('machine', 'pseries', 'pseries-rhel7.3.0')
    src_qemu_cmd = params.create_qemu_cmd()
    src_host_session.boot_guest(cmd=src_qemu_cmd, vm_alias='src')

    test.sub_step_log('1.1 Connecting to src serial')
    src_serial = RemoteSerialMonitor(id,
                                     params,
                                     ip=src_host_ip,
                                     port=serial_port)
    src_serial.serial_login()
    src_remote_qmp = RemoteQMPMonitor(id,
                                      params,
                                      ip=src_host_ip,
                                      port=qmp_port)

    test.sub_step_log('2 Start guest on Destination Host  host with same '
                      'qemu cli as step1 but appending')
    if (flag == 'p8_to_p9'):
        params.vm_base_cmd_update('machine', 'pseries-rhel7.3.0',
                                  'pseries-rhel7.3.0,max-cpu-compat=power8')
    elif (flag == 'p9_to_p8'):
        params.vm_base_cmd_update('machine',
                                  'pseries-rhel7.3.0,max-cpu-compat=power8',
                                  'pseries-rhel7.3.0')
    incoming_val = 'tcp:0:%s' % incoming_port
    params.vm_base_cmd_add('incoming', incoming_val)
    params.vm_base_cmd_update(
        'chardev',
        'socket,id=serial_id_serial0,host=%s,port=%s,server,nowait' %
        (src_host_ip, serial_port),
        'socket,id=serial_id_serial0,host=%s,port=%s,server,nowait' %
        (dst_host_ip, serial_port))
    dst_qemu_cmd = params.create_qemu_cmd()
    src_host_session.boot_remote_guest(cmd=dst_qemu_cmd,
                                       ip=dst_host_ip,
                                       vm_alias='dst')
    dst_remote_qmp = RemoteQMPMonitor(id,
                                      params,
                                      ip=dst_host_ip,
                                      port=qmp_port)

    test.main_step_log('3. Migrate guest from Source Host host to Destination'
                       ' Host  host')
    check_info = utils_migration.do_migration(remote_qmp=src_remote_qmp,
                                              migrate_port=incoming_port,
                                              dst_ip=dst_host_ip)
    if (check_info == False):
        test.test_error('Migration timeout')

    test.main_step_log('4.Check devices function one by one')
    dst_serial = RemoteSerialMonitor(id,
                                     params,
                                     ip=dst_host_ip,
                                     port=serial_port)
    output = dst_serial.serial_cmd_output('dmesg')
    if re.findall(r'Call Trace:', output):
        test.test_error('Guest hit call trace after migration')
    dst_remote_qmp.qmp_cmd_output('{"execute":"system_reset"}')
    dst_guest_ip = dst_serial.serial_login()
    dst_guest_session = GuestSession(case_id=id,
                                     params=params,
                                     ip=dst_guest_ip)
    test.sub_step_log('a.Check networking')
    dst_guest_session.guest_ping_test('www.redhat.com', 10)
    test.sub_step_log('b.Check block by the following methods')
    utils_migration.filebench_test(dst_guest_session)
    test.sub_step_log('c.Check VNC console and check keyboard by input keys')
    time.sleep(3)

    test.main_step_log('5.Migrate the guest back to Source Host host and '
                       'please refer to step 3')
    src_remote_qmp.qmp_cmd_output('{"execute":"quit"}', recv_timeout=3)
    time.sleep(3)
    src_host_session.check_guest_process(src_ip=src_host_ip)

    if (flag == 'p8_to_p9'):
        params.vm_base_cmd_update('machine',
                                  'pseries-rhel7.3.0,max-cpu-compat=power8',
                                  'pseries-rhel7.3.0')
    elif (flag == 'p9_to_p8'):
        params.vm_base_cmd_update('machine', 'pseries-rhel7.3.0',
                                  'pseries-rhel7.3.0,max-cpu-compat=power8')
    params.vm_base_cmd_update(
        'chardev',
        'socket,id=serial_id_serial0,host=%s,port=%s,server,nowait' %
        (dst_host_ip, serial_port),
        'socket,id=serial_id_serial0,host=%s,port=%s,server,nowait' %
        (src_host_ip, serial_port))
    src_qemu_cmd = params.create_qemu_cmd()
    src_host_session.boot_guest(cmd=src_qemu_cmd, vm_alias='src')
    src_remote_qmp = RemoteQMPMonitor(id,
                                      params,
                                      ip=src_host_ip,
                                      port=qmp_port)
    check_info = utils_migration.do_migration(remote_qmp=dst_remote_qmp,
                                              migrate_port=incoming_port,
                                              dst_ip=src_host_ip)
    if (check_info == False):
        test.test_error('Migration timeout')

    test.main_step_log('6.Repeat step 4')
    src_serial = RemoteSerialMonitor(id, params, src_host_ip, serial_port)
    output = src_serial.serial_cmd_output('dmesg')
    if re.findall(r'Call Trace:', output):
        test.test_error('Guest hit call trace after migration')
    src_remote_qmp.qmp_cmd_output('{"execute":"system_reset"}')
    src_guest_ip = src_serial.serial_login()
    src_guest_session = GuestSession(case_id=id,
                                     params=params,
                                     ip=src_guest_ip)
    test.sub_step_log('a.Check networking')
    src_guest_session.guest_ping_test('www.redhat.com', 10)
    test.sub_step_log('b.Check block by the following methods')
    utils_migration.filebench_test(src_guest_session)
    test.sub_step_log('c.Check VNC console and check keyboard by input keys')
Exemplo n.º 2
0
def run_case(params):
    src_host_ip = params.get('src_host_ip')
    dst_host_ip = params.get('dst_host_ip')
    qmp_port = int(params.get('qmp_port'))
    serial_port = int(params.get('serial_port'))
    incoming_port = params.get('incoming_port')
    share_images_dir = params.get('share_images_dir')
    matrix = params.get('matrix')
    disk1_name = params.get('disk1_name').split('.')[0]
    disk1_format = params.get('disk1_name').split('.')[1]
    disk2_name = params.get('disk2_name').split('.')[0]
    disk2_format = params.get('disk2_name').split('.')[1]
    disk3_name = params.get('disk3_name').split('.')[0]
    disk3_format = params.get('disk3_name').split('.')[1]
    disk4_name = params.get('disk4_name').split('.')[0]
    disk4_format = params.get('disk4_name').split('.')[1]
    disk5_name = params.get('disk5_name').split('.')[0]
    disk5_format = params.get('disk5_name').split('.')[1]
    iso = params.get('cdrom1_name')

    test = CreateTest(case_id='rhel_135046', params=params)
    id = test.get_id()
    src_host_session = HostSession(id, params)
    test.test_print('=======Create test environment=======')
    test.sub_step_log('~~~~1. Create 5 data disks~~~~')
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk1_name,
                                disk_format=disk1_format,
                                disk_size=2048)
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk2_name,
                                disk_format=disk2_format,
                                disk_size=2048)
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk3_name,
                                disk_format=disk3_format,
                                disk_size=2048)
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk4_name,
                                disk_format=disk4_format,
                                disk_size=2048)
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk5_name,
                                disk_format=disk5_format,
                                disk_size=2048)

    test.sub_step_log('~~~~2. Create 1 iso~~~~')
    utils_stable_abi_ppc.create_iso(host_session=src_host_session,
                                    disk_dir=share_images_dir,
                                    iso=iso)

    test.sub_step_log('~~~~3. Configure host hugepage~~~~')
    utils_stable_abi_ppc.configure_host_hugepage(
        host_session=src_host_session,
        matrix=matrix,
        dst_ip=dst_host_ip,
        mount_point='/mnt/kvm_hugepage')

    test.sub_step_log('~~~~4. Check matrix~~~~')
    flag = utils_stable_abi_ppc.check_matrix(host_session=src_host_session,
                                             dst_ip=dst_host_ip,
                                             matrix=matrix)

    test.main_step_log('1. start guest on Source Host  host must have '
                       'following devices')
    if (flag == 'p9_to_p8'):
        params.vm_base_cmd_update(
            'machine', 'pseries',
            'pseries-rhel7.3.0-sxxm,max-cpu-compat=power8')
    else:
        params.vm_base_cmd_update('machine', 'pseries',
                                  'pseries-rhel7.3.0-sxxm')
    src_qemu_cmd = params.create_qemu_cmd()
    src_host_session.boot_guest(cmd=src_qemu_cmd, vm_alias='src')

    test.sub_step_log('1.1 Connecting to src serial')
    src_remote_qmp = RemoteQMPMonitor(id,
                                      params,
                                      ip=src_host_ip,
                                      port=qmp_port)
    src_serial = RemoteSerialMonitor(id,
                                     params,
                                     ip=src_host_ip,
                                     port=serial_port)
    src_guest_ip = src_serial.serial_login()

    test.sub_step_log('2 Start guest on Destination Host  host with same '
                      'qemu cli as step1 but appending')
    if (flag == 'p8_to_p9'):
        params.vm_base_cmd_update(
            'machine', 'pseries-rhel7.3.0-sxxm',
            'pseries-rhel7.3.0-sxxm,max-cpu-compat=power8')
    elif (flag == 'p9_to_p8'):
        params.vm_base_cmd_update(
            'machine', 'pseries-rhel7.3.0-sxxm,max-cpu-compat=power8',
            'pseries-rhel7.3.0-sxxm')
    incoming_val = 'tcp:0:%s' % incoming_port
    params.vm_base_cmd_add('incoming', incoming_val)
    params.vm_base_cmd_update(
        'chardev', 'socket,id=serial_id_serial0,host=%s,'
        'port=%s,server,nowait' % (src_host_ip, serial_port),
        'socket,id=serial_id_serial0,host=%s,port=%s,'
        'server,nowait' % (dst_host_ip, serial_port))
    dst_qemu_cmd = params.create_qemu_cmd()
    src_host_session.boot_remote_guest(cmd=dst_qemu_cmd,
                                       ip=dst_host_ip,
                                       vm_alias='dst')
    dst_remote_qmp = RemoteQMPMonitor(id,
                                      params,
                                      ip=dst_host_ip,
                                      port=qmp_port)

    test.main_step_log(
        '3.In guest, execute the program to generate dirty pages')
    src_guest_session = GuestSession(case_id=id,
                                     params=params,
                                     ip=src_guest_ip)
    utils_migration.dirty_page_test(host_session=src_host_session,
                                    guest_session=src_guest_session,
                                    guest_ip=src_guest_ip,
                                    script='migration_dirtypage_2.c')

    test.main_step_log('4.Enable postcopy on both sides and do migration')
    utils_migration.set_migration_capabilities(remote_qmp=src_remote_qmp,
                                               capabilities='postcopy-ram',
                                               state='true')
    utils_migration.set_migration_capabilities(remote_qmp=dst_remote_qmp,
                                               capabilities='postcopy-ram',
                                               state='true')
    cmd = '{"execute":"migrate", "arguments": { "uri": "tcp:%s:%s" }}'\
          % (dst_host_ip, incoming_port)
    src_remote_qmp.qmp_cmd_output(cmd=cmd)

    test.main_step_log('5.check the migration status, after generating dirty '
                       'pages, change to postcopy mode')
    utils_migration.switch_to_postcopy(remote_qmp=src_remote_qmp)
    chk_info = utils_migration.query_migration(remote_qmp=src_remote_qmp)
    if chk_info == False:
        test.test_error('Migration timeout')

    test.main_step_log('6.Check devices function one by one')
    dst_serial = RemoteSerialMonitor(id,
                                     params,
                                     ip=dst_host_ip,
                                     port=serial_port)
    output = dst_serial.serial_cmd_output('dmesg')
    if re.findall(r'Call Trace:', output):
        test.test_error('Guest hit call trace after migration')
    dst_remote_qmp.qmp_cmd_output('{"execute":"system_reset"}')
    dst_guest_ip = dst_serial.serial_login()
    dst_guest_session = GuestSession(case_id=id,
                                     params=params,
                                     ip=dst_guest_ip)
    test.sub_step_log('a.Check networking')
    dst_guest_session.guest_ping_test('www.redhat.com', 10)
    test.sub_step_log('b.Check block by the following methods')
    utils_migration.filebench_test(dst_guest_session)
    test.sub_step_log('c.Check VNC console and check keyboard by input keys')
    time.sleep(3)

    test.main_step_log('7.Migrate the guest back to src host and please '
                       'refer to step 4 and step 5')
    src_remote_qmp.qmp_cmd_output('{"execute":"quit"}')
    time.sleep(3)
    src_host_session.check_guest_process(src_ip=src_host_ip)

    if (flag == 'p8_to_p9'):
        params.vm_base_cmd_update(
            'machine', 'pseries-rhel7.3.0-sxxm,max-cpu-compat=power8',
            'pseries-rhel7.3.0-sxxm')
    elif (flag == 'p9_to_p8'):
        params.vm_base_cmd_update(
            'machine', 'pseries-rhel7.3.0-sxxm',
            'pseries-rhel7.3.0-sxxm,max-cpu-compat=power8')
    params.vm_base_cmd_update(
        'chardev', 'socket,id=serial_id_serial0,host=%s,'
        'port=%s,server,nowait' % (dst_host_ip, serial_port),
        'socket,id=serial_id_serial0,host=%s,port=%s,'
        'server,nowait' % (src_host_ip, serial_port))
    src_qemu_cmd = params.create_qemu_cmd()
    src_host_session.boot_guest(cmd=src_qemu_cmd, vm_alias='src')
    src_remote_qmp = RemoteQMPMonitor(id,
                                      params,
                                      ip=src_host_ip,
                                      port=qmp_port)

    utils_migration.dirty_page_test(host_session=src_host_session,
                                    guest_session=dst_guest_session,
                                    guest_ip=dst_guest_ip,
                                    script='migration_dirtypage_2.c')

    utils_migration.set_migration_capabilities(remote_qmp=dst_remote_qmp,
                                               capabilities='postcopy-ram',
                                               state='true')
    utils_migration.set_migration_capabilities(remote_qmp=src_remote_qmp,
                                               capabilities='postcopy-ram',
                                               state='true')
    cmd = '{"execute":"migrate", "arguments": { "uri": "tcp:%s:%s" }}'\
          % (src_host_ip, incoming_port)
    dst_remote_qmp.qmp_cmd_output(cmd=cmd)
    utils_migration.switch_to_postcopy(remote_qmp=dst_remote_qmp)
    chk_info = utils_migration.query_migration(remote_qmp=dst_remote_qmp)
    if chk_info == False:
        test.test_error('Migration timeout')

    test.main_step_log('8.Repeat step6')
    src_serial = RemoteSerialMonitor(id, params, src_host_ip, serial_port)
    output = src_serial.serial_cmd_output('dmesg')
    if re.findall(r'Call Trace:', output):
        test.test_error('Guest hit call trace after migration')
    src_remote_qmp.qmp_cmd_output('{"execute":"system_reset"}')
    src_guest_ip = src_serial.serial_login()
    src_guest_session = GuestSession(case_id=id,
                                     params=params,
                                     ip=src_guest_ip)
    test.sub_step_log('a.Check networking')
    src_guest_session.guest_ping_test('www.redhat.com', 10)
    test.sub_step_log('b.Check block by the following methods')
    utils_migration.filebench_test(src_guest_session)
    test.sub_step_log('c.Check VNC console and check keyboard by input keys')
Exemplo n.º 3
0
def run_case(params):
    src_host_ip = params.get('src_host_ip')
    dst_host_ip = params.get('dst_host_ip')
    qmp_port = int(params.get('qmp_port'))
    serial_port = int(params.get('serial_port'))
    share_images_dir = params.get('share_images_dir')
    sys_image_name = params.get('sys_image_name')
    matrix = params.get('matrix')
    disk1_name = params.get('disk1_name').split('.')[0]
    disk1_format = params.get('disk1_name').split('.')[1]
    disk2_name = params.get('disk2_name').split('.')[0]
    disk2_format = params.get('disk2_name').split('.')[1]
    disk3_name = params.get('disk3_name').split('.')[0]
    disk3_format = params.get('disk3_name').split('.')[1]
    disk4_name = params.get('disk4_name').split('.')[0]
    disk4_format = params.get('disk4_name').split('.')[1]
    disk5_name = params.get('disk5_name').split('.')[0]
    disk5_format = params.get('disk5_name').split('.')[1]
    iso = params.get('cdrom1_name')

    test = CreateTest(case_id='rhel_133480', params=params)
    id = test.get_id()
    src_host_session = HostSession(id, params)
    test.test_print('=======Create test environment=======')
    test.sub_step_log('~~~~1. Create 5 data disks~~~~')
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk1_name,
                                disk_format=disk1_format,
                                disk_size=2048)
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk2_name,
                                disk_format=disk2_format,
                                disk_size=2048)
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk3_name,
                                disk_format=disk3_format,
                                disk_size=2048)
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk4_name,
                                disk_format=disk4_format,
                                disk_size=2048)
    utils_migration.create_disk(host_session=src_host_session,
                                disk_dir=share_images_dir,
                                disk_name=disk5_name,
                                disk_format=disk5_format,
                                disk_size=2048)

    test.sub_step_log('~~~~2. Create 1 iso~~~~')
    utils_stable_abi_ppc.create_iso(host_session=src_host_session,
                                    disk_dir=share_images_dir,
                                    iso=iso)

    test.sub_step_log('~~~~3. Configure host hugepage~~~~')
    utils_stable_abi_ppc.configure_host_hugepage(
        host_session=src_host_session,
        matrix=matrix,
        dst_ip=dst_host_ip,
        mount_point='/mnt/kvm_hugepage')

    test.main_step_log('1. Guest must be installed on Source Host  host and '
                       'copy it to Destination Host host. guest must have '
                       'following devices')
    test.main_step_log('2.install guest on Source Host  (old host)')
    test.main_step_log(
        '3.Copy image from Source Host  host to Destination Host  host')
    dst_del_img = 'ssh root@%s rm -rf /tmp/%s' % (dst_host_ip, sys_image_name)
    src_host_session.host_cmd(cmd=dst_del_img)
    cmd = 'scp %s/%s root@%s:/tmp/%s' % (share_images_dir, sys_image_name,
                                         dst_host_ip, sys_image_name)
    src_host_session.host_cmd(cmd=cmd)
    md5_cmd_src = "md5sum %s/%s | awk '{print $1}'" % (share_images_dir,
                                                       sys_image_name)
    md5_src_images = src_host_session.host_cmd_output(cmd=md5_cmd_src)
    md5_cmd_dst = "ssh root@%s md5sum /tmp/%s | awk '{print $1}'" % (
        dst_host_ip, sys_image_name)
    md5_dst_images = src_host_session.host_cmd_output(cmd=md5_cmd_dst)

    if not (md5_src_images == md5_dst_images):
        test.test_error('Failed to scp system image to dst host')

    test.main_step_log('4.Boot guest on Destination Host  host and check '
                       'devices function one by one with machine '
                       'type \"-M pseries-rhel7.6.0 \"')
    params.vm_base_cmd_update(
        'chardev',
        'socket,id=serial_id_serial0,host=%s,port=%s,server,nowait' %
        (src_host_ip, serial_port),
        'socket,id=serial_id_serial0,host=%s,port=%s,server,nowait' %
        (dst_host_ip, serial_port))
    if (matrix == 'P8_P9'):
        cmd = 'ssh root@%s lscpu' % dst_host_ip
        output = src_host_session.host_cmd_output(cmd=cmd)
        if re.findall(r'POWER9', output):
            params.vm_base_cmd_update(
                'machine', 'pseries',
                'pseries-rhel7.6.0,max-cpu-compat=power8')
        else:
            params.vm_base_cmd_update('machine', 'pseries',
                                      'pseries-rhel7.6.0')
    else:
        params.vm_base_cmd_update('machine', 'pseries', 'pseries-rhel7.6.0')
    dst_qemu_cmd = params.create_qemu_cmd()
    src_host_session.boot_remote_guest(cmd=dst_qemu_cmd,
                                       ip=dst_host_ip,
                                       vm_alias='dst')
    dst_remote_qmp = RemoteQMPMonitor(id,
                                      params,
                                      ip=dst_host_ip,
                                      port=qmp_port)
    dst_serial = RemoteSerialMonitor(id,
                                     params,
                                     ip=dst_host_ip,
                                     port=serial_port)
    dst_guest_ip = dst_serial.serial_login()
    dst_guest_session = GuestSession(case_id=id,
                                     params=params,
                                     ip=dst_guest_ip)

    test.sub_step_log('a.Check networking')
    dst_guest_session.guest_ping_test('www.redhat.com', 10)
    test.sub_step_log('b.Check block by the following methods')
    utils_migration.filebench_test(dst_guest_session)
    test.sub_step_log('c.Check VNC console and check keyboard by input keys')
    dst_remote_qmp.qmp_cmd_output('{"execute":"system_reset"}')
    dst_serial.serial_login()
Exemplo n.º 4
0
def run_case(params):
    src_host_ip = params.get('src_host_ip')
    dst_host_ip = params.get('dst_host_ip')
    qmp_port = int(params.get('qmp_port'))
    serial_port = int(params.get('serial_port'))
    incoming_port = params.get('incoming_port')
    test = CreateTest(case_id='rhel7_93722', params=params)
    id = test.get_id()
    src_host_session = HostSession(id, params)
    size = '2147483648'

    test.main_step_log('1.configure hugepage(both src and dst)')
    output = src_host_session.host_cmd_output(cmd='lscpu')
    if re.findall(r'POWER8', output):
        matrix = 'P8_P8'
    elif re.findall(r'POWER9', output):
        matrix = 'P9_P9'
    utils_stable_abi_ppc.configure_host_hugepage(
        host_session=src_host_session,
        matrix=matrix,
        dst_ip=dst_host_ip,
        mount_point='/mnt/kvm_hugepage')

    test.main_step_log(
        '2.Boot a guest with hugepage memdev and numa on src host')
    params.vm_base_cmd_add(
        'object', 'memory-backend-file,id=ram-node0,prealloc=yes,'
        'mem-path=/dev/hugepages,size=%s' % size)
    params.vm_base_cmd_add('numa', 'node,nodeid=0,cpus=0-1,memdev=ram-node0')
    params.vm_base_cmd_add(
        'object', 'memory-backend-file,id=ram-node1,prealloc=yes,'
        'mem-path=/dev/hugepages,size=%s' % size)
    params.vm_base_cmd_add('numa', 'node,nodeid=1,cpus=2-3,memdev=ram-node1')
    src_qemu_cmd = params.create_qemu_cmd()
    src_host_session.boot_guest(cmd=src_qemu_cmd, vm_alias='src')
    src_remote_qmp = RemoteQMPMonitor(id, params, src_host_ip, qmp_port)
    src_serial = RemoteSerialMonitor(id, params, src_host_ip, serial_port)
    src_serial.serial_login()

    test.main_step_log('3. Boot a guest on dst host')
    incoming_val = 'tcp:0:%s' % incoming_port
    params.vm_base_cmd_add('incoming', incoming_val)
    dst_qemu_cmd = params.create_qemu_cmd()
    src_host_session.boot_remote_guest(cmd=dst_qemu_cmd,
                                       ip=dst_host_ip,
                                       vm_alias='dst')
    dst_remote_qmp = RemoteQMPMonitor(id, params, dst_host_ip, qmp_port)

    test.main_step_log('4.On src host and dst host, '
                       'enable postcopy and do migration')
    test.sub_step_log('set src host postcopy-ram on')
    utils_migration.set_migration_capabilities(remote_qmp=src_remote_qmp,
                                               capabilities='postcopy-ram',
                                               state='true')
    test.sub_step_log('set dst host postcopy-ram on')
    utils_migration.set_migration_capabilities(remote_qmp=dst_remote_qmp,
                                               capabilities='postcopy-ram',
                                               state='true')
    test.sub_step_log('start to do migration')
    cmd = '{"execute":"migrate", "arguments": { "uri": "tcp:%s:%s" }}' \
          % (dst_host_ip, incoming_port)
    src_remote_qmp.qmp_cmd_output(cmd=cmd)
    utils_migration.switch_to_postcopy(remote_qmp=src_remote_qmp,
                                       dirty_count_threshold=0)
    chk_info = utils_migration.query_migration(remote_qmp=src_remote_qmp)
    if chk_info == False:
        test.test_error('Migration timeout')

    test.sub_step_log('Check guest status after migration finished')
    dst_serial = RemoteSerialMonitor(id, params, dst_host_ip, serial_port)
    output = dst_serial.serial_cmd_output('dmesg')
    if re.findall(r'Call Trace:', output):
        test.test_error('Guest hit call trace after migration')
    dst_serial.serial_cmd(cmd='reboot')
    dst_guest_ip = dst_serial.serial_login()
    dst_guest_session = GuestSession(case_id=id,
                                     params=params,
                                     ip=dst_guest_ip)
    dst_guest_session.guest_ping_test(dst_ip='www.redhat.com', count=10)