Exemplo n.º 1
0
def create_moblab_repair_strategy():
    """
    Return a `RepairStrategy` for a `MoblabHost`.

    Moblab is a subset of the CrOS verify and repair.  Several pieces
    are removed because they're not expected to be meaningful.  Some
    others are removed for more specific reasons:

    'tpm':  Moblab DUTs don't run the tests that matter to this
        verifier.  TODO(jrbarnette)  This assertion is unproven.

    'good_au':  This verifier can't pass, because the Moblab AU
        procedure doesn't properly delete CrosHost.PROVISION_FAILED.
        TODO(jrbarnette) We should refactor _machine_install() so that
        it can be different for Moblab.

    'firmware':  Moblab DUTs shouldn't be in FAFT pools, so we don't try
        this.

    'powerwash':  Powerwash on Moblab causes trouble with deleting the
        DHCP leases file, so we skip it.
    """
    verify_dag = _moblab_verify_dag()
    repair_actions = _moblab_repair_actions()
    return hosts.RepairStrategy(verify_dag, repair_actions)
Exemplo n.º 2
0
def create_servo_repair_strategy():
    """
    Return a `RepairStrategy` for a `ServoHost`.
    """
    config = ['brd_config', 'ser_config']
    verify_dag = [
        (repair.SshVerifier, 'servo_ssh', []),
        (_UpdateVerifier, 'update', ['servo_ssh']),
        (_BoardConfigVerifier, 'brd_config', ['servo_ssh']),
        (_SerialConfigVerifier, 'ser_config', ['servo_ssh']),
        (_ServodJobVerifier, 'job', config),
        (_ServodConnectionVerifier, 'servod', ['job']),
        (_PowerButtonVerifier, 'pwr_button', ['servod']),
        (_LidVerifier, 'lid_open', ['servod']),
        # TODO(jrbarnette):  We want a verifier for whether there's
        # a working USB stick plugged into the servo.  However,
        # although we always want to log USB stick problems, we don't
        # want to fail the servo because we don't want a missing USB
        # stick to prevent, say, power cycling the DUT.
        #
        # So, it may be that the right fix is to put diagnosis into
        # ServoInstallRepair rather than add a verifier.
    ]

    servod_deps = ['job', 'servod', 'pwr_button', 'lid_open']
    repair_actions = [
        (repair.RPMCycleRepair, 'rpm', [], ['servo_ssh']),
        (_RestartServod, 'restart', ['servo_ssh'], config + servod_deps),
        (_ServoRebootRepair, 'reboot', ['servo_ssh'], servod_deps),
    ]
    return hosts.RepairStrategy(verify_dag, repair_actions)
Exemplo n.º 3
0
def create_jetstream_repair_strategy():
    """
    Return a `RepairStrategy` for a `JetstreamHost`.

    The Jetstream repair strategy is based on the CrOS verify and repair,
    but adds the JetstreamServicesVerifier.
    """
    verify_dag = _jetstream_verify_dag()
    repair_actions = _jetstream_repair_actions()
    return hosts.RepairStrategy(verify_dag, repair_actions)
def create_moblab_repair_strategy():
    """
    Return a `RepairStrategy` for a `MoblabHost`.

    Moblab is a subset of the CrOS verify and repair.  Several pieces
    are removed because they're not expected to be meaningful.  Some
    others are removed for more specific reasons:

    'tpm':  Moblab DUTs don't run the tests that matter to this
        verifier.  TODO(jrbarnette)  This assertion is unproven.

    'good_au':  This verifier can't pass, because the Moblab AU
        procedure doesn't properly delete CrosHost.PROVISION_FAILED.
        TODO(jrbarnette) We should refactor _machine_install() so that
        it can be different for Moblab.

    'firmware':  Moblab DUTs shouldn't be in FAFT pools, so we don't try
        this.

    'powerwash':  Powerwash on Moblab causes trouble with deleting the
        DHCP leases file, so we skip it.
    """
    FirmwareVersionVerifier = cros_firmware.FirmwareVersionVerifier
    verify_dag = [
        (repair.SshVerifier,         'ssh',     []),
        (ACPowerVerifier,            'power',   ['ssh']),
        (FirmwareVersionVerifier,    'rwfw',    ['ssh']),
        (PythonVerifier,             'python',  ['ssh']),
        (repair.LegacyHostVerifier,  'cros',    ['ssh']),
    ]
    au_triggers = ['power', 'rwfw', 'python', 'cros']
    repair_actions = [
        (repair.RPMCycleRepair, 'rpm', [], ['ssh', 'power']),
        (AutoUpdateRepair, 'au', ['ssh'], au_triggers),
    ]
    return hosts.RepairStrategy(verify_dag, repair_actions)
Exemplo n.º 5
0
def create_cros_repair_strategy():
    """Return a `RepairStrategy` for a `CrosHost`."""
    verify_dag = _cros_verify_dag()
    repair_actions = _cros_repair_actions()
    return hosts.RepairStrategy(verify_dag, repair_actions)
def create_cros_repair_strategy():
    """Return a `RepairStrategy` for a `CrosHost`."""
    FirmwareStatusVerifier = cros_firmware.FirmwareStatusVerifier
    FirmwareVersionVerifier = cros_firmware.FirmwareVersionVerifier
    verify_dag = [
        (repair.SshVerifier,         'ssh',      []),
        (DevModeVerifier,            'devmode',  ['ssh']),
        (ACPowerVerifier,            'power',    ['ssh']),
        (EXT4fsErrorVerifier,        'ext4',     ['ssh']),
        (WritableVerifier,           'writable', ['ssh']),
        (TPMStatusVerifier,          'tpm',      ['ssh']),
        (UpdateSuccessVerifier,      'good_au',  ['ssh']),
        (FirmwareStatusVerifier,     'fwstatus', ['ssh']),
        (FirmwareVersionVerifier,    'rwfw',     ['ssh']),
        (PythonVerifier,             'python',   ['ssh']),
        (repair.LegacyHostVerifier,  'cros',     ['ssh']),
    ]

    # The dependencies and triggers for the 'au', 'powerwash', and 'usb'
    # repair actions stack up:  Each one is able to repair progressively
    # more verifiers than the one before.  The 'triggers' lists below
    # show the progression.
    #
    # N.B. AC power detection depends on software on the DUT, and there
    # have been bugs where detection failed even though the DUT really
    # did have power.  So, we make the 'power' verifier a trigger for
    # reinstall repair actions, too.
    #
    # TODO(jrbarnette):  AU repair can't fix all problems reported by
    # the 'cros' verifier; it's listed as an AU trigger as a
    # simplification.  The ultimate fix is to split the 'cros' verifier
    # into smaller individual verifiers.

    usb_triggers       = ['ssh', 'writable']
    powerwash_triggers = ['tpm', 'good_au', 'ext4']
    au_triggers        = ['power', 'rwfw', 'python', 'cros']

    FirmwareRepair = cros_firmware.FirmwareRepair
    repair_actions = [
        # RPM cycling must precede Servo reset:  if the DUT has a dead
        # battery, we need to reattach AC power before we reset via servo.
        (repair.RPMCycleRepair, 'rpm', [], ['ssh', 'power']),
        (ServoSysRqRepair, 'sysrq', [], ['ssh']),
        (ServoResetRepair, 'servoreset', [], ['ssh']),

        # N.B. FirmwareRepair can't fix a 'good_au' failure directly,
        # because it doesn't remove the flag file that triggers the
        # failure.  We include it as a repair trigger because it's
        # possible the the last update failed because of the firmware,
        # and we want the repair steps below to be able to trust the
        # firmware.
        (FirmwareRepair, 'firmware', [], ['ssh', 'fwstatus', 'good_au']),

        (repair.RebootRepair, 'reboot', ['ssh'], ['devmode', 'writable']),

        (AutoUpdateRepair, 'au',
                usb_triggers + powerwash_triggers, au_triggers),
        (PowerWashRepair, 'powerwash',
                usb_triggers, powerwash_triggers + au_triggers),
        (ServoInstallRepair, 'usb',
                [], usb_triggers + powerwash_triggers + au_triggers),
    ]
    return hosts.RepairStrategy(verify_dag, repair_actions)