def METHOD_NAME(params, vm, test, check_error_msg=True):
    """
    Check related information in dmesg output
    :param params: config parameters in dict
    :param vm: VM instance
    :param test: test object
    :param check_error_msg: one boolean variable indicating whether need check error message
    """
    error_msg = params.get("error_msg")
    device_target = params.get("target_dev")
    operate_guest_disk_after_killing_nbdserver(vm, device_target)
    def _check_dmeg_msg(error_msg):
        """
        Check whether error_msg in dmesg output
        :param error_msg: error message
        """
        try:
            session = vm.wait_for_login()
            cmd = ("dmesg| tail")
            status, output = session.cmd_status_output(cmd)
            LOG.debug("Disk operation in VM:\nexit code:\n%s\noutput:\n%s",
                      status, output)
            session.cmd("dmesg -C")
            if status != 0:
                return False
        except (remote.LoginError, virt_vm.VMError, aexpect.ShellError) as e:
            LOG.error(str(e))
            session.cmd("dmesg -C")
            return False
        else:
            return re.search(r'%s' % error_msg, output)
    result = _check_dmeg_msg(error_msg)
    if check_error_msg:
        if not result:
            test.fail("Failed to get expected message: %s" % error_msg)
    else:
        if result:
            test.fail("Unexpected messages: %s are found" % error_msg)