已合并
【b3d6ad33c88b64eae08b4ba99f0f235d】feat(cli): 社区软件包剪裁psu work mode的cli接口 #1426
【b3d6ad33c88b64eae08b4ba99f0f235d】feat(cli): 社区软件包剪裁psu work mode的cli接口 #1426
已合并
tangjingman创建于 8月11日
共 6 个文件变更+227-177
@@ -1,5 +1,8 @@
1# Changelog1# Changelog
2All notable changes to this project will be documented in this file.2All notable changes to this project will be documented in this file.
3+## [1.110.100] 2026-08-11
4+社区软件包剪裁psu work mode的cli接口
5+ 
3## [1.110.99] 2026-08-116## [1.110.99] 2026-08-11
4修复ipmcset -t maintenance -d importcsr帮助信息不完整问题7修复ipmcset -t maintenance -d importcsr帮助信息不完整问题
5 8 
@@ -1,4 +1,5 @@
1{%1{%
2+ local cjson = require('cjson')
2 local get_real_work_mode = {3 local get_real_work_mode = {
3 [0] = 'DC',4 [0] = 'DC',
4 [1] = 'AC',5 [1] = 'AC',
@@ -12,9 +13,10 @@
12 one_power.Model,one_power.SerialNumber, one_power.FirmwareVersion, one_power.Rate, get_real_work_mode[one_power.PowerSupplyType])13 one_power.Model,one_power.SerialNumber, one_power.FirmwareVersion, one_power.Rate, get_real_work_mode[one_power.PowerSupplyType])
13 echo(line)14 echo(line)
14 end15 end
15- 16+ if ActiveStandbySupported ~= cjson.null then
16- echo(string.format('\n%-23s :\n', 'Current PSU WorkMode'))17+ echo(string.format('\n%-23s :\n', 'Current PSU WorkMode'))
17- echo(string.format('%-23s :\n', 'Actual PSU Status'))18+ echo(string.format('%-23s :\n', 'Actual PSU Status'))
19+ end
18 -- 支持主备20 -- 支持主备
19 if ActiveStandbySupported == true then21 if ActiveStandbySupported == true then
20 if PowerActualWorkingMode == 'Active/Standby' then22 if PowerActualWorkingMode == 'Active/Standby' then
@@ -29,7 +31,9 @@
29 echo(string.format('%-23s : Load Balancing\n', ' Work Mode'))31 echo(string.format('%-23s : Load Balancing\n', ' Work Mode'))
30 end32 end
31 end33 end
32- echo(string.format('%-23s :\n', 'Predicted PSU Status'))34+ if PowerWorkingMode ~= cjson.null then
35+ echo(string.format('%-23s :\n', 'Predicted PSU Status'))
36+ end
33 -- 期待的电源工作模式37 -- 期待的电源工作模式
34 if PowerWorkingMode == 'Active/Standby' then38 if PowerWorkingMode == 'Active/Standby' then
35 echo(string.format('%-23s : Active/Standby\n', ' Work Mode'))39 echo(string.format('%-23s : Active/Standby\n', ' Work Mode'))
@@ -906,17 +906,17 @@
906 "Usage": "ipmcget -d psuinfo",906 "Usage": "ipmcget -d psuinfo",
907 "Brief": "",907 "Brief": "",
908 "RspBody": {908 "RspBody": {
909- "ActiveStandbySupported": "${ProcessingFlow[1]/Destination/ActiveStandbySupported}",909+ "ActiveStandbySupported": null,
910 "GetPowerList": "${Statements/GetPowerList()}",910 "GetPowerList": "${Statements/GetPowerList()}",
911- "PowerWorkingMode": "${ProcessingFlow[1]/Destination/PowerWorkingMode}",911+ "PowerWorkingMode": null,
912- "PowerActualWorkingMode": "${ProcessingFlow[1]/Destination/PowerActualWorkingMode}",912+ "PowerActualWorkingMode": null,
913- "ExpectedActivePSU": "${ProcessingFlow[1]/Destination/ExpectedActivePSU}",913+ "ExpectedActivePSU": null,
914- "DeepSleepSupported": "${ProcessingFlow[1]/Destination/DeepSleepSupported}",914+ "DeepSleepSupported": null,
915- "DeepSleep": "${ProcessingFlow[1]/Destination/DeepSleep}"915+ "DeepSleep": null
916 },916 },
917 "Statements": {917 "Statements": {
918 "GetPowerList": {918 "GetPowerList": {
919- "Input": "${ProcessingFlow[2]/Destination/PowerList}",919+ "Input": "${ProcessingFlow[1]/Destination/PowerList}",
920 "Steps": [920 "Steps": [
921 {921 {
922 "Type": "Expand"922 "Type": "Expand"
@@ -925,19 +925,6 @@
925 }925 }
926 },926 },
927 "ProcessingFlow": [927 "ProcessingFlow": [
928- {
929- "Type": "Property",
930- "Path": "/bmc/kepler/Systems/1/PowerStrategy",
931- "Interface": "bmc.kepler.Systems.PowerStrategy",
932- "Destination": {
933- "ActiveStandbySupported": "ActiveStandbySupported",
934- "PowerWorkingMode": "PowerWorkingMode",
935- "PowerActualWorkingMode": "PowerActualWorkingMode",
936- "ExpectedActivePSU": "ExpectedActivePSU",
937- "DeepSleepSupported": "DeepSleepSupported",
938- "DeepSleep": "DeepSleep"
939- }
940- },
941 {928 {
942 "Type": "List",929 "Type": "List",
943 "Path": "/bmc/kepler/Systems/1/PowerMgmt",930 "Path": "/bmc/kepler/Systems/1/PowerMgmt",
@@ -669,159 +669,7 @@
669 }669 }
670 ]670 ]
671 },671 },
672- {672+ 
673- "Uri": "/cli/v1/_/psuworkmode",
674- "Interfaces": [
675- {
676- "Type": "Patch",
677- "Usage": "ipmcset -d psuworkmode -v <option> [active psuid|enabled/disabled]",
678- "Description": "Set PSU work mode",
679- "ReqBody": {
680- "Type": "object",
681- "Required": true,
682- "Properties": {
683- "value1": {
684- "Required": false
685- },
686- "value2": {
687- "Required": false
688- },
689- "value3": {
690- "Required": false
691- }
692- }
693- },
694- "RspBody": {
695- "value1": "${ReqBody/value1}",
696- "value2": "${ReqBody/value2}",
697- "value3": "${ReqBody/value3}",
698- "GetAllValueParamsValid": "${Statements/GetAllValueParamsValid()}",
699- "DeepSleepSupported": "${ProcessingFlow[1]/Destination/DeepSleepSupported}",
700- "NormalAndRedundancy": "${ProcessingFlow[1]/Destination/NormalAndRedundancy}",
701- "OnePowerList": "${ProcessingFlow[2]/Destination/OnePowerList}"
702- },
703- "Statements": {
704- "GetAllValueParamsValid": {
705- "Steps": [
706- {
707- "Type": "Script",
708- "Formula": "check_psuworkmode_params_valid.lua"
709- }
710- ]
711- },
712- "GetDeepSleepStatus": {
713- "Input": "${ReqBody/value2}",
714- "Steps": [
715- {
716- "Type": "Switch",
717- "Formula": [
718- {
719- "Case": "enabled",
720- "To": "Enabled"
721- },
722- {
723- "Case": "disabled",
724- "To": "Disabled"
725- }
726- ]
727- }
728- ]
729- }
730- },
731- "ProcessingFlow": [
732- {
733- "Type": "Property",
734- "Path": "/bmc/kepler/Systems/1/PowerStrategy",
735- "Interface": "bmc.kepler.Systems.PowerStrategy",
736- "Destination": {
737- "DeepSleepSupported": "DeepSleepSupported",
738- "NormalAndRedundancy": "NormalAndRedundancy"
739- }
740- },
741- {
742- "Type": "List",
743- "Path": "/bmc/kepler/Systems/1/PowerMgmt",
744- "Destination": {
745- "Members": "OnePowerList"
746- }
747- },
748- {
749- "Type": "Method",
750- "Path": "/bmc/kepler/Systems/1/PowerStrategy",
751- "Interface": "bmc.kepler.Systems.PowerStrategy",
752- "Name": "SetPowerWorkingMode",
753- "Params": [
754- "LoadBalancing",
755- {}
756- ],
757- "CallIf": {
758- "${Statements/GetAllValueParamsValid()}": true,
759- "${ReqBody/value1}": "0",
760- "${ReqBody/value2}": "#WITHOUT",
761- "${ProcessingFlow[1]/Destination/NormalAndRedundancy}": "Disabled"
762- }
763- },
764- {
765- "Type": "Method",
766- "Path": "/bmc/kepler/Systems/1/PowerStrategy",
767- "Interface": "bmc.kepler.Systems.PowerStrategy",
768- "Name": "SetPowerWorkingMode",
769- "Params": [
770- "Active/Standby",
771- [
772- "${ReqBody/value2}"
773- ]
774- ],
775- "CallIf": {
776- "${Statements/GetAllValueParamsValid()}": true,
777- "${ReqBody/value1}": "1",
778- "${ReqBody/value2}": "#WITH",
779- "${ReqBody/value3}": "#WITHOUT",
780- "${ProcessingFlow[1]/Destination/NormalAndRedundancy}": "Disabled"
781- }
782- },
783- {
784- "Type": "Method",
785- "Path": "/bmc/kepler/Systems/1/PowerStrategy",
786- "Interface": "bmc.kepler.Systems.PowerStrategy",
787- "Name": "SetPowerWorkingMode",
788- "Params": [
789- "Active/Standby",
790- [
791- "${ReqBody/value2}",
792- "${ReqBody/value3}"
793- ]
794- ],
795- "CallIf": {
796- "${Statements/GetAllValueParamsValid()}": true,
797- "${ReqBody/value1}": "1",
798- "${ReqBody/value2}": "#WITH",
799- "${ReqBody/value3}": "#WITH",
800- "${ProcessingFlow[1]/Destination/NormalAndRedundancy}": "Disabled"
801- }
802- },
803- {
804- "Type": "Property",
805- "Path": "/bmc/kepler/Systems/1/PowerStrategy",
806- "Interface": "bmc.kepler.Systems.PowerStrategy",
807- "Source": {
808- "DeepSleep": "${Statements/GetDeepSleepStatus()}"
809- },
810- "CallIf": {
811- "${Statements/GetAllValueParamsValid()}": true,
812- "${ReqBody/value1}": "2",
813- "${ReqBody/value2}": "#WITH",
814- "${ReqBody/value3}": "#WITHOUT"
815- }
816- }
817- ],
818- "Echoes": [
819- "ipmcset/_psuworkmode",
820- ""
821- ]
822- }
823- ]
824- },
825 {673 {
826 "Uri": "/cli/v1/_/deluser",674 "Uri": "/cli/v1/_/deluser",
827 "Interfaces": [675 "Interfaces": [
@@ -0,0 +1,51 @@
1+{
2+ "Uri.Actions" : {
3+ "Remove": [],
4+ "Copy": [
5+ {
6+ "Source": "ipmcset/psuworkmode.json",
7+ "Target": "ipmcset/psuworkmode.json"
8+ }
9+ ]
10+ },
11+ "Property.Actions" : [
12+ {
13+ "Target": "ipmcget/target.json",
14+ "Uri": "/cli/v1/_/psuinfo",
15+ "Method": "Get",
16+ "Remove": [
17+ "RspBody/ActiveStandbySupported",
18+ "RspBody/PowerWorkingMode",
19+ "RspBody/PowerActualWorkingMode",
20+ "RspBody/ExpectedActivePSU",
21+ "RspBody/DeepSleepSupported",
22+ "RspBody/DeepSleep"
23+ ],
24+ "Modify": {
25+ "RspBody": {
26+ "ActiveStandbySupported": "${ProcessingFlow[1]/Destination/ActiveStandbySupported}",
27+ "PowerWorkingMode": "${ProcessingFlow[1]/Destination/PowerWorkingMode}",
28+ "PowerActualWorkingMode": "${ProcessingFlow[1]/Destination/PowerActualWorkingMode}",
29+ "ExpectedActivePSU": "${ProcessingFlow[1]/Destination/ExpectedActivePSU}",
30+ "DeepSleepSupported": "${ProcessingFlow[1]/Destination/DeepSleepSupported}",
31+ "DeepSleep": "${ProcessingFlow[1]/Destination/DeepSleep}"
32+ },
33+ "ProcessingFlow": [
34+ {
35+ "Type": "Property",
36+ "Path": "/bmc/kepler/Systems/1/PowerStrategy",
37+ "Interface": "bmc.kepler.Systems.PowerStrategy",
38+ "Destination": {
39+ "ActiveStandbySupported": "ActiveStandbySupported",
40+ "PowerWorkingMode": "PowerWorkingMode",
41+ "PowerActualWorkingMode": "PowerActualWorkingMode",
42+ "ExpectedActivePSU": "ExpectedActivePSU",
43+ "DeepSleepSupported": "DeepSleepSupported",
44+ "DeepSleep": "DeepSleep"
45+ }
46+ }
47+ ]
48+ }
atomgit-bot
atomgit-botatomgit-bot8月11日

🟡 Medium Priority

变更后的社区 target.json 中,GetPowerList.Input 引用 ${ProcessingFlow[1]/Destination/PowerList}(ProcessingFlow 仅含 List 步骤,1-based 索引 [1] 正确指向 List)。

OEM 的 config.json 通过 Modify 向 ProcessingFlow 添加 Property 步骤,但其 RspBody 中 6 个字段均引用 ${ProcessingFlow[1]/Destination/...},同时未更新社区配置中保留的 GetPowerList.Input。

根据合并语义不同,将产生以下任一失败:

  • 若 Property 被 prepend 到索引 [1]:GetPowerList.Input(ProcessingFlow[1])错误指向 Property 步骤,Property 的 Destination 不含 PowerList,导致 GetPowerList 语句失败。
  • 若 Property 被 append 到索引 [2]:OEM 的 RspBody 字段(ActiveStandbySupported 等)引用 ProcessingFlow[1] 错误指向 List 步骤,List 的 Destination 不含这些字段,导致电源模式信息缺失。
  • 若 Modify 的 ProcessingFlow 为整体替换:List 步骤丢失,GetPowerList 同样失败。

无论哪种合并策略,OEM 配置均无法同时保证社区保留的 GetPowerList.Input 与 OEM 新增的 RspBody 字段引用正确。

likedislike
不准确?
tangjingman
tangjingman
8月12日 评论:
49+ }
50+ ]
51+}
@@ -0,0 +1,157 @@
1+{
2+ "Resources": [
3+ {
4+ "Uri": "/cli/v1/_/psuworkmode",
5+ "Interfaces": [
6+ {
7+ "Type": "Patch",
8+ "Usage": "ipmcset -d psuworkmode -v <option> [active psuid|enabled/disabled]",
9+ "Description": "Set PSU work mode",
10+ "ReqBody": {
11+ "Type": "object",
12+ "Required": true,
13+ "Properties": {
14+ "value1": {
15+ "Required": false
16+ },
17+ "value2": {
18+ "Required": false
19+ },
20+ "value3": {
21+ "Required": false
22+ }
23+ }
24+ },
25+ "RspBody": {
26+ "value1": "${ReqBody/value1}",
27+ "value2": "${ReqBody/value2}",
28+ "value3": "${ReqBody/value3}",
29+ "GetAllValueParamsValid": "${Statements/GetAllValueParamsValid()}",
30+ "DeepSleepSupported": "${ProcessingFlow[1]/Destination/DeepSleepSupported}",
31+ "NormalAndRedundancy": "${ProcessingFlow[1]/Destination/NormalAndRedundancy}",
32+ "OnePowerList": "${ProcessingFlow[2]/Destination/OnePowerList}"
33+ },
34+ "Statements": {
35+ "GetAllValueParamsValid": {
36+ "Steps": [
37+ {
38+ "Type": "Script",
39+ "Formula": "check_psuworkmode_params_valid.lua"
40+ }
41+ ]
42+ },
43+ "GetDeepSleepStatus": {
44+ "Input": "${ReqBody/value2}",
45+ "Steps": [
46+ {
47+ "Type": "Switch",
48+ "Formula": [
49+ {
50+ "Case": "enabled",
51+ "To": "Enabled"
52+ },
53+ {
54+ "Case": "disabled",
55+ "To": "Disabled"
56+ }
57+ ]
58+ }
59+ ]
60+ }
61+ },
62+ "ProcessingFlow": [
63+ {
64+ "Type": "Property",
65+ "Path": "/bmc/kepler/Systems/1/PowerStrategy",
66+ "Interface": "bmc.kepler.Systems.PowerStrategy",
67+ "Destination": {
68+ "DeepSleepSupported": "DeepSleepSupported",
69+ "NormalAndRedundancy": "NormalAndRedundancy"
70+ }
71+ },
72+ {
73+ "Type": "List",
74+ "Path": "/bmc/kepler/Systems/1/PowerMgmt",
75+ "Destination": {
76+ "Members": "OnePowerList"
77+ }
78+ },
79+ {
80+ "Type": "Method",
81+ "Path": "/bmc/kepler/Systems/1/PowerStrategy",
82+ "Interface": "bmc.kepler.Systems.PowerStrategy",
83+ "Name": "SetPowerWorkingMode",
84+ "Params": [
85+ "LoadBalancing",
86+ {}
87+ ],
88+ "CallIf": {
89+ "${Statements/GetAllValueParamsValid()}": true,
90+ "${ReqBody/value1}": "0",
91+ "${ReqBody/value2}": "#WITHOUT",
92+ "${ProcessingFlow[1]/Destination/NormalAndRedundancy}": "Disabled"
93+ }
94+ },
95+ {
96+ "Type": "Method",
97+ "Path": "/bmc/kepler/Systems/1/PowerStrategy",
98+ "Interface": "bmc.kepler.Systems.PowerStrategy",
99+ "Name": "SetPowerWorkingMode",
100+ "Params": [
101+ "Active/Standby",
102+ [
103+ "${ReqBody/value2}"
104+ ]
105+ ],
106+ "CallIf": {
107+ "${Statements/GetAllValueParamsValid()}": true,
108+ "${ReqBody/value1}": "1",
109+ "${ReqBody/value2}": "#WITH",
110+ "${ReqBody/value3}": "#WITHOUT",
111+ "${ProcessingFlow[1]/Destination/NormalAndRedundancy}": "Disabled"
112+ }
113+ },
114+ {
115+ "Type": "Method",
116+ "Path": "/bmc/kepler/Systems/1/PowerStrategy",
117+ "Interface": "bmc.kepler.Systems.PowerStrategy",
118+ "Name": "SetPowerWorkingMode",
119+ "Params": [
120+ "Active/Standby",
121+ [
122+ "${ReqBody/value2}",
123+ "${ReqBody/value3}"
124+ ]
125+ ],
126+ "CallIf": {
127+ "${Statements/GetAllValueParamsValid()}": true,
128+ "${ReqBody/value1}": "1",
129+ "${ReqBody/value2}": "#WITH",
130+ "${ReqBody/value3}": "#WITH",
131+ "${ProcessingFlow[1]/Destination/NormalAndRedundancy}": "Disabled"
132+ }
133+ },
134+ {
135+ "Type": "Property",
136+ "Path": "/bmc/kepler/Systems/1/PowerStrategy",
137+ "Interface": "bmc.kepler.Systems.PowerStrategy",
138+ "Source": {
139+ "DeepSleep": "${Statements/GetDeepSleepStatus()}"
140+ },
141+ "CallIf": {
142+ "${Statements/GetAllValueParamsValid()}": true,
143+ "${ReqBody/value1}": "2",
144+ "${ReqBody/value2}": "#WITH",
145+ "${ReqBody/value3}": "#WITHOUT"
146+ }
147+ }
148+ ],
149+ "Echoes": [
150+ "ipmcset/_psuworkmode",
151+ ""
152+ ]
153+ }
154+ ]
155+ }
156+ ]
157+}