Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

systems.hpp - initial multi-host implementation #1

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

mox669
Copy link

@mox669 mox669 commented Dec 8, 2023

BMCWEB multi-host implementation

In order to support class 1 multi-host server configurations (i.e. yosemite v3, 1 BMC, N hosts), this change enables bmcweb to gather information on multiple available hosts and handle the information accordingly.
The implementation is based on an already taken - and now abondened - effort from earlier this year as can be seen on gerrit:

The redfish core library api has only support for bmc system with
single host/computer system. The platforms with multiple hosts cannot
be discovered and computer system specific redfish queries is not
supported with the current implementation.

This change adds initial support to discover and populate multihost
systems as well as single host systems and support some system info
queries. The host systems discovery is based on number of host power
state instances.(xyz.openbmc_project.State.Host).

The multi-host computer system discovery is placed under meson option
"unstable-redfish-multi-computer-system". by default this is option
is disabled.In this case existing single host computer system
discovery implementation is unaffected.

The redfish url for single host system is represented by the name
"system".

i.e : /redfish/v1/Systems/system

The multi host system uses the same name with host number at the end.

/redfish/v1/Systems/system1
/redfish/v1/Systems/system2
.
.
/redfish/v1/Systems/systemN

The change expects no impact on current single host implementation.
It only extends the support for multihost bmc systems.

The current changes are only a subset of the patches to come, to fully implement multi host support.

Reviewing

The bmcweb devs wrote a document on common errors. Since I am new to cpp, I might misunderstood or unintentionally ignored one or two of these common errors. Might be good to have a look at the document and have it ready for reviewing.

Testing

NOTE: real hardware testing hasn't been performed yet!
Changes were tested in QEMU with the romulus image by IBM. After successful compilation of bmcweb on local machine,
the resulting patch file has been appended to the yocto build system in meta-ibm/meta-romulus/recipes-phosphor/interfaces/bmcweb.

In general, all Redfish routes touched by the change need to be tested - for both - single-host- and multi-host-configuration to ensure that we don't break the single-host configuration. This means, we have to test the implementation twice (enabling/ disabling -Dexperimental-redfish-multi-computer-system in bmcweb_%.bbappend).
In order to automate this process to some extend, the scripts/test-all-routes.sh curls every route for you, and stores the response in a file that you have to specify as argument to the script. Afterwards you have to compare the response to the expected output:

Expected response

Expected response single host
- GET /redfish/v1/Systems
  Response should contain one system called "system"
- GET /redfish/v1/Systems/system
  Response should contain all information for system called "system"
- GET /redfish/v1/Systems/system0
  Response should contain all information for system called "system"
- GET /redfish/v1/Systems/system1
  Should return 404 resource not found error
- GET /redfish/v1/Systems/foobar
  Should return 404 resource not found error
- GET /redfish/v1/Systems/sysem0
  Should return 404 resource not found error

- GET /redfish/v1/Systems/system/ResetActionInfo
  Response should contain all ResetAction information for system called "system"
- GET /redfish/v1/Systems/system0/ResetActionInfo
  Response should contain all ResetAction information for system called "system"
- GET /redfish/v1/Systems/system1/ResetActionInfo
  Should return 404 resource not found error
- GET /redfish/v1/Systems/foobar/ResetActionInfo
  Should return 404 resource not found error
- GET /redfish/v1/Systems/sysem0/ResetActionInfo
  Should return 404 resource not found error

- POST /redfish/v1/Systems/system/Actions/ComputerSystem.Reset
  Should return 200 OK
- POST /redfish/v1/Systems/system0/Actions/ComputerSystem.Reset
  Should return 200 OK
- POST /redfish/v1/Systems/system1/Actions/ComputerSystem.Reset
  Should return 404 resource not found error
- POST /redfish/v1/Systems/foobar/Actions/ComputerSystem.Reset
  Should return 404 resource not found error
- POST /redfish/v1/Systems/sysem0/Actions/ComputerSystem.Reset
  Should return 404 resource not found error
Expected response multi host
- GET /redfish/v1/Systems
  Response should contain all found systems and display them as
    "system0", "system1", ... "systemN"

- GET /redfish/v1/Systems/system
  Response should contain all information for system called "system"
- GET /redfish/v1/Systems/system0
  Response should contain all information for system called "system0"
- GET /redfish/v1/Systems/system1
  Response should contain all information for system called "system1"
- GET /redfish/v1/Systems/system255
  Should return 404 resource not found IF system255 does not exist
- GET /redfish/v1/Systems/foobar
  Should return 404 resource not found error
- GET /redfish/v1/Systems/sysem0
  Should return 404 resource not found error

- GET /redfish/v1/Systems/system/ResetActionInfo
  Response should contain all ResetAction information for system called "system"
- GET /redfish/v1/Systems/system0/ResetActionInfo
  Response should contain all ResetAction information for system called "system"
- GET /redfish/v1/Systems/system1/ResetActionInfo
  Should return 404 resource not found error
