Created
January 24, 2020 06:06
-
-
Save cclloyd/8b53b8055cf31a084860188591978c30 to your computer and use it in GitHub Desktop.
Ceph librbd export-diff non-working example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Issues: | |
- Size of written file not identical to size crated by `rbd export-diff` command. | |
- Total size of extents does not equal diff-size | |
''' | |
offsets = [] | |
extents = [] | |
def iter_cb(offset, length, exists): | |
if exists: | |
offsets.append(offset) | |
extents.append(length) | |
image.diff_iterate(0, image.size(), None, iter_cb) | |
with open(os.path.join(BACKUP_DIR, 'test.img'), 'wb') as f: | |
for offset, extent in zip(offsets, extents): | |
f.write(image.read(offset, extent)) | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment