Beispiel #1
0
 def check_result(result, status_error):
     """
     Check virt-v2v command result
     """
     utlv.check_exit_status(result, status_error)
     output = result.stdout + result.stderr
     if status_error:
         if checkpoint in ['running', 'paused']:
             check_v2v_log(output, 'not_shutdown')
         else:
             check_v2v_log(output, checkpoint)
     else:
         if output_mode == 'rhev':
             if not utils_v2v.import_vm_to_ovirt(
                     params, address_cache, timeout=v2v_timeout):
                 raise exceptions.TestFail('Import VM failed')
         if output_mode == 'libvirt':
             try:
                 virsh.start(vm_name, debug=True, ignore_status=False)
             except Exception, e:
                 raise exceptions.TestFail('Start vm failed: %s' % str(e))
         # Check guest following the checkpoint document after convertion
         vmchecker = VMChecker(test, params, env)
         params['vmchecker'] = vmchecker
         ret = vmchecker.run()
         if len(ret) == 0:
             logging.info("All common checkpoints passed")
         if checkpoint in ['multi_kernel', 'debug_kernel']:
             default_kernel = params.get('defaultkernel')
             check_boot_kernel(vmchecker.checker, default_kernel,
                               debug_kernel)
             if checkpoint == 'multi_kernel':
                 check_vmlinuz_initramfs(output)
         elif checkpoint == 'floppy':
             check_floppy_exist(vmchecker.checker)
         elif checkpoint == 'multi_disks':
             check_disks(vmchecker.checker)
         elif checkpoint == 'multi_netcards':
             check_multi_netcards(params['mac_address'],
                                  vmchecker.virsh_instance)
         elif checkpoint.startswith('spice'):
             vmchecker.check_graphics({'type': 'spice'})
             if checkpoint == 'spice_encrypt':
                 vmchecker.check_graphics(params[checkpoint])
         elif checkpoint.startswith('selinux'):
             status = vmchecker.checker.session.cmd(
                 'getenforce').strip().lower()
             logging.info('Selinux status after v2v:%s', status)
             if status != checkpoint[8:]:
                 log_fail('Selinux status not match')
         elif checkpoint == 'guest_firewalld_status':
             check_firewalld_status(vmchecker.checker, params[checkpoint])
         elif checkpoint in ['ntpd_on', 'sync_ntp']:
             check_time_keep(vmchecker.checker)
         check_v2v_log(output, checkpoint)
         # Merge 2 error lists
         error_list.extend(vmchecker.errors)
         if len(error_list):
             log_fail('%d checkpoints failed: %s' %
                      (len(error_list), error_list))