- GET /redfish/v1/Systems/foobar/ResetActionInfo
  Response should contain all ResetAction information for system called "system"
- GET /redfish/v1/Systems/sysem0/ResetActionInfo
  Should return 404 resource not found error

- POST /redfish/v1/Systems/system/Actions/ComputerSystem.Reset
  Should return 200 OK
- POST /redfish/v1/Systems/system0/Actions/ComputerSystem.Reset
  Should return 200 OK
- POST /redfish/v1/Systems/system1/Actions/ComputerSystem.Reset
  Should return 404 resource not found error
- POST /redfish/v1/Systems/foobar/Actions/ComputerSystem.Reset
  Should return 404 resource not found error
- POST /redfish/v1/Systems/sysem0/Actions/ComputerSystem.Reset
  Should return 404 resource not found error

Response of local testing in QEMU

Response single host

GET /redfish/v1/Systems

{
  "@odata.id": "/redfish/v1/Systems",
  "@odata.type": "#ComputerSystemCollection.ComputerSystemCollection",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Systems/system"
    }
  ],
  "Members@odata.count": 1,
  "Name": "Computer System Collection"
}

GET /redfish/v1/Systems/system

{
  "@odata.id": "/redfish/v1/Systems/system",
  "@odata.type": "#ComputerSystem.v1_16_0.ComputerSystem",
  "Actions": {
    "#ComputerSystem.Reset": {
      "@Redfish.ActionInfo": "/redfish/v1/Systems/system/ResetActionInfo",
      "target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset"
    }
  },
  "Bios": {
    "@odata.id": "/redfish/v1/Systems/system/Bios"
  },
  "Boot": {
    "AutomaticRetryAttempts": 3,
    "AutomaticRetryConfig": "RetryAttempts",
    "AutomaticRetryConfig@Redfish.AllowableValues": [
      "Disabled",
      "RetryAttempts"
    ],
    "BootSourceOverrideEnabled": "Disabled",
    "BootSourceOverrideMode": "UEFI",
    "BootSourceOverrideMode@Redfish.AllowableValues": [
      "Legacy",
      "UEFI"
    ],
    "BootSourceOverrideTarget": "None",
    "BootSourceOverrideTarget@Redfish.AllowableValues": [
      "None",
      "Pxe",
      "Hdd",
      "Cd",
      "Diags",
      "BiosSetup",
      "Usb"
    ],
    "RemainingAutomaticRetryAttempts": 3,
    "StopBootOnFault": "Never",
    "TrustedModuleRequiredToBoot": "Disabled"
  },
  "BootProgress": {
    "LastState": "None",
    "LastStateTime": "1970-01-01T00:00:00.000000+00:00"
  },
  "Description": "Computer System",
  "FabricAdapters": {
    "@odata.id": "/redfish/v1/Systems/system/FabricAdapters"
  },
  "GraphicalConsole": {
    "ConnectTypesSupported": [
      "KVMIP"
    ],
    "MaxConcurrentSessions": 4,
    "ServiceEnabled": true
  },
  "Id": "system",
  "IndicatorLED": "Off",
  "LastResetTime": "1970-01-01T00:00:00+00:00",
  "Links": {
    "Chassis": [
      {
        "@odata.id": "/redfish/v1/Chassis/chassis"
      }
    ],
    "ManagedBy": [
      {
        "@odata.id": "/redfish/v1/Managers/bmc"
      }
    ]
  },
  "LocationIndicatorActive": false,
  "LogServices": {
    "@odata.id": "/redfish/v1/Systems/system/LogService"
  },
  "Memory": {
    "@odata.id": "/redfish/v1/Systems/system/Memory"
  },
  "MemorySummary": {
    "TotalSystemMemoryGiB": 0.0
  },
  "Name": "system",
  "PCIeDevices": [],
  "PCIeDevices@odata.count": 0,
  "PowerRestorePolicy": "AlwaysOff",
  "PowerState": "Off",
  "ProcessorSummary": {
    "Count": 0
  },
  "Processors": {
    "@odata.id": "/redfish/v1/Systems/system/Processors"
  },
  "SerialConsole": {
    "IPMI": {
      "ServiceEnabled": true
    },
    "MaxConcurrentSessions": 15,
    "SSH": {
      "HotKeySequenceDisplay": "Press ~. to exit console",
      "Port": 2200,
      "ServiceEnabled": true
    }
  },
  "Status": {
    "Health": "OK",
    "HealthRollup": "OK",
    "State": "Disabled"
  },
  "Storage": {
    "@odata.id": "/redfish/v1/Systems/system/Storage"
  },
  "SystemType": "Physical"
}

GET /redfish/v1/Systems/system0

{
  "@odata.id": "/redfish/v1/Systems/system",
  "@odata.type": "#ComputerSystem.v1_16_0.ComputerSystem",
  "Actions": {
    "#ComputerSystem.Reset": {
      "@Redfish.ActionInfo": "/redfish/v1/Systems/system/ResetActionInfo",
      "target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset"
    }
  },
  "Bios": {
    "@odata.id": "/redfish/v1/Systems/system/Bios"
  },
  "Boot": {
    "AutomaticRetryAttempts": 3,
    "AutomaticRetryConfig": "RetryAttempts",
    "AutomaticRetryConfig@Redfish.AllowableValues": [
      "Disabled",
      "RetryAttempts"
    ],
    "BootSourceOverrideEnabled": "Disabled",
    "BootSourceOverrideMode": "UEFI",
    "BootSourceOverrideMode@Redfish.AllowableValues": [
      "Legacy",
      "UEFI"
    ],
    "BootSourceOverrideTarget": "None",
    "BootSourceOverrideTarget@Redfish.AllowableValues": [
      "None",
      "Pxe",
      "Hdd",
      "Cd",
      "Diags",
      "BiosSetup",
      "Usb"
    ],
    "RemainingAutomaticRetryAttempts": 3,
    "StopBootOnFault": "Never",
    "TrustedModuleRequiredToBoot": "Disabled"
  },
  "BootProgress": {
    "LastState": "None",
    "LastStateTime": "1970-01-01T00:00:00.000000+00:00"
  },
  "Description": "Computer System",
  "FabricAdapters": {
    "@odata.id": "/redfish/v1/Systems/system/FabricAdapters"
  },
  "GraphicalConsole": {
    "ConnectTypesSupported": [
      "KVMIP"
    ],
    "MaxConcurrentSessions": 4,
    "ServiceEnabled": true
  },
  "Id": "system",
  "IndicatorLED": "Off",
  "LastResetTime": "1970-01-01T00:00:00+00:00",
  "Links": {
    "Chassis": [
      {
        "@odata.id": "/redfish/v1/Chassis/chassis"
      }
    ],
    "ManagedBy": [
      {
        "@odata.id": "/redfish/v1/Managers/bmc"
      }
    ]
  },
  "LocationIndicatorActive": false,
  "LogServices": {
    "@odata.id": "/redfish/v1/Systems/system/LogService"
  },
  "Memory": {
    "@odata.id": "/redfish/v1/Systems/system/Memory"
  },
  "MemorySummary": {
    "TotalSystemMemoryGiB": 0.0
  },
  "Name": "system",
  "PCIeDevices": [],
  "PCIeDevices@odata.count": 0,
  "PowerRestorePolicy": "AlwaysOff",
  "PowerState": "Off",
  "ProcessorSummary": {
    "Count": 0
  },
  "Processors": {
    "@odata.id": "/redfish/v1/Systems/system/Processors"
  },
  "SerialConsole": {
    "IPMI": {
      "ServiceEnabled": true
    },
    "MaxConcurrentSessions": 15,
    "SSH": {
      "HotKeySequenceDisplay": "Press ~. to exit console",
      "Port": 2200,
      "ServiceEnabled": true
    }
  },
  "Status": {
    "Health": "OK",
    "HealthRollup": "OK",
    "State": "Disabled"
  },
  "Storage": {
    "@odata.id": "/redfish/v1/Systems/system/Storage"
  },
  "SystemType": "Physical"
}

GET /redfish/v1/Systems/system1

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'system1' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "system1"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.16.0.ResourceNotFound",
    "message": "The requested resource of type ComputerSystem named 'system1' was not found."
  }
}

GET /redfish/v/fileSystems/sysem0

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'sysem0' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "sysem0"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.16.0.ResourceNotFound",
    "message": "The requested resource of type ComputerSystem named 'sysem0' was not found."
  }
}

GET /redfish/v1/Systems/foobar

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'foobar' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "foobar"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.16.0.ResourceNotFound",
    "message": "The requested resource of type ComputerSystem named 'foobar' was not found."
  }
}

GET /redfish/v1/Systems/system/ResetActionInfo

{
  "@odata.id": "/redfish/v1/Systems/system/ResetActionInfo",
  "@odata.type": "#ActionInfo.v1_1_2.ActionInfo",
  "Id": "ResetActionInfo",
  "Name": "Reset Action Info",
  "Parameters": [
    {
      "AllowableValues": [
        "On",
        "ForceOff",
        "ForceOn",
        "ForceRestart",
        "GracefulRestart",
        "GracefulShutdown",
        "PowerCycle",
        "Nmi"
      ],
      "DataType": "String",
      "Name": "ResetType",
      "Required": true
    }
  ]
}

GET /redfish/v1/Systems/system0/ResetActionInfo

{
  "@odata.id": "/redfish/v1/Systems/system0/ResetActionInfo",
  "@odata.type": "#ActionInfo.v1_1_2.ActionInfo",
  "Id": "ResetActionInfo",
  "Name": "Reset Action Info",
  "Parameters": [
    {
      "AllowableValues": [
        "On",
        "ForceOff",
        "ForceOn",
        "ForceRestart",
        "GracefulRestart",
        "GracefulShutdown",
        "PowerCycle",
        "Nmi"
      ],
      "DataType": "String",
      "Name": "ResetType",
      "Required": true
    }
  ]
}

