Skip to content

Add post-transfer disk checksum verification#406

Open
claudiubelu wants to merge 1 commit intocloudbase:masterfrom
claudiubelu:adds-checksum
Open

Add post-transfer disk checksum verification#406
claudiubelu wants to merge 1 commit intocloudbase:masterfrom
claudiubelu:adds-checksum

Conversation

@claudiubelu
Copy link
Copy Markdown
Member

After each disk is written, compare the source (replicator) and destination (writer) checksums to catch any data corruption during transfer. The comparison happens while the writer device is still acquired so the checksum job can run.

  • Client.get_disk_checksum: calls GET /api/v1/dev/{disk}/checksum

  • HTTPBackupWriterImpl:

    • _create_checksum_job: calls POST /api/v2/device/{disk}/checksumJob
    • _delete_checksum_job: calls DELETE /api/v2/device/{disk}/checksumJob/{id}
      - _get_checksum_job_status: calls GET /api/v2/device/{disk}/checksumJob/{id}
    • get_disk_checksum: creates checksum job, waits for it to finish, and returns the checksum value and algorithm.
  • Replicator._verify_disk_checksum: compares both sides, raises on algorithm or value mismatch.

Comment on lines +763 to +765
"start_offset": 0,
"end_offset": 0,
"checksum_algorithm": algorithm,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

start_offset/end_offset should also be configurable. Default to 0.

There are cases where we add a 1GB extra padding to destination disks, in that case we'll need to specifically pass in an end_offset, so that the destination hasher stops there. The padding was added because in some cases, the source provider can't accurately report the exact size of the source disks (i.e. the in-guest disk is larger than what the platform reports by a small amount).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@claudiubelu claudiubelu force-pushed the adds-checksum branch 2 times, most recently from 37db355 to e14d59a Compare April 9, 2026 12:42
After each disk is written, compare the source (replicator) and
destination (writer) checksums to catch any data corruption during
transfer. The comparison happens while the writer device is still
acquired so the checksum job can run.

- Client.get_disk_checksum: calls GET /api/v1/dev/{disk}/checksum

- HTTPBackupWriterImpl:
  - _create_checksum_job: calls POST /api/v2/device/{disk}/checksumJob
  - _delete_checksum_job: calls DELETE /api/v2/device/{disk}/checksumJob/{id}
  - _get_checksum_job_status: calls GET /api/v2/device/{disk}/checksumJob/{id}
  - get_disk_checksum: creates checksum job, waits for it to finish, and
    returns the checksum value and algorithm.

- Replicator._verify_disk_checksum: compares both sides, raises on
  algorithm or value mismatch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants