Skip to content

Conversation

@Schamper
Copy link
Member

@Schamper Schamper commented Dec 30, 2025

Closes #58

Based on #72 for convenience.

TODO:

  • Fix up COWD implementation (need to regenerate test data)
  • Add more test data (e.g. snapshots), perhaps generated on ESXi
  • Add benchmarks and compare to previous implementation

This implementation aims to be a little simpler than the previous one, but we should be wary for performance degradation.

…/test.vmcx,tests/_data/descriptor/vmx/encrypted.vmx,tests/_data/disk/asif/basic.asif.gz,tests/_data/disk/hdd/expanding.hdd/DiskDescriptor.xml,tests/_data/disk/hdd/expanding.hdd/expanding.hdd,tests/_data/disk/hdd/expanding.hdd/expanding.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz,tests/_data/disk/hdd/plain.hdd/DiskDescriptor.xml,tests/_data/disk/hdd/plain.hdd/plain.hdd,tests/_data/disk/hdd/plain.hdd/plain.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz,tests/_data/disk/hdd/split.hdd/DiskDescriptor.xml,tests/_data/disk/hdd/split.hdd/split.hdd,tests/_data/disk/hdd/split.hdd/split.hdd.0.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz,tests/_data/disk/hdd/split.hdd/split.hdd.1.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz,tests/_data/disk/hdd/split.hdd/split.hdd.2.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz,tests/_data/disk/hdd/split.hdd/split.hdd.3.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz,tests/_data/disk/hdd/split.hdd/split.hdd.4.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz,tests/_data/disk/hdd/split.hdd/split.hdd.5.{5fbaabe3-6958-40ff-92a7-860e329aab41}.hds.gz,tests/_data/disk/qcow2/backing-chain-1.qcow2.gz,tests/_data/disk/qcow2/backing-chain-2.qcow2.gz,tests/_data/disk/qcow2/backing-chain-3.qcow2.gz,tests/_data/disk/qcow2/basic-zstd.qcow2.gz,tests/_data/disk/qcow2/basic.qcow2.gz,tests/_data/disk/qcow2/data-file.bin.gz,tests/_data/disk/qcow2/data-file.qcow2.gz,tests/_data/disk/qcow2/snapshot.qcow2.gz,tests/_data/disk/vdi/basic.vdi.gz,tests/_data/disk/vhd/dynamic.vhd.gz,tests/_data/disk/vhd/fixed.vhd.gz,tests/_data/disk/vhdx/differencing.avhdx.gz,tests/_data/disk/vhdx/dynamic.vhdx.gz,tests/_data/disk/vhdx/fixed.vhdx.gz,tests/_data/disk/vmdk/sesparse.vmdk.gz,tests/_data/util/envelope/encryption.info,tests/_data/util/envelope/local.tgz.ve,tests/_data/util/vmtar/test.vgz: convert to Git LFS
@codecov
Copy link

codecov bot commented Dec 30, 2025

Codecov Report

❌ Patch coverage is 84.82385% with 56 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.86%. Comparing base (b19a789) to head (1ada24d).

Files with missing lines Patch % Lines
dissect/hypervisor/disk/vmdk.py 82.65% 51 Missing ⚠️
dissect/hypervisor/disk/vdi.py 92.75% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #74      +/-   ##
==========================================
+ Coverage   78.01%   82.86%   +4.84%     
==========================================
  Files          26       26              
  Lines        2202     2206       +4     
==========================================
+ Hits         1718     1828     +110     
+ Misses        484      378     -106     
Flag Coverage Δ
unittests 82.86% <84.82%> (+4.84%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Schamper Schamper changed the base branch from main to improve-vdi January 5, 2026 13:25
Copy link
Contributor

@Miauwkeru Miauwkeru left a comment

Choose a reason for hiding this comment

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

I haven't looked at benchmarking it yet, but this is what I found when testing the implementation

Comment on lines +171 to +173
if self.parent is not None:
self.parent.seek(offset)
buf = self.parent.read(read_size)
Copy link
Contributor

Choose a reason for hiding this comment

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

When parent is a VMDK object, it does not have the seek and read anymore as VMDK is not a stream. This situation occurs when the VMDK object sets its parent with open_parent on L80, L95

self.descriptor = None
self._disk_offsets = []
self.sector_count = 0
class VMDK:
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe an idea to add a __repr__ to make it easier to debug?


return self.read_sectors(sector, count)

class Extent:
Copy link
Contributor

Choose a reason for hiding this comment

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

and a __repr__ for this one

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.

Change VMDK implementation to return stream on .open() instead of being a stream

2 participants