GET /redfish/v1/Systems/system1/ResetActionInfo

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'system1' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "system1"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.16.0.ResourceNotFound",
    "message": "The requested resource of type ComputerSystem named 'system1' was not found."
  }
}

GET /redfish/v1/Systems/sysem0/ResetActionInfo

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'sysem0' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "sysem0"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.16.0.ResourceNotFound",
    "message": "The requested resource of type ComputerSystem named 'sysem0' was not found."
  }
}

GET /redfish/v1/Systems/foobar/ResetActionInfo

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'foobar' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "foobar"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.16.0.ResourceNotFound",
    "message": "The requested resource of type ComputerSystem named 'foobar' was not found."
  }
}

POST /redfish/v1/Systems/system/Actions/ComputerSystem.Reset

{
  "@Message.ExtendedInfo": [
    {
      "@odata.type": "#Message.v1_1_1.Message",
      "Message": "The request completed successfully.",
      "MessageArgs": [],
      "MessageId": "Base.1.16.0.Success",
      "MessageSeverity": "OK",
      "Resolution": "None"
    }
  ]
}

POST /redfish/v1/Systems/system0/Actions/ComputerSystem.Reset

{
  "@Message.ExtendedInfo": [
    {
      "@odata.type": "#Message.v1_1_1.Message",
      "Message": "The request completed successfully.",
      "MessageArgs": [],
      "MessageId": "Base.1.16.0.Success",
      "MessageSeverity": "OK",
      "Resolution": "None"
    }
  ]
}

POST /redfish/v1/Systems/system1/Actions/ComputerSystem.Reset

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'system1' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "system1"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      },
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The parameter GracefulRestart for the action Reset is not supported on the target resource.",
        "MessageArgs": [
          "GracefulRestart",
          "Reset"
        ],
        "MessageId": "Base.1.16.0.ActionParameterNotSupported",
        "MessageSeverity": "Warning",
        "Resolution": "Remove the parameter supplied and resubmit the request if the operation failed."
      }
    ],
    "code": "Base.1.11.0.GeneralError",
    "message": "A general error has occurred. See Resolution for information on how to resolve the error."
  }
}

POST /redfish/v1/Systems/sysem0/Actions/ComputerSystem.Reset

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'sysem0' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "sysem0"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      },
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The parameter GracefulRestart for the action Reset is not supported on the target resource.",
        "MessageArgs": [
          "GracefulRestart",
          "Reset"
        ],
        "MessageId": "Base.1.16.0.ActionParameterNotSupported",
        "MessageSeverity": "Warning",
        "Resolution": "Remove the parameter supplied and resubmit the request if the operation failed."
      }
    ],
    "code": "Base.1.11.0.GeneralError",
    "message": "A general error has occurred. See Resolution for information on how to resolve the error."
  }
}

POST /redfish/v1/Systems/foobar/Actions/ComputerSystem.Reset

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'foobar' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "foobar"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      },
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The parameter GracefulRestart for the action Reset is not supported on the target resource.",
        "MessageArgs": [
          "GracefulRestart",
          "Reset"
        ],
        "MessageId": "Base.1.16.0.ActionParameterNotSupported",
        "MessageSeverity": "Warning",
        "Resolution": "Remove the parameter supplied and resubmit the request if the operation failed."
      }
    ],
    "code": "Base.1.11.0.GeneralError",
    "message": "A general error has occurred. See Resolution for information on how to resolve the error."
  }
}
Response multi host GET /redfish/v1/Systems
{
  "@odata.id": "/redfish/v1/Systems",
  "@odata.type": "#ComputerSystemCollection.ComputerSystemCollection",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Systems/system0"
    }
  ],
  "Members@odata.count": 1,
  "Name": "Computer System Collection"
}

GET /redfish/v1/Systems/system

