-
Notifications
You must be signed in to change notification settings - Fork 118
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
according to the 1.4 PCIeFunctions standard has been moved (#240)
Co-authored-by: Maksim Kovshov <[email protected]>
- Loading branch information
Showing
3 changed files
with
14 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,9 +85,7 @@ type PCIeDevice struct { | |
ChassisCount int | ||
// PCIeFunctions shall be a reference to the resources that this device | ||
// exposes and shall reference a resource of type PCIeFunction. | ||
pcieFunctions []string | ||
// PCIeFunctionsCount is the number of PCIeFunctions. | ||
PCIeFunctionsCount int | ||
pcieFunctions string | ||
// rawData holds the original serialized JSON so we can compare updates. | ||
rawData []byte | ||
} | ||
|
@@ -96,15 +94,14 @@ type PCIeDevice struct { | |
func (pciedevice *PCIeDevice) UnmarshalJSON(b []byte) error { | ||
type temp PCIeDevice | ||
type links struct { | ||
Chassis common.Links | ||
ChassisCount int `json:"[email protected]"` | ||
PCIeFunctions common.Links | ||
PCIeFunctionsCount int `json:"[email protected]"` | ||
Chassis common.Links | ||
ChassisCount int `json:"[email protected]"` | ||
} | ||
var t struct { | ||
temp | ||
Assembly common.Link | ||
Links links | ||
Assembly common.Link | ||
PCIeFunctions common.Link | ||
Links links | ||
} | ||
|
||
err := json.Unmarshal(b, &t) | ||
|
@@ -118,8 +115,7 @@ func (pciedevice *PCIeDevice) UnmarshalJSON(b []byte) error { | |
pciedevice.assembly = t.Assembly.String() | ||
pciedevice.chassis = t.Links.Chassis.ToStrings() | ||
pciedevice.ChassisCount = t.Links.ChassisCount | ||
pciedevice.pcieFunctions = t.Links.PCIeFunctions.ToStrings() | ||
pciedevice.PCIeFunctionsCount = t.Links.PCIeFunctionsCount | ||
pciedevice.pcieFunctions = t.PCIeFunctions.String() | ||
|
||
// This is a read/write object, so we need to save the raw object data for later | ||
pciedevice.rawData = b | ||
|
@@ -241,22 +237,6 @@ func (pciedevice *PCIeDevice) Chassis() ([]*Chassis, error) { | |
} | ||
|
||
// PCIeFunctions get the PCIe functions that this device exposes. | ||
func (pciedevice *PCIeDevice) PCIeFunctions() ([]*PCIeDevice, error) { | ||
var result []*PCIeDevice | ||
|
||
collectionError := common.NewCollectionError() | ||
for _, funcLink := range pciedevice.pcieFunctions { | ||
pciFunction, err := GetPCIeDevice(pciedevice.Client, funcLink) | ||
if err != nil { | ||
collectionError.Failures[funcLink] = err | ||
} else { | ||
result = append(result, pciFunction) | ||
} | ||
} | ||
|
||
if collectionError.Empty() { | ||
return result, nil | ||
} | ||
|
||
return result, collectionError | ||
func (pciedevice *PCIeDevice) PCIeFunctions() ([]*PCIeFunction, error) { | ||
return ListReferencedPCIeFunctions(pciedevice.Client, pciedevice.pcieFunctions) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,18 +29,13 @@ var pcieDeviceBody = `{ | |
"Chassis": [{ | ||
"@odata.id": "/redfish/v1/Chassis/Chassis-1" | ||
}], | ||
"[email protected]": 1, | ||
"PCIeFunctions": [{ | ||
"@odata.id": "/redfish/v1/Functions/1" | ||
}, | ||
{ | ||
"@odata.id": "/redfish/v1/Functions/2" | ||
} | ||
], | ||
"[email protected]": 1 | ||
"[email protected]": 1 | ||
}, | ||
"Manufacturer": "Acme Inc", | ||
"Model": "A1", | ||
"PCIeFunctions": { | ||
"@odata.id": "/redfish/v1/Systems/system/PCIeDevices/AAABBCC/PCIeFunctions" | ||
}, | ||
"PCIeInterface": { | ||
"LanesInUse": 32, | ||
"MaxLanes": 32, | ||
|