'Check the passed kernel identifier against the command line
and the running kernel, abort the job on missmatch.'

def end_reboot_and_verify(self, expected_when, expected_id, subdir, type='src', patches=[]):

    logging.info("POST    BOOT:    checking    booted    kernel    mark=%d    identity='%s'    type='%s'", expected_when, expected_id, type)
    running_id = utils.running_os_ident()
    cmdline = utils.read_one_line('/proc/cmdline')
    find_sum = re.compile('.*IDENT=(\\d+)')
    m = find_sum.match(cmdline)
    cmdline_when = (-1)
    if m:
        cmdline_when = int(m.groups()[0])
    bad = False
    if (((type == 'src') and (expected_id != running_id)) or ((type == 'rpm') and (not running_id.startswith((expected_id + '::'))))):
        logging.error('Kernel    identifier    mismatch')
        bad = True
    if (expected_when != cmdline_when):
        logging.error('Kernel    command    line    mismatch')
        bad = True
    if bad:
        logging.error(('            Expected    Ident:    ' + expected_id))
        logging.error(('                Running    Ident:    ' + running_id))
        logging.error('                Expected    Mark:    %d', expected_when)
        logging.error('Command    Line    Mark:    %d', cmdline_when)
        logging.error(('                    Command    Line:    ' + cmdline))
        self._record_reboot_failure(subdir, 'reboot.verify', 'boot    failure', running_id=running_id)
        raise error.JobError('Reboot    returned    with    the    wrong    kernel')
    self.record('GOOD', subdir, 'reboot.verify', utils.running_os_full_version())
    self.end_reboot(subdir, expected_id, patches, running_id=running_id)