{
  "@odata.id": "/redfish/v1/Systems/system0",
  "@odata.type": "#ComputerSystem.v1_16_0.ComputerSystem",
  "Actions": {
    "#ComputerSystem.Reset": {
      "@Redfish.ActionInfo": "/redfish/v1/Systems/system0/ResetActionInfo",
      "target": "/redfish/v1/Systems/system0/Actions/ComputerSystem.Reset"
    }
  },
  "Bios": {
    "@odata.id": "/redfish/v1/Systems/system0/Bios"
  },
  "Boot": {
    "AutomaticRetryAttempts": 3,
    "AutomaticRetryConfig": "RetryAttempts",
    "AutomaticRetryConfig@Redfish.AllowableValues": [
      "Disabled",
      "RetryAttempts"
    ],
    "BootSourceOverrideEnabled": "Disabled",
    "BootSourceOverrideMode": "UEFI",
    "BootSourceOverrideMode@Redfish.AllowableValues": [
      "Legacy",
      "UEFI"
    ],
    "BootSourceOverrideTarget": "None",
    "BootSourceOverrideTarget@Redfish.AllowableValues": [
      "None",
      "Pxe",
      "Hdd",
      "Cd",
      "Diags",
      "BiosSetup",
      "Usb"
    ],
    "RemainingAutomaticRetryAttempts": 3,
    "StopBootOnFault": "Never",
    "TrustedModuleRequiredToBoot": "Disabled"
  },
  "BootProgress": {
    "LastState": "None",
    "LastStateTime": "1970-01-01T00:00:00.000000+00:00"
  },
  "Description": "Computer System",
  "FabricAdapters": {
    "@odata.id": "/redfish/v1/Systems/system0/FabricAdapters"
  },
  "GraphicalConsole": {
    "ConnectTypesSupported": [
      "KVMIP"
    ],
    "MaxConcurrentSessions": 4,
    "ServiceEnabled": true
  },
  "Id": "system0",
  "IndicatorLED": "Off",
  "LastResetTime": "1970-01-01T00:00:00+00:00",
  "Links": {
    "Chassis": [
      {
        "@odata.id": "/redfish/v1/Chassis/chassis"
      }
    ],
    "ManagedBy": [
      {
        "@odata.id": "/redfish/v1/Managers/bmc"
      }
    ]
  },
  "LocationIndicatorActive": false,
  "LogServices": {
    "@odata.id": "/redfish/v1/Systems/system0/LogService"
  },
  "Memory": {
    "@odata.id": "/redfish/v1/Systems/system0/Memory"
  },
  "MemorySummary": {
    "TotalSystemMemoryGiB": 0.0
  },
  "Name": "system0",
  "PCIeDevices": [],
  "PCIeDevices@odata.count": 0,
  "PowerRestorePolicy": "AlwaysOff",
  "PowerState": "Off",
  "ProcessorSummary": {
    "Count": 0
  },
  "Processors": {
    "@odata.id": "/redfish/v1/Systems/system0/Processors"
  },
  "SerialConsole": {
    "IPMI": {
      "ServiceEnabled": true
    },
    "MaxConcurrentSessions": 15,
    "SSH": {
      "HotKeySequenceDisplay": "Press ~. to exit console",
      "Port": 2200,
      "ServiceEnabled": true
    }
  },
  "Status": {
    "Health": "OK",
    "HealthRollup": "OK",
    "State": "Disabled"
  },
  "Storage": {
    "@odata.id": "/redfish/v1/Systems/system0/Storage"
  },
  "SystemType": "Physical"
}

GET /redfish/v1/Systems/system0

{
  "@odata.id": "/redfish/v1/Systems/system0",
  "@odata.type": "#ComputerSystem.v1_16_0.ComputerSystem",
  "Actions": {
    "#ComputerSystem.Reset": {
      "@Redfish.ActionInfo": "/redfish/v1/Systems/system0/ResetActionInfo",
      "target": "/redfish/v1/Systems/system0/Actions/ComputerSystem.Reset"
    }
  },
  "Bios": {
    "@odata.id": "/redfish/v1/Systems/system0/Bios"
  },
  "Boot": {
    "AutomaticRetryAttempts": 3,
    "AutomaticRetryConfig": "RetryAttempts",
    "AutomaticRetryConfig@Redfish.AllowableValues": [
      "Disabled",
      "RetryAttempts"
    ],
    "BootSourceOverrideEnabled": "Disabled",
    "BootSourceOverrideMode": "UEFI",
    "BootSourceOverrideMode@Redfish.AllowableValues": [
      "Legacy",
      "UEFI"
    ],
    "BootSourceOverrideTarget": "None",
    "BootSourceOverrideTarget@Redfish.AllowableValues": [
      "None",
      "Pxe",
      "Hdd",
      "Cd",
      "Diags",
      "BiosSetup",
      "Usb"
    ],
    "RemainingAutomaticRetryAttempts": 3,
    "StopBootOnFault": "Never",
    "TrustedModuleRequiredToBoot": "Disabled"
  },
  "BootProgress": {
    "LastState": "None",
    "LastStateTime": "1970-01-01T00:00:00.000000+00:00"
  },
  "Description": "Computer System",
  "FabricAdapters": {
    "@odata.id": "/redfish/v1/Systems/system0/FabricAdapters"
  },
  "GraphicalConsole": {
    "ConnectTypesSupported": [
      "KVMIP"
    ],
    "MaxConcurrentSessions": 4,
    "ServiceEnabled": true
  },
  "Id": "system0",
  "IndicatorLED": "Off",
  "LastResetTime": "1970-01-01T00:00:00+00:00",
  "Links": {
    "Chassis": [
      {
        "@odata.id": "/redfish/v1/Chassis/chassis"
      }
    ],
    "ManagedBy": [
      {
        "@odata.id": "/redfish/v1/Managers/bmc"
      }
    ]
  },
  "LocationIndicatorActive": false,
  "LogServices": {
    "@odata.id": "/redfish/v1/Systems/system0/LogService"
  },
  "Memory": {
    "@odata.id": "/redfish/v1/Systems/system0/Memory"
  },
  "MemorySummary": {
    "TotalSystemMemoryGiB": 0.0
  },
  "Name": "system0",
  "PCIeDevices": [],
  "PCIeDevices@odata.count": 0,
  "PowerRestorePolicy": "AlwaysOff",
  "PowerState": "Off",
  "ProcessorSummary": {
    "Count": 0
  },
  "Processors": {
    "@odata.id": "/redfish/v1/Systems/system0/Processors"
  },
  "SerialConsole": {
    "IPMI": {
      "ServiceEnabled": true
    },
    "MaxConcurrentSessions": 15,
    "SSH": {
      "HotKeySequenceDisplay": "Press ~. to exit console",
      "Port": 2200,
      "ServiceEnabled": true
    }
  },
  "Status": {
    "Health": "OK",
    "HealthRollup": "OK",
    "State": "Disabled"
  },
  "Storage": {
    "@odata.id": "/redfish/v1/Systems/system0/Storage"
  },
  "SystemType": "Physical"
}

