rbd: improve logging for rpc calls

added logging of reqID for volume group rpc calls.
Also, added logs for replication rpc calls
which are helpful during debugging of issues related to
failover/relocate.

Signed-off-by: Nikhil-Ladha <nikhilladha1999@gmail.com>
This commit is contained in:
Nikhil-Ladha
2025-05-19 11:51:19 +05:30
committed by mergify[bot]
parent c761b98933
commit 706cd88065
3 changed files with 33 additions and 11 deletions

View File

@ -306,6 +306,7 @@ func (rs *ReplicationServer) EnableVolumeReplication(ctx context.Context,
return nil, status.Error(codes.Internal, err.Error())
}
log.UsefulLog(ctx, "mirror state is %s", info.GetState())
if info.GetState() != librbd.MirrorImageEnabled.String() {
err = rbdVol.HandleParentImageExistence(ctx, flattenMode)
if err != nil {
@ -371,6 +372,7 @@ func (rs *ReplicationServer) DisableVolumeReplication(ctx context.Context,
return nil, status.Error(codes.Internal, err.Error())
}
log.UsefulLog(ctx, "mirror state is %s", info.GetState())
switch info.GetState() {
// image is already in disabled state
case librbd.MirrorImageDisabled.String():
@ -433,6 +435,7 @@ func (rs *ReplicationServer) PromoteVolume(ctx context.Context,
return nil, status.Error(codes.Internal, err.Error())
}
log.UsefulLog(ctx, "mirror state is %s, primary: %s", info.GetState(), info.IsPrimary())
if info.GetState() != librbd.MirrorImageEnabled.String() {
return nil, status.Errorf(
@ -533,6 +536,7 @@ func (rs *ReplicationServer) DemoteVolume(ctx context.Context,
return nil, status.Error(codes.Internal, err.Error())
}
log.UsefulLog(ctx, "mirror state is %s, primary: %s", info.GetState(), info.IsPrimary())
if info.GetState() != librbd.MirrorImageEnabled.String() {
return nil, status.Errorf(