I disagree with this approach. Instead of just updating two of the methods, you should be updating all the methods in the FaultAPIs class that could fail in the same way and have them raise an exception. You
should create a new FaultAPIs_v2 class for the updated methods to avoid impacting existing users. When a user of this API wants to use the new exceptions, they will start using the new class.
Bart
From: Lin, Shuicheng [mailto:shuicheng.lin@intel.com]
Sent: February 25, 2019 2:58 AM
To: MacDonald, Eric; Liu, Tao; Bailey, Henry Albert (Al); Wensley, Barton
Cc: Xie, Cindy; starlingx-discuss@lists.starlingx.io
Subject: RE: Improve FM's Python API return data
Hi all,
Based on the comments in patch [0], I will add two new API, get_fault_ex and get_faults_by_id_ex.
I will not add a new class, since all other APIs are kept without change.
For get_fault_ex and get_faults_by_id_ex:
the return value will be alarm list (maybe None).
Exception will be thrown if there is error during API execution.
[0]:
https://review.openstack.org/637655
Best Regards
Shuicheng
From: Lin, Shuicheng [mailto:shuicheng.lin@intel.com]
Sent: Wednesday, February 20, 2019 10:41 AM
To: MacDonald, Eric <Eric.MacDonald@windriver.com>; Liu, Tao <Tao.Liu@windriver.com>; Al.Bailey@windriver.com
Cc: Xie, Cindy <cindy.xie@intel.com>; starlingx-discuss@lists.starlingx.io
Subject: Re: [Starlingx-discuss] Improve FM's Python API return data
Hi Eric,
Thanks for the detail comments.
In my plan, the return value for get_fault API will be like below:
(False, None): there is error in the API execution.
(True, None): API execution correctly, and there is no alarm message.
(True, Alarm): API execution correctly, and there is alarm message.
I think it should fix the issue you have. Is it right?
If you agree on this new API return value change, I will implement it.
Thanks.
Best Regards
Shuicheng
From: MacDonald, Eric [mailto:Eric.MacDonald@windriver.com]
Sent: Tuesday, February 19, 2019 10:35 PM
To: Lin, Shuicheng <shuicheng.lin@intel.com>; Liu, Tao <Tao.Liu@windriver.com>
Cc: Xie, Cindy <cindy.xie@intel.com>
Subject: RE: Improve FM's Python API return data
I took a look and added comments. I don’t think this update fixes the issue I have.
From: Lin, Shuicheng [mailto:shuicheng.lin@intel.com]
Sent: Monday, February 18, 2019 10:09 PM
To: MacDonald, Eric; Liu, Tao
Cc: Xie, Cindy
Subject: RE: Improve FM's Python API return data
Importance: High
Resend the mail.
Best Regards
Shuicheng
From: Lin, Shuicheng
Sent: Tuesday, February 19, 2019 9:56 AM
To: Liu, Tao (Wind River) <tao.liu@windriver.com>; 'eric.macdonald@windriver.com' <eric.macdonald@windriver.com>
Cc: Xie, Cindy <cindy.xie@intel.com>
Subject: Improve FM's Python API return data
Hi Tao/Eric,
For
story 2004859, I plan to modify the get_fault api return value as a tuple.
(True/False, Alarm)
Alarm is valid only when the 1st item is True.
Sample code is uploaded for you early review:
Stx-fault: https://review.openstack.org/637655
Stx-integ: https://review.openstack.org/637656
Could you help review it and share your thought?
If you agree on it, I will implement the code and test it.
For test, I will try to kill fmManager/modify its listening port to simulate the failure case.
For the api call outside of stx-fault, I may try to call it manually to verify.
Please share me if there is better verify method.
Thanks.
Best Regards
Shuicheng