GET /redfish/v1/Systems/system1

{
  "@odata.id": "/redfish/v1/Systems/system1",
  "@odata.type": "#ComputerSystem.v1_16_0.ComputerSystem",
  "Actions": {
    "#ComputerSystem.Reset": {
      "@Redfish.ActionInfo": "/redfish/v1/Systems/system1/ResetActionInfo",
      "target": "/redfish/v1/Systems/system1/Actions/ComputerSystem.Reset"
    }
  },
  "Bios": {
    "@odata.id": "/redfish/v1/Systems/system1/Bios"
  },
  "Boot": {
    "StopBootOnFault": "Never",
    "TrustedModuleRequiredToBoot": "Disabled"
  },
  "Description": "Computer System",
  "FabricAdapters": {
    "@odata.id": "/redfish/v1/Systems/system1/FabricAdapters"
  },
  "GraphicalConsole": {
    "ConnectTypesSupported": [
      "KVMIP"
    ],
    "MaxConcurrentSessions": 4,
    "ServiceEnabled": true
  },
  "Id": "system1",
  "IndicatorLED": "Off",
  "Links": {
    "Chassis": [
      {
        "@odata.id": "/redfish/v1/Chassis/chassis"
      }
    ],
    "ManagedBy": [
      {
        "@odata.id": "/redfish/v1/Managers/bmc"
      }
    ]
  },
  "LocationIndicatorActive": false,
  "LogServices": {
    "@odata.id": "/redfish/v1/Systems/system1/LogService"
  },
  "Memory": {
    "@odata.id": "/redfish/v1/Systems/system1/Memory"
  },
  "MemorySummary": {
    "TotalSystemMemoryGiB": 0.0
  },
  "Name": "system1",
  "PCIeDevices": [],
  "PCIeDevices@odata.count": 0,
  "ProcessorSummary": {
    "Count": 0
  },
  "Processors": {
    "@odata.id": "/redfish/v1/Systems/system1/Processors"
  },
  "SerialConsole": {
    "IPMI": {
      "ServiceEnabled": true
    },
    "MaxConcurrentSessions": 15,
    "SSH": {
      "HotKeySequenceDisplay": "Press ~. to exit console",
      "Port": 2200,
      "ServiceEnabled": true
    }
  },
  "Status": {
    "Health": "OK",
    "HealthRollup": "OK",
    "State": "Enabled"
  },
  "Storage": {
    "@odata.id": "/redfish/v1/Systems/system1/Storage"
  },
  "SystemType": "Physical",
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The request failed due to an internal service error.  The service is still operational.",
        "MessageArgs": [],
        "MessageId": "Base.1.16.0.InternalError",
        "MessageSeverity": "Critical",
        "Resolution": "Resubmit the request.  If the problem persists, consider resetting the service."
      },
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The request failed due to an internal service error.  The service is still operational.",
        "MessageArgs": [],
        "MessageId": "Base.1.16.0.InternalError",
        "MessageSeverity": "Critical",
        "Resolution": "Resubmit the request.  If the problem persists, consider resetting the service."
      },
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The request failed due to an internal service error.  The service is still operational.",
        "MessageArgs": [],
        "MessageId": "Base.1.16.0.InternalError",
        "MessageSeverity": "Critical",
        "Resolution": "Resubmit the request.  If the problem persists, consider resetting the service."
      }
    ],
    "code": "Base.1.11.0.GeneralError",
    "message": "A general error has occurred. See Resolution for information on how to resolve the error."
  }
}

GET /redfish/v/fileSystems/sysem0

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'sysem0' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "sysem0"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.16.0.ResourceNotFound",
    "message": "The requested resource of type ComputerSystem named 'sysem0' was not found."
  }
}

