[edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: Add debug messages

Chang, Abner via groups.io posted 1 patch 4 months, 1 week ago
Failed in applying to current master (apply log)
.../ComputerSystemCollectionDxe.c                      |  3 ++-
.../EdkIIRedfishResourceConfigLib.c                    |  7 ++++++-
.../Library/RedfishVersionLib/RedfishVersionLib.c      |  2 ++
.../RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c      | 10 ++++++++++
4 files changed, 20 insertions(+), 2 deletions(-)
[edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: Add debug messages
Posted by Chang, Abner via groups.io 4 months, 1 week ago
From: Abner Chang <abner.chang@amd.com>

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
---
 .../ComputerSystemCollectionDxe.c                      |  3 ++-
 .../EdkIIRedfishResourceConfigLib.c                    |  7 ++++++-
 .../Library/RedfishVersionLib/RedfishVersionLib.c      |  2 ++
 .../RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c      | 10 ++++++++++
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
index 595a960300..74003406ef 100644
--- a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
+++ b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCollectionDxe.c
@@ -107,7 +107,7 @@ HandleResource (
     DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s\n", __func__, Uri));
     Status = EdkIIRedfishResourceConfigProvisioning (&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 PATCH mode: %r\n", __func__, Status));
     }
 
     return Status;
@@ -385,6 +385,7 @@ RedfishCollectionFeatureCallback (
 
   StrCatS (ResourceUri, MAX_URI_LENGTH, Private->RedfishVersion);
   StrCatS (ResourceUri, MAX_URI_LENGTH, InformationExchange->SendInformation.FullUri);
+  DEBUG ((DEBUG_MANAGEABILITY, "%a: Redfish collection resource URI - %s\n", __func__, ResourceUri));
 
   //
   // Initialize collection path
diff --git a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c
index 7a7bb4dece..09ae3921e3 100644
--- a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c
+++ b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResourceConfigLib.c
@@ -78,7 +78,12 @@ GetRedfishSchemaInfo (
                                  &Header
                                  );
   if (EFI_ERROR (Status)) {
-    DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n", __func__, Status));
+    if (Status == EFI_UNSUPPORTED) {
+      DEBUG ((DEBUG_ERROR, "%a, No proper JSON to C structure converter for this Redfish resource.\n", __func__));
+    } else {
+      DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n", __func__, Status));
+    }
+
     return Status;
   }
 
diff --git a/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c b/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c
index 45e156ca94..bcaca3c745 100644
--- a/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c
+++ b/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c
@@ -140,6 +140,7 @@ RedfishGetVersion (
 
   if (VersionString != NULL) {
     CacheVersion (Service, VersionString);
+    DEBUG ((DEBUG_MANAGEABILITY, "%a: Redfish version - %s\n", __func__, VersionString));
     return VersionString;
   }
 
@@ -150,6 +151,7 @@ ON_ERROR:
     VersionString = REDFISH_VERSION_DEFAULT_STRING;
   }
 
+  DEBUG ((DEBUG_MANAGEABILITY, "%a: Redfish version - %s\n", __func__, VersionString));
   return AllocateCopyPool (StrSize (VersionString), VersionString);
 }
 
diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
index c0c3ec476f..dce83a8a98 100644
--- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
+++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
@@ -135,6 +135,12 @@ StartUpFeatureDriver (
     return;
   }
 
+  if (CurrentConfigLanguageUri != NULL) {
+    DEBUG ((DEBUG_MANAGEABILITY, "%a: Current Config Language URI - %s\n", __func__, CurrentConfigLanguageUri));
+  } else {
+    DEBUG ((DEBUG_MANAGEABILITY, "%a: Current Config Language URI - Servie Root\n", __func__));
+  }
+
   NextParentUri = (EFI_STRING)AllocateZeroPool (MaxParentUriLength * sizeof (CHAR16));
   if (NextParentUri == NULL) {
     DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for parent configure language.\n", __func__));
@@ -151,6 +157,10 @@ StartUpFeatureDriver (
       ThisList->InformationExchange = mInformationExchange;
       Status                        = SetupExchangeInformationInfo (ThisList, NextParentUri);
       if (!EFI_ERROR (Status)) {
+        DEBUG ((DEBUG_MANAGEABILITY, "%a: Sender exchange information for Collection Feature Driver:\n", __func__));
+        DEBUG ((DEBUG_MANAGEABILITY, "  Parent URI   : %s\n", ThisList->InformationExchange->SendInformation.ParentUri));
+        DEBUG ((DEBUG_MANAGEABILITY, "  Property name: %s\n", ThisList->InformationExchange->SendInformation.PropertyName));
+        DEBUG ((DEBUG_MANAGEABILITY, "  Full URI     : %s\n", ThisList->InformationExchange->SendInformation.FullUri));
         Status = ThisList->Callback (
                              StartupContext->This,
                              StartupContext->Action,
-- 
2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112685): https://edk2.groups.io/g/devel/message/112685
Mute This Topic: https://groups.io/mt/103257786/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [edk2-redfish-client][PATCH] RedfishClientPkg: Add debug messages
Posted by Nickle Wang via groups.io 4 months, 1 week ago

Reviewed-by: Nickle Wang <nicklew@nvidia.com>

Regards,
Nickle

> -----Original Message-----
> From: abner.chang@amd.com <abner.chang@amd.com>
> Sent: Tuesday, December 19, 2023 12:33 PM
> To: devel@edk2.groups.io
> Cc: Nickle Wang <nicklew@nvidia.com>; Igor Kulchytskyy <igork@ami.com>;
> Mike Maslenkin <mike.maslenkin@gmail.com>
> Subject: [edk2-redfish-client][PATCH] RedfishClientPkg: Add debug messages
> 
> External email: Use caution opening links or attachments
> 
> 
> From: Abner Chang <abner.chang@amd.com>
> 
> Signed-off-by: Abner Chang <abner.chang@amd.com>
> Cc: Nickle Wang <nicklew@nvidia.com>
> Cc: Igor Kulchytskyy <igork@ami.com>
> Cc: Mike Maslenkin <mike.maslenkin@gmail.com>
> ---
>  .../ComputerSystemCollectionDxe.c                      |  3 ++-
>  .../EdkIIRedfishResourceConfigLib.c                    |  7 ++++++-
>  .../Library/RedfishVersionLib/RedfishVersionLib.c      |  2 ++
>  .../RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c      | 10 ++++++++++
>  4 files changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git
> a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCo
> llectionDxe.c
> b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCo
> llectionDxe.c
> index 595a960300..74003406ef 100644
> ---
> a/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSystemCo
> llectionDxe.c
> +++ b/RedfishClientPkg/Features/ComputerSystemCollectionDxe/ComputerSyst
> +++ emCollectionDxe.c
> @@ -107,7 +107,7 @@ HandleResource (
>      DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s\n", __func__, Uri));
>      Status = EdkIIRedfishResourceConfigProvisioning (&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 PATCH mode:
> + %r\n", __func__, Status));
>      }
> 
>      return Status;
> @@ -385,6 +385,7 @@ RedfishCollectionFeatureCallback (
> 
>    StrCatS (ResourceUri, MAX_URI_LENGTH, Private->RedfishVersion);
>    StrCatS (ResourceUri, MAX_URI_LENGTH, InformationExchange-
> >SendInformation.FullUri);
> +  DEBUG ((DEBUG_MANAGEABILITY, "%a: Redfish collection resource URI -
> + %s\n", __func__, ResourceUri));
> 
>    //
>    // Initialize collection path
> diff --git
> a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResource
> ConfigLib.c
> b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResource
> ConfigLib.c
> index 7a7bb4dece..09ae3921e3 100644
> ---
> a/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfishResource
> ConfigLib.c
> +++ b/RedfishClientPkg/Library/EdkIIRedfishResourceConfigLib/EdkIIRedfis
> +++ hResourceConfigLib.c
> @@ -78,7 +78,12 @@ GetRedfishSchemaInfo (
>                                   &Header
>                                   );
>    if (EFI_ERROR (Status)) {
> -    DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n", __func__, Status));
> +    if (Status == EFI_UNSUPPORTED) {
> +      DEBUG ((DEBUG_ERROR, "%a, No proper JSON to C structure converter for
> this Redfish resource.\n", __func__));
> +    } else {
> +      DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n", __func__, Status));
> +    }
> +
>      return Status;
>    }
> 
> diff --git a/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c
> b/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c
> index 45e156ca94..bcaca3c745 100644
> --- a/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c
> +++ b/RedfishClientPkg/Library/RedfishVersionLib/RedfishVersionLib.c
> @@ -140,6 +140,7 @@ RedfishGetVersion (
> 
>    if (VersionString != NULL) {
>      CacheVersion (Service, VersionString);
> +    DEBUG ((DEBUG_MANAGEABILITY, "%a: Redfish version - %s\n",
> + __func__, VersionString));
>      return VersionString;
>    }
> 
> @@ -150,6 +151,7 @@ ON_ERROR:
>      VersionString = REDFISH_VERSION_DEFAULT_STRING;
>    }
> 
> +  DEBUG ((DEBUG_MANAGEABILITY, "%a: Redfish version - %s\n", __func__,
> + VersionString));
>    return AllocateCopyPool (StrSize (VersionString), VersionString);  }
> 
> diff --git a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> index c0c3ec476f..dce83a8a98 100644
> --- a/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> +++ b/RedfishClientPkg/RedfishFeatureCoreDxe/RedfishFeatureCoreDxe.c
> @@ -135,6 +135,12 @@ StartUpFeatureDriver (
>      return;
>    }
> 
> +  if (CurrentConfigLanguageUri != NULL) {
> +    DEBUG ((DEBUG_MANAGEABILITY, "%a: Current Config Language URI -
> + %s\n", __func__, CurrentConfigLanguageUri));  } else {
> +    DEBUG ((DEBUG_MANAGEABILITY, "%a: Current Config Language URI -
> + Servie Root\n", __func__));  }
> +
>    NextParentUri = (EFI_STRING)AllocateZeroPool (MaxParentUriLength * sizeof
> (CHAR16));
>    if (NextParentUri == NULL) {
>      DEBUG ((DEBUG_ERROR, "%a: Fail to allocate memory for parent configure
> language.\n", __func__)); @@ -151,6 +157,10 @@ StartUpFeatureDriver (
>        ThisList->InformationExchange = mInformationExchange;
>        Status                        = SetupExchangeInformationInfo (ThisList, NextParentUri);
>        if (!EFI_ERROR (Status)) {
> +        DEBUG ((DEBUG_MANAGEABILITY, "%a: Sender exchange information for
> Collection Feature Driver:\n", __func__));
> +        DEBUG ((DEBUG_MANAGEABILITY, "  Parent URI   : %s\n", ThisList-
> >InformationExchange->SendInformation.ParentUri));
> +        DEBUG ((DEBUG_MANAGEABILITY, "  Property name: %s\n", ThisList-
> >InformationExchange->SendInformation.PropertyName));
> +        DEBUG ((DEBUG_MANAGEABILITY, "  Full URI     : %s\n", ThisList-
> >InformationExchange->SendInformation.FullUri));
>          Status = ThisList->Callback (
>                               StartupContext->This,
>                               StartupContext->Action,
> --
> 2.37.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112719): https://edk2.groups.io/g/devel/message/112719
Mute This Topic: https://groups.io/mt/103257786/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-