Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ import (

const (
configMapName = "composable-dra/composable-dra-dds"
GpuDeviceType = "gpu"
)

type CDIManager struct {
Expand Down Expand Up @@ -537,12 +536,8 @@ func (m *CDIManager) generatePool(device *device, fabricID int, generation int64
var devices []resourceapi.Device
for i := 0; i < device.availableDeviceCount; i++ {
d := resourceapi.Device{
Name: fmt.Sprintf("%s-gpu%d", device.k8sDeviceName, i),
Attributes: map[resourceapi.QualifiedName]resourceapi.DeviceAttribute{
"type": {
StringValue: ptr.To(GpuDeviceType),
},
},
Name: fmt.Sprintf("%s-%d", device.k8sDeviceName, i),
Attributes: make(map[resourceapi.QualifiedName]resourceapi.DeviceAttribute),
BindsToNode: ptr.To(true),
BindingConditions: []string{"FabricDeviceReady"},
BindingFailureConditions: []string{"FabricDeviceReschedule", "FabricDeviceFailed"},
Expand Down
6 changes: 3 additions & 3 deletions pkg/manager/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ func TestCheckResourcePoolLoop(t *testing.T) {
}
var deviceFound bool
for _, device := range resourceslice.Spec.Devices {
if len(tc.expectedDeviceName) > 0 && device.Name == tc.expectedDeviceName+"-gpu0" {
if len(tc.expectedDeviceName) > 0 && device.Name == tc.expectedDeviceName+"-0" {
deviceFound = true
for expectedKey, expectedValue := range tc.expectedAttributes {
value := device.Attributes[resourceapi.QualifiedName(expectedKey)]
Expand Down Expand Up @@ -1176,7 +1176,7 @@ func TestCDIManagerManageCDIResourceSlices(t *testing.T) {
t.Errorf("unexpected device num, expected %d but got %d", availableDevice, len(resourceslice.Spec.Devices))
}
for _, device := range resourceslice.Spec.Devices {
if device.Name == tc.expectedDeviceName+"-gpu0" {
if device.Name == tc.expectedDeviceName+"-0" {
deviceFound = true
productName := device.Attributes["productName"]
if productName.StringValue != nil && *productName.StringValue != tc.expectedProductName {
Expand Down Expand Up @@ -1313,7 +1313,7 @@ func TestCDIManagerGeneratePool(t *testing.T) {
"productName": "TEST DEVICE 1",
},
availableDeviceCount: 3,
expectedDeviceName: "test-device-1-gpu0",
expectedDeviceName: "test-device-1-0",
},
}
for _, tc := range testCases {
Expand Down