@@ -815,6 +815,8 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo(ctx context.Context,
815
815
}
816
816
cr , err := util .NewUserCredentials (req .GetSecrets ())
817
817
if err != nil {
818
+ log .ErrorLog (ctx , "failed to get user credentials: %v" , err )
819
+
818
820
return nil , status .Error (codes .Internal , err .Error ())
819
821
}
820
822
defer cr .DeleteCredentials ()
@@ -830,6 +832,8 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo(ctx context.Context,
830
832
831
833
rbdVol , err := mgr .GetVolumeByID (ctx , volumeID )
832
834
if err != nil {
835
+ log .ErrorLog (ctx , "failed to get volume with id %q: %v" , volumeID , err )
836
+
833
837
switch {
834
838
case errors .Is (err , corerbd .ErrImageNotFound ):
835
839
err = status .Error (codes .NotFound , err .Error ())
@@ -843,12 +847,14 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo(ctx context.Context,
843
847
}
844
848
mirror , err := rbdVol .ToMirror ()
845
849
if err != nil {
850
+ log .ErrorLog (ctx , "failed to convert volume %q to mirror type: %v" , rbdVol , err )
851
+
846
852
return nil , status .Error (codes .Internal , err .Error ())
847
853
}
848
854
849
855
info , err := mirror .GetMirroringInfo (ctx )
850
856
if err != nil {
851
- log .ErrorLog (ctx , err . Error () )
857
+ log .ErrorLog (ctx , "failed to get info for mirror %q: %v" , mirror , err )
852
858
853
859
return nil , status .Error (codes .Aborted , err .Error ())
854
860
}
@@ -864,17 +870,18 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo(ctx context.Context,
864
870
865
871
mirrorStatus , err := mirror .GetGlobalMirroringStatus (ctx )
866
872
if err != nil {
873
+ log .ErrorLog (ctx , "failed to get status for mirror %q: %v" , mirror , err )
874
+
867
875
if errors .Is (err , corerbd .ErrImageNotFound ) {
868
876
return nil , status .Error (codes .Aborted , err .Error ())
869
877
}
870
- log .ErrorLog (ctx , err .Error ())
871
878
872
879
return nil , status .Error (codes .Internal , err .Error ())
873
880
}
874
881
875
882
remoteStatus , err := mirrorStatus .GetRemoteSiteStatus (ctx )
876
883
if err != nil {
877
- log .ErrorLog (ctx , err . Error () )
884
+ log .ErrorLog (ctx , "failed to get remote site status for mirror %q: %v" , mirror , err )
878
885
879
886
if errors .Is (err , librbd .ErrNotExist ) {
880
887
return nil , status .Errorf (codes .NotFound , "failed to get remote status: %v" , err )
@@ -886,10 +893,11 @@ func (rs *ReplicationServer) GetVolumeReplicationInfo(ctx context.Context,
886
893
description := remoteStatus .GetDescription ()
887
894
resp , err := getLastSyncInfo (ctx , description )
888
895
if err != nil {
896
+ log .ErrorLog (ctx , "failed to parse last sync info from %q: %v" , description , err )
897
+
889
898
if errors .Is (err , corerbd .ErrLastSyncTimeNotFound ) {
890
899
return nil , status .Errorf (codes .NotFound , "failed to get last sync info: %v" , err )
891
900
}
892
- log .ErrorLog (ctx , err .Error ())
893
901
894
902
return nil , status .Errorf (codes .Internal , "failed to get last sync info: %v" , err )
895
903
}
0 commit comments