def METHOD_NAME(self, record, shift, args, replay_path, image_path, port):
    logger = logging.getLogger('replay')
    vm = self.get_vm()
    vm.set_console()
    if record:
        logger.info('recording the execution...')
        mode = 'record'
    else:
        logger.info('replaying the execution...')
        mode = 'replay'
        vm.add_args('-gdb', 'tcp::%d' % port, '-S')
    vm.add_args('-icount', 'shift=%s,rr=%s,rrfile=%s,rrsnapshot=init' %
                (shift, mode, replay_path),
                '-net', 'none')
    vm.add_args('-drive', 'file=%s,if=none' % image_path)
    if args:
        vm.add_args(*args)
    vm.launch()
    return vm