Beispiel #2
0
 def check_result(result, status_error):
     """
     Check virt-v2v command result
     """
     libvirt.check_exit_status(result, status_error)
     output = result.stdout_text + result.stderr_text
     if not status_error and checkpoint != 'vdsm':
         vmchecker = VMChecker(test, params, env)
         params['vmchecker'] = vmchecker
         if output_mode == 'rhev':
             if not utils_v2v.import_vm_to_ovirt(params, address_cache,
                                                 timeout=v2v_timeout):
                 test.fail('Import VM failed')
         elif output_mode == 'libvirt':
             try:
                 virsh.start(vm_name, debug=True, ignore_status=False)
             except Exception as e:
                 test.fail('Start vm failed: %s' % str(e))
         # Check guest following the checkpoint document after conversion
         LOG.info('Checking common checkpoints for v2v')
         if params.get('skip_vm_check') != 'yes':
             ret = vmchecker.run()
             if len(ret) == 0:
                 LOG.info("All common checkpoints passed")
         else:
             LOG.info(
                 'Skip checking vm after conversion: %s' %
                 skip_reason)
         # Check specific checkpoints
         if checkpoint == 'console_xvc0':
             check_grub_file(vmchecker.checker, 'console_xvc0')
         if checkpoint in ('vnc_autoport', 'vnc_encrypt'):
             vmchecker.check_graphics(params[checkpoint])
         if checkpoint == 'pv_with_regular_kernel':
             check_kernel(vmchecker.checker)
         if checkpoint in ['sound', 'pcspk']:
             check_sound_card(vmchecker.checker, checkpoint)
         if checkpoint == 'multidisk':
             check_disk(vmchecker.checker, params['disk_count'])
     log_check = utils_v2v.check_log(params, output)
     if log_check:
         log_fail(log_check)
     # Merge 2 error lists
     if params.get('vmchecker'):
         error_list.extend(params['vmchecker'].errors)
     if len(error_list):
         test.fail(
             '%d checkpoints failed: %s' %
             (len(error_list), error_list))
 def check_result(result, status_error):
     """
     Check virt-v2v command result
     """
     libvirt.check_exit_status(result, status_error)
     output = result.stdout + result.stderr
     if not status_error and checkpoint != 'vdsm':
         if output_mode == 'rhev':
             if not utils_v2v.import_vm_to_ovirt(params, address_cache,
                                                 timeout=v2v_timeout):
                 test.fail('Import VM failed')
         elif output_mode == 'libvirt':
             try:
                 virsh.start(vm_name, debug=True, ignore_status=False)
             except Exception, e:
                 test.fail('Start vm failed: %s', str(e))
         # Check guest following the checkpoint document after convertion
         logging.info('Checking common checkpoints for v2v')
         vmchecker = VMChecker(test, params, env)
         params['vmchecker'] = vmchecker
         ret = vmchecker.run()
         if len(ret) == 0:
             logging.info("All common checkpoints passed")
         # Check specific checkpoints
         if checkpoint == 'rhev_file':
             check_rhev_file_exist(vmchecker.checker)
         if checkpoint == 'console_xvc0':
             check_grub_file(vmchecker.checker, 'console_xvc0')
         if checkpoint in ('vnc_autoport', 'vnc_encrypt'):
             vmchecker.check_graphics(params[checkpoint])
         if checkpoint == 'sdl':
             if output_mode == 'libvirt':
                 vmchecker.check_graphics({'type': 'vnc'})
             elif output_mode == 'rhev':
                 vmchecker.check_graphics({'type': 'spice'})
         if checkpoint == 'pv_with_regular_kernel':
             check_kernel(vmchecker.checker)
         if checkpoint in ['sound', 'pcspk']:
             check_sound_card(vmchecker.checker, checkpoint)
         if checkpoint == 'rhsrvany_md5':
             check_rhsrvany_md5(vmchecker.checker)
         if checkpoint == 'multidisk':
             check_disk(vmchecker.checker, params['disk_count'])
Beispiel #4
0
 def check_result(result, status_error):
     """
     Check virt-v2v command result
     """
     libvirt.check_exit_status(result, status_error)
     output = result.stdout + result.stderr
     if not status_error and checkpoint != 'vdsm':
         if output_mode == 'rhev':
             if not utils_v2v.import_vm_to_ovirt(
                     params, address_cache, timeout=v2v_timeout):
                 test.fail('Import VM failed')
         elif output_mode == 'libvirt':
             try:
                 virsh.start(vm_name, debug=True, ignore_status=False)
             except Exception, e:
                 test.fail('Start vm failed: %s', str(e))
         # Check guest following the checkpoint document after convertion
         logging.info('Checking common checkpoints for v2v')
         vmchecker = VMChecker(test, params, env)
         params['vmchecker'] = vmchecker
         ret = vmchecker.run()
         if len(ret) == 0:
             logging.info("All common checkpoints passed")
         # Check specific checkpoints
         if checkpoint == 'rhev_file':
             check_rhev_file_exist(vmchecker.checker)
         if checkpoint == 'console_xvc0':
             check_grub_file(vmchecker.checker, 'console_xvc0')
         if checkpoint in ('vnc_autoport', 'vnc_encrypt'):
             vmchecker.check_graphics(params[checkpoint])
         if checkpoint == 'sdl':
             if output_mode == 'libvirt':
                 vmchecker.check_graphics({'type': 'vnc'})
             elif output_mode == 'rhev':
                 vmchecker.check_graphics({'type': 'spice'})
         if checkpoint == 'pv_with_regular_kernel':
             check_kernel(vmchecker.checker)
         if checkpoint in ['sound', 'pcspk']:
             check_sound_card(vmchecker.checker, checkpoint)
         if checkpoint == 'rhsrvany_md5':
             check_rhsrvany_md5(vmchecker.checker)
         if checkpoint == 'multidisk':
             check_disk(vmchecker.checker, params['disk_count'])
