Skip to content

Commit afeabf6

Browse files
kaovilaiclaudehappy-otter
committed
rbd: add debug logging to ProcessMetadata for CBT diagnostics
Add debug log statements to ProcessMetadata to log the snapshot ID, volume size, and DiffIterateByID configuration parameters. This helps diagnose cases where GetMetadataAllocated returns empty streams despite the underlying rbd diff working correctly. Ref: kaovilai/cephcsi-cbt-e2e#2 Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
1 parent 2bf52db commit afeabf6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

internal/rbd/snap_diff.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ func (rbdSnap *rbdSnapshot) ProcessMetadata(
5858
return fmt.Errorf("failed to get snapshot ID of %q: %w", rbdSnap, err)
5959
}
6060

61+
log.DebugLog(ctx, "ProcessMetadata: image=%q, snapID=%d, VolSize=%d", rbdSnap, snapID, rbdSnap.VolSize)
62+
6163
err = image.SetSnapByID(snapID)
6264
if err != nil {
6365
return fmt.Errorf("failed to set snapshot %q by ID %d: %w",
@@ -107,12 +109,17 @@ func (rbdSnap *rbdSnapshot) ProcessMetadata(
107109
diffIterateByIDConfig.FromSnapID = fromSnapID
108110
}
109111

112+
log.DebugLog(ctx, "ProcessMetadata: DiffIterateByID config: Offset=%d, Length=%d, FromSnapID=%d",
113+
diffIterateByIDConfig.Offset, diffIterateByIDConfig.Length, diffIterateByIDConfig.FromSnapID)
114+
110115
diffIterateErr := image.DiffIterateByID(diffIterateByIDConfig)
111116
err = handleDiffIterateError(diffIterateErr)
112117
if err != nil {
113118
return fmt.Errorf("failed to get diff: %w", err)
114119
}
115120

121+
log.DebugLog(ctx, "ProcessMetadata: DiffIterateByID completed, remaining blocks=%d", len(changedBlocks))
122+
116123
if len(changedBlocks) != 0 {
117124
// Send any remaining changed blocks after the loop.
118125
err = sendResponse(changedBlocks)

0 commit comments

Comments
 (0)