GET /redfish/v1/Systems/foobar

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'foobar' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "foobar"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.16.0.ResourceNotFound",
    "message": "The requested resource of type ComputerSystem named 'foobar' was not found."
  }
}```

GET /redfish/v1/Systems/system/ResetActionInfo

```json
{
  "@odata.id": "/redfish/v1/Systems/system/ResetActionInfo",
  "@odata.type": "#ActionInfo.v1_1_2.ActionInfo",
  "Id": "ResetActionInfo",
  "Name": "Reset Action Info",
  "Parameters": [
    {
      "AllowableValues": [
        "On",
        "ForceOff",
        "ForceOn",
        "ForceRestart",
        "GracefulRestart",
        "GracefulShutdown",
        "PowerCycle",
        "Nmi"
      ],
      "DataType": "String",
      "Name": "ResetType",
      "Required": true
    }
  ]
}

GET /redfish/v1/Systems/system0/ResetActionInfo

{
  "@odata.id": "/redfish/v1/Systems/system0/ResetActionInfo",
  "@odata.type": "#ActionInfo.v1_1_2.ActionInfo",
  "Id": "ResetActionInfo",
  "Name": "Reset Action Info",
  "Parameters": [
    {
      "AllowableValues": [
        "On",
        "ForceOff",
        "ForceOn",
        "ForceRestart",
        "GracefulRestart",
        "GracefulShutdown",
        "PowerCycle",
        "Nmi"
      ],
      "DataType": "String",
      "Name": "ResetType",
      "Required": true
    }
  ]
}

GET /redfish/v1/Systems/system1/ResetActionInfo

{
  "@odata.id": "/redfish/v1/Systems/system1/ResetActionInfo",
  "@odata.type": "#ActionInfo.v1_1_2.ActionInfo",
  "Id": "ResetActionInfo",
  "Name": "Reset Action Info",
  "Parameters": [
    {
      "AllowableValues": [
        "On",
        "ForceOff",
        "ForceOn",
        "ForceRestart",
        "GracefulRestart",
        "GracefulShutdown",
        "PowerCycle",
        "Nmi"
      ],
      "DataType": "String",
      "Name": "ResetType",
      "Required": true
    }
  ]
}

GET /redfish/v1/Systems/sysem0/ResetActionInfo

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'sysem0' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "sysem0"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.16.0.ResourceNotFound",
    "message": "The requested resource of type ComputerSystem named 'sysem0' was not found."
  }
}

GET /redfish/v1/Systems/foobar/ResetActionInfo

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'foobar' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "foobar"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      }
    ],
    "code": "Base.1.16.0.ResourceNotFound",
    "message": "The requested resource of type ComputerSystem named 'foobar' was not found."
  }
}

POST /redfish/v1/Systems/system/Actions/ComputerSystem.Reset

{
  "@Message.ExtendedInfo": [
    {
      "@odata.type": "#Message.v1_1_1.Message",
      "Message": "The request completed successfully.",
      "MessageArgs": [],
      "MessageId": "Base.1.16.0.Success",
      "MessageSeverity": "OK",
      "Resolution": "None"
    }
  ]
}

POST /redfish/v1/Systems/system0/Actions/ComputerSystem.Reset

{
  "@Message.ExtendedInfo": [
    {
      "@odata.type": "#Message.v1_1_1.Message",
      "Message": "The request completed successfully.",
      "MessageArgs": [],
      "MessageId": "Base.1.16.0.Success",
      "MessageSeverity": "OK",
      "Resolution": "None"
    }
  ]
}

POST /redfish/v1/Systems/system1/Actions/ComputerSystem.Reset

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The request failed due to an internal service error.  The service is still operational.",
        "MessageArgs": [],
        "MessageId": "Base.1.16.0.InternalError",
        "MessageSeverity": "Critical",
        "Resolution": "Resubmit the request.  If the problem persists, consider resetting the service."
      }
    ],
    "code": "Base.1.16.0.InternalError",
    "message": "The request failed due to an internal service error.  The service is still operational."
  }
}

POST /redfish/v1/Systems/sysem0/Actions/ComputerSystem.Reset

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'sysem0' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "sysem0"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      },
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The parameter GracefulRestart for the action Reset is not supported on the target resource.",
        "MessageArgs": [
          "GracefulRestart",
          "Reset"
        ],
        "MessageId": "Base.1.16.0.ActionParameterNotSupported",
        "MessageSeverity": "Warning",
        "Resolution": "Remove the parameter supplied and resubmit the request if the operation failed."
      }
    ],
    "code": "Base.1.11.0.GeneralError",
    "message": "A general error has occurred. See Resolution for information on how to resolve the error."
  }
}

POST /redfish/v1/Systems/foobar/Actions/ComputerSystem.Reset

{
  "error": {
    "@Message.ExtendedInfo": [
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The requested resource of type ComputerSystem named 'foobar' was not found.",
        "MessageArgs": [
          "ComputerSystem",
          "foobar"
        ],
        "MessageId": "Base.1.16.0.ResourceNotFound",
        "MessageSeverity": "Critical",
        "Resolution": "Provide a valid resource identifier and resubmit the request."
      },
      {
        "@odata.type": "#Message.v1_1_1.Message",
        "Message": "The request body submitted was malformed JSON and could not be parsed by the receiving service.",
        "MessageArgs": [],
        "MessageId": "Base.1.16.0.MalformedJSON",
        "MessageSeverity": "Critical",
        "Resolution": "Ensure that the request body is valid JSON and resubmit the request."
      }
    ],
    "code": "Base.1.11.0.GeneralError",
    "message": "A general error has occurred. See Resolution for information on how to resolve the error."
  }
}

@mox669 mox669 requested a review from MDr164 December 8, 2023 12:48
@mox669 mox669 force-pushed the dev/multi-host-impl branch 2 times, most recently from 2b0ba60 to af944a1 Compare February 27, 2024 14:55
redfish-core/lib/systems.hpp Outdated Show resolved Hide resolved
redfish-core/include/utils/collection.hpp Outdated Show resolved Hide resolved
redfish-core/lib/systems.hpp Outdated Show resolved Hide resolved
redfish-core/lib/systems.hpp Outdated Show resolved Hide resolved
redfish-core/lib/systems.hpp Outdated Show resolved Hide resolved
redfish-core/lib/systems.hpp Outdated Show resolved Hide resolved
redfish-core/lib/systems.hpp Outdated Show resolved Hide resolved
@mox669 mox669 force-pushed the dev/multi-host-impl branch 4 times, most recently from 28045c1 to d5b9425 Compare April 17, 2024 12:58
@mox669 mox669 force-pushed the dev/multi-host-impl branch 10 times, most recently from 2e50134 to c885511 Compare May 15, 2024 12:35
@mox669 mox669 force-pushed the dev/multi-host-impl branch 9 times, most recently from 411fc52 to 54989b9 Compare May 16, 2024 16:28
@mox669 mox669 force-pushed the dev/multi-host-impl branch 5 times, most recently from 8b80c57 to fab200d Compare July 26, 2024 11:33
@mox669 mox669 force-pushed the dev/multi-host-impl branch 19 times, most recently from 08f4df7 to 10fabff Compare August 19, 2024 17:33
Oliver Brewka added 2 commits August 22, 2024 14:11
This change introduces a new a function similar to getCollectionMembers
but specific to computerSystem discovery. Since more
functionality will be added soon to support multi host redfish
and in general request handling with the long term goal not using
hardcoded URIs anymore, a new utility header for systems.hpp is being
introduced in this patch that will hold the rest of the incoming
definitions.

getSystemCollectionMembers supports multi host platforms like
yosemite4 or bletchley. Currently we have to distinguish between single
and multi host platforms and unfortunately handle both separate
from each other, thus cannot use the generic getCollectionMembers from
collection.hpp. However, this should change sometime in the future.
It should be mentioned, that functionalitywise the newly introduced
function shares almost all of the code used in getCollectionMembers from
collection.hpp. Only simplification has been done, since this function
only serves a single usecase.

Testing: To test the functionality, requests have been manually made
to check the response for both, single and multi host emulated in qemu.
For the multi host platform a yosemite4 image with 8 emulated eeproms
has been used, single host was performed on the same image with only 1
emulated eeprom that EM would probe against to identify an available
host.

"single host"
{
  "@odata.id": "/redfish/v1/Systems",
  "@odata.type": "#ComputerSystemCollection.ComputerSystemCollection",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Systems/system"
    }
  ],
  "Members@odata.count": 1,
  "Name": "Computer System Collection"
}

multi host
{
  "@odata.id": "/redfish/v1/Systems",
  "@odata.type": "#ComputerSystemCollection.ComputerSystemCollection",
  "Members": [
{
  "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_T1_Slot_1"
},
{
  "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_T1_Slot_2"
},
{
  "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_T1_Slot_3"
},
{
  "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_T1_Slot_4"
},
{
  "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_T1_Slot_5"
},
{
  "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_T1_Slot_6"
},
{
  "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_T1_Slot_7"
},
{
  "@odata.id": "/redfish/v1/Systems/Yosemite_4_Sentinel_Dome_T1_Slot_8"
}
  ],
  "Members@odata.count": 8,
  "Name": "Computer System Collection"
}%

Change-Id: I82d59487b7c17b22cd638acd8f687f31c96ca156
Signed-off-by: Oliver Brewka <mox669.dev@gmail.com>
In an effort to support multi host in bmcweb, a new method to retrieve
dbus resources is needed. Since the long term goal for bmcweb is to get
rid of hardcoded URIs as much as possible to align with the redfish
spec, this method shall handle single host as well.

Initially bmcweb hardcoded object paths and services to retrieve various
resources via dbus method calls. However, the introduction of multi host
platforms also introduces new service names and object paths.
Hardcoding them does not cut it anymore, since we don't necessarily
know how they are called, nor should we do any assumptions on naming
schemes by default.

This method follows this idea and lets DBUS return needed paths and
services, if any, primarily based on a systemName the user sends
a request for.

Change-Id: I67c17c3dd7a354fa9a2ebbc56d4def7a7e788909
Signed-off-by: Oliver Brewka <mox669.dev@gmail.com>
Change-Id: I3b825e42c52f017659553ff22a7bacf9e07cfa6f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants