chore(hyperv): add local disk deep inspection API - #12
Conversation
Add DetectLocal() to the Detector that runs virt-inspector directly on locally-mounted VHD/VHDX files without requiring VDDK or vSphere snapshots. Used by Forklift for Hyper-V cold preflight inspection via SMB-mounted disks. Changes: - pkg/vmdetect: add DetectLocal() and DetectLocalParams, relax NewDetector() credential validation for local-path usage - internal/inspection: add InspectLocal() to VirtInspector for running virt-inspector on local disk files with proper format/arg ordering - internal/persistent: add InspectLocal() to InspectorInterface and Inspector implementation Signed-off-by: Elad Hazan <ehazan@redhat.com>
Cover local-path Detector construction, required DetectLocal params, and virt-inspector --format-before -a argument order. Signed-off-by: Elad Hazan <ehazan@redhat.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (4)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe PR adds local disk inspection through virt-inspector, exposes it through the persistent inspection interface, and adds local detection that validates fstab data and extracts inspection results. Detector creation now supports empty vSphere configuration for local detection. ChangesLocal disk detection
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: 🔵 Low · up to This change allows local disk images to be inspected without vCenter credentials, which can expose metadata from any compatible file readable by the inspection process if an integration accepts untrusted paths. The PR is mergeable with explicit owner awareness that callers must authenticate requests, bind paths to the intended VM or tenant, and restrict access to approved disk locations. Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant DetectLocal
participant Inspector
participant VirtInspector
participant virt-inspector
DetectLocal->>Inspector: pass local virt-inspector arguments
Inspector->>VirtInspector: InspectLocal(ctx, virtInspectorArgs)
VirtInspector->>virt-inspector: inspect local disk files
virt-inspector-->>VirtInspector: return inspection XML or error
VirtInspector-->>Inspector: parse XML or return failure
Inspector-->>DetectLocal: return inspection result
DetectLocal->>DetectLocal: validate fstab and build DetectResult
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
DetectLocal()so callers can run virt-inspector on locally mounted VHD/VHDX files (no VDDK or vSphere snapshot).NewDetector()so Hyper-V / local-path use does not require vCenter credentials.vendor/, this is the real module change that PR should consume.Test plan
go test ./pkg/vmdetect/ ./internal/inspection/ ./internal/checks/Summary by CodeRabbit
New Features
Bug Fixes