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
2 changes: 2 additions & 0 deletions internal/controller/resourcemonitor_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ func TestCollectInfo(t *testing.T) {
{
Name: "gpu-3",
State: "Preparing",
Model: "A100 80G",
Driver: "gpu.nvidia.com",
Pool: "nvidia-a100-80-fabric1",
},
Expand Down Expand Up @@ -695,6 +696,7 @@ func TestCollectInfo(t *testing.T) {
{
Name: "gpu-3",
State: "Preparing",
Model: "A100 80G",
Driver: "gpu.nvidia.com",
Pool: "nvidia-a100-80-fabric1",
},
Expand Down
9 changes: 9 additions & 0 deletions internal/utils/info_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ func GetResourceClaimInfo(ctx context.Context, kubeClient client.Client, composa
}
}

if deviceInfo.Model == "" {
re := regexp.MustCompile(`-fabric\d+$`)
deviceName := re.ReplaceAllString(device.Pool, "")
if model, err := getModelName(composableDRASpec, deviceName); err == nil {
logger.Info("Found model name from allocation pool", "device", device.Device, "pool", device.Pool, "model", model)
deviceInfo.Model = model
}
}

if len(rc.Status.Devices) == 0 {
deviceInfo.State = "Preparing"
} else {
Expand Down
2 changes: 2 additions & 0 deletions internal/utils/info_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ func TestGetResourceClaimInfo(t *testing.T) {
{
Name: "nvidia-a100-80-gpu2",
State: "Preparing",
Model: "A100 80G",
Driver: "gpu.nvidia.com",
Pool: "nvidia-a100-80-fabric1",
},
Expand Down Expand Up @@ -589,6 +590,7 @@ func TestGetResourceClaimInfo(t *testing.T) {
{
Name: "nvidia-a100-80-gpu2",
State: "Preparing",
Model: "A100 80G",
Driver: "gpu.nvidia.com",
Pool: "nvidia-a100-80-fabric1",
},
Expand Down
17 changes: 9 additions & 8 deletions internal/utils/reschedule_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ outerLoop:
}
}
}
if !exit {
logger.V(1).Info("Setting FabricDeviceFailed to Failed due to device was not found in resourceSlice", "device", rcDevice.Name)
resourceClaimInfos[k], err = setDevicesState(ctx, kubeClient, rc, "Failed", "FabricDeviceFailed")
if err != nil {
return resourceClaimInfos, fmt.Errorf("failed to set devices state: %w", err)
}
continue outerLoop
}
_ = exit
// if !exit {
// logger.V(1).Info("Setting FabricDeviceFailed to Failed due to device was not found in resourceSlice", "device", rcDevice.Name)
// resourceClaimInfos[k], err = setDevicesState(ctx, kubeClient, rc, "Failed", "FabricDeviceFailed")
// if err != nil {
// return resourceClaimInfos, fmt.Errorf("failed to set devices state: %w", err)
// }
// continue outerLoop
// }

for _, composabilityRequest := range composabilityRequestList.Items {
if composabilityRequest.Spec.Resource.Size > 0 &&
Expand Down
35 changes: 29 additions & 6 deletions internal/utils/reschedule_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2360,7 +2360,7 @@ func TestRescheduleFailedNotification(t *testing.T) {
},
},
{
name: "ResourceClaim not exit in resourceSlice",
name: "Missing pool devices remain Preparing",
existingComposableResource: &cdioperator.ComposableResourceList{
Items: []cdioperator.ComposableResource{
{
Expand Down Expand Up @@ -2489,14 +2489,14 @@ func TestRescheduleFailedNotification(t *testing.T) {
{
Name: "device-1",
Model: "A100 40G",
State: "Failed",
State: "Preparing",
Driver: "gpu.nvidia.com",
Pool: "test-pool",
},
{
Name: "device-2",
Model: "A100 40G",
State: "Failed",
State: "Preparing",
Driver: "gpu.nvidia.com",
Pool: "test-pool",
},
Expand All @@ -2505,7 +2505,7 @@ func TestRescheduleFailedNotification(t *testing.T) {
},
},
{
name: "ResourceClaim not exit in resourceSlice and set device state failed",
name: "Missing pool devices do not attempt a ResourceClaim status update",
existingComposableResource: &cdioperator.ComposableResourceList{
Items: []cdioperator.ComposableResource{
{
Expand Down Expand Up @@ -2623,8 +2623,31 @@ func TestRescheduleFailedNotification(t *testing.T) {
},
},
},
wantErr: true,
expectedErrMsg: "failed to set devices state:",
wantErr: false,
expectedResourceClaims: []types.ResourceClaimInfo{
{
Name: "claim1",
Namespace: "test-ns",
NodeName: "node1",
CreationTimestamp: metav1.Time{Time: now},
Devices: []types.ResourceClaimDevice{
{
Name: "device-1",
Model: "A100 40G",
State: "Preparing",
Driver: "gpu.nvidia.com",
Pool: "test-pool",
},
{
Name: "device-2",
Model: "A100 40G",
State: "Preparing",
Driver: "gpu.nvidia.com",
Pool: "test-pool",
},
},
},
},
},
{
name: "failed to list composableResource",
Expand Down