Beispiel #5
0
    def check_result(result, status_error):
        """
        Check virt-v2v command result
        """
        utlv.check_exit_status(result, status_error)
        output = result.stdout_text + result.stderr_text
        if not status_error:
            if output_mode == 'json' and not check_json_output(params):
                test.fail('check json output failed')
            if output_mode == 'local' and not check_local_output(params):
                test.fail('check local output failed')
            if output_mode in ['null', 'json', 'local']:
                return

            vmchecker = VMChecker(test, params, env)
            params['vmchecker'] = vmchecker
            if output_mode == 'rhev':
                if not utils_v2v.import_vm_to_ovirt(
                        params, address_cache, timeout=v2v_timeout):
                    test.fail('Import VM failed')
            if output_mode == 'libvirt':
                try:
                    virsh.start(vm_name, debug=True, ignore_status=False)
                except Exception as e:
                    test.fail('Start vm failed: %s' % str(e))
            # Check guest following the checkpoint document after conversion
            if params.get('skip_vm_check') != 'yes':
                ret = vmchecker.run()
                if len(ret) == 0:
                    LOG.info("All common checkpoints passed")
            LOG.debug(vmchecker.vmxml)
            if checkpoint == 'multi_kernel':
                check_boot_kernel(vmchecker.checker)
                check_vmlinuz_initramfs(output)
            if checkpoint == 'floppy':
                # Convert to rhv will remove all removable devices(floppy,
                # cdrom)
                if output_mode in ['local', 'libvirt']:
                    check_floppy_exist(vmchecker.checker)
            if checkpoint == 'multi_disks':
                check_disks(vmchecker.checker)
            if checkpoint == 'multi_netcards':
                check_multi_netcards(params['mac_address'], vmchecker.vmxml)
            if checkpoint.startswith(('spice', 'vnc')):
                if checkpoint == 'spice_encrypt':
                    vmchecker.check_graphics(params[checkpoint])
                else:
                    graph_type = checkpoint.split('_')[0]
                    vmchecker.check_graphics({'type': graph_type})
                    video_type = vmchecker.xmltree.find(
                        './devices/video/model').get('type')
                    if utils_v2v.multiple_versions_compare(
                            V2V_ADAPTE_SPICE_REMOVAL_VER):
                        expect_video_type = 'vga'
                    else:
                        expect_video_type = 'qxl'

                    if video_type.lower() != expect_video_type:
                        log_fail('Video expect %s, actual %s' %
                                 (expect_video_type, video_type))
            if checkpoint.startswith('listen'):
                listen_type = vmchecker.xmltree.find(
                    './devices/graphics/listen').get('type')
                LOG.info('listen type is: %s', listen_type)
                if listen_type != checkpoint.split('_')[-1]:
                    log_fail('listen type changed after conversion')
            if checkpoint.startswith('selinux'):
                status = vmchecker.checker.session.cmd(
                    'getenforce').strip().lower()
                LOG.info('Selinux status after v2v:%s', status)
                if status != checkpoint[8:]:
                    log_fail('Selinux status not match')
            if checkpoint == 'check_selinuxtype':
                expect_output = vmchecker.checker.session.cmd(
                    'cat /etc/selinux/config')
                expect_selinuxtype = re.search(r'^SELINUXTYPE=\s*(\S+)$',
                                               expect_output,
                                               re.MULTILINE).group(1)
                actual_output = vmchecker.checker.session.cmd('sestatus')
                actual_selinuxtype = re.search(
                    r'^Loaded policy name:\s*(\S+)$', actual_output,
                    re.MULTILINE).group(1)
                if actual_selinuxtype != expect_selinuxtype:
                    log_fail('Seliunx type not match')
            if checkpoint == 'guest_firewalld_status':
                check_firewalld_status(vmchecker.checker, params[checkpoint])
            if checkpoint in ['ntpd_on', 'sync_ntp']:
                check_time_keep(vmchecker.checker)
            # Merge 2 error lists
            error_list.extend(vmchecker.errors)
        log_check = utils_v2v.check_log(params, output)
        if log_check:
            log_fail(log_check)
        if len(error_list):
            test.fail('%d checkpoints failed: %s' %
                      (len(error_list), error_list))
 def check_result(result, status_error):
     """
     Check virt-v2v command result
     """
     libvirt.check_exit_status(result, status_error)
     output = result.stdout + result.stderr
     if not status_error and checkpoint != 'vdsm':
         if output_mode == 'rhev':
             if not utils_v2v.import_vm_to_ovirt(
                     params, address_cache, timeout=v2v_timeout):
                 test.fail('Import VM failed')
         elif output_mode == 'libvirt':
             try:
                 virsh.start(vm_name, debug=True, ignore_status=False)
             except Exception as e:
                 test.fail('Start vm failed: %s', str(e))
         # Check guest following the checkpoint document after convertion
         logging.info('Checking common checkpoints for v2v')
         vmchecker = VMChecker(test, params, env)
         params['vmchecker'] = vmchecker
         if params.get('skip_vm_check') != 'yes':
             ret = vmchecker.run()
             if len(ret) == 0:
                 logging.info("All common checkpoints passed")
         else:
             logging.info('Skip checking vm after conversion: %s' %
                          skip_reason)
         # Check specific checkpoints
         if checkpoint == 'console_xvc0':
             check_grub_file(vmchecker.checker, 'console_xvc0')
         if checkpoint in ('vnc_autoport', 'vnc_encrypt'):
             vmchecker.check_graphics(params[checkpoint])
         if checkpoint == 'sdl':
             if output_mode == 'libvirt':
                 vmchecker.check_graphics({'type': 'vnc'})
             elif output_mode == 'rhev':
                 vmchecker.check_graphics({'type': 'spice'})
         if checkpoint == 'pv_with_regular_kernel':
             check_kernel(vmchecker.checker)
         if checkpoint in ['sound', 'pcspk']:
             check_sound_card(vmchecker.checker, checkpoint)
         if checkpoint == 'rhsrvany_md5':
             check_rhsrvany_md5(vmchecker.checker)
         if checkpoint == 'multidisk':
             check_disk(vmchecker.checker, params['disk_count'])
     log_check = utils_v2v.check_log(params, output)
     if log_check:
         log_fail(log_check)
     # Merge 2 error lists
     if params.get('vmchecker'):
         error_list.extend(params['vmchecker'].errors)
     # Virtio drivers will not be installed without virtio-win setup
     if checkpoint == 'virtio_win_unset':
         missing_list = params.get('missing').split(',')
         expect_errors = ['Not find driver: ' + x for x in missing_list]
         logging.debug('Expect errors: %s' % expect_errors)
         logging.debug('Actual errors: %s' % error_list)
         if set(error_list) == set(expect_errors):
             error_list[:] = []
         else:
             logging.error('Virtio drivers not meet expectation')
     if len(error_list):
         test.fail('%d checkpoints failed: %s' %
                   (len(error_list), error_list))
