Skip to content

Commit

Permalink
fix: NPE error
Browse files Browse the repository at this point in the history
longhorn/longhorn-9852

Signed-off-by: Chin-Ya Huang <[email protected]>
  • Loading branch information
c3y1huang committed Dec 3, 2024
1 parent bfa1d21 commit 2652397
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/spdk/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -996,8 +996,10 @@ func (e *Engine) ReplicaAdd(spdkClient *spdkclient.Client, dstReplicaName, dstRe
}
}
if engineErr != nil || err != nil {
e.log.WithError(err).Errorf("Engine failed to start replica %s rebuilding, will mark the rebuilding replica mode from %v to ERR", dstReplicaName, e.ReplicaStatusMap[dstReplicaName].Mode)
e.ReplicaStatusMap[dstReplicaName].Mode = types.ModeERR
if e.ReplicaStatusMap[dstReplicaName] != nil && e.ReplicaStatusMap[dstReplicaName].Mode != types.ModeERR {
e.log.WithError(err).Errorf("Engine failed to start replica %s rebuilding, will mark the rebuilding replica mode from %v to ERR", dstReplicaName, e.ReplicaStatusMap[dstReplicaName].Mode)
e.ReplicaStatusMap[dstReplicaName].Mode = types.ModeERR
}

Check warning on line 1002 in pkg/spdk/engine.go

View check run for this annotation

Codecov / codecov/patch

pkg/spdk/engine.go#L999-L1002

Added lines #L999 - L1002 were not covered by tests
updateRequired = true
}
}()
Expand Down

0 comments on commit 2652397

Please sign in to comment.