|
Post by AMI_shirleyh on Jan 17, 2022 13:01:40 GMT
We have the following scenario in which we have 3 properties Task based and one of them has an invalid input. [ Partial Success Scenario in Task Based approach ]
PATCH Request in URI_1
{ "a" : "afdsfa", "b" : "Task_b", "c" : "Task_c" }
Consider a,b,c are String type and User gave property 'a' as String with value not in the allowable list.
Is the following response Format valid ?
Status 202 with @message.ExtendedInfo
@message.ExtendedInfo": [ { "@odata.type": "#Message.v1_0_8.Message", "Message": "The value 'Of' for the property a is not in the list of acceptable values.", "MessageArgs": [ "Of", "a" ], "MessageId": "Base.1.12.PropertyValueNotInList", "RelatedProperties": [ "#/a" ], "Resolution": "Choose a value from the enumeration list that the implementation can support and resubmit the request if the operation failed.", "Severity": "Warning" } ],
{ "@odata.context": "/redfish/v1/$metadata#Task.Task", "@odata.id": "/redfish/v1/TaskService/Tasks/1", "@odata.type": "#Task.v1_4_2.Task", "Description": "Task for URI_1", "Id": "1", "Name": "URI_1", "TaskState": "New" }
|
|
|
Post by shawn on Jan 18, 2022 0:41:03 GMT
IMO, I don't see it correct since the server didn't collect all information it needs from user. And, italso returns 202 if a task created but seems to violate its criteria.
|
|
|
Post by AMI_shirleyh on Jan 19, 2022 5:19:44 GMT
I think as 200 with ExtendedInfo is allowed for Partial Success, we can allow ExtendedInfo with all successful responses.
|
|
|
Post by shawn on Jan 19, 2022 5:45:38 GMT
According to "Asynchronous operations" section, a task should only created that takes long time operation and should return 202. But yes, I think if a task could be created by only "b" and "c" information, then respond 202 with a extenedinfo should be fine.
|
|
|
Post by mraineri on Jan 19, 2022 13:47:51 GMT
Generally speaking, while it's possible to support a partial success with an operation that requires a task, this might be unfavorable to a client. In these cases, the client will be waiting for a final response to the operation in order to take corrective action based on the messages in the end response. Clients are likely to either not monitor those messages in the task or cancel the task to retry the operation. Clients receiving a task will typically poll the task monitor until the task is completed and not necessarily look in the body. It may be worth rejecting the operation completely with a 400. However, if partial success is required, one thing to keep in mind is Task resource already has a common place to stage messages with the "Messages" property. The usage of "@message.ExtendedInfo" is only needed in the final response after the task is complete. So, the pattern would look something like this:
PATCH Request in URI_1
{ "a" : "afdsfa", "b" : "Task_b", "c" : "Task_c" }
HTTP 202 Accepted
{ "@odata.context": "/redfish/v1/$metadata#Task.Task", "@odata.id": "/redfish/v1/TaskService/Tasks/1", "@odata.type": "#Task.v1_4_2.Task", "Description": "Task for URI_1", "Id": "1", "Name": "URI_1", "TaskState": "New", "Messages": [ // Invalid value for prop 'a' and other client errors ] }
HTTP 200 OK
{ "@odata.id": "URI_1", "a": "", "b": "Task_b", "c": "Task_c", "@Message.ExtendedInfo": [ // Invalid value for prop 'a' and other client errors ] } Note the usage of "Messages" in 202 Accepted, and finally "@message.ExtendedInfo" in the final 200 OK response.
|
|
|
Post by AMI_shirleyh on Jan 20, 2022 5:23:58 GMT
Thanks. I'l follow this.
|
|
|
Post by AMI_archerwen on May 27, 2022 11:56:41 GMT
Hi, one more doubt. When PATCH partial value success, if return 200 code, we normally shows correct response + ExtendedInfo. Ex: 1. PATCH valid value for property A 2. PATCH invalid value for property B => Return 200 + resource response (property A is changed) + ExtendedInfo for property B.
But if we use the task to implement the PATCH process. How do we display the resource response (property A is changed) when GET task?
Is below example is correct?
When return 202 Accpted, only display the error message for property B. { "@odata.context": "/redfish/v1/$metadata#Task.Task", "@odata.id": "/redfish/v1/TaskService/Tasks/2", "@odata.type": "#Task.v1_4_2.Task", "Description": "Task for NetworkProtocol Patch Task", "Id": "2", "Name": "NetworkProtocol Patch Task", "TaskState": "New", "Messages": [ { "@odata.type": "#Message.v1_0_8.Message", "Message": "The task with id 2 has completed.", "MessageArgs": [ "2" ], "MessageId": "TaskEvent.1.0.TaskCompletedOK", "Resolution": "None.", "Severity": "OK" }, { "@odata.type": "#Message.v1_0_8.Message", "Message": "The operation failed because this service is disabled and can no longer take incoming requests.", "MessageId": "Ami.1.0.ServiceDisabled", "RelatedProperties": [ "#/NTP/NTPServers" ], "Resolution": "Enable the service and resubmit the request.", "Severity": "Critical" } ] }
After task completed, shows the resource response (property A is changed) + ExtendedInfo for property B: { "@message.ExtendedInfo": [ { "@odata.type": "#Message.v1_0_8.Message", "Message": "The operation failed because this service is disabled and can no longer take incoming requests.", "MessageId": "Ami.1.0.ServiceDisabled", "RelatedProperties": [ "#/NTP/NTPServers" ], "Resolution": "Enable the service and resubmit the request.", "Severity": "Critical" } ], "@odata.context": "/redfish/v1/$metadata#Task.Task", "@odata.etag": "\"1650943133\"", "@odata.id": "/redfish/v1/TaskService/Tasks/2", "@odata.type": "#Task.v1_4_2.Task", "Description": "Task for NetworkProtocol Patch Task", "EndTime": "2022-04-25T23:18:53+20:00", "Id": "2", "Messages": [ { "@odata.type": "#Message.v1_0_8.Message", "Message": "The task with id 2 has completed.", "MessageArgs": [ "2" ], "MessageId": "TaskEvent.1.0.TaskCompletedOK", "Resolution": "None.", "Severity": "OK" }, { "@odata.context": "#ManagerNetworkProtocol.ManagerNetworkProtocol", "@odata.etag": "\"1653641524\"", "@odata.id": "#/redfish/v1/Managers/Self/NetworkProtocol", "@odata.type": "#ManagerNetworkProtocol.v1_6_0.ManagerNetworkProtocol", "Description": "Network Protocol Details", "FQDN": "AMI0020220525AA.megarac.qa", "HTTPS": { "Certificates": { "@odata.id": "/redfish/v1/Managers/Self/NetworkProtocol/HTTPS/Certificates" }, "Port": 443, "ProtocolEnabled": true }, "HostName": "AMI0020220525AA", "IPMI": { "Port": 623, "ProtocolEnabled": true }, "Id": "NetworkProtocol", "KVMIP": { "Port": 443, "ProtocolEnabled": true }, "NTP": { "NTPServers": [ "pool.ntp.org" ], "Port": 123, "ProtocolEnabled": false }, "Name": "Manager Network Protocol", "SNMP": { "AuthenticationProtocol": "Account", "EnableSNMPv1": true, "EnableSNMPv2c": true, "EnableSNMPv3": true, "EncryptionProtocol": "Account", "EngineId": { "ArchitectureId": "80 db 44 95 36 3a 91 90 62", "PrivateEnterpriseId": "80 00 1f 88" }, "Port": 161, "ProtocolEnabled": true }, "SSDP": { "Port": 1900, "ProtocolEnabled": true }, "SSH": { "Port": 22, "ProtocolEnabled": true }, "Status": { "Health": "OK", "State": "Enabled" }, "VirtualMedia": { "Port": 443, "ProtocolEnabled": true } } ], "Name": "NetworkProtocol Patch Task", "StartTime": "2022-04-25T23:18:53+20:00", "TaskState": "Completed", "TaskStatus": "OK" }
|
|
|
Post by mraineri on Jun 1, 2022 13:24:19 GMT
You wouldn't show the ManagerNetworkProtocol resource at all when responding to GET requests on the task monitor until the operation is complete. You can build messages in the Messages array of the Task resource if you'd like to give the client an early indication.
Remember, the task is an intermediate step between the start and end of the operation. The semantics for what is in the response for a partial PATCH success describe the result of the operation, which would apply to the final GET operation on the task monitor after the task is complete.
|
|
|
Post by AMI_archerwen on Jun 8, 2022 4:03:54 GMT
Yes, so about my example, I expected the "partial PATCH success response" would be in the "Message" array after the task completed. I'm not sure the "partial PATCH success response" can be shows in "Message" array or not.
|
|
|
Post by mraineri on Jun 9, 2022 13:56:23 GMT
When the task is complete, the GET operation on the task monitor will return the ManagerNetworkProtocol resource with the extended info array to show the warnings/errors.
GET /redfish/v1/TaskService/TaskMonitors/12345
HTTP 200 OK
{ "@odata.context": "#ManagerNetworkProtocol.ManagerNetworkProtocol", "@odata.etag": "\"1653641524\"", "@odata.id": "#/redfish/v1/Managers/Self/NetworkProtocol", "@odata.type": "#ManagerNetworkProtocol.v1_6_0.ManagerNetworkProtocol", "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_0_8.Message", "Message": "The operation failed because this service is disabled and can no longer take incoming requests.", "MessageId": "Ami.1.0.ServiceDisabled", "RelatedProperties": [ "#/NTP/NTPServers" ], "Resolution": "Enable the service and resubmit the request.", "Severity": "Critical" } ], "Description": "Network Protocol Details", "FQDN": "AMI0020220525AA.megarac.qa", "HTTPS": { "Certificates": { "@odata.id": "/redfish/v1/Managers/Self/NetworkProtocol/HTTPS/Certificates" }, "Port": 443, "ProtocolEnabled": true }, "HostName": "AMI0020220525AA", "IPMI": { "Port": 623, "ProtocolEnabled": true }, "Id": "NetworkProtocol", "KVMIP": { "Port": 443, "ProtocolEnabled": true }, "NTP": { "NTPServers": [ "pool.ntp.org" ], "Port": 123, "ProtocolEnabled": false }, "Name": "Manager Network Protocol", "SNMP": { "AuthenticationProtocol": "Account", "EnableSNMPv1": true, "EnableSNMPv2c": true, "EnableSNMPv3": true, "EncryptionProtocol": "Account", "EngineId": { "ArchitectureId": "80 db 44 95 36 3a 91 90 62", "PrivateEnterpriseId": "80 00 1f 88" }, "Port": 161, "ProtocolEnabled": true }, "SSDP": { "Port": 1900, "ProtocolEnabled": true }, "SSH": { "Port": 22, "ProtocolEnabled": true }, "Status": { "Health": "OK", "State": "Enabled" }, "VirtualMedia": { "Port": 443, "ProtocolEnabled": true } }
A GET on the Task resource would show the status of the task itself, and you can also include the same messages (or other messages about the task itself) in the Messages array if you think it would be useful.
GET /redfish/v1/TaskService/Tasks/2
HTTP 200 OK
{ "@odata.context": "/redfish/v1/$metadata#Task.Task", "@odata.etag": "\"1650943133\"", "@odata.id": "/redfish/v1/TaskService/Tasks/2", "@odata.type": "#Task.v1_4_2.Task", "Description": "Task for NetworkProtocol Patch Task", "EndTime": "2022-04-25T23:18:53+20:00", "Id": "2", "Messages": [ { "@odata.type": "#Message.v1_0_8.Message", "Message": "The operation failed because this service is disabled and can no longer take incoming requests.", "MessageId": "Ami.1.0.ServiceDisabled", "RelatedProperties": [ "#/NTP/NTPServers" ], "Resolution": "Enable the service and resubmit the request.", "Severity": "Critical" } ], "Name": "NetworkProtocol Patch Task", "StartTime": "2022-04-25T23:18:53+20:00", "TaskState": "Completed", "TaskStatus": "OK" }
|
|