示例#1
0
                                                  ov_target=test_path,
                                                  ov_enabled="Once")
                boot_obj = redfish_utilities.get_system_boot(
                    redfish_obj, system)
                if boot_obj[
                        "BootSourceOverrideTarget"] != test_path and boot_obj[
                            "BootSourceOverrideEnabled"] != "Once":
                    raise ValueError(
                        "Boot object was not modified after PATCH")
                else:
                    results.update_test_results("Boot Set", 0, None)

                    # Reset the system
                    print("Resetting {}".format(system))
                    try:
                        response = redfish_utilities.system_reset(
                            redfish_obj, system)
                        response = redfish_utilities.poll_task_monitor(
                            redfish_obj, response)
                        redfish_utilities.verify_response(response)

                        # Monitor the system to go back to None
                        print("Monitoring boot progress for {}...".format(
                            system))
                        for i in range(0, 300):
                            time.sleep(1)
                            boot_obj = redfish_utilities.get_system_boot(
                                redfish_obj, system)
                            if boot_obj[
                                    "BootSourceOverrideEnabled"] == "Disabled":
                                break
                        if boot_obj["BootSourceOverrideEnabled"] == "Disabled":
                    help="Indicates if reset information should be reported")
args = argget.parse_args()

# Set up the Redfish object
redfish_obj = redfish.redfish_client(base_url=args.rhost,
                                     username=args.user,
                                     password=args.password)
redfish_obj.login(auth="session")

try:
    if args.info:
        reset_uri, reset_parameters = redfish_utilities.get_system_reset_info(
            redfish_obj, args.system)
        printed_reset_types = False
        for param in reset_parameters:
            if param["Name"] == "ResetType" and "AllowableValues" in param:
                print("Supported reset types: {}".format(", ".join(
                    param["AllowableValues"])))
                printed_reset_types = True
        if not printed_reset_types:
            print("No reset information found")
    else:
        print("Resetting the system...")
        response = redfish_utilities.system_reset(redfish_obj, args.system,
                                                  args.type)
        response = redfish_utilities.poll_task_monitor(redfish_obj, response)
        redfish_utilities.verify_response(response)
finally:
    # Log out
    redfish_obj.logout()
示例#3
0
            if reset_types is None:
                results.update_test_results(
                    "Reset Type Check", 1,
                    "{} is not advertising any allowable resets.".format(
                        system["Id"]))
                continue
            results.update_test_results("Reset Type Check", 0, None)

            # Reset the system
            for reset_type in reset_types:
                if reset_type == "Nmi":
                    # NMI could fail depending on the state of the system; no real reason to test this at this time
                    continue
                print("Resetting {} using {}".format(system["Id"], reset_type))
                try:
                    response = redfish_utilities.system_reset(
                        redfish_obj, system["Id"], reset_type)
                    response = redfish_utilities.poll_task_monitor(
                        redfish_obj, response)
                    redfish_utilities.verify_response(response)
                    results.update_test_results("Reset Performed", 0, None)
                except Exception as err:
                    results.update_test_results(
                        "Reset Performed", 1,
                        "Failed to reset {} using {} ({})".format(
                            system["Id"], reset_type, err))
                    continue

                # Allow some time before checking the power state
                # We also might skip the PowerState check and want to allow for the system to settle before performing another reset
                time.sleep(10)