Skip to content

Commit

Permalink
[issue-1198] removing fakeattach check for online drive
Browse files Browse the repository at this point in the history
  • Loading branch information
katarzynakulpa committed Jul 10, 2024
1 parent f0bbf0e commit c2a229b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 28 deletions.
2 changes: 1 addition & 1 deletion pkg/crcontrollers/drive/drivecontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func (c *Controller) handleDriveStatus(ctx context.Context, drive *drivecrd.Driv
case apiV1.DriveStatusOnline:
// move MISSING volumes to OPERATIVE status
for _, volume := range volumes {
if volume.Spec.OperationalStatus == apiV1.OperationalStatusMissing && !c.isFakeAttach(volume) {
if volume.Spec.OperationalStatus == apiV1.OperationalStatusMissing {
if err := c.crHelper.UpdateVolumeOpStatus(ctx, volume, apiV1.OperationalStatusOperative); err != nil {
return err
}
Expand Down
27 changes: 0 additions & 27 deletions pkg/crcontrollers/drive/drivecontroller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -752,33 +752,6 @@ func TestDriveController_handleDriveStatus(t *testing.T) {
assert.NotNil(t, resultVolume[0].Spec)
assert.Equal(t, resultVolume[0].Spec.OperationalStatus, apiV1.OperationalStatusOperative)

assert.Nil(t, dc.client.DeleteCR(testCtx, expectedD))
assert.Nil(t, dc.client.DeleteCR(testCtx, expectedV))
})
t.Run("Missing volume status for fake attach", func(t *testing.T) {
expectedD := testBadCRDrive.DeepCopy()
assert.NotNil(t, expectedD)
assert.Nil(t, dc.client.CreateCR(testCtx, expectedD.Name, expectedD))

expectedV := failedVolCR.DeepCopy()
expectedV.Annotations = map[string]string{fakeAttachVolumeAnnotation: fakeAttachVolumeKey}
assert.NotNil(t, expectedV)
expectedV.Spec.OperationalStatus = apiV1.OperationalStatusMissing
assert.Nil(t, dc.client.CreateCR(testCtx, expectedV.Name, expectedV))

err := dc.handleDriveStatus(testCtx, expectedD)
assert.Nil(t, err)
assert.Equal(t, expectedD.Spec.UUID, driveUUID)
assert.Equal(t, expectedD.Spec.Status, apiV1.DriveStatusOnline)
assert.Equal(t, expectedD.Spec.Health, apiV1.HealthBad)
assert.Empty(t, expectedD.Spec.Usage)

resultVolume, err := dc.crHelper.GetVolumesByLocation(testCtx, driveUUID)
assert.Nil(t, err)
assert.NotNil(t, resultVolume)
assert.NotNil(t, resultVolume[0].Spec)
assert.Equal(t, resultVolume[0].Spec.OperationalStatus, apiV1.OperationalStatusMissing)

assert.Nil(t, dc.client.DeleteCR(testCtx, expectedD))
assert.Nil(t, dc.client.DeleteCR(testCtx, expectedV))
})
Expand Down

0 comments on commit c2a229b

Please sign in to comment.