@@ -654,6 +654,12 @@ func (o *ConcurrentTridentOrchestrator) cleanupDeletingBackends(ctx context.Cont
654654 backend := results [0 ].Backend .Read
655655 deleter := results [0 ].Backend .Delete
656656
657+ if backend == nil {
658+ Logc (ctx ).WithField ("backendUUID" , backendUUID ).Debug ("Backend not found." )
659+ unlocker ()
660+ continue
661+ }
662+
657663 if err = o .storeClient .DeleteBackend (ctx , backend ); err != nil {
658664 Logc (ctx ).WithField ("backendUUID" , backendUUID ).WithError (err ).Error ("Failed to delete deleting backend." )
659665 unlocker ()
@@ -818,7 +824,7 @@ func (o *ConcurrentTridentOrchestrator) reconcileNodeAccessOnAllBackends(ctx con
818824
819825 var wg sync.WaitGroup
820826 wg .Add (len (allBackends ))
821- var errors error
827+ var reconcileErrors error
822828
823829 for _ , b := range allBackends {
824830 backend := b
@@ -862,7 +868,12 @@ func (o *ConcurrentTridentOrchestrator) reconcileNodeAccessOnAllBackends(ctx con
862868 if dbErr != nil {
863869 return dbErr
864870 }
871+
865872 upsertBackend := results [0 ].Backend .Read
873+ if upsertBackend == nil {
874+ return errors .NotFoundError ("backend %s not found for reconcile" , backend .BackendUUID ())
875+ }
876+
866877 if reconcileErr := o .reconcileNodeAccessOnBackend (
867878 ctx , upsertBackend , results [0 ].VolumePublications , results [0 ].Nodes ); reconcileErr != nil {
868879 return reconcileErr
@@ -871,7 +882,7 @@ func (o *ConcurrentTridentOrchestrator) reconcileNodeAccessOnAllBackends(ctx con
871882 return nil
872883 }()
873884 if err != nil {
874- errors = multierr .Append (errors , err )
885+ reconcileErrors = multierr .Append (reconcileErrors , err )
875886 Logc (ctx ).WithError (err ).WithField ("backend" , backend .Name ()).Warn (
876887 "Error during node access reconciliation." )
877888 }
@@ -880,7 +891,7 @@ func (o *ConcurrentTridentOrchestrator) reconcileNodeAccessOnAllBackends(ctx con
880891
881892 wg .Wait ()
882893
883- return errors
894+ return reconcileErrors
884895}
885896
886897func (o * ConcurrentTridentOrchestrator ) reconcileNodeAccessOnBackend (ctx context.Context , b storage.Backend ,
@@ -1931,6 +1942,12 @@ func (o *ConcurrentTridentOrchestrator) addVolume(
19311942 backend = results [0 ].Backend .Read
19321943 upserter = results [0 ].Volume .Upsert
19331944
1945+ if backend == nil {
1946+ Logc (ctx ).WithField ("backend" , backendName ).Debug ("Backend not found." )
1947+ unlocker ()
1948+ continue
1949+ }
1950+
19341951 // Get actual pools from backend
19351952 pools := make (map [string ]* storage.Pool )
19361953 backend .StoragePools ().Range (func (k , v interface {}) bool {
@@ -2048,6 +2065,10 @@ func (o *ConcurrentTridentOrchestrator) addVolume(
20482065func (o * ConcurrentTridentOrchestrator ) addVolumeRetry (
20492066 ctx context.Context , volConfig * storage.VolumeConfig , pool storage.Pool , volAttributes map [string ]sa.Request ,
20502067) (volume * storage.Volume , err error ) {
2068+ if pool == nil {
2069+ return nil , fmt .Errorf ("pool cannot be nil" )
2070+ }
2071+
20512072 logFields := LogFields {
20522073 "backend" : pool .Backend ().Name (),
20532074 "pool" : pool .Name (),
@@ -2664,13 +2685,13 @@ func (o *ConcurrentTridentOrchestrator) deleteVolume(ctx context.Context, volume
26642685 snapshotsForVolume := results [2 ].Snapshots
26652686 subordinatesForVolume := results [2 ].SubordinateVolumes
26662687
2667- logFields := LogFields {"volume" : volumeName , "backendUUID" : volume .BackendUUID }
2668-
26692688 if volume == nil {
26702689 unlocker ()
26712690 return errors .NotFoundError ("volume %s not found" , volumeName )
26722691 }
26732692
2693+ logFields := LogFields {"volume" : volumeName , "backendUUID" : volume .BackendUUID }
2694+
26742695 // If there are any snapshots or subordinate volumes for this volume, we need to "soft" delete.
26752696 // Only hard delete this volume when its last snapshot is deleted and no subordinates remain.
26762697 if len (snapshotsForVolume ) > 0 || len (subordinatesForVolume ) > 0 {
@@ -3499,7 +3520,7 @@ func (o *ConcurrentTridentOrchestrator) resizeVolume(ctx context.Context, volume
34993520 "volume" : volName ,
35003521 "backendUUID" : backendUUID ,
35013522 }).Error ("Unable to find volume during resize." )
3502- return fmt .Errorf ("unable to find volume %v during resize" , volume . Config . Name )
3523+ return fmt .Errorf ("unable to find volume %v during resize" , volName )
35033524 }
35043525
35053526 if backend == nil {
0 commit comments