已开启
feat: 支持主备管理北向接口适配 #1493
malfoy创建于 13 天前
feat: 支持主备管理北向接口适配 #1493
已开启
共 13 个文件变更+376-19
| @@ -931,6 +931,20 @@ | |||
| 931 | ] | 931 | ] |
| 932 | } | 932 | } |
| 933 | }, | 933 | }, |
| 934 | + { | ||
| 935 | + "Targets": [ | ||
| 936 | + "/redfish/v1/Managers/{id}/Actions/Manager.ForceFailover" | ||
| 937 | + ], | ||
| 938 | + "OperationMap": { | ||
| 939 | + "POST": [ | ||
| 940 | + { | ||
| 941 | + "Privilege": [ | ||
| 942 | + "ConfigureComponents" | ||
| 943 | + ] | ||
| 944 | + } | ||
| 945 | + ] | ||
| 946 | + } | ||
| 947 | + }, | ||
| 934 | { | 948 | { |
| 935 | "Targets": [ | 949 | "Targets": [ |
| 936 | "/redfish/v1/Managers/{id}/Actions/Oem/{{OemIdentifier}}/Manager.GeneralDownload", | 950 | "/redfish/v1/Managers/{id}/Actions/Oem/{{OemIdentifier}}/Manager.GeneralDownload", |
| @@ -188,6 +188,36 @@ | |||
| 188 | } | 188 | } |
| 189 | ] | 189 | ] |
| 190 | }, | 190 | }, |
| 191 | + { | ||
| 192 | + "Uri": "/redfish/v1/Managers/:managerid/ForceFailoverActionInfo", | ||
| 193 | + "Interfaces": [ | ||
| 194 | + { | ||
| 195 | + "Type": "GET", | ||
| 196 | + "ResourceExist": { | ||
| 197 | + "${Statements/IsValidManagersId()}": true | ||
| 198 | + }, | ||
| 199 | + "RspBody": { | ||
| 200 | + "@odata.context": "/redfish/v1/$metadata#ActionInfo.ActionInfo", | ||
| 201 | + "@odata.id": "/redfish/v1/Managers/${Uri/managerid}/ForceFailoverActionInfo", | ||
| 202 | + "@odata.type": "#ActionInfo.v1_0_1.ActionInfo", | ||
| 203 | + "Id": "ForceFailoverActionInfo", | ||
| 204 | + "Name": "Force Failover Action Info", | ||
| 205 | + "Parameters": [], | ||
| 206 | + "Oem": {} | ||
| 207 | + }, | ||
| 208 | + "Statements": { | ||
| 209 | + "IsValidManagersId": { | ||
| 210 | + "Steps": [ | ||
| 211 | + { | ||
| 212 | + "Type": "Plugin", | ||
| 213 | + "Formula": "utils.is_valid_managers_id(Uri.managerid)" | ||
| 214 | + } | ||
| 215 | + ] | ||
| 216 | + } | ||
| 217 | + } | ||
| 218 | + } | ||
| 219 | + ] | ||
| 220 | + }, | ||
| 191 | { | 221 | { |
| 192 | "Uri": "/redfish/v1/Managers/:managerid/Actions/Oem/{{OemIdentifier}}/Manager.RollBack", | 222 | "Uri": "/redfish/v1/Managers/:managerid/Actions/Oem/{{OemIdentifier}}/Manager.RollBack", |
| 193 | "Interfaces": [ | 223 | "Interfaces": [ |
| @@ -1522,6 +1552,64 @@ | |||
| 1522 | } | 1552 | } |
| 1523 | } | 1553 | } |
| 1524 | ] | 1554 | ] |
| 1555 | + }, | ||
| 1556 | + { | ||
| 1557 | + "Uri": "/redfish/v1/Managers/:managerid/Actions/Manager.ForceFailover", | ||
| 1558 | + "Interfaces": [ | ||
| 1559 | + { | ||
| 1560 | + "Type": "POST", | ||
| 1561 | + "ResourceExist": { | ||
| 1562 | + "${Statements/IsValidManagersId()}": true, | ||
| 1563 | + "${Statements/IsHasActiveAndStandby()}": true | ||
| 1564 | + }, | ||
| 1565 | + "Statements": { | ||
| 1566 | + "IsValidManagersId": { | ||
| 1567 | + "Steps": [ | ||
| 1568 | + { | ||
| 1569 | + "Type": "Plugin", | ||
| 1570 | + "Formula": "utils.is_valid_managers_id(Uri.managerid)" | ||
| 1571 | + } | ||
| 1572 | + ] | ||
| 1573 | + }, | ||
| 1574 | + "IsHasActiveAndStandby": { | ||
| 1575 | + "Steps": [ | ||
| 1576 | + { | ||
| 1577 | + "Type": "Plugin", | ||
| 1578 | + "Formula": "utils.is_has_active_and_standby(ProcessingFlow[1].Destination.ActiveStatus, ProcessingFlow[2].Destination.RemoteIdPaths)" | ||
| 1579 | + } | ||
| 1580 | + ] | ||
| 1581 | + } | ||
| 1582 | + }, | ||
| 1583 | + "ProcessingFlow": [ | ||
| 1584 | + { | ||
| 1585 | + "Type": "Property", | ||
| 1586 | + "Path": "/bmc/kepler/Managers/1/ActiveStandby/Local", | ||
W | |||
| 1587 | + "Interface": "bmc.kepler.Managers.ActiveStandby.Status", | ||
| 1588 | + "Destination": { | ||
| 1589 | + "ActiveStatus": "ActiveStatus" | ||
| 1590 | + } | ||
| 1591 | + }, | ||
| 1592 | + { | ||
| 1593 | + "Type": "List", | ||
| 1594 | + "Path": "/bmc/kepler/Managers/1/ActiveStandby/Remotes", | ||
| 1595 | + "Interface": "bmc.kepler.Managers.ActiveStandby.Remote", | ||
| 1596 | + "Destination": { | ||
| 1597 | + "Members": "RemoteIdPaths" | ||
| 1598 | + } | ||
| 1599 | + }, | ||
| 1600 | + { | ||
| 1601 | + "Type": "Method", | ||
| 1602 | + "Path": "/bmc/kepler/Managers/1/ActiveStandby/Local", | ||
| 1603 | + "Interface": "bmc.kepler.Managers.ActiveStandby.Local", | ||
| 1604 | + "Name": "SwitchStatus", | ||
| 1605 | + "Params": [0], | ||
| 1606 | + "Destination": { | ||
| 1607 | + "TaskId": "TaskId" | ||
| 1608 | + } | ||
| 1609 | + } | ||
| 1610 | + ] | ||
| 1611 | + } | ||
| 1612 | + ] | ||
| 1525 | } | 1613 | } |
| 1526 | ] | 1614 | ] |
| 1527 | } | 1615 | } |
| @@ -103,7 +103,7 @@ | |||
| 103 | "Severity": "${Statements/BMCStatus()/Severity}" | 103 | "Severity": "${Statements/BMCStatus()/Severity}" |
| 104 | } | 104 | } |
| 105 | }, | 105 | }, |
| 106 | - "State": "Enabled" | 106 | + "State": "${Statements/GetActiveStatus()}" |
| 107 | }, | 107 | }, |
| 108 | "GraphicalConsole": { | 108 | "GraphicalConsole": { |
| 109 | "ServiceEnabled": "${ProcessingFlow[6]/Destination/ServiceEnabled}", | 109 | "ServiceEnabled": "${ProcessingFlow[6]/Destination/ServiceEnabled}", |
| @@ -264,6 +264,10 @@ | |||
| 264 | "target": "/redfish/v1/Managers/${Uri/managerid}/Actions/Manager.ResetToDefaults", | 264 | "target": "/redfish/v1/Managers/${Uri/managerid}/Actions/Manager.ResetToDefaults", |
| 265 | "@Redfish.ActionInfo": "/redfish/v1/Managers/${Uri/managerid}/ResetToDefaultsActionInfo" | 265 | "@Redfish.ActionInfo": "/redfish/v1/Managers/${Uri/managerid}/ResetToDefaultsActionInfo" |
| 266 | }, | 266 | }, |
| 267 | + "#Manager.ForceFailover": { | ||
| 268 | + "target": "/redfish/v1/Managers/${Uri/managerid}/Actions/Manager.ForceFailover", | ||
| 269 | + "@Redfish.ActionInfo": "/redfish/v1/Managers/${Uri/managerid}/ForceFailoverActionInfo" | ||
| 270 | + }, | ||
| 267 | "Oem": { | 271 | "Oem": { |
| 268 | "{{OemIdentifier}}": { | 272 | "{{OemIdentifier}}": { |
| 269 | "#Manager.DeleteLanguage": { | 273 | "#Manager.DeleteLanguage": { |
| @@ -551,6 +555,14 @@ | |||
| 551 | "Formula": "orchestrator.managers.get_servers()" | 555 | "Formula": "orchestrator.managers.get_servers()" |
| 552 | } | 556 | } |
| 553 | ] | 557 | ] |
| 558 | + }, | ||
| 559 | + "GetActiveStatus": { | ||
| 560 | + "Steps": [ | ||
| 561 | + { | ||
| 562 | + "Type": "Plugin", | ||
| 563 | + "Formula": "orchestrator.managers.get_active_status(ProcessingFlow[30].Destination.ActiveStatus)" | ||
| 564 | + } | ||
| 565 | + ] | ||
| 554 | } | 566 | } |
| 555 | }, | 567 | }, |
| 556 | "ProcessingFlow": [ | 568 | "ProcessingFlow": [ |
| @@ -838,7 +850,15 @@ | |||
| 838 | "Destination": { | 850 | "Destination": { |
| 839 | "Valid": "NandFlashValid" | 851 | "Valid": "NandFlashValid" |
| 840 | } | 852 | } |
| 841 | - } | 853 | + }, |
| 854 | + { | ||
| 855 | + "Type": "Property", | ||
| 856 | + "Path": "/bmc/kepler/Managers/1/ActiveStandby/Local", | ||
| 857 | + "Interface": "bmc.kepler.Managers.ActiveStandby.Status", | ||
| 858 | + "Destination": { | ||
| 859 | + "ActiveStatus": "ActiveStatus" | ||
| 860 | + } | ||
| 861 | + } | ||
| 842 | ] | 862 | ] |
| 843 | }, | 863 | }, |
| 844 | { | 864 | { |
| @@ -566,4 +566,13 @@ function m.invalid_to_na(diagnostic_data) | |||
| 566 | return diagnostic_data | 566 | return diagnostic_data |
| 567 | end | 567 | end |
| 568 | 568 | ||
| 569 | +function m.get_active_status(active_status) | ||
| 570 | + if not active_status then | ||
| 571 | + return "Absent" | ||
| 572 | + end | ||
| 573 | + if active_status == 0 then | ||
| 574 | + return "StandbySpare" | ||
| 575 | + end | ||
| 576 | + return "Enabled" | ||
| 577 | +end | ||
| 569 | return m | 578 | return m |
| @@ -605,4 +605,30 @@ function m.check_file_exist(file_name, file_type) | |||
| 605 | return false | 605 | return false |
| 606 | end | 606 | end |
| 607 | 607 | ||
| 608 | +function m.is_has_active_and_standby(local_state, remote_id_paths) | ||
| 609 | + local has_active = false | ||
| 610 | + local has_standby = false | ||
| 611 | + -- 检查本板状态 | ||
| 612 | + if local_state == 1 then | ||
| 613 | + has_active = true | ||
| 614 | + elseif local_state == 0 then | ||
| 615 | + has_standby = true | ||
| 616 | + end | ||
| 617 | + | ||
| 618 | + -- 检查远端状态 | ||
| 619 | + for _, remote_id_path in ipairs(remote_id_paths) do | ||
| 620 | + local ok, obj = pcall(mdb.get_object, bus, remote_id_path, 'bmc.kepler.Managers.ActiveStandby.Status') | ||
| 621 | + if ok then | ||
| 622 | + local state = obj.ActiveStatus | ||
| 623 | + if state == 1 then | ||
| 624 | + has_active = true | ||
| 625 | + elseif state == 0 then | ||
| 626 | + has_standby = true | ||
| 627 | + end | ||
| 628 | + end | ||
| 629 | + end | ||
| 630 | + -- 同时存在主和备返回 true | ||
| 631 | + return (has_active and has_standby) | ||
| 632 | +end | ||
| 633 | + | ||
| 608 | return m | 634 | return m |
Ainterface_config/web_backend/mapping_config/BMCSettings/ActiveStandbyMgmt.json+107-0文件内容审核中,请稍后刷新重试


新增代码中出现硬编码实例 ID(/Managers/1),应使用动态段引用。