Beispiel #7
0
 def check_result(result, status_error):
     """
     Check virt-v2v command result
     """
     utlv.check_exit_status(result, status_error)
     output = result.stdout + result.stderr
     if skip_check:
         logging.info('Skip checking vm after conversion')
     elif not status_error:
         if output_mode == 'rhev':
             if not utils_v2v.import_vm_to_ovirt(
                     params, address_cache, timeout=v2v_timeout):
                 test.fail('Import VM failed')
         if output_mode == 'libvirt':
             try:
                 virsh.start(vm_name, debug=True, ignore_status=False)
             except Exception as e:
                 test.fail('Start vm failed: %s' % str(e))
         # Check guest following the checkpoint document after convertion
         vmchecker = VMChecker(test, params, env)
         params['vmchecker'] = vmchecker
         if params.get('skip_check') != 'yes':
             ret = vmchecker.run()
             if len(ret) == 0:
                 logging.info("All common checkpoints passed")
         vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(
             vm_name, virsh_instance=vmchecker.virsh_instance)
         logging.debug(vmxml)
         if checkpoint == 'multi_kernel':
             check_boot_kernel(vmchecker.checker)
         if checkpoint == 'floppy':
             check_floppy_exist(vmchecker.checker)
         if checkpoint == 'multi_disks':
             check_disks(vmchecker.checker)
         if checkpoint == 'multi_netcards':
             check_multi_netcards(params['mac_address'],
                                  vmchecker.virsh_instance)
         if checkpoint.startswith(('spice', 'vnc')):
             if checkpoint == 'spice_encrypt':
                 vmchecker.check_graphics(params[checkpoint])
             else:
                 graph_type = checkpoint.split('_')[0]
                 vmchecker.check_graphics({'type': graph_type})
                 video_type = vmxml.get_devices('video')[0].model_type
                 if video_type.lower() != 'qxl':
                     log_fail('Video expect QXL, actual %s' % video_type)
         if checkpoint.startswith('listen'):
             listen_type = vmxml.get_devices('graphics')[0].listen_type
             logging.info('listen type is: %s', listen_type)
             if listen_type != checkpoint.split('_')[-1]:
                 log_fail('listen type changed after conversion')
         if checkpoint.startswith('selinux'):
             status = vmchecker.checker.session.cmd(
                 'getenforce').strip().lower()
             logging.info('Selinux status after v2v:%s', status)
             if status != checkpoint[8:]:
                 log_fail('Selinux status not match')
         if checkpoint == 'guest_firewalld_status':
             check_firewalld_status(vmchecker.checker, params[checkpoint])
         if checkpoint in ['ntpd_on', 'sync_ntp']:
             check_time_keep(vmchecker.checker)
         # Merge 2 error lists
         error_list.extend(vmchecker.errors)
     log_check = utils_v2v.check_log(params, output)
     if log_check:
         log_fail(log_check)
     if len(error_list):
         test.fail('%d checkpoints failed: %s' %
                   (len(error_list), error_list))
Beispiel #8
0
 def check_result(result, status_error):
     """
     Check virt-v2v command result
     """
     utlv.check_exit_status(result, status_error)
     output = result.stdout + result.stderr
     if skip_check:
         logging.info('Skip checking vm after conversion')
     elif not status_error:
         if output_mode == 'rhev':
             if not utils_v2v.import_vm_to_ovirt(params, address_cache,
                                                 timeout=v2v_timeout):
                 test.fail('Import VM failed')
         if output_mode == 'libvirt':
             try:
                 virsh.start(vm_name, debug=True, ignore_status=False)
             except Exception, e:
                 test.fail('Start vm failed: %s' % str(e))
         # Check guest following the checkpoint document after convertion
         vmchecker = VMChecker(test, params, env)
         params['vmchecker'] = vmchecker
         if params.get('skip_check') != 'yes':
             ret = vmchecker.run()
             if len(ret) == 0:
                 logging.info("All common checkpoints passed")
         vmxml = vm_xml.VMXML.new_from_inactive_dumpxml(
                 vm_name, virsh_instance=vmchecker.virsh_instance)
         logging.debug(vmxml)
         if checkpoint in ['multi_kernel', 'debug_kernel']:
             default_kernel = params.get('defaultkernel')
             check_boot_kernel(vmchecker.checker, default_kernel, debug_kernel)
             if checkpoint == 'multi_kernel':
                 check_vmlinuz_initramfs(output)
         if checkpoint == 'floppy':
             check_floppy_exist(vmchecker.checker)
         if checkpoint == 'multi_disks':
             check_disks(vmchecker.checker)
         if checkpoint == 'multi_netcards':
             check_multi_netcards(params['mac_address'],
                                  vmchecker.virsh_instance)
         if checkpoint.startswith(('spice', 'vnc')):
             if checkpoint == 'spice_encrypt':
                 vmchecker.check_graphics(params[checkpoint])
             else:
                 graph_type = checkpoint.split('_')[0]
                 vmchecker.check_graphics({'type': graph_type})
                 video_type = vmxml.get_devices('video')[0].model_type
                 if video_type.lower() != 'qxl':
                     log_fail('Video expect QXL, actual %s' % video_type)
         if checkpoint.startswith('listen'):
             listen_type = vmxml.get_devices('graphics')[0].listen_type
             logging.info('listen type is: %s', listen_type)
             if listen_type != checkpoint.split('_')[-1]:
                 log_fail('listen type changed after conversion')
         if checkpoint.startswith('selinux'):
             status = vmchecker.checker.session.cmd('getenforce').strip().lower()
             logging.info('Selinux status after v2v:%s', status)
             if status != checkpoint[8:]:
                 log_fail('Selinux status not match')
         if checkpoint == 'guest_firewalld_status':
             check_firewalld_status(vmchecker.checker, params[checkpoint])
         if checkpoint in ['ntpd_on', 'sync_ntp']:
             check_time_keep(vmchecker.checker)
         # Merge 2 error lists
         error_list.extend(vmchecker.errors)
 def check_result(result, status_error):
     """
     Check virt-v2v command result
     """
     libvirt.check_exit_status(result, status_error)
     output = result.stdout + result.stderr
     if not status_error and checkpoint != 'vdsm':
         if output_mode == 'rhev':
             if not utils_v2v.import_vm_to_ovirt(params, address_cache,
                                                 timeout=v2v_timeout):
                 test.fail('Import VM failed')
         elif output_mode == 'libvirt':
             try:
                 virsh.start(vm_name, debug=True, ignore_status=False)
             except Exception as e:
                 test.fail('Start vm failed: %s', str(e))
         # Check guest following the checkpoint document after convertion
         logging.info('Checking common checkpoints for v2v')
         vmchecker = VMChecker(test, params, env)
         params['vmchecker'] = vmchecker
         ret = vmchecker.run()
         if len(ret) == 0:
             logging.info("All common checkpoints passed")
         # Check specific checkpoints
         if checkpoint == 'rhev_file':
             check_rhev_file_exist(vmchecker.checker)
         if checkpoint == 'console_xvc0':
             check_grub_file(vmchecker.checker, 'console_xvc0')
         if checkpoint in ('vnc_autoport', 'vnc_encrypt'):
             vmchecker.check_graphics(params[checkpoint])
         if checkpoint == 'sdl':
             if output_mode == 'libvirt':
                 vmchecker.check_graphics({'type': 'vnc'})
             elif output_mode == 'rhev':
                 vmchecker.check_graphics({'type': 'spice'})
         if checkpoint == 'pv_with_regular_kernel':
             check_kernel(vmchecker.checker)
         if checkpoint in ['sound', 'pcspk']:
             check_sound_card(vmchecker.checker, checkpoint)
         if checkpoint == 'rhsrvany_md5':
             check_rhsrvany_md5(vmchecker.checker)
         if checkpoint == 'multidisk':
             check_disk(vmchecker.checker, params['disk_count'])
     log_check = utils_v2v.check_log(params, output)
     if log_check:
         log_fail(log_check)
     # Merge 2 error lists
     if params.get('vmchecker'):
         error_list.extend(params['vmchecker'].errors)
     # Virtio drivers will not be installed without virtio-win setup
     if checkpoint == 'virtio_win_unset':
         missing_list = params.get('missing').split(',')
         expect_errors = ['Not find driver: ' + x for x in missing_list]
         logging.debug('Expect errors: %s' % expect_errors)
         logging.debug('Actual errors: %s' % error_list)
         if set(error_list) == set(expect_errors):
             error_list[:] = []
         else:
             logging.error('Virtio drivers not meet expectation')
     if len(error_list):
         test.fail('%d checkpoints failed: %s' % (len(error_list), error_list))