[AMD Official Use Only - General] Reviewed-by: Abner Chang <[email protected]>
> -----Original Message----- > From: Nickle Wang <[email protected]> > Sent: Thursday, November 23, 2023 10:13 PM > To: [email protected] > Cc: Chang, Abner <[email protected]>; Igor Kulchytskyy > <[email protected]>; Nick Ramirez <[email protected]> > Subject: [edk2-redfish-client][PATCH] > RedfishClientPkg/ComputerSystemCollectionDxe: handle more scenarios > > Caution: This message originated from an External Source. Use proper caution > when opening attachments, clicking links, or responding. > > > This change defines two more error returns and allow feature driver to > handle the scenarios while 1) the resource is not owned by feature > driver. 2) feature driver owns this resource but there is nothing to > manage on this resource now. > Detail changes are: > - Use "%a:" instead of "%a," in debug macro. > - Add two error return from EdkIIRedfishResourceConfigIdentify(). > - EFI_UNSUPPORTED: this resource is not owned by feature driver. > Caller should ignore this resource. > - EFI_NOT_FOUND: this resource is owned by feature driver but > there is nothing to handle now. Caller may ignore rest of > operations and proceed to next Redfish resource. > - Add error return from EdkIIRedfishResourceConfigCheck(). > - EFI_UNSUPPORTED: this resource it not owned by feature driver. > Caller should ignore this URI. > > Signed-off-by: Nickle Wang <[email protected]> > Cc: Abner Chang <[email protected]> > Cc: Igor Kulchytskyy <[email protected]> > Cc: Nick Ramirez <[email protected]> > --- > .../Library/EdkIIRedfishResourceConfigLib.h | 9 ++- > .../ComputerSystemCollectionDxe.c | 59 +++++++++++-------- > 2 files changed, 43 insertions(+), 25 deletions(-) > > diff --git a/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h > b/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h > index a7856033..8999868a 100644 > --- a/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h > +++ b/RedfishClientPkg/Include/Library/EdkIIRedfishResourceConfigLib.h > @@ -77,6 +77,8 @@ EdkIIRedfishResourceConfigUpdate ( > @param[in] Uri The target URI to consume. > > @retval EFI_SUCCESS Value is returned successfully. > + @retval EFI_UNSUPPORTED This resource is not owned by feature > driver. > + Caller should ignore this resource. > @retval Others Some error happened. > > **/ > @@ -94,7 +96,12 @@ EdkIIRedfishResourceConfigCheck ( > @param[in] InformationExchange Pointer to > RESOURCE_INFORMATION_EXCHANGE. > > @retval EFI_SUCCESS This is target resource which we want to > handle. > - @retval EFI_UNSUPPORTED This is not the target resource. > + @retval EFI_UNSUPPORTED This resource is not owned by feature > driver. > + Caller should ignore this resource. > + @retval EFI_NOT_FOUND This resource is owned by feature driver > but > there > + is nothing to handle now. Caller may > ignore the > + rest of operations like check(), > provisioning(), > + consume() and update(). > @retval Others Some error happened. > > **/ > diff --git > a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste > mCollectionDxe.c > b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste > mCollectionDxe.c > index 1e362d49..111f8212 100644 > --- > a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste > mCollectionDxe.c > +++ > b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyste > mCollectionDxe.c > @@ -3,6 +3,7 @@ > Redfish feature driver implementation - ComputerSystemCollection > > (C) Copyright 2020-2022 Hewlett Packard Enterprise Development LP<BR> > + Copyright (c) 2022-2023, NVIDIA CORPORATION & AFFILIATES. All rights > reserved. > > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -32,11 +33,11 @@ HandleResource ( > // Resource match > // > > - DEBUG ((REDFISH_DEBUG_TRACE, "%a, process resource for: %s\n", > __func__, Uri)); > + DEBUG ((REDFISH_DEBUG_TRACE, "%a: process resource for: %s\n", > __func__, Uri)); > > Status = GetRedfishSchemaInfo (Private->RedfishService, Private- > >JsonStructProtocol, Uri, &SchemaInfo); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to get schema information from: %s > %r\n", __func__, Uri, Status)); > + DEBUG ((DEBUG_ERROR, "%a: failed to get schema information from: %s > %r\n", __func__, Uri, Status)); > return Status; > } > > @@ -50,15 +51,19 @@ HandleResource ( > Status = EdkIIRedfishResourceConfigIdentify (&SchemaInfo, Uri, Private- > >InformationExchange); > if (EFI_ERROR (Status)) { > if (Status == EFI_UNSUPPORTED) { > - DEBUG ((DEBUG_MANAGEABILITY, "%a, \"%s\" is not handled by us\n", > __func__, Uri)); > + DEBUG ((DEBUG_MANAGEABILITY, "%a: \"%s\" is not handled by us\n", > __func__, Uri)); > + return EFI_SUCCESS; > + } else if (Status == EFI_NOT_FOUND) { > + DEBUG ((DEBUG_MANAGEABILITY, "%a: \"%s\" has nothing to > handle\n", __func__, Uri)); > + RedfisSetRedfishUri (L"/Systems/{1}", Uri); > return EFI_SUCCESS; > } > > - DEBUG ((DEBUG_ERROR, "%a, fail to identify resource: \"%s\": %r\n", > __func__, Uri, Status)); > + DEBUG ((DEBUG_ERROR, "%a: fail to identify resource: \"%s\": %r\n", > __func__, Uri, Status)); > return Status; > } > } else { > - DEBUG ((REDFISH_DEBUG_TRACE, "%a, history record found: %s\n", > __func__, ConfigLang)); > + DEBUG ((REDFISH_DEBUG_TRACE, "%a: history record found: %s\n", > __func__, ConfigLang)); > // > // Set exchange information > // > @@ -70,7 +75,7 @@ HandleResource ( > AllocateZeroPool (sizeof > (REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG)); > > if (Private->InformationExchange- > >ReturnedInformation.ConfigureLanguageList.List == NULL) { > - DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for > REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG.\n", __func__)); > + DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for > REDFISH_FEATURE_ARRAY_TYPE_CONFIG_LANG.\n", __func__)); > return EFI_OUT_OF_RESOURCES; > } > > @@ -78,7 +83,7 @@ HandleResource ( > Private->InformationExchange- > >ReturnedInformation.ConfigureLanguageList.List[0].ConfigureLang = > (EFI_STRING)AllocateCopyPool (StrSize (ReturnedConfigLang), (VOID > *)ReturnedConfigLang); > } else { > - DEBUG ((DEBUG_ERROR, "%a, > GetArrayIndexFromArrayTypeConfigureLang fail: %r\n", __func__, Status)); > + DEBUG ((DEBUG_ERROR, "%a: > GetArrayIndexFromArrayTypeConfigureLang fail: %r\n", __func__, Status)); > } > > FreePool (ConfigLang); > @@ -91,13 +96,18 @@ HandleResource ( > DEBUG ((REDFISH_DEBUG_TRACE, "%a Check for %s\n", __func__, Uri)); > Status = EdkIIRedfishResourceConfigCheck (&SchemaInfo, Uri); > if (EFI_ERROR (Status)) { > + if (Status == EFI_UNSUPPORTED) { > + DEBUG ((REDFISH_DEBUG_TRACE, "%a: \"%s\" is not handled by us\n", > __func__, Uri)); > + return EFI_SUCCESS; > + } > + > // > // The target property does not exist, do the provision to create > property. > // > DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s\n", __func__, Uri)); > Status = EdkIIRedfishResourceConfigProvisionging (&SchemaInfo, Uri, > Private->InformationExchange, FALSE); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to provision with GET mode: %r\n", > __func__, Status)); > + DEBUG ((DEBUG_ERROR, "%a: failed to provision with GET mode: %r\n", > __func__, Status)); > } > > return Status; > @@ -109,7 +119,7 @@ HandleResource ( > DEBUG ((REDFISH_DEBUG_TRACE, "%a consume for %s\n", __func__, Uri)); > Status = EdkIIRedfishResourceConfigConsume (&SchemaInfo, Uri); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to consume resource for: %s: %r\n", > __func__, Uri, Status)); > + DEBUG ((DEBUG_ERROR, "%a: failed to consume resource for: %s: %r\n", > __func__, Uri, Status)); > } > > // > @@ -118,7 +128,7 @@ HandleResource ( > DEBUG ((REDFISH_DEBUG_TRACE, "%a update for %s\n", __func__, Uri)); > Status = EdkIIRedfishResourceConfigUpdate (&SchemaInfo, Uri); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to update resource for: %s: %r\n", > __func__, Uri, Status)); > + DEBUG ((DEBUG_ERROR, "%a: failed to update resource for: %s: %r\n", > __func__, Uri, Status)); > } > > return Status; > @@ -145,7 +155,7 @@ HandleCollectionResource ( > return EFI_NOT_READY; > } > > - DEBUG ((REDFISH_DEBUG_TRACE, "%a, process collection for: %s\n", > __func__, Private->CollectionUri)); > + DEBUG ((REDFISH_DEBUG_TRACE, "%a: process collection for: %s\n", > __func__, Private->CollectionUri)); > > // > // Convert JSON text to C structure. > @@ -157,7 +167,7 @@ HandleCollectionResource ( > (EFI_REST_JSON_STRUCTURE_HEADER > **)&Collection > ); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n", __func__, > Status)); > + DEBUG ((DEBUG_ERROR, "%a: ToStructure() failed: %r\n", __func__, > Status)); > return Status; > } > > @@ -182,7 +192,7 @@ HandleCollectionResource ( > if (MemberUri != NULL) { > Status = HandleResource (Private, MemberUri); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, process ComputerSystemCollection > resource: %a failed: %r\n", __func__, UriData->Uri, Status)); > + DEBUG ((DEBUG_ERROR, "%a: process ComputerSystemCollection > resource: %a failed: %r\n", __func__, UriData->Uri, Status)); > } > > FreePool (MemberUri); > @@ -216,19 +226,19 @@ CreateCollectionResource ( > return EFI_INVALID_PARAMETER; > } > > - DEBUG ((REDFISH_DEBUG_TRACE, "%a, create resource for collection for: > %s\n", __func__, Private->CollectionUri)); > + DEBUG ((REDFISH_DEBUG_TRACE, "%a: create resource for collection for: > %s\n", __func__, Private->CollectionUri)); > > Status = GetSupportedSchemaVersion (REDFISH_SCHEMA_NAME, > &SchemaInfo); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to find supported schema from HII > database: %r\n", __func__, Status)); > + DEBUG ((DEBUG_ERROR, "%a: failed to find supported schema from HII > database: %r\n", __func__, Status)); > return Status; > } > > - DEBUG ((REDFISH_DEBUG_TRACE, "%a, supported schema: %a > %a.%a.%a\n", __func__, SchemaInfo.Schema, SchemaInfo.Major, > SchemaInfo.Minor, SchemaInfo.Errata)); > + DEBUG ((REDFISH_DEBUG_TRACE, "%a: supported schema: %a > %a.%a.%a\n", __func__, SchemaInfo.Schema, SchemaInfo.Major, > SchemaInfo.Minor, SchemaInfo.Errata)); > > Status = EdkIIRedfishResourceConfigProvisionging (&SchemaInfo, Private- > >CollectionUri, Private->InformationExchange, TRUE); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to create resource for: %s: %r\n", > __func__, Private->CollectionUri, Status)); > + DEBUG ((DEBUG_ERROR, "%a: failed to create resource for: %s: %r\n", > __func__, Private->CollectionUri, Status)); > } > > return Status; > @@ -283,14 +293,14 @@ CollectionHandler ( > return EFI_INVALID_PARAMETER; > } > > - DEBUG ((REDFISH_DEBUG_TRACE, "%a, collection handler for %s\n", > __func__, Private->CollectionUri)); > + DEBUG ((REDFISH_DEBUG_TRACE, "%a: collection handler for %s\n", > __func__, Private->CollectionUri)); > > // > // Query collection from Redfish service. > // > Status = GetResourceByUri (Private->RedfishService, Private->CollectionUri, > &Private->RedResponse); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, unable to get resource from: %s :%r\n", > __func__, Private->CollectionUri, Status)); > + DEBUG ((DEBUG_ERROR, "%a: unable to get resource from: %s :%r\n", > __func__, Private->CollectionUri, Status)); > goto ON_RELEASE; > } > > @@ -350,6 +360,7 @@ RedfishCollectionFeatureCallback ( > > RedfishService = Private->RedfishService; > if (RedfishService == NULL) { > + DEBUG ((DEBUG_ERROR, "%a: no Redfish service configured\n", > __func__)); > return EFI_NOT_READY; > } > > @@ -368,7 +379,7 @@ RedfishCollectionFeatureCallback ( > // > ResourceUri = (EFI_STRING)AllocateZeroPool (MAX_URI_LENGTH * sizeof > (CHAR16)); > if (ResourceUri == NULL) { > - DEBUG ((DEBUG_ERROR, "%a, Fail to allocate memory for full URI.\n", > __func__)); > + DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for full URI.\n", > __func__)); > return EFI_OUT_OF_RESOURCES; > } > > @@ -386,7 +397,7 @@ RedfishCollectionFeatureCallback ( > > Status = CollectionHandler (Private); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, CollectionHandler failure: %r\n", __func__, > Status)); > + DEBUG ((DEBUG_ERROR, "%a: CollectionHandler failure: %r\n", __func__, > Status)); > } > > return EFI_SUCCESS; > @@ -492,7 +503,7 @@ EfiRestJasonStructureProtocolIsReady ( > (VOID **)&mRedfishCollectionPrivate->JsonStructProtocol > ); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to locate > gEfiRestJsonStructureProtocolGuid: %r\n", __func__, Status)); > + DEBUG ((DEBUG_ERROR, "%a: failed to locate > gEfiRestJsonStructureProtocolGuid: %r\n", __func__, Status)); > } > > gBS->CloseEvent (Event); > @@ -528,7 +539,7 @@ EdkIIRedfishFeatureProtocolIsReady ( > (VOID **)&FeatureProtocol > ); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to locate > gEdkIIRedfishFeatureProtocolGuid: %r\n", __func__, Status)); > + DEBUG ((DEBUG_ERROR, "%a: failed to locate > gEdkIIRedfishFeatureProtocolGuid: %r\n", __func__, Status)); > gBS->CloseEvent (Event); > return; > } > @@ -540,7 +551,7 @@ EdkIIRedfishFeatureProtocolIsReady ( > (VOID *)mRedfishCollectionPrivate > ); > if (EFI_ERROR (Status)) { > - DEBUG ((DEBUG_ERROR, "%a, failed to register %s: %r\n", __func__, > REDFISH_MANAGED_URI, Status)); > + DEBUG ((DEBUG_ERROR, "%a: failed to register %s: %r\n", __func__, > REDFISH_MANAGED_URI, Status)); > } > > mRedfishCollectionPrivate->FeatureProtocol = FeatureProtocol; > -- > 2.17.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#111779): https://edk2.groups.io/g/devel/message/111779 Mute This Topic: https://groups.io/mt/102767203/21656 Group Owner: [email protected] Unsubscribe: https://edk2.groups.io/g/devel/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
