public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Mike Maslenkin" <mike.maslenkin@gmail.com>
To: Nickle Wang <nicklew@nvidia.com>
Cc: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"abner.chang@amd.com" <abner.chang@amd.com>,
	"igork@ami.com" <igork@ami.com>
Subject: Re: [edk2-devel] [edk2-redfish-client][PATCH 4/4] RedfishClientPkg: use POST method while provisioning new property.
Date: Mon, 18 Dec 2023 03:33:01 +0300	[thread overview]
Message-ID: <EE356099-04CD-4380-8B3D-6BEDFF51C54C@gmail.com> (raw)
In-Reply-To: <MW4PR12MB7031581D22691CD171305654D993A@MW4PR12MB7031.namprd12.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 5686 bytes --]


Hi Nickle,

> On 15. 12. 2023., at 04:53, Nickle Wang <nicklew@nvidia.com> wrote:
> 
> Hi Mike,
> 
> Per Redfish specification 7.9 POST(create)
> 
> "The POST request is submitted to the resource collection to which the new resource will belong."
> 
> If this is not a collection resource, we cannot use POST method. And /redfish/v1/Systems/SYS_ID/Bios is not a collection resource. The allowed method returned from BMC for BIOS resource is usually "GET" and "PUT".
> 
> So, I think that the fourth parameter is still FALSE here. But I admit that the function header below is confusing and did not express above rule clearly.
> 
> /**
>  Provisioning redfish resource by given URI.
> 
>  @param[in]   Schema              Redfish schema information.
>  @param[in]   Uri                 Target URI to create resource.
>  @param[in]   InformationExchange Pointer to RESOURCE_INFORMATION_EXCHANGE.
>  @param[in]   HttpPostMode        TRUE if resource does not exist, HTTP POST method is used.
>                                   FALSE if the resource exist but some of properties are missing,
>                                   HTTP PUT method is used.
> 
>  @retval EFI_SUCCESS              Value is returned successfully.
>  @retval Others                   Some error happened.
> 
> **/
> 
> Below is my suggestion.
> 
>  @param[in]   HttpPostMode        TRUE if target resource is a member of collection resource, HTTP POST method is used.
>                                                             FALSE if target resource is non-collection resource, HTTP PUT method is used.
> 
> Do you think this helps to explain the use-case of fourth parameter more clearly?
> 
> Thanks,
> Nickle


Seems like more comments need to be changed....
The idea behind this patch is the basis of the current implementation of RedfishClientPkg/Features/Bios/v1_0_9.
The EdkIIRedfishResourceConfigProvisioning function calls the EDKII_REDFISH_RESOURCE_CONFIG_PROTOCOL::Provisioning function,
this is RedfishResourceProvisioningResource() for this driver[1], then it calls RedfishProvisioningResourceCommon() where the logic
of this flag is completely changed [2].
So, for the current implementation of this flag, it is not a choice between POST and PUT, but between POST and PATCH (see [1]).
May be flag should not be inverted here [3]? 
The value of FALSE here (you expect PUT to be used) means the following ProvisioningBiosExistResource() function calls
ProvisioningBiosProperties() with ProvisionMode == TRUE. This ProvisionMode == TRUE forces PropertyChanged set into TRUE,
so finally ProvisioningBiosProperties() returns success even for elements that do not exist.

Here I mean elements of /redfish/v1/Systems/{SystemID}/Bios/Attributes. I'm in situation when Attributes exists,
but it is empty.

Currently the PUT method is not used anywhere in RedfishClientPkg/Features/Bios and "PUT back to instance" actually performs the PATCH.

I will drop this patch from the current PR until it becomes clear how this can be improved.

Regards,
Mike.
> 
>> -----Original Message-----
>> From: Mike Maslenkin <mike.maslenkin@gmail.com>
>> Sent: Friday, December 15, 2023 8:04 AM
>> To: devel@edk2.groups.io
>> Cc: abner.chang@amd.com; Nickle Wang <nicklew@nvidia.com>;
>> igork@ami.com; Mike Maslenkin <mike.maslenkin@gmail.com>
>> Subject: [edk2-redfish-client][PATCH 4/4] RedfishClientPkg: use POST method
>> while provisioning new property.
>> 
>> External email: Use caution opening links or attachments
>> 
>> 
>> If EdkIIRedfishResourceConfigCheck fails according to the logic and
>> comment: new resources should be provisioned, so the POST method must be
>> used. Fourth parameter of EdkIIRedfishResourceConfigProvisioning is BOOLEAN
>> HttpPostMode, so we pass TRUE here.
>> 
>> Cc: Abner Chang <abner.chang@amd.com>
>> Cc: Igor Kulchytskyy <igork@ami.com>
>> Cc: Nickle Wang <nicklew@nvidia.com>
>> Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
>> ---
>> RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
>> b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
>> index a26a1083cd74..4fd4845f3420 100644
>> --- a/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
>> +++ b/RedfishClientPkg/Features/Bios/v1_0_9/Common/BiosCommon.c
>> @@ -818,9 +818,9 @@ HandleResource (
>>     // The target property does not exist, do the provision to create property.
>> 
>>     //
>> 
>>     DEBUG ((REDFISH_DEBUG_TRACE, "%a provision for %s\n", __func__, Uri));
>> 
>> -    Status = EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri, Private-
>>> InformationExchange, FALSE);
>> 
>> +    Status = EdkIIRedfishResourceConfigProvisioning (&SchemaInfo, Uri,
>> + Private->InformationExchange, TRUE);
>> 
>>     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 POST mode:
>> + %r\n", __func__, Status));
>> 
>>     }
>> 
>> 
>> 
>>     return Status;
>> 
>> --
>> 2.32.0 (Apple Git-132)

> 




-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#112610): https://edk2.groups.io/g/devel/message/112610
Mute This Topic: https://groups.io/mt/103181641/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 12041 bytes --]

  reply	other threads:[~2023-12-18  0:33 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15  0:03 [edk2-devel] [edk2-redfish-client][PATCH 0/4] change method for provisioning + minor fixes Mike Maslenkin
2023-12-15  0:03 ` [edk2-devel] [edk2-redfish-client][PATCH 1/4] RedfishClientPkg: add check for NULL pointer to avoid ASSERT Mike Maslenkin
2023-12-15  1:23   ` Nickle Wang via groups.io
2023-12-15  0:03 ` [edk2-devel] [edk2-redfish-client][PATCH 2/4] RedfishClientPkg: fix typo in EfiRestJsonStructureProtocolIsReady Mike Maslenkin
2023-12-15  1:23   ` Nickle Wang via groups.io
2023-12-15  0:03 ` [edk2-devel] [edk2-redfish-client][PATCH 3/4] RedfishClientPkg: fix access to unitialized variable Mike Maslenkin
2023-12-15  1:24   ` Nickle Wang via groups.io
2023-12-15  0:04 ` [edk2-devel] [edk2-redfish-client][PATCH 4/4] RedfishClientPkg: use POST method while provisioning new property Mike Maslenkin
2023-12-15  1:53   ` Nickle Wang via groups.io
2023-12-18  0:33     ` Mike Maslenkin [this message]
     [not found]     ` <17A1C5C572E0EF8A.24236@groups.io>
2023-12-18  0:57       ` Mike Maslenkin
2023-12-18  5:32         ` Chang, Abner via groups.io

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=EE356099-04CD-4380-8B3D-6BEDFF51C54C@gmail.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox