From 6fe2e5011eaaf2c3cd2d3d3e56a55bf981334698 Mon Sep 17 00:00:00 2001 From: Scott Howe Date: Wed, 23 Oct 2024 11:18:35 -0600 Subject: [PATCH] fix(cxl-host): fix syntax error and improve ci (#47) * fix(cxl-host): fix syntax error * ci: add cxl-host build to ci --- .github/workflows/go.yml | 8 +++- cmd/cxl-host/service/cxl_host_service.go | 48 ++++++++++++------------ 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 2bc984d..920494d 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -17,9 +17,13 @@ jobs: - name: Generate support files run: make generate - + - name: Format Golang run: if [ "$(gofmt -l . | wc -l)" -gt 0 ]; then exit 1; fi - - name: Build Golang + - name: Build cfm-service & cfm-cli (Golang) run: make build-go + + - name: Build cxl-host (Golang) + working-directory: ./cmd/cxl-host + run: make local diff --git a/cmd/cxl-host/service/cxl_host_service.go b/cmd/cxl-host/service/cxl_host_service.go index 151e63e..c46961b 100644 --- a/cmd/cxl-host/service/cxl_host_service.go +++ b/cmd/cxl-host/service/cxl_host_service.go @@ -169,8 +169,8 @@ func (s *CxlHostApiService) RedfishV1AccountServiceGet(ctx context.Context) (red }, ServiceEnabled: &enabled, Status: redfishapi.ResourceStatus{ - Health: &resourcehealthOk, - State: &resourcestateEnabled, + Health: resourcehealthOk, + State: resourcestateEnabled, }, } @@ -272,8 +272,8 @@ func (s *CxlHostApiService) RedfishV1ChassisChassisIdGet(ctx context.Context, ch // }, SerialNumber: &uuid, Status: redfishapi.ResourceStatus{ - Health: &resourcehealthOk, - State: &resourcestateEnabled, + Health: resourcehealthOk, + State: resourcestateEnabled, }, UUID: uuid, Version: &version, @@ -346,8 +346,8 @@ func (s *CxlHostApiService) RedfishV1ChassisChassisIdMemoryMemoryIdGet(ctx conte Enabled: true, Name: memoryId, Status: redfishapi.ResourceStatus{ - Health: &resourcehealthOk, - State: &resourcestateEnabled, + Health: resourcehealthOk, + State: resourcestateEnabled, }, } @@ -395,8 +395,8 @@ func (s *CxlHostApiService) RedfishV1FabricsFabricIdGet(ctx context.Context, fab Name: fabricId + " Fabric", Oem: nil, Status: redfishapi.ResourceStatus{ - Health: &resourcehealthOk, - State: &resourcestateEnabled, + Health: resourcehealthOk, + State: resourcestateEnabled, }, Switches: redfishapi.OdataV4IdRef{ OdataId: "/redfish/v1/Fabrics/" + fabricId + "/Switches", @@ -458,8 +458,8 @@ func (s *CxlHostApiService) RedfishV1FabricsFabricIdSwitchesSwitchIdGet(ctx cont RedundancyodataCount: 1, SerialNumber: &serial, Status: redfishapi.ResourceStatus{ - Health: &resourcehealthOk, - State: &resourcestateEnabled, + Health: resourcehealthOk, + State: resourcestateEnabled, }, SupportedProtocols: []redfishapi.ProtocolProtocol{redfishapi.PROTOCOLPROTOCOL_CXL}, SwitchType: redfishapi.PROTOCOLPROTOCOL_CXL, @@ -532,8 +532,8 @@ func (s *CxlHostApiService) RedfishV1FabricsFabricIdSwitchesSwitchIdPortsPortIdG PortType: redfishapi.PORTV1110PORTTYPE_BIDIRECTIONAL_PORT, SignalDetected: &detected, Status: redfishapi.ResourceStatus{ - Health: &resourcehealthOk, - State: &resourcestateEnabled, + Health: resourcehealthOk, + State: resourcestateEnabled, }, } @@ -627,8 +627,8 @@ func (s *CxlHostApiService) RedfishV1SessionServiceGet(ctx context.Context) (red SessionTimeout: int64(SessionTimeout), Sessions: redfishapi.OdataV4IdRef{OdataId: "/redfish/v1/SessionService/Sessions"}, Status: redfishapi.ResourceStatus{ - Health: &resourcehealthOk, - State: &resourcestateEnabled, + Health: resourcehealthOk, + State: resourcestateEnabled, }, } @@ -911,7 +911,7 @@ func (s *CxlHostApiService) RedfishV1ChassisChassisIdPCIeDevicesPCIeDeviceIdCXLL dev := GetCXLDevInfo(BDtoBDF(pCIeDeviceId)) gcxlid := FormatGCXLID(dev) - fmt := redfishapi.ResourceV1200DurableNameFormat("GCXLID") + fmt := redfishapi.ResourceV1191DurableNameFormat("GCXLID") resource := redfishapi.CxlLogicalDeviceV111CxlLogicalDevice{ OdataContext: "/redfish/v1/$metadata#CXLLogicalDevice.CXLLogicalDevice", OdataId: "/redfish/v1/Chassis/" + chassisId + "/PCIeDevices/" + pCIeDeviceId + "/CXLLogicalDevices/" + cXLLogicalDeviceId, @@ -936,12 +936,12 @@ func (s *CxlHostApiService) RedfishV1ChassisChassisIdPCIeDevicesPCIeDeviceIdCXLL Name: "Locally attached CXL Logical Device " + string(dev.GetCxlType()), SemanticsSupported: []redfishapi.CxlLogicalDeviceV111CxlSemantic{}, Status: redfishapi.ResourceStatus{ - Health: &resourcehealthOk, - State: &resourcestateEnabled, + Health: resourcehealthOk, + State: resourcestateEnabled, }, Identifiers: []redfishapi.ResourceIdentifier{{ DurableName: &gcxlid, - DurableNameFormat: &fmt, + DurableNameFormat: fmt, }}, } devCap := dev.GetCxlCap() @@ -1032,8 +1032,8 @@ func (s *CxlHostApiService) RedfishV1ChassisChassisIdPCIeDevicesPCIeDeviceIdGet( OdataId: "/redfish/v1/Chassis/" + chassisId + "/PCIeDevices/" + pCIeDeviceId + "/PCIeFunctions", }, Status: redfishapi.ResourceStatus{ - Health: &resourcehealthOk, - State: &resourcestateEnabled, + Health: resourcehealthOk, + State: resourcestateEnabled, }, } @@ -1118,8 +1118,8 @@ func (s *CxlHostApiService) RedfishV1ChassisChassisIdPCIeDevicesPCIeDeviceIdPCIe Name: "PCIe Function", RevisionId: &revisionId, Status: redfishapi.ResourceStatus{ - Health: &resourcehealthOk, - State: &resourcestateEnabled, + Health: resourcehealthOk, + State: resourcestateEnabled, }, VendorId: &vendorId, } @@ -1464,8 +1464,8 @@ func (s *CxlHostApiService) RedfishV1SystemsComputerSystemIdMemoryMemoryIdGet(ct Name: "CXL Device memory", MemoryMedia: []redfishapi.MemoryV1190MemoryMedia{redfishapi.MEMORYV1190MEMORYMEDIA_PROPRIETARY}, Status: redfishapi.ResourceStatus{ - Health: &resourcehealthOk, - State: &resourcestateEnabled, + Health: resourcehealthOk, + State: resourcestateEnabled, }, Links: redfishapi.MemoryV1190Links{ MemoryMediaSources: []redfishapi.OdataV4IdRef{