VM validations library for migration preparation.
This library provides tools and utilities for inspecting and validating virtual machines before migration. It includes support for various inspection methods including virt-inspector and virt-v2v-inspector with VDDK integration.
-
pkg/types: Public types and data structures
types.go: Core typesSnapshotDiskInfo: VM snapshot disk information for VDDK access
virt_inspector.go: virt-inspector XML data structuresVirtInspectorXML: Root structure for virt-inspector output- OS information, applications, filesystems, mountpoints, drives
virt_v2v_inspector.go: virt-v2v-inspector XML data structuresVirtV2VInspectorXML: Root structure for virt-v2v-inspector output- OS information and firmware details
-
pkg/inspection: Public bridge to inspection functionality (temporary for external usage)
- Re-exports internal inspection types and functions
-
internal/inspection: Core inspection implementation
virt_inspector.go: libguestfs virt-inspector integration with NBDKit/VDDKvirt_v2v_inspector.go: virt-v2v-inspector integration with VDDK direct accessnbdkit_vddk.go: NBDKit server with VDDK plugin for snapshot accessvirt_v2v_open.go: virt-v2v-open NBD server integration
Import the library in your Go project:
import (
"github.com/kubev2v/vm-migration-detective/pkg/inspection"
"github.com/kubev2v/vm-migration-detective/pkg/types"
)inspector := inspection.NewVirtInspector("", 30*time.Minute, logger)
inspectionData, err := inspector.Inspect(
ctx,
vmName,
snapshotName,
vcenterURL,
datacenter,
username,
password,
diskInfo,
)
// inspectionData is *types.VirtInspectorXML with OS info, apps, filesystems, etc.inspector := inspection.NewVirtV2vInspector("", 30*time.Minute, logger)
inspectionData, err := inspector.Inspect(
ctx,
vmName,
snapshotName,
vcenterURL,
datacenter,
username,
password,
diskInfo,
"no_verify=1", // SSL verification option
)
// inspectionData is *types.VirtV2VInspectorXML with OS and firmware infoSee the Makefile for available targets:
make validate-all: Run all validations (lint, format check, tidy check)make lint: Run golangci-lintmake format: Format code with goimportsmake check-format: Check if code formatting is correctmake tidy: Tidy go modulesmake tidy-check: Check if go.mod and go.sum are tidymake verify: Verify the code compilesmake clean: Clean build artifacts and downloaded tools
- Go 1.24.0 or later
- libguestfs tools (virt-inspector)
- virt-v2v tools (virt-v2v-inspector)
- NBDKit with VDDK plugin (optional, for VDDK support)