vm

package
v0.0.0-...-bd75e23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2026 License: MIT Imports: 33 Imported by: 1

Documentation

Index

Constants

View Source
const (
	StateInitializing  = State("initializing")
	StateStarting      = State("starting")
	StateCheckpointing = State("checkpointing")
	StateRestoring     = State("restoring")
	StateStopping      = State("stopping")
	StateTerminating   = State("terminating")
	StateTerminated    = State("terminated")
	StateMaintenance   = State("maintenance")
)

Enhanced lifecycle states that extend the existing State type

View Source
const (
	// ScheduleStatePending indicates the migration is scheduled but not started
	ScheduleStatePending = "pending"

	// ScheduleStateRunning indicates the migration is in progress
	ScheduleStateRunning = "running"

	// ScheduleStateCompleted indicates the migration completed successfully
	ScheduleStateCompleted = "completed"

	// ScheduleStateFailed indicates the migration failed
	ScheduleStateFailed = "failed"

	// ScheduleStateCancelled indicates the migration was cancelled
	ScheduleStateCancelled = "cancelled"
)
View Source
const (
	// Predictive prefetching targets
	TARGET_PREDICTION_ACCURACY   = 0.85 // 85% accuracy
	TARGET_PREDICTION_LATENCY_MS = 10   // 10ms max prediction latency
)
View Source
const (
	// StateUnknown represents an unknown VM state
	StateUnknown State = "unknown"

	// StateCreated means the VM has been created but not started
	StateCreated State = "created"

	// StateCreating represents a VM that is being created
	StateCreating State = "creating"

	// StateProvisioning represents a VM that is being provisioned
	StateProvisioning State = "provisioning"

	// StateRunning means the VM is currently running
	StateRunning State = "running"

	// StateStopped means the VM has been stopped
	StateStopped State = "stopped"

	// StatePaused represents a paused VM
	StatePaused State = "paused"

	// StatePausing represents a VM that is being paused
	StatePausing State = "pausing"

	// StateResuming represents a VM that is being resumed
	StateResuming State = "resuming"

	// StateRestarting represents a VM that is being restarted
	StateRestarting State = "restarting"

	// StateDeleting represents a VM that is being deleted
	StateDeleting State = "deleting"

	// StateMigrating represents a VM that is being migrated
	StateMigrating State = "migrating"

	// StateFailed means the VM has failed to start or has crashed
	StateFailed State = "failed"

	// Legacy state constants for compatibility
	VMStateError     = StateFailed
	VMStateRunning   = StateRunning
	VMStateDeleting  = StateDeleting
	VMStateCreating  = StateCreating
	VMStateMigrating = StateMigrating
	VMStateSuspended = StatePaused
	VMStatePaused    = StatePaused
	VMStateStopped   = StateStopped
)
View Source
const (
	MigrationStatePending      string = "pending"
	MigrationStatePreparing    string = "preparing"
	MigrationStateInitiating   string = "initiating"
	MigrationStateRunning      string = "running"
	MigrationStateTransferring string = "transferring"
	MigrationStateActivating   string = "activating"
	MigrationStateCompleted    string = "completed"
	MigrationStateFailed       string = "failed"
	MigrationStateError        string = "error"
	MigrationStateRollingBack  string = "rollingback"
	MigrationStateRolledBack   string = "rolledback"
)

Migration states

View Source
const (
	MigrationEventInitiated         string = "migration_initiated"
	MigrationEventStarted           string = "migration_started"
	MigrationEventProgress          string = "migration_progress"
	MigrationEventTransferStarted   string = "transfer_started"
	MigrationEventTransferDone      string = "transfer_done"
	MigrationEventActivationStarted string = "activation_started"
	MigrationEventActivationDone    string = "activation_done"
	MigrationEventCompleted         string = "migration_completed"
	MigrationEventFailed            string = "migration_failed"
	MigrationEventRollbackStarted   string = "rollback_started"
	MigrationEventRollbackDone      string = "rollback_done"
)

MigrationEventTypes define the different types of migration events

View Source
const (
	VMOperationStart    = "start"
	VMOperationStop     = "stop"
	VMOperationRestart  = "restart"
	VMOperationDelete   = "delete"
	VMOperationMigrate  = "migrate"
	VMOperationPause    = "pause"
	VMOperationResume   = "resume"
	VMOperationSnapshot = "snapshot"
	VMOperationRestore  = "restore"
	VMOperationClone    = "clone"
)

VM operation constants

Variables

View Source
var (
	ErrVMNotFound            = errors.New("VM not found")
	ErrOperationNotSupported = errors.New("operation not supported by driver")
	ErrInvalidVMState        = errors.New("invalid VM state for operation")
	ErrBackupNotFound        = errors.New("backup not found")
	ErrBackupCorrupted       = errors.New("backup is corrupted")
)

Enhanced error types for better error handling

View Source
var (
	ErrMigrationNotFound = errors.New("migration not found")
)

Functions

func CalculateBandwidthRequirements

func CalculateBandwidthRequirements(totalBytes int64, maxDowntimeSeconds int) int64

CalculateBandwidthRequirements calculates the required bandwidth for a migration

func CalculateFileChecksum

func CalculateFileChecksum(filePath string) (string, error)

CalculateFileChecksum calculates SHA-256 checksum of a file

func CalculateOptimalIterations

func CalculateOptimalIterations(memorySizeMB int, dirtyRateMBPerSec int64, bandwidthMBPerSec int64, maxDowntimeMS int) int

CalculateOptimalIterations calculates the optimal number of pre-copy iterations

func CheckNetworkConnectivity

func CheckNetworkConnectivity(address string, port int, timeoutSec int) (bool, error)

CheckNetworkConnectivity checks if there's network connectivity between two nodes

func CheckSystemResources

func CheckSystemResources(requiredMemoryMB int) (bool, map[string]interface{})

CheckSystemResources checks if the system has enough resources for migration

func CompressFile

func CompressFile(sourcePath, destPath string, level int) (int64, error)

CompressFile compresses a file using gzip at the specified compression level

func DecompressFile

func DecompressFile(sourcePath, destPath string) (int64, error)

DecompressFile decompresses a gzip compressed file

func EstimateMemoryDirtyRate

func EstimateMemoryDirtyRate(vm *VM) (int64, error)

EstimateMemoryDirtyRate simulates memory dirty rate calculation for pre-copy migrations

func EstimateMigrationTime

func EstimateMigrationTime(totalBytes int64, bandwidthBytesPerSec int64) time.Duration

EstimateMigrationTime estimates the time required for migration

func JSONEventHandler

func JSONEventHandler(event VMEvent)

JSONEventHandler is a handler that outputs VM events as JSON

func LogAlertHandler

func LogAlertHandler(alert *Alert)

LogAlertHandler logs alerts

func LoggingEventHandler

func LoggingEventHandler(event VMEvent)

LoggingEventHandler is a handler that logs VM events

func VerifyFileIntegrity

func VerifyFileIntegrity(filePath, expectedChecksum string) (bool, error)

VerifyFileIntegrity verifies a file's integrity by comparing its checksum

Types

type AccessMetrics

type AccessMetrics struct {
	ReadLatencyMs       float64   `json:"read_latency_ms"`
	WriteLatencyMs      float64   `json:"write_latency_ms"`
	CacheHitRate        float64   `json:"cache_hit_rate"`
	LocalHitRate        float64   `json:"local_hit_rate"`
	RemoteHitRate       float64   `json:"remote_hit_rate"`
	ErrorRate           float64   `json:"error_rate"`
	ThroughputOpsPerSec float64   `json:"throughput_ops_per_sec"`
	LastMeasurement     time.Time `json:"last_measurement"`
}

AccessMetrics tracks state access performance

type AccessPattern

type AccessPattern struct {
	AccessCount     int64     `json:"access_count"`
	LastAccess      time.Time `json:"last_access"`
	AccessFrequency float64   `json:"access_frequency"` // accesses per second
	ReadWriteRatio  float64   `json:"read_write_ratio"` // reads / writes
	Locality        float64   `json:"locality"`         // spatial locality score
}

AccessPattern tracks memory access patterns for optimization

type Alert

type Alert struct {
	ID         string     `json:"id"`
	VMID       string     `json:"vm_id"`
	Level      AlertLevel `json:"level"`
	Message    string     `json:"message"`
	Timestamp  time.Time  `json:"timestamp"`
	Resolved   bool       `json:"resolved"`
	ResolvedAt *time.Time `json:"resolved_at,omitempty"`
}

Alert represents a VM alert

type AlertConfig

type AlertConfig struct {
	Enabled         bool     `json:"enabled"`
	EmailRecipients []string `json:"email_recipients,omitempty"`
	WebhookURL      string   `json:"webhook_url,omitempty"`
	AlertOnWarning  bool     `json:"alert_on_warning"`
	AlertOnCritical bool     `json:"alert_on_critical"`
	AlertOnRecover  bool     `json:"alert_on_recover"`
}

AlertConfig represents alert configuration

type AlertHandler

type AlertHandler func(alert *Alert)

AlertHandler is a function that handles alerts

type AlertLevel

type AlertLevel string

AlertLevel represents the level of an alert

const (
	// AlertLevelInfo represents an informational alert
	AlertLevelInfo AlertLevel = "info"

	// AlertLevelWarning represents a warning alert
	AlertLevelWarning AlertLevel = "warning"

	// AlertLevelCritical represents a critical alert
	AlertLevelCritical AlertLevel = "critical"
)

type AutoResolveRule

type AutoResolveRule struct {
	RuleID        string                 `json:"rule_id"`
	FieldPattern  string                 `json:"field_pattern"`
	ConflictTypes []string               `json:"conflict_types"`
	Strategy      ConflictStrategy       `json:"strategy"`
	Conditions    map[string]interface{} `json:"conditions"`
	Priority      int                    `json:"priority"`
	Enabled       bool                   `json:"enabled"`
}

AutoResolveRule defines automatic conflict resolution rules

type BackupStatus

type BackupStatus string

BackupStatus represents the status of a backup

const (
	// BackupStatusCreating indicates the backup is being created
	BackupStatusCreating BackupStatus = "creating"

	// BackupStatusCompleted indicates the backup completed successfully
	BackupStatusCompleted BackupStatus = "completed"

	// BackupStatusFailed indicates the backup failed
	BackupStatusFailed BackupStatus = "failed"

	// BackupStatusRestoring indicates the backup is being restored
	BackupStatusRestoring BackupStatus = "restoring"

	// BackupStatusDeleting indicates the backup is being deleted
	BackupStatusDeleting BackupStatus = "deleting"

	// BackupStatusDeleted indicates the backup has been deleted
	BackupStatusDeleted BackupStatus = "deleted"
)

type BackupStorageProvider

type BackupStorageProvider interface {
	// Store stores a backup
	Store(ctx context.Context, vmID, backupID string, data []byte) (string, error)

	// Retrieve retrieves a backup
	Retrieve(ctx context.Context, storagePath string) ([]byte, error)

	// Delete deletes a backup
	Delete(ctx context.Context, storagePath string) error

	// List lists all backups for a VM
	List(ctx context.Context, vmID string) ([]string, error)
}

BackupStorageProvider is an interface for backup storage providers

type BackupType

type BackupType string

BackupType represents the type of backup

const (
	// BackupTypeFull represents a full backup
	BackupTypeFull BackupType = "full"

	// BackupTypeIncremental represents an incremental backup
	BackupTypeIncremental BackupType = "incremental"

	// BackupTypeDifferential represents a differential backup
	BackupTypeDifferential BackupType = "differential"
)

type CPUFeatures

type CPUFeatures struct {
	VTx            bool     `json:"vtx"`             // Intel VT-x
	AMDV           bool     `json:"amdv"`            // AMD-V
	EPT            bool     `json:"ept"`             // Extended Page Tables
	NPT            bool     `json:"npt"`             // Nested Page Tables
	VPID           bool     `json:"vpid"`            // Virtual Processor ID
	ASID           bool     `json:"asid"`            // Address Space ID
	AES            bool     `json:"aes"`             // AES-NI
	AVX            bool     `json:"avx"`             // Advanced Vector Extensions
	AVX2           bool     `json:"avx2"`            // Advanced Vector Extensions 2
	TSX            bool     `json:"tsx"`             // Transactional Synchronization Extensions
	SGX            bool     `json:"sgx"`             // Software Guard Extensions
	SupportedFlags []string `json:"supported_flags"` // Raw CPU flags
	ModelName      string   `json:"model_name"`      // CPU model name
	Vendor         string   `json:"vendor"`          // CPU vendor
	Cores          int      `json:"cores"`           // Physical cores
	Threads        int      `json:"threads"`         // Logical threads
	MaxFrequency   int64    `json:"max_frequency"`   // Max frequency in MHz
	CacheL1        int64    `json:"cache_l1"`        // L1 cache size in KB
	CacheL2        int64    `json:"cache_l2"`        // L2 cache size in KB
	CacheL3        int64    `json:"cache_l3"`        // L3 cache size in KB
}

CPUFeatures represents CPU virtualization features

type CPUMetrics

type CPUMetrics struct {
	UsagePercent     float64 `json:"usage_percent"`
	SystemPercent    float64 `json:"system_percent"`
	UserPercent      float64 `json:"user_percent"`
	IOWaitPercent    float64 `json:"iowait_percent"`
	StealPercent     float64 `json:"steal_percent"`
	Cores            int     `json:"cores"`
	ThrottledPeriods int64   `json:"throttled_periods"`
	ThrottledTime    int64   `json:"throttled_time"`
}

CPUMetrics represents CPU metrics

type CPUPinningConfig

type CPUPinningConfig struct {
	VCPUs       []VCPUPinning          `json:"vcpus"`
	IOThreads   []IOThreadPinning      `json:"io_threads,omitempty"`
	EmulatorPin string                 `json:"emulator_pin,omitempty"`
	Options     map[string]interface{} `json:"options,omitempty"`
}

CPUPinningConfig represents CPU pinning configuration

type CPUStats

type CPUStats struct {
	Timestamp  time.Time
	UserTime   int64
	SystemTime int64
	TotalTime  int64
}

CPUStats holds CPU statistics for calculating usage

type CapabilityDetector

type CapabilityDetector struct {
	// contains filtered or unexported fields
}

CapabilityDetector detects available hypervisors and their capabilities

type Certificate

type Certificate struct {
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Type        string            `json:"type"`
	Fingerprint string            `json:"fingerprint"`
	NotBefore   time.Time         `json:"not_before"`
	NotAfter    time.Time         `json:"not_after"`
	CreatedAt   time.Time         `json:"created_at"`
	UpdatedAt   time.Time         `json:"updated_at"`
	Path        string            `json:"path"`
	Tags        []string          `json:"tags,omitempty"`
	Metadata    map[string]string `json:"metadata,omitempty"`
}

Certificate represents a certificate

type Checkpoint

type Checkpoint struct {
	ID           string                 `json:"id"`
	Timestamp    time.Time              `json:"timestamp"`
	MemoryState  []byte                 `json:"memory_state"`
	DiskState    map[string][]byte      `json:"disk_state"`
	NetworkState map[string]interface{} `json:"network_state"`
	CPUState     map[string]interface{} `json:"cpu_state"`
	Metadata     map[string]string      `json:"metadata"`
	Size         int64                  `json:"size"`
	Compressed   bool                   `json:"compressed"`
	Encrypted    bool                   `json:"encrypted"`
}

Checkpoint represents a VM checkpoint

type CheckpointStorage

type CheckpointStorage interface {
	SaveCheckpoint(checkpoint *Checkpoint) error
	LoadCheckpoint(id string) (*Checkpoint, error)
	DeleteCheckpoint(id string) error
	ListCheckpoints(vmID string) ([]*Checkpoint, error)
}

CheckpointStorage defines the interface for checkpoint storage

type ClusterRef

type ClusterRef struct {
	ClusterID       string    `json:"cluster_id"`
	ClusterEndpoint string    `json:"cluster_endpoint"`
	LastContact     time.Time `json:"last_contact"`
	Available       bool      `json:"available"`
	RTT             float64   `json:"rtt"` // Round trip time in ms
}

ClusterRef represents a reference to another cluster

type ClusterRole

type ClusterRole string

ClusterRole represents a role in a VM cluster

const (
	// ClusterRoleMaster represents a master node in a cluster
	ClusterRoleMaster ClusterRole = "master"

	// ClusterRoleWorker represents a worker node in a cluster
	ClusterRoleWorker ClusterRole = "worker"

	// ClusterRoleStorage represents a storage node in a cluster
	ClusterRoleStorage ClusterRole = "storage"
)

type ClusterState

type ClusterState string

ClusterState represents the state of a VM cluster

const (
	// ClusterStateCreating indicates the cluster is being created
	ClusterStateCreating ClusterState = "creating"

	// ClusterStateRunning indicates the cluster is running
	ClusterStateRunning ClusterState = "running"

	// ClusterStateUpdating indicates the cluster is being updated
	ClusterStateUpdating ClusterState = "updating"

	// ClusterStateDegraded indicates the cluster is in a degraded state
	ClusterStateDegraded ClusterState = "degraded"

	// ClusterStateStopped indicates the cluster is stopped
	ClusterStateStopped ClusterState = "stopped"

	// ClusterStateDeleting indicates the cluster is being deleted
	ClusterStateDeleting ClusterState = "deleting"
)

type ConflictPolicy

type ConflictPolicy struct {
	DefaultStrategy  ConflictStrategy            `json:"default_strategy"`
	FieldPolicies    map[string]ConflictStrategy `json:"field_policies"`
	TimeoutMs        int64                       `json:"timeout_ms"`
	RequireConsensus bool                        `json:"require_consensus"`
	VotingEnabled    bool                        `json:"voting_enabled"`
}

ConflictPolicy defines how conflicts should be resolved

type ConflictResolutionInfo

type ConflictResolutionInfo struct {
	ActiveConflicts  []StateConflict    `json:"active_conflicts"`
	ResolutionPolicy ConflictPolicy     `json:"resolution_policy"`
	LastResolution   time.Time          `json:"last_resolution"`
	ConflictHistory  []ResolvedConflict `json:"conflict_history"`
	AutoResolveRules []AutoResolveRule  `json:"auto_resolve_rules"`
}

ConflictResolutionInfo tracks conflict resolution state

type ConflictSeverity

type ConflictSeverity string

ConflictSeverity defines the severity of a conflict

const (
	ConflictSeverityLow      ConflictSeverity = "low"
	ConflictSeverityMedium   ConflictSeverity = "medium"
	ConflictSeverityHigh     ConflictSeverity = "high"
	ConflictSeverityCritical ConflictSeverity = "critical"
)

type ConflictStrategy

type ConflictStrategy string

ConflictStrategy defines conflict resolution strategies

const (
	ConflictLastWriteWins  ConflictStrategy = "last_write_wins"
	ConflictHighestVersion ConflictStrategy = "highest_version"
	ConflictMerge          ConflictStrategy = "merge"
	ConflictManual         ConflictStrategy = "manual"
	ConflictVoting         ConflictStrategy = "voting"
)

type ConsistencyLevel

type ConsistencyLevel string

ConsistencyLevel defines required state consistency

const (
	ConsistencyEventual ConsistencyLevel = "eventual"
	ConsistencyStrong   ConsistencyLevel = "strong"
	ConsistencySession  ConsistencyLevel = "session"
	ConsistencyLinear   ConsistencyLevel = "linearizable"
)

type ConsistencyMetrics

type ConsistencyMetrics struct {
	ConsistencyLatencyMs float64   `json:"consistency_latency_ms"`
	ConflictRate         float64   `json:"conflict_rate"`
	ResolutionTimeMs     float64   `json:"resolution_time_ms"`
	SyncSuccessRate      float64   `json:"sync_success_rate"`
	VectorClockDrift     float64   `json:"vector_clock_drift"`
	StateVersions        int64     `json:"state_versions"`
	LastConsistencyCheck time.Time `json:"last_consistency_check"`
}

ConsistencyMetrics tracks consistency performance

type ContainerConfig

type ContainerConfig struct {
	Enabled    bool
	DockerPath string
}

ContainerConfig contains container runtime configuration

type ContainerDriver

type ContainerDriver struct {
	// contains filtered or unexported fields
}

ContainerDriver implements the VMDriver interface for container-based VMs

func (*ContainerDriver) ConfigureCPUPinning

func (d *ContainerDriver) ConfigureCPUPinning(ctx context.Context, vmID string, pinning *CPUPinningConfig) error

ConfigureCPUPinning configures CPU pinning (not supported for containers)

func (*ContainerDriver) ConfigureNUMA

func (d *ContainerDriver) ConfigureNUMA(ctx context.Context, vmID string, topology *NUMATopology) error

ConfigureNUMA configures NUMA topology (not supported for containers)

func (*ContainerDriver) Create

func (d *ContainerDriver) Create(ctx context.Context, config VMConfig) (string, error)

Create creates a new container VM

func (*ContainerDriver) Delete

func (d *ContainerDriver) Delete(ctx context.Context, vmID string) error

Delete deletes a container VM

func (*ContainerDriver) GetCapabilities

func (d *ContainerDriver) GetCapabilities(ctx context.Context) (*HypervisorCapabilities, error)

GetCapabilities returns the capabilities of the container driver

func (*ContainerDriver) GetHypervisorInfo

func (d *ContainerDriver) GetHypervisorInfo(ctx context.Context) (*HypervisorInfo, error)

GetHypervisorInfo returns information about the container runtime

func (*ContainerDriver) GetInfo

func (d *ContainerDriver) GetInfo(ctx context.Context, vmID string) (*VMInfo, error)

GetInfo gets information about a container VM

func (*ContainerDriver) GetMetrics

func (d *ContainerDriver) GetMetrics(ctx context.Context, vmID string) (*VMInfo, error)

GetMetrics gets metrics for a container VM

func (*ContainerDriver) GetStatus

func (d *ContainerDriver) GetStatus(ctx context.Context, vmID string) (State, error)

GetStatus gets the status of a container VM

func (*ContainerDriver) HotPlugDevice

func (d *ContainerDriver) HotPlugDevice(ctx context.Context, vmID string, device *DeviceConfig) error

HotPlugDevice hot-plugs a device (not supported for containers)

func (*ContainerDriver) HotUnplugDevice

func (d *ContainerDriver) HotUnplugDevice(ctx context.Context, vmID string, deviceID string) error

HotUnplugDevice hot-unplugs a device (not supported for containers)

func (*ContainerDriver) ListVMs

func (d *ContainerDriver) ListVMs(ctx context.Context) ([]VMInfo, error)

ListVMs lists all container VMs

func (*ContainerDriver) Migrate

func (d *ContainerDriver) Migrate(ctx context.Context, vmID, target string, params map[string]string) error

Migrate migrates a container VM (not supported)

func (*ContainerDriver) Pause

func (d *ContainerDriver) Pause(ctx context.Context, vmID string) error

Pause pauses a container VM

func (*ContainerDriver) Resume

func (d *ContainerDriver) Resume(ctx context.Context, vmID string) error

Resume resumes a container VM

func (*ContainerDriver) Snapshot

func (d *ContainerDriver) Snapshot(ctx context.Context, vmID, name string, params map[string]string) (string, error)

Snapshot creates a snapshot of a container VM (not supported)

func (*ContainerDriver) Start

func (d *ContainerDriver) Start(ctx context.Context, vmID string) error

Start starts a container VM

func (*ContainerDriver) Stop

func (d *ContainerDriver) Stop(ctx context.Context, vmID string) error

Stop stops a container VM

func (*ContainerDriver) SupportsGPUPassthrough

func (d *ContainerDriver) SupportsGPUPassthrough() bool

SupportsGPUPassthrough returns whether the driver supports GPU passthrough

func (*ContainerDriver) SupportsHotPlug

func (d *ContainerDriver) SupportsHotPlug() bool

SupportsHotPlug returns whether the driver supports hot-plugging devices

func (*ContainerDriver) SupportsLiveMigration

func (d *ContainerDriver) SupportsLiveMigration() bool

SupportsLiveMigration returns whether the driver supports live migration

func (*ContainerDriver) SupportsMigrate

func (d *ContainerDriver) SupportsMigrate() bool

SupportsMigrate returns whether the driver supports migration

func (*ContainerDriver) SupportsNUMA

func (d *ContainerDriver) SupportsNUMA() bool

SupportsNUMA returns whether the driver supports NUMA configuration

func (*ContainerDriver) SupportsPause

func (d *ContainerDriver) SupportsPause() bool

SupportsPause returns whether the driver supports pausing VMs

func (*ContainerDriver) SupportsResume

func (d *ContainerDriver) SupportsResume() bool

SupportsResume returns whether the driver supports resuming VMs

func (*ContainerDriver) SupportsSRIOV

func (d *ContainerDriver) SupportsSRIOV() bool

SupportsSRIOV returns whether the driver supports SR-IOV

func (*ContainerDriver) SupportsSnapshot

func (d *ContainerDriver) SupportsSnapshot() bool

SupportsSnapshot returns whether the driver supports snapshots

type ContainerInfo

type ContainerInfo struct {
	ID      string
	Image   string
	Status  State
	Created time.Time
	Config  VMConfig
}

ContainerInfo holds information about a containerd container

type ContainerdConfig

type ContainerdConfig struct {
	Enabled   bool
	Address   string
	Namespace string
}

ContainerdConfig contains containerd specific configuration

type ContainerdDriver

type ContainerdDriver struct {
	// contains filtered or unexported fields
}

ContainerdDriver is a functional implementation of the containerd driver

func (*ContainerdDriver) ConfigureCPUPinning

func (d *ContainerdDriver) ConfigureCPUPinning(ctx context.Context, vmID string, pinning *CPUPinningConfig) error

ConfigureCPUPinning configures CPU pinning

func (*ContainerdDriver) ConfigureNUMA

func (d *ContainerdDriver) ConfigureNUMA(ctx context.Context, vmID string, topology *NUMATopology) error

ConfigureNUMA configures NUMA topology

func (*ContainerdDriver) Create

func (d *ContainerdDriver) Create(ctx context.Context, config VMConfig) (string, error)

Create creates a new containerd container VM

func (*ContainerdDriver) Delete

func (d *ContainerdDriver) Delete(ctx context.Context, vmID string) error

Delete deletes a containerd container VM

func (*ContainerdDriver) GetCapabilities

func (d *ContainerdDriver) GetCapabilities(ctx context.Context) (*HypervisorCapabilities, error)

GetCapabilities returns the capabilities of the containerd driver

func (*ContainerdDriver) GetHypervisorInfo

func (d *ContainerdDriver) GetHypervisorInfo(ctx context.Context) (*HypervisorInfo, error)

GetHypervisorInfo returns information about the containerd runtime

func (*ContainerdDriver) GetInfo

func (d *ContainerdDriver) GetInfo(ctx context.Context, vmID string) (*VMInfo, error)

GetInfo gets information about a containerd container VM

func (*ContainerdDriver) GetMetrics

func (d *ContainerdDriver) GetMetrics(ctx context.Context, vmID string) (*VMInfo, error)

GetMetrics gets metrics for a containerd container VM

func (*ContainerdDriver) GetStatus

func (d *ContainerdDriver) GetStatus(ctx context.Context, vmID string) (State, error)

GetStatus gets the status of a containerd container VM

func (*ContainerdDriver) HotPlugDevice

func (d *ContainerdDriver) HotPlugDevice(ctx context.Context, vmID string, device *DeviceConfig) error

HotPlugDevice hot-plugs a device

func (*ContainerdDriver) HotUnplugDevice

func (d *ContainerdDriver) HotUnplugDevice(ctx context.Context, vmID string, deviceID string) error

HotUnplugDevice hot-unplugs a device

func (*ContainerdDriver) ListVMs

func (d *ContainerdDriver) ListVMs(ctx context.Context) ([]VMInfo, error)

ListVMs lists all containerd container VMs

func (*ContainerdDriver) Migrate

func (d *ContainerdDriver) Migrate(ctx context.Context, vmID, target string, params map[string]string) error

Migrate migrates a containerd container VM

func (*ContainerdDriver) Pause

func (d *ContainerdDriver) Pause(ctx context.Context, vmID string) error

Pause pauses a containerd container VM

func (*ContainerdDriver) Resume

func (d *ContainerdDriver) Resume(ctx context.Context, vmID string) error

Resume resumes a containerd container VM

func (*ContainerdDriver) Snapshot

func (d *ContainerdDriver) Snapshot(ctx context.Context, vmID, name string, params map[string]string) (string, error)

Snapshot creates a snapshot of a containerd container VM

func (*ContainerdDriver) Start

func (d *ContainerdDriver) Start(ctx context.Context, vmID string) error

Start starts a containerd container VM

func (*ContainerdDriver) Stop

func (d *ContainerdDriver) Stop(ctx context.Context, vmID string) error

Stop stops a containerd container VM

func (*ContainerdDriver) SupportsGPUPassthrough

func (d *ContainerdDriver) SupportsGPUPassthrough() bool

SupportsGPUPassthrough returns whether the driver supports GPU passthrough

func (*ContainerdDriver) SupportsHotPlug

func (d *ContainerdDriver) SupportsHotPlug() bool

SupportsHotPlug returns whether the driver supports hot-plugging devices

func (*ContainerdDriver) SupportsLiveMigration

func (d *ContainerdDriver) SupportsLiveMigration() bool

SupportsLiveMigration returns whether the driver supports live migration

func (*ContainerdDriver) SupportsMigrate

func (d *ContainerdDriver) SupportsMigrate() bool

SupportsMigrate returns whether the driver supports migration

func (*ContainerdDriver) SupportsNUMA

func (d *ContainerdDriver) SupportsNUMA() bool

SupportsNUMA returns whether the driver supports NUMA configuration

func (*ContainerdDriver) SupportsPause

func (d *ContainerdDriver) SupportsPause() bool

SupportsPause returns whether the driver supports pausing VMs

func (*ContainerdDriver) SupportsResume

func (d *ContainerdDriver) SupportsResume() bool

SupportsResume returns whether the driver supports resuming VMs

func (*ContainerdDriver) SupportsSRIOV

func (d *ContainerdDriver) SupportsSRIOV() bool

SupportsSRIOV returns whether the driver supports SR-IOV

func (*ContainerdDriver) SupportsSnapshot

func (d *ContainerdDriver) SupportsSnapshot() bool

SupportsSnapshot returns whether the driver supports snapshots

type CoreStubDriver

type CoreStubDriver struct{}

func (*CoreStubDriver) ConfigureCPUPinning

func (d *CoreStubDriver) ConfigureCPUPinning(ctx context.Context, vmID string, pinning *CPUPinningConfig) error

func (*CoreStubDriver) ConfigureNUMA

func (d *CoreStubDriver) ConfigureNUMA(ctx context.Context, vmID string, topology *NUMATopology) error

func (*CoreStubDriver) Create

func (d *CoreStubDriver) Create(ctx context.Context, cfg VMConfig) (string, error)

func (*CoreStubDriver) Delete

func (d *CoreStubDriver) Delete(ctx context.Context, vmID string) error

func (*CoreStubDriver) GetCapabilities

func (d *CoreStubDriver) GetCapabilities(ctx context.Context) (*HypervisorCapabilities, error)

func (*CoreStubDriver) GetHypervisorInfo

func (d *CoreStubDriver) GetHypervisorInfo(ctx context.Context) (*HypervisorInfo, error)

func (*CoreStubDriver) GetInfo

func (d *CoreStubDriver) GetInfo(ctx context.Context, vmID string) (*VMInfo, error)

func (*CoreStubDriver) GetMetrics

func (d *CoreStubDriver) GetMetrics(ctx context.Context, vmID string) (*VMInfo, error)

func (*CoreStubDriver) GetStatus

func (d *CoreStubDriver) GetStatus(ctx context.Context, vmID string) (State, error)

func (*CoreStubDriver) HotPlugDevice

func (d *CoreStubDriver) HotPlugDevice(ctx context.Context, vmID string, device *DeviceConfig) error

func (*CoreStubDriver) HotUnplugDevice

func (d *CoreStubDriver) HotUnplugDevice(ctx context.Context, vmID string, deviceID string) error

func (*CoreStubDriver) ListVMs

func (d *CoreStubDriver) ListVMs(ctx context.Context) ([]VMInfo, error)

func (*CoreStubDriver) Migrate

func (d *CoreStubDriver) Migrate(ctx context.Context, vmID, target string, params map[string]string) error

func (*CoreStubDriver) Pause

func (d *CoreStubDriver) Pause(ctx context.Context, vmID string) error

func (*CoreStubDriver) Resume

func (d *CoreStubDriver) Resume(ctx context.Context, vmID string) error

func (*CoreStubDriver) Snapshot

func (d *CoreStubDriver) Snapshot(ctx context.Context, vmID, name string, params map[string]string) (string, error)

func (*CoreStubDriver) Start

func (d *CoreStubDriver) Start(ctx context.Context, vmID string) error

func (*CoreStubDriver) Stop

func (d *CoreStubDriver) Stop(ctx context.Context, vmID string) error

func (*CoreStubDriver) SupportsGPUPassthrough

func (d *CoreStubDriver) SupportsGPUPassthrough() bool

func (*CoreStubDriver) SupportsHotPlug

func (d *CoreStubDriver) SupportsHotPlug() bool

func (*CoreStubDriver) SupportsLiveMigration

func (d *CoreStubDriver) SupportsLiveMigration() bool

func (*CoreStubDriver) SupportsMigrate

func (d *CoreStubDriver) SupportsMigrate() bool

func (*CoreStubDriver) SupportsNUMA

func (d *CoreStubDriver) SupportsNUMA() bool

func (*CoreStubDriver) SupportsPause

func (d *CoreStubDriver) SupportsPause() bool

func (*CoreStubDriver) SupportsResume

func (d *CoreStubDriver) SupportsResume() bool

func (*CoreStubDriver) SupportsSRIOV

func (d *CoreStubDriver) SupportsSRIOV() bool

func (*CoreStubDriver) SupportsSnapshot

func (d *CoreStubDriver) SupportsSnapshot() bool

type CreateVMRequest

type CreateVMRequest struct {
	Name                  string            `json:"name"`
	Spec                  VMConfig          `json:"spec"`
	Tags                  map[string]string `json:"tags"`
	AllowMissingOwnership bool              `json:"-" yaml:"-"`
}

CreateVMRequest represents a request to create a VM

func (CreateVMRequest) Normalized

func (r CreateVMRequest) Normalized() CreateVMRequest

Normalized returns a request with the canonical NovaCron VM contract defaults applied.

func (CreateVMRequest) Validate

func (r CreateVMRequest) Validate() error

Validate checks whether a create request conforms to the canonical VM contract.

type DeviceConfig

type DeviceConfig struct {
	Type       string                 `json:"type"` // cpu, memory, disk, network, gpu, usb
	Name       string                 `json:"name"`
	Address    string                 `json:"address,omitempty"`
	Bus        string                 `json:"bus,omitempty"`
	Slot       string                 `json:"slot,omitempty"`
	Parameters map[string]interface{} `json:"parameters"`
}

DeviceConfig represents a device configuration for hot-plug operations

type DiskImage

type DiskImage struct {
	Path        string `json:"path"`
	Size        int64  `json:"size"`
	Format      string `json:"format"`
	Checksum    string `json:"checksum"`
	Compressed  bool   `json:"compressed"`
	Incremental bool   `json:"incremental"`
}

DiskImage represents a disk image in a snapshot

type DiskMetrics

type DiskMetrics struct {
	Device         string  `json:"device"`
	TotalBytes     int64   `json:"total_bytes"`
	UsedBytes      int64   `json:"used_bytes"`
	UsagePercent   float64 `json:"usage_percent"`
	ReadBytes      int64   `json:"read_bytes"`
	WriteBytes     int64   `json:"write_bytes"`
	ReadOps        int64   `json:"read_ops"`
	WriteOps       int64   `json:"write_ops"`
	ReadLatencyMs  float64 `json:"read_latency_ms"`
	WriteLatencyMs float64 `json:"write_latency_ms"`
	IOTimeMs       int64   `json:"io_time_ms"`
}

DiskMetrics represents disk metrics

type DiskStats

type DiskStats struct {
	Timestamp  time.Time
	ReadBytes  int64
	WriteBytes int64
	ReadOps    int64
	WriteOps   int64
	IOTimeMs   int64
}

DiskStats holds disk statistics for calculating rates

type DistributedMetrics

type DistributedMetrics struct {
	StateAccess        *AccessMetrics             `json:"state_access"`
	Migration          *MigrationMetrics          `json:"migration"`
	MemoryDistribution *MemoryDistributionMetrics `json:"memory_distribution"`
	NetworkPerformance *NetworkMetrics            `json:"network_performance"`
	ConsistencyMetrics *ConsistencyMetrics        `json:"consistency_metrics"`
	PredictiveMetrics  *PredictiveMetrics         `json:"predictive_metrics"`
	LastUpdate         time.Time                  `json:"last_update"`
}

DistributedMetrics tracks performance metrics for distributed operations

type DistributedStateInfo

type DistributedStateInfo struct {
	StateVersion        uint64           `json:"state_version"`         // Vector clock for state consistency
	LastStateUpdate     time.Time        `json:"last_state_update"`     // Timestamp of last state change
	StateDirty          bool             `json:"state_dirty"`           // Whether state needs synchronization
	ShardID             string           `json:"shard_id"`              // Which shard contains this VM's state
	ReplicationNodes    []string         `json:"replication_nodes"`     // Nodes that replicate this VM's state
	GlobalCoordinates   *GlobalPosition  `json:"global_coordinates"`    // Position in global cluster space
	MigrationState      *MigrationInfo   `json:"migration_state"`       // Current migration status
	PredictiveCache     *PredictiveCache `json:"predictive_cache"`      // AI-driven predictive caching info
	CrossClusterRefs    []string         `json:"cross_cluster_refs"`    // References to other clusters
	StateConsistency    ConsistencyLevel `json:"state_consistency"`     // Required consistency level
	LastConsistencySync time.Time        `json:"last_consistency_sync"` // Last consistency check
}

DistributedStateInfo holds information about VM's distributed state

type DriverCapabilities

type DriverCapabilities struct {
	SupportsCreate   bool
	SupportsStart    bool
	SupportsStop     bool
	SupportsDelete   bool
	SupportsStatus   bool
	SupportsInfo     bool
	SupportsMetrics  bool
	SupportsListVMs  bool
	SupportsPause    bool
	SupportsResume   bool
	SupportsSnapshot bool
	SupportsMigrate  bool
}

DriverCapabilities tracks what a driver supports for capability-based testing

type EnhancedVM

type EnhancedVM struct {
	*VM
	// contains filtered or unexported fields
}

EnhancedVM extends the basic VM with lifecycle management capabilities

type EventFilter

type EventFilter struct {
	Name      string
	Types     []EventType
	VMIDs     []string
	Severity  EventSeverity
	Enabled   bool
	Predicate func(*LifecycleEvent) bool
}

EventFilter defines event filtering criteria

type EventHandler

type EventHandler interface {
	HandleEvent(event *LifecycleEvent) error
	GetEventTypes() []EventType
	GetName() string
}

EventHandler defines the interface for event handlers

type EventSeverity

type EventSeverity int

EventSeverity represents event severity levels

const (
	SeverityInfo EventSeverity = iota
	SeverityWarning
	SeverityError
	SeverityCritical
)

func (EventSeverity) String

func (es EventSeverity) String() string

type EventType

type EventType int

EventType represents different types of lifecycle events

const (
	EventVMCreated EventType = iota
	EventVMStarted
	EventVMStopped
	EventVMPaused
	EventVMResumed
	EventVMFailed
	EventVMTerminated
	EventCheckpointCreated
	EventCheckpointRestored
	EventSnapshotCreated
	EventSnapshotRestored
	EventMigrationStarted
	EventMigrationCompleted
	EventMigrationFailed
	EventHealthCheckFailed
	EventResourceLimitExceeded
)

func (EventType) String

func (et EventType) String() string

type FederationContext

type FederationContext struct {
	HomeClusterID      string            `json:"home_cluster_id"`
	CurrentClusterID   string            `json:"current_cluster_id"`
	AuthorizedClusters []string          `json:"authorized_clusters"`
	FederationTokens   map[string]string `json:"federation_tokens"`
	CrossClusterRefs   []ClusterRef      `json:"cross_cluster_refs"`
	SecurityContext    SecurityContext   `json:"security_context"`
	NetworkPolicy      NetworkPolicy     `json:"network_policy"`
}

FederationContext holds cross-cluster federation information

type FileMigrationStorage

type FileMigrationStorage struct {
	// contains filtered or unexported fields
}

FileMigrationStorage implements MigrationStorage using the filesystem

func NewFileMigrationStorage

func NewFileMigrationStorage(storageDir string) (*FileMigrationStorage, error)

NewFileMigrationStorage creates a new FileMigrationStorage

func (*FileMigrationStorage) DeleteMigrationRecord

func (s *FileMigrationStorage) DeleteMigrationRecord(migrationID string) error

DeleteMigrationRecord removes a migration record

func (*FileMigrationStorage) ListMigrationRecords

func (s *FileMigrationStorage) ListMigrationRecords() ([]*MigrationRecord, error)

ListMigrationRecords retrieves all migration records

func (*FileMigrationStorage) ListMigrationRecordsForVM

func (s *FileMigrationStorage) ListMigrationRecordsForVM(vmID string) ([]*MigrationRecord, error)

ListMigrationRecordsForVM retrieves all migration records for a specific VM

func (*FileMigrationStorage) LoadMigrationRecord

func (s *FileMigrationStorage) LoadMigrationRecord(migrationID string) (*MigrationRecord, error)

LoadMigrationRecord retrieves a migration record from a file

func (*FileMigrationStorage) SaveMigrationRecord

func (s *FileMigrationStorage) SaveMigrationRecord(record *MigrationRecord) error

SaveMigrationRecord persists a migration record to a file

type GPUDevice

type GPUDevice struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	Vendor        string `json:"vendor"`
	Model         string `json:"model"`
	MemoryMB      int64  `json:"memory_mb"`
	PCIAddress    string `json:"pci_address"`
	IOMMUGroup    int    `json:"iommu_group"`
	Virtualizable bool   `json:"virtualizable"`
	InUse         bool   `json:"in_use"`
}

GPUDevice represents a GPU device

type GPUVirtualizationMode

type GPUVirtualizationMode string

GPUVirtualizationMode represents GPU virtualization modes

const (
	GPUModePassthrough GPUVirtualizationMode = "passthrough"
	GPUModeVGPU        GPUVirtualizationMode = "vgpu"
	GPUModeSRIOV       GPUVirtualizationMode = "sriov"
	GPUModeMdev        GPUVirtualizationMode = "mdev"
)

type GeoCoord

type GeoCoord struct {
	Latitude  float64 `json:"latitude"`
	Longitude float64 `json:"longitude"`
}

GeoCoord represents geographic coordinates

type GlobalPosition

type GlobalPosition struct {
	ClusterID        string    `json:"cluster_id"`
	NodeID           string    `json:"node_id"`
	RegionID         string    `json:"region_id"`
	AvailabilityZone string    `json:"availability_zone"`
	GeographicCoord  *GeoCoord `json:"geographic_coord,omitempty"`
	NetworkLatency   float64   `json:"network_latency"` // ms to cluster root
}

GlobalPosition represents VM's position in the global distributed space

type HardwareVirtualization

type HardwareVirtualization struct {
	// contains filtered or unexported fields
}

HardwareVirtualization provides hardware-specific virtualization features

func NewHardwareVirtualization

func NewHardwareVirtualization() (*HardwareVirtualization, error)

NewHardwareVirtualization creates a new hardware virtualization manager

func (*HardwareVirtualization) AllocateVF

func (hv *HardwareVirtualization) AllocateVF(ctx context.Context, pciAddress, vmID string) (*VirtualFunction, error)

AllocateVF allocates a virtual function from an SR-IOV device

func (*HardwareVirtualization) DisableSRIOV

func (hv *HardwareVirtualization) DisableSRIOV(ctx context.Context, pciAddress string) error

DisableSRIOV disables SR-IOV on a device

func (*HardwareVirtualization) EnableSRIOV

func (hv *HardwareVirtualization) EnableSRIOV(ctx context.Context, pciAddress string, numVFs int) error

EnableSRIOV enables SR-IOV on a device

func (*HardwareVirtualization) GetCPUFeatures

func (hv *HardwareVirtualization) GetCPUFeatures() *CPUFeatures

GetCPUFeatures returns detected CPU features

func (*HardwareVirtualization) GetGPUDevices

func (hv *HardwareVirtualization) GetGPUDevices() map[string]*GPUDevice

GetGPUDevices returns all GPU devices

func (*HardwareVirtualization) GetNUMATopology

func (hv *HardwareVirtualization) GetNUMATopology() *SystemNUMATopology

GetNUMATopology returns system NUMA topology

func (*HardwareVirtualization) GetSRIOVDevices

func (hv *HardwareVirtualization) GetSRIOVDevices() map[string]*SRIOVDevice

GetSRIOVDevices returns all SR-IOV capable devices

func (*HardwareVirtualization) GetVirtualizationCapabilities

func (hv *HardwareVirtualization) GetVirtualizationCapabilities() map[string]interface{}

GetVirtualizationCapabilities returns a summary of virtualization capabilities

func (*HardwareVirtualization) IsIOMMUEnabled

func (hv *HardwareVirtualization) IsIOMMUEnabled() bool

IsIOMMUEnabled returns whether IOMMU is enabled

func (*HardwareVirtualization) IsVirtualizationEnabled

func (hv *HardwareVirtualization) IsVirtualizationEnabled() bool

IsVirtualizationEnabled returns whether hardware virtualization is enabled

func (*HardwareVirtualization) Refresh

func (hv *HardwareVirtualization) Refresh(ctx context.Context) error

Refresh refreshes hardware information

func (*HardwareVirtualization) ReleaseVF

func (hv *HardwareVirtualization) ReleaseVF(ctx context.Context, pciAddress, vfID string) error

ReleaseVF releases a virtual function

type HealthCheck

type HealthCheck struct {
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Status      HealthStatus      `json:"status"`
	LastChecked time.Time         `json:"last_checked"`
	LastSuccess *time.Time        `json:"last_success,omitempty"`
	LastFailure *time.Time        `json:"last_failure,omitempty"`
	FailCount   int               `json:"fail_count"`
	Message     string            `json:"message,omitempty"`
	Metadata    map[string]string `json:"metadata,omitempty"`
}

HealthCheck represents a health check for a VM

func ProcessRunningCheck

func ProcessRunningCheck(ctx context.Context, vm *VM) (*HealthCheck, error)

ProcessRunningCheck checks if the VM process is running

func ResourceUsageCheck

func ResourceUsageCheck(ctx context.Context, vm *VM) (*HealthCheck, error)

ResourceUsageCheck checks if the VM's resource usage is within acceptable limits

type HealthCheckFunc

type HealthCheckFunc func(ctx context.Context, vm *VM) (*HealthCheck, error)

HealthCheckFunc is a function that performs a health check

type HealthCheckResult

type HealthCheckResult struct {
	CheckName string                 `json:"check_name"`
	Status    HealthState            `json:"status"`
	Message   string                 `json:"message"`
	Timestamp time.Time              `json:"timestamp"`
	Duration  time.Duration          `json:"duration"`
	Error     string                 `json:"error,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

HealthCheckResult represents the result of a health check

type HealthCheckSpec

type HealthCheckSpec struct {
	Name        string
	Description string
	CheckFunc   func() HealthCheckResult
	Timeout     time.Duration
	Critical    bool
}

HealthCheckSpec defines a health check specification

type HealthChecker

type HealthChecker struct {
	// contains filtered or unexported fields
}

HealthChecker monitors VM health

func NewHealthChecker

func NewHealthChecker(vmID string) *HealthChecker

NewHealthChecker creates a new health checker for a VM

func (*HealthChecker) AddCheck

func (hc *HealthChecker) AddCheck(check HealthCheckSpec)

AddCheck adds a custom health check

func (*HealthChecker) GetHistory

func (hc *HealthChecker) GetHistory(limit int) []HealthCheckResult

GetHistory returns the health check history

func (*HealthChecker) GetStatus

func (hc *HealthChecker) GetStatus() HealthState

GetStatus returns the current health status

func (*HealthChecker) RunHealthCheck

func (hc *HealthChecker) RunHealthCheck() []HealthCheckResult

RunHealthCheck performs an immediate health check

func (*HealthChecker) SetEventCallback

func (hc *HealthChecker) SetEventCallback(callback func(result HealthCheckResult))

SetEventCallback sets a callback for health check events

func (*HealthChecker) SetInterval

func (hc *HealthChecker) SetInterval(interval time.Duration)

SetInterval sets the health check interval

func (*HealthChecker) Start

func (hc *HealthChecker) Start()

Start starts the health checker

func (*HealthChecker) Stop

func (hc *HealthChecker) Stop()

Stop stops the health checker

type HealthState

type HealthState int

HealthState represents overall health state

const (
	HealthUnknown HealthState = iota
	HealthHealthy
	HealthWarning
	HealthCritical
)

func (HealthState) String

func (hs HealthState) String() string

type HealthStatus

type HealthStatus string

HealthStatus represents the health status of a VM

const (
	// HealthStatusHealthy indicates the VM is healthy
	HealthStatusHealthy HealthStatus = "healthy"

	// HealthStatusDegraded indicates the VM is degraded
	HealthStatusDegraded HealthStatus = "degraded"

	// HealthStatusUnhealthy indicates the VM is unhealthy
	HealthStatusUnhealthy HealthStatus = "unhealthy"

	// HealthStatusUnknown indicates the VM's health is unknown
	HealthStatusUnknown HealthStatus = "unknown"
)

type HyperVConfig

type HyperVConfig struct {
	Enabled  bool
	Hostname string
	Username string
	Password string
	Domain   string
	UseSSL   bool
	Port     int
}

HyperVConfig contains Hyper-V specific configuration

type HypervisorCapabilities

type HypervisorCapabilities struct {
	Type                   VMType   `json:"type"`
	Version                string   `json:"version"`
	SupportsPause          bool     `json:"supports_pause"`
	SupportsResume         bool     `json:"supports_resume"`
	SupportsSnapshot       bool     `json:"supports_snapshot"`
	SupportsMigrate        bool     `json:"supports_migrate"`
	SupportsLiveMigration  bool     `json:"supports_live_migration"`
	SupportsHotPlug        bool     `json:"supports_hot_plug"`
	SupportsGPUPassthrough bool     `json:"supports_gpu_passthrough"`
	SupportsSRIOV          bool     `json:"supports_sriov"`
	SupportsNUMA           bool     `json:"supports_numa"`
	MaxVCPUs               int      `json:"max_vcpus"`
	MaxMemoryMB            int64    `json:"max_memory_mb"`
	SupportedFeatures      []string `json:"supported_features"`
	HardwareExtensions     []string `json:"hardware_extensions"`
}

HypervisorCapabilities represents the capabilities of a hypervisor

type HypervisorConfig

type HypervisorConfig struct {
	// Node configuration
	NodeID   string
	NodeName string

	// KVM/QEMU configuration
	KVM KVMConfig

	// VMware vSphere configuration
	VMware VMwareConfig

	// Hyper-V configuration
	HyperV HyperVConfig

	// XenServer configuration
	Xen XenConfig

	// Proxmox VE configuration
	Proxmox ProxmoxConfig

	// Container configurations
	Container  ContainerConfig
	Containerd ContainerdConfig

	// Auto-detection settings
	AutoDetect bool
	Priorities []VMType // Preferred order for auto-detection
}

HypervisorConfig contains configuration for all hypervisor types

func DefaultHypervisorConfig

func DefaultHypervisorConfig() *HypervisorConfig

DefaultHypervisorConfig returns a default hypervisor configuration

type HypervisorFactory

type HypervisorFactory struct {
	// contains filtered or unexported fields
}

HypervisorFactory provides a unified interface for creating hypervisor drivers

func NewHypervisorFactory

func NewHypervisorFactory(config *HypervisorConfig) (*HypervisorFactory, error)

NewHypervisorFactory creates a new hypervisor factory

func (*HypervisorFactory) Close

func (f *HypervisorFactory) Close() error

Close closes all initialized drivers

func (*HypervisorFactory) GetAllCapabilities

func (f *HypervisorFactory) GetAllCapabilities(ctx context.Context) (map[VMType]*HypervisorCapabilities, error)

GetAllCapabilities returns capabilities for all available hypervisors

func (*HypervisorFactory) GetBestDriver

func (f *HypervisorFactory) GetBestDriver(ctx context.Context) (VMDriver, VMType, error)

GetBestDriver returns the best available driver based on priorities

func (*HypervisorFactory) GetCapabilities

func (f *HypervisorFactory) GetCapabilities(ctx context.Context, vmType VMType) (*HypervisorCapabilities, error)

GetCapabilities returns capabilities for a specific hypervisor

func (*HypervisorFactory) GetDetectionResults

func (f *HypervisorFactory) GetDetectionResults(ctx context.Context) (map[VMType]*HypervisorSupport, error)

GetDetectionResults returns the results of hypervisor detection

func (*HypervisorFactory) GetDriver

func (f *HypervisorFactory) GetDriver(ctx context.Context, vmType VMType) (VMDriver, error)

GetDriver returns a driver for the specified VM type

func (*HypervisorFactory) GetSupportedTypes

func (f *HypervisorFactory) GetSupportedTypes() []VMType

GetSupportedTypes returns all supported VM types

func (*HypervisorFactory) RefreshCapabilities

func (f *HypervisorFactory) RefreshCapabilities(ctx context.Context) error

RefreshCapabilities refreshes the capability cache

func (*HypervisorFactory) ValidateConfiguration

func (f *HypervisorFactory) ValidateConfiguration() error

ValidateConfiguration validates the hypervisor configuration

type HypervisorInfo

type HypervisorInfo struct {
	Type           VMType                  `json:"type"`
	Version        string                  `json:"version"`
	ConnectionURI  string                  `json:"connection_uri"`
	Hostname       string                  `json:"hostname"`
	CPUModel       string                  `json:"cpu_model"`
	CPUCores       int                     `json:"cpu_cores"`
	MemoryMB       int64                   `json:"memory_mb"`
	Virtualization string                  `json:"virtualization"` // VT-x, AMD-V, etc.
	IOMMUEnabled   bool                    `json:"iommu_enabled"`
	NUMANodes      int                     `json:"numa_nodes"`
	GPUDevices     []GPUDevice             `json:"gpu_devices"`
	NetworkDevices []NetworkDevice         `json:"network_devices"`
	StorageDevices []StorageDevice         `json:"storage_devices"`
	ActiveVMs      int                     `json:"active_vms"`
	Capabilities   *HypervisorCapabilities `json:"capabilities"`
	Metadata       map[string]interface{}  `json:"metadata"`
}

HypervisorInfo represents information about the hypervisor

type HypervisorSupport

type HypervisorSupport struct {
	Type         VMType                  `json:"type"`
	Available    bool                    `json:"available"`
	Enabled      bool                    `json:"enabled"`
	Version      string                  `json:"version,omitempty"`
	Error        string                  `json:"error,omitempty"`
	Capabilities *HypervisorCapabilities `json:"capabilities,omitempty"`
	Priority     int                     `json:"priority"`
}

HypervisorSupport represents support status for a hypervisor

type HypervisorTestSuite

type HypervisorTestSuite struct {
	// contains filtered or unexported fields
}

HypervisorTestSuite provides comprehensive testing infrastructure for all hypervisor drivers

func NewHypervisorTestSuite

func NewHypervisorTestSuite(t *testing.T, driver VMDriver, driverType VMType) *HypervisorTestSuite

NewHypervisorTestSuite creates a new test suite for a hypervisor driver

func (*HypervisorTestSuite) AddCleanup

func (s *HypervisorTestSuite) AddCleanup(fn func() error)

AddCleanup adds a cleanup function to be executed after tests

func (*HypervisorTestSuite) Cleanup

func (s *HypervisorTestSuite) Cleanup()

Cleanup performs all registered cleanup operations

func (*HypervisorTestSuite) RunAllTests

func (s *HypervisorTestSuite) RunAllTests(ctx context.Context) error

RunAllTests executes all test cases in the suite

func (*HypervisorTestSuite) TestBasicLifecycle

func (s *HypervisorTestSuite) TestBasicLifecycle(ctx context.Context) error

TestBasicLifecycle tests create, start, stop, delete operations

func (*HypervisorTestSuite) TestConcurrentOperations

func (s *HypervisorTestSuite) TestConcurrentOperations(ctx context.Context) error

TestConcurrentOperations tests concurrent access to the driver

func (*HypervisorTestSuite) TestErrorHandling

func (s *HypervisorTestSuite) TestErrorHandling(ctx context.Context) error

TestErrorHandling tests various error conditions

func (*HypervisorTestSuite) TestGetInfo

func (s *HypervisorTestSuite) TestGetInfo(ctx context.Context) error

TestGetInfo tests VM information retrieval

func (*HypervisorTestSuite) TestGetMetrics

func (s *HypervisorTestSuite) TestGetMetrics(ctx context.Context) error

TestGetMetrics tests VM metrics retrieval

func (*HypervisorTestSuite) TestListVMs

func (s *HypervisorTestSuite) TestListVMs(ctx context.Context) error

TestListVMs tests VM listing functionality

func (*HypervisorTestSuite) TestPauseResume

func (s *HypervisorTestSuite) TestPauseResume(ctx context.Context) error

TestPauseResume tests pause and resume operations if supported

func (*HypervisorTestSuite) TestSnapshot

func (s *HypervisorTestSuite) TestSnapshot(ctx context.Context) error

TestSnapshot tests snapshot creation if supported

type IOThreadPinning

type IOThreadPinning struct {
	IOThread int    `json:"iothread"`
	CPUSet   string `json:"cpuset"`
}

IOThreadPinning represents I/O thread to CPU mapping

type InMemoryCheckpointStorage

type InMemoryCheckpointStorage struct {
	// contains filtered or unexported fields
}

InMemoryCheckpointStorage is an in-memory implementation for testing

func (*InMemoryCheckpointStorage) DeleteCheckpoint

func (s *InMemoryCheckpointStorage) DeleteCheckpoint(id string) error

func (*InMemoryCheckpointStorage) ListCheckpoints

func (s *InMemoryCheckpointStorage) ListCheckpoints(vmID string) ([]*Checkpoint, error)

func (*InMemoryCheckpointStorage) LoadCheckpoint

func (s *InMemoryCheckpointStorage) LoadCheckpoint(id string) (*Checkpoint, error)

func (*InMemoryCheckpointStorage) SaveCheckpoint

func (s *InMemoryCheckpointStorage) SaveCheckpoint(checkpoint *Checkpoint) error

type InMemoryMigrationStorage

type InMemoryMigrationStorage struct {
	// contains filtered or unexported fields
}

InMemoryMigrationStorage implements MigrationStorage in memory (for testing)

func NewInMemoryMigrationStorage

func NewInMemoryMigrationStorage() *InMemoryMigrationStorage

NewInMemoryMigrationStorage creates a new InMemoryMigrationStorage

func (*InMemoryMigrationStorage) DeleteMigrationRecord

func (s *InMemoryMigrationStorage) DeleteMigrationRecord(migrationID string) error

DeleteMigrationRecord removes a migration record from memory

func (*InMemoryMigrationStorage) ListMigrationRecords

func (s *InMemoryMigrationStorage) ListMigrationRecords() ([]*MigrationRecord, error)

ListMigrationRecords retrieves all migration records from memory

func (*InMemoryMigrationStorage) ListMigrationRecordsForVM

func (s *InMemoryMigrationStorage) ListMigrationRecordsForVM(vmID string) ([]*MigrationRecord, error)

ListMigrationRecordsForVM retrieves all migration records for a specific VM from memory

func (*InMemoryMigrationStorage) LoadMigrationRecord

func (s *InMemoryMigrationStorage) LoadMigrationRecord(migrationID string) (*MigrationRecord, error)

LoadMigrationRecord retrieves a migration record from memory

func (*InMemoryMigrationStorage) SaveMigrationRecord

func (s *InMemoryMigrationStorage) SaveMigrationRecord(record *MigrationRecord) error

SaveMigrationRecord stores a migration record in memory

type InMemorySnapshotStorage

type InMemorySnapshotStorage struct {
	// contains filtered or unexported fields
}

InMemorySnapshotStorage is an in-memory implementation for testing

func (*InMemorySnapshotStorage) DeleteSnapshot

func (s *InMemorySnapshotStorage) DeleteSnapshot(id string) error

func (*InMemorySnapshotStorage) ListSnapshots

func (s *InMemorySnapshotStorage) ListSnapshots(vmID string) ([]*Snapshot, error)

func (*InMemorySnapshotStorage) LoadSnapshot

func (s *InMemorySnapshotStorage) LoadSnapshot(id string) (*Snapshot, error)

func (*InMemorySnapshotStorage) SaveSnapshot

func (s *InMemorySnapshotStorage) SaveSnapshot(snapshot *Snapshot) error

type KVMConfig

type KVMConfig struct {
	Enabled        bool
	LibvirtURI     string
	QEMUBinaryPath string
	VMBasePath     string
	UseLibvirt     bool
}

KVMConfig contains KVM/QEMU specific configuration

type KVMDriverEnhanced

type KVMDriverEnhanced struct {
	// contains filtered or unexported fields
}

KVMDriverEnhanced implements the VMDriver interface for KVM-based VMs

func (*KVMDriverEnhanced) ConfigureCPUPinning

func (d *KVMDriverEnhanced) ConfigureCPUPinning(ctx context.Context, vmID string, pinning *CPUPinningConfig) error

ConfigureCPUPinning configures CPU pinning (not implemented yet)

func (*KVMDriverEnhanced) ConfigureNUMA

func (d *KVMDriverEnhanced) ConfigureNUMA(ctx context.Context, vmID string, topology *NUMATopology) error

ConfigureNUMA configures NUMA topology (not implemented yet)

func (*KVMDriverEnhanced) Create

func (d *KVMDriverEnhanced) Create(ctx context.Context, config VMConfig) (string, error)

Create creates a new KVM VM

func (*KVMDriverEnhanced) Delete

func (d *KVMDriverEnhanced) Delete(ctx context.Context, vmID string) error

Delete deletes a KVM VM

func (*KVMDriverEnhanced) GetCapabilities

func (d *KVMDriverEnhanced) GetCapabilities(ctx context.Context) (*HypervisorCapabilities, error)

GetCapabilities returns the capabilities of the KVM driver

func (*KVMDriverEnhanced) GetHypervisorInfo

func (d *KVMDriverEnhanced) GetHypervisorInfo(ctx context.Context) (*HypervisorInfo, error)

GetHypervisorInfo returns information about the KVM hypervisor

func (*KVMDriverEnhanced) GetInfo

func (d *KVMDriverEnhanced) GetInfo(ctx context.Context, vmID string) (*VMInfo, error)

GetInfo returns information about a VM

func (*KVMDriverEnhanced) GetMetrics

func (d *KVMDriverEnhanced) GetMetrics(ctx context.Context, vmID string) (*VMInfo, error)

GetMetrics returns performance metrics for a VM

func (*KVMDriverEnhanced) GetNamespacePath

func (d *KVMDriverEnhanced) GetNamespacePath(vmID string) string

GetNamespacePath returns the PID namespace path for a given VM's QEMU process. This is used for guest namespace eBPF injection.

func (*KVMDriverEnhanced) GetProcessPID

func (d *KVMDriverEnhanced) GetProcessPID(vmID string) int

GetProcessPID returns the hypervisor process PID for a given VM. For KVM/QEMU VMs, this reads from the PID file or falls back to process scanning.

func (*KVMDriverEnhanced) GetStatus

func (d *KVMDriverEnhanced) GetStatus(ctx context.Context, vmID string) (VMState, error)

GetStatus returns the status of a VM

func (*KVMDriverEnhanced) HotPlugDevice

func (d *KVMDriverEnhanced) HotPlugDevice(ctx context.Context, vmID string, device *DeviceConfig) error

HotPlugDevice hot-plugs a device (not implemented yet)

func (*KVMDriverEnhanced) HotUnplugDevice

func (d *KVMDriverEnhanced) HotUnplugDevice(ctx context.Context, vmID string, deviceID string) error

HotUnplugDevice hot-unplugs a device (not implemented yet)

func (*KVMDriverEnhanced) ListVMs

func (d *KVMDriverEnhanced) ListVMs(ctx context.Context) ([]VMInfo, error)

ListVMs returns a list of all VMs

func (*KVMDriverEnhanced) Migrate

func (d *KVMDriverEnhanced) Migrate(ctx context.Context, vmID, target string, params map[string]string) error

Migrate is not implemented for this basic driver

func (*KVMDriverEnhanced) Pause

func (d *KVMDriverEnhanced) Pause(ctx context.Context, vmID string) error

Pause pauses a VM

func (*KVMDriverEnhanced) Resume

func (d *KVMDriverEnhanced) Resume(ctx context.Context, vmID string) error

Resume resumes a paused VM

func (*KVMDriverEnhanced) Snapshot

func (d *KVMDriverEnhanced) Snapshot(ctx context.Context, vmID, name string, params map[string]string) (string, error)

Snapshot creates a snapshot of a VM

func (*KVMDriverEnhanced) Start

func (d *KVMDriverEnhanced) Start(ctx context.Context, vmID string) error

Start starts a KVM VM

func (*KVMDriverEnhanced) Stop

func (d *KVMDriverEnhanced) Stop(ctx context.Context, vmID string) error

Stop stops a KVM VM

func (*KVMDriverEnhanced) SupportsGPUPassthrough

func (d *KVMDriverEnhanced) SupportsGPUPassthrough() bool

SupportsGPUPassthrough returns whether the driver supports GPU passthrough

func (*KVMDriverEnhanced) SupportsHotPlug

func (d *KVMDriverEnhanced) SupportsHotPlug() bool

SupportsHotPlug returns whether the driver supports hot-plugging devices

func (*KVMDriverEnhanced) SupportsLiveMigration

func (d *KVMDriverEnhanced) SupportsLiveMigration() bool

SupportsLiveMigration returns whether the driver supports live migration

func (*KVMDriverEnhanced) SupportsMigrate

func (d *KVMDriverEnhanced) SupportsMigrate() bool

func (*KVMDriverEnhanced) SupportsNUMA

func (d *KVMDriverEnhanced) SupportsNUMA() bool

SupportsNUMA returns whether the driver supports NUMA configuration

func (*KVMDriverEnhanced) SupportsPause

func (d *KVMDriverEnhanced) SupportsPause() bool

Optional operation support

func (*KVMDriverEnhanced) SupportsResume

func (d *KVMDriverEnhanced) SupportsResume() bool

func (*KVMDriverEnhanced) SupportsSRIOV

func (d *KVMDriverEnhanced) SupportsSRIOV() bool

SupportsSRIOV returns whether the driver supports SR-IOV

func (*KVMDriverEnhanced) SupportsSnapshot

func (d *KVMDriverEnhanced) SupportsSnapshot() bool

type KVMMetricsProvider

type KVMMetricsProvider struct {
	// contains filtered or unexported fields
}

KVMMetricsProvider collects metrics from KVM VMs

func NewKVMMetricsProvider

func NewKVMMetricsProvider(vmID, nodeID string, pid int, socketPath, detailLevel string) *KVMMetricsProvider

NewKVMMetricsProvider creates a new KVM metrics provider

func (*KVMMetricsProvider) Close

func (p *KVMMetricsProvider) Close() error

Close closes the metrics provider

func (*KVMMetricsProvider) GetMetrics

func (p *KVMMetricsProvider) GetMetrics(ctx context.Context) (*VMMetrics, error)

GetMetrics returns metrics for a KVM VM

func (*KVMMetricsProvider) GetVMID

func (p *KVMMetricsProvider) GetVMID() string

GetVMID returns the VM ID

type KVMVMInfo

type KVMVMInfo struct {
	ID          string
	Config      VMConfig
	Process     *os.Process
	PID         int
	State       State
	DiskPath    string
	ConfigPath  string
	MonitorPath string
	VNCPort     int
	StartTime   time.Time
	StoppedTime *time.Time
}

KVMVMInfo stores information about a KVM VM

type LifecycleEvent

type LifecycleEvent struct {
	Type        EventType              `json:"type"`
	VMID        string                 `json:"vm_id"`
	Timestamp   time.Time              `json:"timestamp"`
	Data        map[string]interface{} `json:"data"`
	Source      string                 `json:"source"`
	Severity    EventSeverity          `json:"severity"`
	Description string                 `json:"description"`
}

LifecycleEvent represents a VM lifecycle event

type LifecycleEventBus

type LifecycleEventBus struct {
	// contains filtered or unexported fields
}

LifecycleEventBus manages event distribution and handling

func NewLifecycleEventBus

func NewLifecycleEventBus() *LifecycleEventBus

NewLifecycleEventBus creates a new event bus

func (*LifecycleEventBus) AddFilter

func (bus *LifecycleEventBus) AddFilter(filter EventFilter)

AddFilter adds an event filter

func (*LifecycleEventBus) Emit

func (bus *LifecycleEventBus) Emit(event *LifecycleEvent)

Emit emits an event to the bus

func (*LifecycleEventBus) GetEventCount

func (bus *LifecycleEventBus) GetEventCount(vmID string, eventType EventType) int

GetEventCount returns the count of events by type

func (*LifecycleEventBus) GetEventHistory

func (bus *LifecycleEventBus) GetEventHistory(vmID string, eventTypes []EventType, limit int) []*LifecycleEvent

GetEventHistory returns the event history with optional filtering

func (*LifecycleEventBus) RegisterHandler

func (bus *LifecycleEventBus) RegisterHandler(handler EventHandler)

RegisterHandler registers an event handler for specific event types

func (*LifecycleEventBus) RemoveFilter

func (bus *LifecycleEventBus) RemoveFilter(filterName string)

RemoveFilter removes an event filter

func (*LifecycleEventBus) Stop

func (bus *LifecycleEventBus) Stop()

Stop stops the event bus

func (*LifecycleEventBus) UnregisterHandler

func (bus *LifecycleEventBus) UnregisterHandler(handler EventHandler)

UnregisterHandler removes an event handler

type LifecycleLoggingHandler

type LifecycleLoggingHandler struct {
	// contains filtered or unexported fields
}

LifecycleLoggingHandler logs all lifecycle events

func NewLifecycleLoggingHandler

func NewLifecycleLoggingHandler() *LifecycleLoggingHandler

NewLifecycleLoggingHandler creates a new lifecycle logging event handler

func (*LifecycleLoggingHandler) GetEventTypes

func (h *LifecycleLoggingHandler) GetEventTypes() []EventType

GetEventTypes returns the event types this handler processes

func (*LifecycleLoggingHandler) GetName

func (h *LifecycleLoggingHandler) GetName() string

GetName returns the handler name

func (*LifecycleLoggingHandler) HandleEvent

func (h *LifecycleLoggingHandler) HandleEvent(event *LifecycleEvent) error

HandleEvent handles the event by logging it

type LifecycleManager

type LifecycleManager struct {
	// contains filtered or unexported fields
}

LifecycleManager manages VM lifecycle operations with advanced state management

func NewLifecycleManager

func NewLifecycleManager() *LifecycleManager

NewLifecycleManager creates a new VM lifecycle manager

func (*LifecycleManager) CreateCheckpoint

func (lm *LifecycleManager) CreateCheckpoint(vmID string, metadata map[string]string) (*Checkpoint, error)

CreateCheckpoint creates a checkpoint of a running VM

func (*LifecycleManager) CreateSnapshot

func (lm *LifecycleManager) CreateSnapshot(vmID, name, description string) (*Snapshot, error)

CreateSnapshot creates a snapshot of a VM

func (*LifecycleManager) CreateVM

func (lm *LifecycleManager) CreateVM(config VMConfig) (*EnhancedVM, error)

CreateVM creates a new enhanced VM

func (*LifecycleManager) GetVMHistory

func (lm *LifecycleManager) GetVMHistory(vmID string) ([]StateTransition, error)

GetVMHistory returns the state transition history of a VM

func (*LifecycleManager) GetVMState

func (lm *LifecycleManager) GetVMState(vmID string) (State, error)

GetVMState returns the current lifecycle state of a VM

func (*LifecycleManager) RestoreCheckpoint

func (lm *LifecycleManager) RestoreCheckpoint(vmID, checkpointID string) error

RestoreCheckpoint restores a VM from a checkpoint

func (*LifecycleManager) StartVM

func (lm *LifecycleManager) StartVM(vmID string) error

StartVM starts a VM with lifecycle management

func (*LifecycleManager) Stop

func (lm *LifecycleManager) Stop()

Stop stops the lifecycle manager

func (*LifecycleManager) StopVM

func (lm *LifecycleManager) StopVM(vmID string, graceful bool) error

StopVM stops a VM gracefully

type LifecycleMetrics

type LifecycleMetrics struct {
	StateTransitions   map[string]int64         `json:"state_transitions"`
	OperationDurations map[string]time.Duration `json:"operation_durations"`
	SuccessRates       map[string]float64       `json:"success_rates"`
	FailureCount       int64                    `json:"failure_count"`
	TotalOperations    int64                    `json:"total_operations"`
	// contains filtered or unexported fields
}

LifecycleMetrics tracks lifecycle operations

func NewLifecycleMetrics

func NewLifecycleMetrics() *LifecycleMetrics

NewLifecycleMetrics creates new lifecycle metrics

func (*LifecycleMetrics) RecordOperation

func (lm *LifecycleMetrics) RecordOperation(operation string, duration time.Duration, success bool)

RecordOperation records an operation in metrics

type LifecyclePolicies

type LifecyclePolicies struct {
	AutoStart          bool            `json:"auto_start"`
	AutoStop           bool            `json:"auto_stop"`
	HealthCheckEnabled bool            `json:"health_check_enabled"`
	BackupEnabled      bool            `json:"backup_enabled"`
	BackupInterval     time.Duration   `json:"backup_interval"`
	RetentionPolicy    RetentionPolicy `json:"retention_policy"`
}

LifecyclePolicies defines automated policies

type LifecycleScheduler

type LifecycleScheduler struct {
	// contains filtered or unexported fields
}

LifecycleScheduler handles scheduled lifecycle operations

func NewLifecycleScheduler

func NewLifecycleScheduler() *LifecycleScheduler

NewLifecycleScheduler creates a new lifecycle scheduler

func (*LifecycleScheduler) AddTask

func (ls *LifecycleScheduler) AddTask(task ScheduledTask)

AddTask adds a scheduled task

func (*LifecycleScheduler) RemoveTask

func (ls *LifecycleScheduler) RemoveTask(taskID string)

RemoveTask removes a scheduled task

func (*LifecycleScheduler) Start

func (ls *LifecycleScheduler) Start()

Start starts the scheduler

func (*LifecycleScheduler) Stop

func (ls *LifecycleScheduler) Stop()

Stop stops the scheduler

type LiveMigrationManager

type LiveMigrationManager struct {
	// contains filtered or unexported fields
}

LiveMigrationManager handles live VM migration

func NewLiveMigrationManager

func NewLiveMigrationManager() *LiveMigrationManager

NewLiveMigrationManager creates a new live migration manager

func (*LiveMigrationManager) GetMigrationStatus

func (lmm *LiveMigrationManager) GetMigrationStatus(migrationID string) (*LiveMigrationStatus, error)

GetMigrationStatus returns the status of a migration

func (*LiveMigrationManager) StartMigration

func (lmm *LiveMigrationManager) StartMigration(vmID, source, destination string, migrationType MigrationType) (*MigrationSession, error)

StartMigration starts a live migration

type LiveMigrationStatus

type LiveMigrationStatus struct {
	InProgress       bool           `json:"in_progress"`
	Type             MigrationType  `json:"type"`
	Source           string         `json:"source"`
	Destination      string         `json:"destination"`
	Progress         float64        `json:"progress"`
	Phase            MigrationPhase `json:"phase"`
	StartTime        time.Time      `json:"start_time"`
	EstimatedFinish  time.Time      `json:"estimated_finish"`
	BytesTransferred int64          `json:"bytes_transferred"`
	TotalBytes       int64          `json:"total_bytes"`
	Error            string         `json:"error,omitempty"`
}

LiveMigrationStatus tracks live migration status

type LocalBackupStorageProvider

type LocalBackupStorageProvider struct {
	// contains filtered or unexported fields
}

LocalBackupStorageProvider is a local backup storage provider

func NewLocalBackupStorageProvider

func NewLocalBackupStorageProvider(storageDir string) *LocalBackupStorageProvider

NewLocalBackupStorageProvider creates a new local backup storage provider

func (*LocalBackupStorageProvider) Delete

func (p *LocalBackupStorageProvider) Delete(ctx context.Context, storagePath string) error

Delete deletes a backup

func (*LocalBackupStorageProvider) List

func (p *LocalBackupStorageProvider) List(ctx context.Context, vmID string) ([]string, error)

List lists all backups for a VM

func (*LocalBackupStorageProvider) Retrieve

func (p *LocalBackupStorageProvider) Retrieve(ctx context.Context, storagePath string) ([]byte, error)

Retrieve retrieves a backup

func (*LocalBackupStorageProvider) Store

func (p *LocalBackupStorageProvider) Store(ctx context.Context, vmID, backupID string, data []byte) (string, error)

Store stores a backup

type MemoryDistributionInfo

type MemoryDistributionInfo struct {
	Enabled            bool                     `json:"enabled"`
	TotalPages         int64                    `json:"total_pages"`
	DistributedPages   int64                    `json:"distributed_pages"`
	LocalPages         int64                    `json:"local_pages"`
	RemotePages        int64                    `json:"remote_pages"`
	PageDistribution   map[string]int64         `json:"page_distribution"` // node_id -> page_count
	DirtyPages         []string                 `json:"dirty_pages"`       // page IDs that need sync
	LastSyncTime       time.Time                `json:"last_sync_time"`
	SyncInProgress     bool                     `json:"sync_in_progress"`
	CompressionEnabled bool                     `json:"compression_enabled"`
	CompressionRatio   float64                  `json:"compression_ratio"`
	CoherenceProtocol  string                   `json:"coherence_protocol"` // "MSI", "MESI", "MOESI"
	AccessPatterns     map[string]AccessPattern `json:"access_patterns"`    // page_id -> pattern
}

MemoryDistributionInfo tracks distributed memory state

type MemoryDistributionMetrics

type MemoryDistributionMetrics struct {
	SyncLatencyMs       float64   `json:"sync_latency_ms"`
	CompressionRatio    float64   `json:"compression_ratio"`
	DeduplicationRatio  float64   `json:"deduplication_ratio"`
	PageFaultRate       float64   `json:"page_fault_rate"`
	RemotePageAccess    float64   `json:"remote_page_access"`
	LocalityScore       float64   `json:"locality_score"`
	CoherenceOverheadMs float64   `json:"coherence_overhead_ms"`
	LastMemorySync      time.Time `json:"last_memory_sync"`
}

MemoryDistributionMetrics tracks memory distribution performance.

type MemoryMetrics

type MemoryMetrics struct {
	TotalBytes      int64   `json:"total_bytes"`
	UsedBytes       int64   `json:"used_bytes"`
	CacheBytes      int64   `json:"cache_bytes"`
	RSSBytes        int64   `json:"rss_bytes"`
	SwapBytes       int64   `json:"swap_bytes"`
	UsagePercent    float64 `json:"usage_percent"`
	SwapPercent     float64 `json:"swap_percent"`
	MajorPageFaults int64   `json:"major_page_faults"`
	MinorPageFaults int64   `json:"minor_page_faults"`
}

MemoryMetrics represents memory metrics

type MetricsEventHandler

type MetricsEventHandler struct {
	// contains filtered or unexported fields
}

MetricsEventHandler updates metrics based on events

func NewMetricsEventHandler

func NewMetricsEventHandler(metrics *LifecycleMetrics) *MetricsEventHandler

NewMetricsEventHandler creates a new metrics event handler

func (*MetricsEventHandler) GetEventTypes

func (h *MetricsEventHandler) GetEventTypes() []EventType

GetEventTypes returns the event types this handler processes

func (*MetricsEventHandler) GetName

func (h *MetricsEventHandler) GetName() string

GetName returns the handler name

func (*MetricsEventHandler) HandleEvent

func (h *MetricsEventHandler) HandleEvent(event *LifecycleEvent) error

HandleEvent handles the event by updating metrics

type Migration

type Migration struct {
	ID         string `json:"id"`
	VMID       string `json:"vm_id"`
	SourceNode string `json:"source_node"`
	TargetNode string `json:"target_node"`
	Status     string `json:"status"`
	Progress   int    `json:"progress"`
}

Migration represents a VM migration

type MigrationEvent

type MigrationEvent struct {
	ID               string    `json:"id"`
	MigrationID      string    `json:"migrationId"`
	Type             string    `json:"type"`
	Timestamp        time.Time `json:"timestamp"`
	Message          string    `json:"message"`
	Progress         float64   `json:"progress"`
	BytesTransferred int64     `json:"bytesTransferred,omitempty"`
	TransferRate     int64     `json:"transferRate,omitempty"`
}

MigrationEvent represents an event related to VM migration

type MigrationInfo

type MigrationInfo struct {
	InProgress          bool              `json:"in_progress"`
	SourceNode          string            `json:"source_node"`
	TargetNode          string            `json:"target_node"`
	MigrationType       string            `json:"migration_type"` // "live", "offline", "hybrid"
	StartedAt           time.Time         `json:"started_at"`
	EstimatedCompletion time.Time         `json:"estimated_completion"`
	Progress            float64           `json:"progress"` // 0.0 to 1.0
	Strategy            MigrationStrategy `json:"strategy"`
	BandwidthUsage      int64             `json:"bandwidth_usage"` // bytes/sec
}

MigrationInfo tracks ongoing migration state

type MigrationManager

type MigrationManager interface {
	// Migration operations
	Migrate(vmID, targetNodeID string, options MigrationOptions) (*MigrationRecord, error)
	CancelMigration(migrationID string) error

	// Migration status
	GetMigrationStatus(migrationID string) (*MigrationStatusStruct, error)
	ListMigrations() ([]*MigrationStatusStruct, error)
	ListMigrationsForVM(vmID string) ([]*MigrationStatusStruct, error)

	// Event subscription
	SubscribeToMigrationEvents(migrationID string) (<-chan MigrationEvent, func(), error)

	// Storage
	SaveMigrationRecord(record *MigrationRecord) error
	LoadMigrationRecord(migrationID string) (*MigrationRecord, error)
	ListMigrationRecords() ([]*MigrationRecord, error)
}

MigrationManager defines the interface for migration management

type MigrationMetrics

type MigrationMetrics struct {
	AverageMigrationTime time.Duration `json:"average_migration_time"`
	SuccessRate          float64       `json:"success_rate"`
	DowntimeMs           float64       `json:"downtime_ms"`
	DataTransferRateMBps float64       `json:"data_transfer_rate_mbps"`
	CompressionRatio     float64       `json:"compression_ratio"`
	PredictionAccuracy   float64       `json:"prediction_accuracy"`
	TotalMigrations      int64         `json:"total_migrations"`
	FailedMigrations     int64         `json:"failed_migrations"`
	LastMigration        time.Time     `json:"last_migration"`
}

MigrationMetrics tracks migration performance

type MigrationOperations

type MigrationOperations struct {
	// contains filtered or unexported fields
}

MigrationOperations provides HTTP handlers for migration-related API endpoints

func NewMigrationOperations

func NewMigrationOperations(migrationManager MigrationManager, logger *logrus.Logger) *MigrationOperations

NewMigrationOperations creates a new MigrationOperations instance

func (*MigrationOperations) RegisterHandlers

func (o *MigrationOperations) RegisterHandlers(mux *http.ServeMux)

RegisterHandlers registers HTTP handlers for migration operations

func (*MigrationOperations) StreamMigrationEvents

func (o *MigrationOperations) StreamMigrationEvents(w http.ResponseWriter, r *http.Request)

StreamMigrationEvents streams migration events over a websocket connection

type MigrationOptions

type MigrationOptions struct {
	Type             string // Migration type: cold, warm, live
	BandwidthLimit   int64  // Bandwidth limit in bytes per second (0 = unlimited)
	CompressionLevel int    // Compression level (0-9)
	MemoryIterations int    // Number of memory iterations for live migration
	Priority         int    // Migration priority (higher numbers = higher priority)
	Force            bool   // Force migration despite warnings
	SkipVerification bool   // Skip VM verification after migration
}

MigrationOptions defines configuration options for a VM migration

func DefaultMigrationOptions

func DefaultMigrationOptions() MigrationOptions

DefaultMigrationOptions returns the default migration options

type MigrationPhase

type MigrationPhase int

MigrationPhase defines migration phases

const (
	PhasePreMigration MigrationPhase = iota
	PhaseMemoryCopy
	PhaseFinalSync
	PhaseHandover
	PhasePostMigration
)

type MigrationPriority

type MigrationPriority int

MigrationPriority represents the priority level of a migration

const (
	// MigrationPriorityLow indicates low priority, migration can be delayed
	MigrationPriorityLow MigrationPriority = 1

	// MigrationPriorityNormal indicates normal priority
	MigrationPriorityNormal MigrationPriority = 5

	// MigrationPriorityHigh indicates high priority, should be scheduled ASAP
	MigrationPriorityHigh MigrationPriority = 8

	// MigrationPriorityCritical indicates critical priority (e.g., host failure)
	MigrationPriorityCritical MigrationPriority = 10
)

type MigrationProgress

type MigrationProgress struct {
	ID          string                 `json:"id"`
	VMID        string                 `json:"vm_id"`
	SourceNode  string                 `json:"source_node"`
	TargetNode  string                 `json:"target_node"`
	Status      MigrationStatus        `json:"status"`
	Percentage  int                    `json:"percentage"`
	StartedAt   time.Time              `json:"started_at"`
	CompletedAt *time.Time             `json:"completed_at,omitempty"`
	Details     map[string]interface{} `json:"details,omitempty"`
}

MigrationProgress represents migration progress information

type MigrationProgressTracker

type MigrationProgressTracker struct {
	// contains filtered or unexported fields
}

MigrationProgressTracker tracks and reports progress for VM migrations

func NewMigrationProgressTracker

func NewMigrationProgressTracker(logger *logrus.Entry, totalBytes int64) *MigrationProgressTracker

NewMigrationProgressTracker creates a new progress tracker

func (*MigrationProgressTracker) GetETA

func (t *MigrationProgressTracker) GetETA() int64

GetETA returns the estimated time remaining in seconds

func (*MigrationProgressTracker) GetElapsedTime

func (t *MigrationProgressTracker) GetElapsedTime() float64

GetElapsedTime returns the elapsed time in seconds

func (*MigrationProgressTracker) GetProgress

func (t *MigrationProgressTracker) GetProgress() float64

GetProgress returns the current progress as a float between 0 and 1

func (*MigrationProgressTracker) GetRate

func (t *MigrationProgressTracker) GetRate() int64

GetRate returns the current transfer rate in bytes per second

func (*MigrationProgressTracker) LogProgress

func (t *MigrationProgressTracker) LogProgress()

LogProgress logs the current progress

func (*MigrationProgressTracker) Update

func (t *MigrationProgressTracker) Update(transferredBytes int64)

Update updates the progress tracker with current progress

type MigrationRecord

type MigrationRecord struct {
	ID             string    `json:"id"`
	VMID           string    `json:"vmId"`
	VMName         string    `json:"vmName"`
	SourceNodeID   string    `json:"sourceNodeId"`
	TargetNodeID   string    `json:"targetNodeId"`
	MigrationType  string    `json:"migrationType"`
	State          string    `json:"state"`
	Progress       float64   `json:"progress"`
	StartTime      time.Time `json:"startTime"`
	CompletionTime time.Time `json:"completionTime,omitempty"`
	ErrorMessage   string    `json:"errorMessage,omitempty"`

	// Performance metrics and details
	TransferRate     int64 `json:"transferRate,omitempty"`     // Bytes per second
	BytesTransferred int64 `json:"bytesTransferred,omitempty"` // Total bytes transferred so far
	TotalBytes       int64 `json:"totalBytes,omitempty"`       // Total bytes to transfer
	DowntimeMs       int64 `json:"downtimeMs,omitempty"`       // Downtime in milliseconds
	TransferTimeMs   int64 `json:"transferTimeMs,omitempty"`   // Transfer time in milliseconds
	ActivationTimeMs int64 `json:"activationTimeMs,omitempty"` // Activation time in milliseconds

	// Configuration options
	BandwidthLimit   int64 `json:"bandwidthLimit,omitempty"`   // Bandwidth limit in bytes per second
	CompressionLevel int   `json:"compressionLevel,omitempty"` // Compression level (0-9)
	MemoryIterations int   `json:"memoryIterations,omitempty"` // Number of memory iterations for live migration
	Priority         int   `json:"priority,omitempty"`         // Migration priority (higher numbers = higher priority)
	Force            bool  `json:"force,omitempty"`            // Force migration despite warnings
	SkipVerification bool  `json:"skipVerification,omitempty"` // Skip VM verification after migration
}

MigrationRecord represents the persistent record of a VM migration

func NewMigrationRecord

func NewMigrationRecord(vmID, vmName, sourceNodeID, targetNodeID, migrationType string) *MigrationRecord

NewMigrationRecord creates a new migration record with default values

type MigrationSchedule

type MigrationSchedule struct {
	// Migration ID
	MigrationID string

	// VM ID to migrate
	VMID string

	// Source and destination nodes
	SourceNodeID      string
	DestinationNodeID string

	// Priority of the migration
	Priority MigrationPriority

	// Scheduled start time
	ScheduledStartTime time.Time

	// Estimated completion time
	EstimatedEndTime time.Time

	// Migration type (cold, warm, live)
	MigrationType string

	// Estimated resource impact
	ResourceImpact ResourceImpact

	// Migration options
	Options map[string]interface{}

	// Actual start and end time (filled after execution)
	ActualStartTime time.Time
	ActualEndTime   time.Time

	// State of the scheduled migration
	State string

	// Maximum allowed downtime in milliseconds
	MaxDowntimeMs int
}

MigrationSchedule represents a scheduled migration

type MigrationScheduler

type MigrationScheduler struct {
	// contains filtered or unexported fields
}

MigrationScheduler manages scheduling and prioritization of VM migrations

func NewMigrationScheduler

func NewMigrationScheduler(config MigrationSchedulerConfig, migrationManager *MigrationManager, logger *logrus.Logger) *MigrationScheduler

NewMigrationScheduler creates a new migration scheduler

func (*MigrationScheduler) CancelMigration

func (s *MigrationScheduler) CancelMigration(migrationID string) error

CancelMigration cancels a scheduled migration

func (*MigrationScheduler) GetAllMigrations

func (s *MigrationScheduler) GetAllMigrations() []*MigrationSchedule

GetAllMigrations returns all migrations in all states

func (*MigrationScheduler) GetMigrationStatus

func (s *MigrationScheduler) GetMigrationStatus(migrationID string) (*MigrationSchedule, error)

GetMigrationStatus returns the status of a migration

func (*MigrationScheduler) ScheduleMigration

func (s *MigrationScheduler) ScheduleMigration(
	vmID string,
	destNodeID string,
	migrationType string,
	maxDowntimeMs int,
	options map[string]interface{},
) (string, error)

ScheduleMigration schedules a migration with default priority

func (*MigrationScheduler) ScheduleMigrationWithPriority

func (s *MigrationScheduler) ScheduleMigrationWithPriority(
	vmID string,
	destNodeID string,
	migrationType string,
	maxDowntimeMs int,
	options map[string]interface{},
	priority MigrationPriority,
) (string, error)

ScheduleMigrationWithPriority schedules a migration with a specific priority

func (*MigrationScheduler) Start

func (s *MigrationScheduler) Start() error

Start starts the migration scheduler

func (*MigrationScheduler) Stop

func (s *MigrationScheduler) Stop() error

Stop stops the migration scheduler

func (*MigrationScheduler) UpdateNodeResources

func (s *MigrationScheduler) UpdateNodeResources(nodeID string, resources ResourceAvailability)

UpdateNodeResources updates the available resources for a node

type MigrationSchedulerConfig

type MigrationSchedulerConfig struct {
	// Maximum concurrent migrations per node
	MaxConcurrentMigrationsPerNode int

	// Maximum concurrent migrations globally
	MaxConcurrentMigrationsGlobal int

	// Migration windows
	MigrationWindows []MigrationWindow

	// Default priority
	DefaultPriority MigrationPriority

	// Resource headroom percentages
	CPUHeadroomPct     float64
	MemoryHeadroomPct  float64
	NetworkHeadroomPct float64
	IOHeadroomPct      float64

	// Retry settings
	MaxRetries         int
	RetryDelayMs       int
	RetryBackoffFactor float64

	// Default migration type
	DefaultMigrationType string
}

MigrationSchedulerConfig contains configuration for the migration scheduler

func DefaultMigrationSchedulerConfig

func DefaultMigrationSchedulerConfig() MigrationSchedulerConfig

DefaultMigrationSchedulerConfig returns the default configuration

type MigrationSession

type MigrationSession struct {
	ID          string
	VMID        string
	Source      string
	Destination string
	Type        MigrationType
	Status      *LiveMigrationStatus
	StartTime   time.Time
	// contains filtered or unexported fields
}

MigrationSession represents an active migration session

type MigrationStatus

type MigrationStatus string

MigrationStatus represents the status of a migration operation (enum type)

const (
	MigrationStatusPending    MigrationStatus = "pending"
	MigrationStatusInProgress MigrationStatus = "in_progress"
	MigrationStatusCompleted  MigrationStatus = "completed"
	MigrationStatusFailed     MigrationStatus = "failed"
	MigrationStatusRolledBack MigrationStatus = "rolled_back"
)

type MigrationStatusStruct

type MigrationStatusStruct struct {
	ID               string    `json:"id"`
	VMID             string    `json:"vmId"`
	VMName           string    `json:"vmName"`
	SourceNodeID     string    `json:"sourceNodeId"`
	TargetNodeID     string    `json:"targetNodeId"`
	MigrationType    string    `json:"migrationType"`
	State            string    `json:"state"`
	Progress         float64   `json:"progress"`
	ProgressPct      float64   `json:"progressPct"` // Progress percentage
	StartTime        time.Time `json:"startTime"`
	CompletionTime   time.Time `json:"completionTime,omitempty"`
	EndTime          time.Time `json:"endTime,omitempty"` // End time
	ErrorMessage     string    `json:"errorMessage,omitempty"`
	Message          string    `json:"message,omitempty"` // General message
	Error            string    `json:"error,omitempty"`   // Error details
	BytesTransferred int64     `json:"bytesTransferred,omitempty"`
	TotalBytes       int64     `json:"totalBytes,omitempty"`
	TransferRate     int64     `json:"transferRate,omitempty"`
}

MigrationStatusStruct provides a snapshot of the current migration status

type MigrationStorage

type MigrationStorage interface {
	// SaveMigrationRecord persists a migration record
	SaveMigrationRecord(record *MigrationRecord) error

	// LoadMigrationRecord retrieves a migration record by ID
	LoadMigrationRecord(migrationID string) (*MigrationRecord, error)

	// ListMigrationRecords retrieves all migration records
	ListMigrationRecords() ([]*MigrationRecord, error)

	// ListMigrationRecordsForVM retrieves all migration records for a specific VM
	ListMigrationRecordsForVM(vmID string) ([]*MigrationRecord, error)

	// DeleteMigrationRecord removes a migration record
	DeleteMigrationRecord(migrationID string) error
}

MigrationStorage defines the interface for migration storage operations

type MigrationStrategy

type MigrationStrategy struct {
	MemoryStrategy    string `json:"memory_strategy"`    // "pre-copy", "post-copy", "hybrid"
	NetworkOptimized  bool   `json:"network_optimized"`  // Use bandwidth optimization
	PredictiveEnabled bool   `json:"predictive_enabled"` // Use AI-driven prediction
	CompressionLevel  int    `json:"compression_level"`  // 0-9
	MaxDowntime       int64  `json:"max_downtime"`       // milliseconds
}

MigrationStrategy defines migration approach

type MigrationType

type MigrationType string

MigrationType represents the type of migration

const (
	MigrationTypeCold MigrationType = "cold"
	MigrationTypeWarm MigrationType = "warm"
	MigrationTypeLive MigrationType = "live"
)

Migration types

type MigrationWindow

type MigrationWindow struct {
	// Days of week (0 = Sunday, 1 = Monday, ..., 6 = Saturday)
	// Empty means all days
	DaysOfWeek []int

	// Start time in 24-hour format (e.g., "22:00")
	StartTime string

	// End time in 24-hour format (e.g., "06:00")
	EndTime string

	// Priority threshold (only migrations with this priority or higher
	// can run outside the window)
	PriorityThreshold MigrationPriority
}

MigrationWindow defines a time window when migrations are allowed

type MockCapabilities

type MockCapabilities struct {
	SupportsPause    bool
	SupportsResume   bool
	SupportsSnapshot bool
	SupportsMigrate  bool
	MaxVMs           int
	MaxCPUPerVM      int
	MaxMemoryPerVM   int64
	SupportedVMTypes []VMType
}

MockCapabilities defines what the mock hypervisor supports

type MockFailureConfig

type MockFailureConfig struct {
	CreateFailureRate   float64 // 0.0 to 1.0
	StartFailureRate    float64
	StopFailureRate     float64
	PauseFailureRate    float64
	ResumeFailureRate   float64
	SnapshotFailureRate float64
	MigrateFailureRate  float64
	StatusFailureRate   float64
	RandomFailures      bool
	FailAfterTime       time.Duration // Fail operations after this time
}

MockFailureConfig allows injecting failures for testing

type MockHypervisor

type MockHypervisor struct {
	// contains filtered or unexported fields
}

MockHypervisor provides a mock implementation of VMDriver for testing

func NewMockHypervisor

func NewMockHypervisor(nodeID, hypervisorID string) *MockHypervisor

NewMockHypervisor creates a new mock hypervisor

func (*MockHypervisor) Configure

func (m *MockHypervisor) Configure(failures MockFailureConfig, latency MockLatencyConfig, capabilities MockCapabilities)

Configure allows changing mock behavior

func (*MockHypervisor) Create

func (m *MockHypervisor) Create(ctx context.Context, config VMConfig) (string, error)

Create creates a mock VM

func (*MockHypervisor) Delete

func (m *MockHypervisor) Delete(ctx context.Context, vmID string) error

Delete deletes a mock VM

func (*MockHypervisor) GetHypervisorInfo

func (m *MockHypervisor) GetHypervisorInfo() map[string]interface{}

GetHypervisorInfo returns information about the mock hypervisor

func (*MockHypervisor) GetInfo

func (m *MockHypervisor) GetInfo(ctx context.Context, vmID string) (*VMInfo, error)

GetInfo returns information about a mock VM

func (*MockHypervisor) GetMetrics

func (m *MockHypervisor) GetMetrics(ctx context.Context, vmID string) (*VMInfo, error)

GetMetrics returns metrics for a mock VM

func (*MockHypervisor) GetSnapshots

func (m *MockHypervisor) GetSnapshots(vmID string) ([]*MockSnapshot, error)

GetSnapshots returns all snapshots for a VM (additional method for testing)

func (*MockHypervisor) GetStatus

func (m *MockHypervisor) GetStatus(ctx context.Context, vmID string) (VMState, error)

GetStatus returns the status of a mock VM

func (*MockHypervisor) ListVMs

func (m *MockHypervisor) ListVMs(ctx context.Context) ([]VMInfo, error)

ListVMs returns a list of all mock VMs

func (*MockHypervisor) Migrate

func (m *MockHypervisor) Migrate(ctx context.Context, vmID, target string, params map[string]string) error

Migrate migrates a mock VM

func (*MockHypervisor) Pause

func (m *MockHypervisor) Pause(ctx context.Context, vmID string) error

Pause pauses a mock VM

func (*MockHypervisor) Reset

func (m *MockHypervisor) Reset()

Reset clears all VMs (for testing)

func (*MockHypervisor) Resume

func (m *MockHypervisor) Resume(ctx context.Context, vmID string) error

Resume resumes a mock VM

func (*MockHypervisor) Snapshot

func (m *MockHypervisor) Snapshot(ctx context.Context, vmID, name string, params map[string]string) (string, error)

Snapshot creates a snapshot of a mock VM

func (*MockHypervisor) Start

func (m *MockHypervisor) Start(ctx context.Context, vmID string) error

Start starts a mock VM

func (*MockHypervisor) Stop

func (m *MockHypervisor) Stop(ctx context.Context, vmID string) error

Stop stops a mock VM

func (*MockHypervisor) SupportsMigrate

func (m *MockHypervisor) SupportsMigrate() bool

func (*MockHypervisor) SupportsPause

func (m *MockHypervisor) SupportsPause() bool

Capability checks

func (*MockHypervisor) SupportsResume

func (m *MockHypervisor) SupportsResume() bool

func (*MockHypervisor) SupportsSnapshot

func (m *MockHypervisor) SupportsSnapshot() bool

type MockLatencyConfig

type MockLatencyConfig struct {
	CreateLatency  time.Duration
	StartLatency   time.Duration
	StopLatency    time.Duration
	StatusLatency  time.Duration
	NetworkLatency time.Duration
	DiskLatency    time.Duration
	VariabilityPct float64 // 0.0 to 1.0 for latency variation
}

MockLatencyConfig simulates network and processing latency

type MockSnapshot

type MockSnapshot struct {
	ID        string
	Name      string
	CreatedAt time.Time
	Size      int64
}

MockSnapshot represents a mock VM snapshot

type MockVM

type MockVM struct {
	ID          string
	Config      VMConfig
	State       State
	CreatedAt   time.Time
	StartedAt   *time.Time
	StoppedAt   *time.Time
	PID         int
	CPUUsage    float64
	MemoryUsage int64
	NetworkRx   int64
	NetworkTx   int64
	DiskRead    int64
	DiskWrite   int64
	// contains filtered or unexported fields
}

MockVM represents a mock virtual machine

type MonitoringConfig

type MonitoringConfig struct {
	Enabled           bool              `json:"enabled"`
	IntervalSeconds   int               `json:"interval_seconds"`
	ResourceThreshold ResourceThreshold `json:"resource_threshold"`
	AlertConfig       AlertConfig       `json:"alert_config"`
}

MonitoringConfig represents VM monitoring configuration

type Mount

type Mount struct {
	Source string `yaml:"source" json:"source"`
	Target string `yaml:"target" json:"target"`
	Type   string `yaml:"type" json:"type"`
	Flags  int    `yaml:"flags" json:"flags"`
	Data   string `yaml:"data" json:"data"`
}

Mount represents a filesystem mount for a VM

type NUMANode

type NUMANode struct {
	ID       int    `json:"id"`
	CPUs     string `json:"cpus"` // CPU set, e.g., "0-3"
	MemoryMB int64  `json:"memory_mb"`
	Distance []int  `json:"distance,omitempty"`
}

NUMANode represents a NUMA node configuration

type NUMANodeInfo

type NUMANodeInfo struct {
	ID             int      `json:"id"`
	CPUs           []int    `json:"cpus"`
	MemoryMB       int64    `json:"memory_mb"`
	FreeMemoryMB   int64    `json:"free_memory_mb"`
	HugePagesTotal int      `json:"hugepages_total"`
	HugePagesFree  int      `json:"hugepages_free"`
	HugePageSize   int      `json:"hugepage_size"` // In KB
	PCIDevices     []string `json:"pci_devices"`
	Distance       []int    `json:"distance"` // Distance to other nodes
}

NUMANodeInfo represents detailed NUMA node information

type NUMATopology

type NUMATopology struct {
	Nodes   []NUMANode             `json:"nodes"`
	Mode    string                 `json:"mode"` // strict, preferred, interleave
	Options map[string]interface{} `json:"options,omitempty"`
}

NUMATopology represents NUMA topology configuration

type NetMetrics

type NetMetrics struct {
	Interface     string  `json:"interface"`
	RxBytes       int64   `json:"rx_bytes"`
	TxBytes       int64   `json:"tx_bytes"`
	RxPackets     int64   `json:"rx_packets"`
	TxPackets     int64   `json:"tx_packets"`
	RxErrors      int64   `json:"rx_errors"`
	TxErrors      int64   `json:"tx_errors"`
	RxDropped     int64   `json:"rx_dropped"`
	TxDropped     int64   `json:"tx_dropped"`
	RxBytesPerSec float64 `json:"rx_bytes_per_sec"`
	TxBytesPerSec float64 `json:"tx_bytes_per_sec"`
}

NetMetrics represents network metrics

type NetStats

type NetStats struct {
	Timestamp time.Time
	RxBytes   int64
	TxBytes   int64
	RxPackets int64
	TxPackets int64
}

NetStats holds network statistics for calculating rates

type NetworkDevice

type NetworkDevice struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	Type       string `json:"type"` // ethernet, infiniband, etc.
	MACAddress string `json:"mac_address"`
	PCIAddress string `json:"pci_address"`
	IOMMUGroup int    `json:"iommu_group"`
	SRIOV      bool   `json:"sriov"`
	VFCount    int    `json:"vf_count,omitempty"`
	InUse      bool   `json:"in_use"`
}

NetworkDevice represents a network device

type NetworkManagerInterface

type NetworkManagerInterface interface {
}

NetworkManagerInterface for migration

type NetworkMetrics

type NetworkMetrics struct {
	BandwidthUtilization   float64   `json:"bandwidth_utilization"`
	LatencyMs              float64   `json:"latency_ms"`
	PacketLossRate         float64   `json:"packet_loss_rate"`
	ThroughputMbps         float64   `json:"throughput_mbps"`
	ConnectionPoolSize     int       `json:"connection_pool_size"`
	ActiveConnections      int       `json:"active_connections"`
	CompressionSavings     float64   `json:"compression_savings"`
	RetransmissionRate     float64   `json:"retransmission_rate"`
	LastNetworkMeasurement time.Time `json:"last_network_measurement"`
}

NetworkMetrics tracks network performance for distributed operations

type NetworkPolicy

type NetworkPolicy struct {
	AllowedNetworks    []string         `json:"allowed_networks"`
	BandwidthLimits    map[string]int64 `json:"bandwidth_limits"` // operation -> bytes/sec
	CompressionEnabled bool             `json:"compression_enabled"`
	PriorityClass      string           `json:"priority_class"`
	QoSSettings        QoSSettings      `json:"qos_settings"`
}

NetworkPolicy defines networking policies for distributed VM operations

type NetworkType

type NetworkType string

NetworkType represents the type of network

const (
	// NetworkTypeBridge represents a bridge network
	NetworkTypeBridge NetworkType = "bridge"

	// NetworkTypeNAT represents a NAT network
	NetworkTypeNAT NetworkType = "nat"

	// NetworkTypeHost represents a host-only network
	NetworkTypeHost NetworkType = "host"

	// NetworkTypeIsolated represents an isolated network
	NetworkTypeIsolated NetworkType = "isolated"
)

type Node

type Node struct {
	ID       string            `json:"id"`
	Name     string            `json:"name"`
	Address  string            `json:"address"`
	Status   string            `json:"status"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

Node represents a node in the cluster

func (*Node) CreateVM

func (n *Node) CreateVM(vmID string, config VMConfig) error

CreateVM creates a VM on this node (stub implementation)

func (*Node) EnsureDirectoryExists

func (n *Node) EnsureDirectoryExists(path string) error

EnsureDirectoryExists ensures a directory exists on this node (stub implementation)

func (*Node) GetDiskPath

func (n *Node) GetDiskPath(vmID string) string

GetDiskPath returns the disk path for a VM on this node (stub implementation)

func (*Node) GetID

func (n *Node) GetID() string

GetID returns the node ID

func (*Node) GetMemoryDeltaPath

func (n *Node) GetMemoryDeltaPath(vmID string) string

GetMemoryDeltaPath returns the memory delta path for a VM on this node (stub implementation)

func (*Node) GetMemoryStatePath

func (n *Node) GetMemoryStatePath(vmID string) string

GetMemoryStatePath returns the memory state path for a VM on this node (stub implementation)

func (*Node) GetVM

func (n *Node) GetVM(vmID string) (*VM, error)

GetVM gets a VM from this node (stub implementation)

func (*Node) ReceiveFile

func (n *Node) ReceiveFile(sourcePath, destPath string) error

ReceiveFile receives a file on this node (stub implementation)

type NodeManagerInterface

type NodeManagerInterface interface {
	GetNode(nodeID string) (*Node, error)
}

NodeManagerInterface for migration

type NodeResourceInfo

type NodeResourceInfo struct {
	NodeID             string            `json:"node_id"`
	TotalCPU           int               `json:"total_cpu"`
	UsedCPU            int               `json:"used_cpu"`
	TotalMemoryMB      int               `json:"total_memory_mb"`
	UsedMemoryMB       int               `json:"used_memory_mb"`
	TotalDiskGB        int               `json:"total_disk_gb"`
	UsedDiskGB         int               `json:"used_disk_gb"`
	CPUUsagePercent    float64           `json:"cpu_usage_percent"`
	MemoryUsagePercent float64           `json:"memory_usage_percent"`
	DiskUsagePercent   float64           `json:"disk_usage_percent"`
	VMCount            int               `json:"vm_count"`
	Status             string            `json:"status"`
	Labels             map[string]string `json:"labels,omitempty"`
}

NodeResourceInfo represents resource information for a node

type PredictionInfo

type PredictionInfo struct {
	PageID      string    `json:"page_id"`
	Confidence  float64   `json:"confidence"` // 0.0 to 1.0
	PredictedAt time.Time `json:"predicted_at"`
	AccessTime  time.Time `json:"access_time"` // predicted access time
	Priority    int       `json:"priority"`    // 1-10
}

PredictionInfo represents an active prediction

type PredictiveCache

type PredictiveCache struct {
	Enabled            bool                 `json:"enabled"`
	CacheHitRate       float64              `json:"cache_hit_rate"`
	PredictionAccuracy float64              `json:"prediction_accuracy"`
	PrefetchedPages    map[string]time.Time `json:"prefetched_pages"` // page_id -> prefetch_time
	ModelVersion       string               `json:"model_version"`
	LastModelUpdate    time.Time            `json:"last_model_update"`
	PredictionsActive  []PredictionInfo     `json:"predictions_active"`
	CacheSize          int64                `json:"cache_size"` // bytes
}

PredictiveCache holds AI-driven predictive caching information

type PredictiveMetrics

type PredictiveMetrics struct {
	PredictionAccuracy   float64       `json:"prediction_accuracy"`
	PredictionLatencyMs  float64       `json:"prediction_latency_ms"`
	CacheHitImprovement  float64       `json:"cache_hit_improvement"`
	PrefetchSuccessRate  float64       `json:"prefetch_success_rate"`
	ModelTrainingTime    time.Duration `json:"model_training_time"`
	FalsePositiveRate    float64       `json:"false_positive_rate"`
	FalseNegativeRate    float64       `json:"false_negative_rate"`
	LastModelUpdate      time.Time     `json:"last_model_update"`
	PredictionsPerSecond float64       `json:"predictions_per_second"`
}

PredictiveMetrics tracks AI-driven predictive performance

type PredictivePrefetchingConfig

type PredictivePrefetchingConfig struct {
	Enabled             bool              `yaml:"enabled" json:"enabled"`
	PredictionAccuracy  float64           `yaml:"prediction_accuracy" json:"prediction_accuracy"`             // Target accuracy (default: 0.85)
	MaxCacheSize        int64             `yaml:"max_cache_size" json:"max_cache_size"`                       // Max cache size in bytes
	PredictionLatencyMs int64             `yaml:"prediction_latency_ms" json:"prediction_latency_ms"`         // Max prediction latency in ms
	ModelType           string            `yaml:"model_type" json:"model_type"`                               // "neural_network", "random_forest", etc.
	TrainingDataSize    int64             `yaml:"training_data_size" json:"training_data_size"`               // Max training samples to retain
	ContinuousLearning  bool              `yaml:"continuous_learning" json:"continuous_learning"`             // Enable continuous model training
	PrefetchAheadTime   string            `yaml:"prefetch_ahead_time" json:"prefetch_ahead_time"`             // How far ahead to prefetch (e.g., "5m")
	AIModelConfig       map[string]string `yaml:"ai_model_config,omitempty" json:"ai_model_config,omitempty"` // Model-specific configuration
}

PredictivePrefetchingConfig configures AI-driven predictive prefetching for VM migrations

func DefaultPredictivePrefetchingConfig

func DefaultPredictivePrefetchingConfig() *PredictivePrefetchingConfig

DefaultPredictivePrefetchingConfig returns default configuration for predictive prefetching

type ProxmoxConfig

type ProxmoxConfig struct {
	Enabled  bool
	URL      string
	Username string
	Password string
	Realm    string
	Node     string
	Insecure bool
}

ProxmoxConfig contains Proxmox VE specific configuration

type QoSSettings

type QoSSettings struct {
	MaxLatency      int64   `json:"max_latency"`       // milliseconds
	MinBandwidth    int64   `json:"min_bandwidth"`     // bytes/sec
	MaxJitter       int64   `json:"max_jitter"`        // milliseconds
	PacketLossLimit float64 `json:"packet_loss_limit"` // percentage
}

QoSSettings defines Quality of Service settings

type RateLimitedReader

type RateLimitedReader struct {
	// contains filtered or unexported fields
}

RateLimitedReader wraps an io.Reader with rate limiting functionality

func NewRateLimitedReader

func NewRateLimitedReader(reader io.Reader, bytesPerSec int64) *RateLimitedReader

NewRateLimitedReader creates a new rate limited reader

func (*RateLimitedReader) Read

func (r *RateLimitedReader) Read(p []byte) (int, error)

Read implements io.Reader with rate limiting

type ResolvedConflict

type ResolvedConflict struct {
	ConflictID       string           `json:"conflict_id"`
	Resolution       ConflictStrategy `json:"resolution"`
	ResolvedAt       time.Time        `json:"resolved_at"`
	ResolvedBy       string           `json:"resolved_by"`
	FinalValue       interface{}      `json:"final_value"`
	ConflictDuration time.Duration    `json:"conflict_duration"`
}

ResolvedConflict represents a resolved conflict

type ResourceAllocation

type ResourceAllocation struct {
	VMID      string
	NodeID    string
	CPUCores  int
	MemoryMB  int
	DiskGB    int
	RequestID string
}

ResourceAllocation represents a resource allocation for a VM

type ResourceAvailability

type ResourceAvailability struct {
	// Available CPU percentage
	CPUPct float64

	// Available memory in MB
	MemoryMB int

	// Available network bandwidth in Mbps
	BandwidthMbps float64

	// Available IO operations per second
	IOPs int
}

ResourceAvailability represents available resources on a system

type ResourceImpact

type ResourceImpact struct {
	// CPU usage as percentage of one CPU core (100 = 1 core)
	CPUPct float64

	// Memory usage in MB
	MemoryMB int

	// Network bandwidth requirement in Mbps
	BandwidthMbps float64

	// Estimated duration in seconds
	DurationSec int

	// IO operations per second
	IOPs int
}

ResourceImpact represents the impact on different resources during migration

func DefaultResourceImpact

func DefaultResourceImpact() ResourceImpact

DefaultResourceImpact returns default resource impact estimation

type ResourceLimits

type ResourceLimits struct {
	MaxCPU     int   `json:"max_cpu"`
	MaxMemory  int64 `json:"max_memory"`
	MaxStorage int64 `json:"max_storage"`
	MaxNetwork int64 `json:"max_network"`
}

ResourceLimits defines resource constraints

type ResourceThreshold

type ResourceThreshold struct {
	CPUWarningPercent     float64 `json:"cpu_warning_percent"`
	CPUCriticalPercent    float64 `json:"cpu_critical_percent"`
	MemoryWarningPercent  float64 `json:"memory_warning_percent"`
	MemoryCriticalPercent float64 `json:"memory_critical_percent"`
	DiskWarningPercent    float64 `json:"disk_warning_percent"`
	DiskCriticalPercent   float64 `json:"disk_critical_percent"`
}

ResourceThreshold represents resource usage thresholds

type RetentionPolicy

type RetentionPolicy struct {
	MaxSnapshots   int           `json:"max_snapshots"`
	MaxCheckpoints int           `json:"max_checkpoints"`
	SnapshotTTL    time.Duration `json:"snapshot_ttl"`
	CheckpointTTL  time.Duration `json:"checkpoint_ttl"`
}

RetentionPolicy defines data retention rules

type SRIOVDevice

type SRIOVDevice struct {
	ID               string            `json:"id"`
	Name             string            `json:"name"`
	PCIAddress       string            `json:"pci_address"`
	Driver           string            `json:"driver"`
	VendorID         string            `json:"vendor_id"`
	DeviceID         string            `json:"device_id"`
	SubsystemVendor  string            `json:"subsystem_vendor"`
	SubsystemDevice  string            `json:"subsystem_device"`
	IOMMUGroup       int               `json:"iommu_group"`
	MaxVFs           int               `json:"max_vfs"`
	CurrentVFs       int               `json:"current_vfs"`
	AvailableVFs     int               `json:"available_vfs"`
	VirtualFunctions []VirtualFunction `json:"virtual_functions"`
	Capabilities     []string          `json:"capabilities"`
	LinkSpeed        string            `json:"link_speed,omitempty"`
	LinkWidth        string            `json:"link_width,omitempty"`
	PowerState       string            `json:"power_state"`
	Temperature      int               `json:"temperature,omitempty"`
	FirmwareVersion  string            `json:"firmware_version,omitempty"`
}

SRIOVDevice represents an SR-IOV capable device

type ScheduledTask

type ScheduledTask struct {
	ID         string
	VMID       string
	Operation  string
	Schedule   string // Cron expression
	NextRun    time.Time
	LastRun    time.Time
	Enabled    bool
	Parameters map[string]interface{}
}

ScheduledTask represents a scheduled lifecycle task

type SchedulerConfig

type SchedulerConfig struct {
	Policy                 SchedulerPolicy `json:"policy"`
	EnableResourceChecking bool            `json:"enable_resource_checking"`
	EnableAntiAffinity     bool            `json:"enable_anti_affinity"`
	EnableNodeLabels       bool            `json:"enable_node_labels"`
	MaxVMsPerNode          int             `json:"max_vms_per_node"`
	MaxCPUOvercommit       float64         `json:"max_cpu_overcommit"`
	MaxMemoryOvercommit    float64         `json:"max_memory_overcommit"`
}

SchedulerConfig represents VM scheduler configuration

type SchedulerPolicy

type SchedulerPolicy string

SchedulerPolicy represents a VM scheduling policy

const (
	// SchedulerPolicyRoundRobin represents a round-robin scheduling policy
	SchedulerPolicyRoundRobin SchedulerPolicy = "round_robin"

	// SchedulerPolicyBinPacking represents a bin-packing scheduling policy
	SchedulerPolicyBinPacking SchedulerPolicy = "bin_packing"

	// SchedulerPolicySpreadOut represents a spread-out scheduling policy
	SchedulerPolicySpreadOut SchedulerPolicy = "spread_out"

	// SchedulerPolicyCustom represents a custom scheduling policy
	SchedulerPolicyCustom SchedulerPolicy = "custom"
)

type SecurityContext

type SecurityContext struct {
	EncryptionEnabled bool              `json:"encryption_enabled"`
	KeyVersion        string            `json:"key_version"`
	AccessPolicies    []string          `json:"access_policies"`
	AuditEnabled      bool              `json:"audit_enabled"`
	Certificates      map[string]string `json:"certificates"`
}

SecurityContext defines security settings for distributed operations

type SecurityProfile

type SecurityProfile struct {
	ID                string            `json:"id"`
	Name              string            `json:"name"`
	Description       string            `json:"description"`
	SecureBoot        bool              `json:"secure_boot"`
	TPMEnabled        bool              `json:"tpm_enabled"`
	EncryptionEnabled bool              `json:"encryption_enabled"`
	EncryptionType    string            `json:"encryption_type,omitempty"`
	CreatedAt         time.Time         `json:"created_at"`
	UpdatedAt         time.Time         `json:"updated_at"`
	Tags              []string          `json:"tags,omitempty"`
	Metadata          map[string]string `json:"metadata,omitempty"`
}

SecurityProfile represents a VM security profile

type Snapshot

type Snapshot struct {
	ID          string            `json:"id"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Timestamp   time.Time         `json:"timestamp"`
	ParentID    string            `json:"parent_id"`
	DiskImages  []DiskImage       `json:"disk_images"`
	VMConfig    VMConfig          `json:"vm_config"`
	Metadata    map[string]string `json:"metadata"`
	Size        int64             `json:"size"`
	State       SnapshotState     `json:"state"`
}

Snapshot represents a VM snapshot

type SnapshotState

type SnapshotState int

SnapshotState represents snapshot states

const (
	SnapshotCreating SnapshotState = iota
	SnapshotReady
	SnapshotDeleting
	SnapshotCorrupted
)

type SnapshotStatus

type SnapshotStatus string

SnapshotStatus represents the status of a snapshot

const (
	// SnapshotStatusCreating indicates the snapshot is being created
	SnapshotStatusCreating SnapshotStatus = "creating"

	// SnapshotStatusCompleted indicates the snapshot completed successfully
	SnapshotStatusCompleted SnapshotStatus = "completed"

	// SnapshotStatusFailed indicates the snapshot failed
	SnapshotStatusFailed SnapshotStatus = "failed"

	// SnapshotStatusDeleting indicates the snapshot is being deleted
	SnapshotStatusDeleting SnapshotStatus = "deleting"

	// SnapshotStatusDeleted indicates the snapshot has been deleted
	SnapshotStatusDeleted SnapshotStatus = "deleted"
)

type SnapshotStorage

type SnapshotStorage interface {
	SaveSnapshot(snapshot *Snapshot) error
	LoadSnapshot(id string) (*Snapshot, error)
	DeleteSnapshot(id string) error
	ListSnapshots(vmID string) ([]*Snapshot, error)
}

SnapshotStorage defines the interface for snapshot storage

type SnapshotType

type SnapshotType string

SnapshotType represents the type of snapshot

const (
	// SnapshotTypeFull represents a full snapshot
	SnapshotTypeFull SnapshotType = "full"

	// SnapshotTypeIncremental represents an incremental snapshot
	SnapshotTypeIncremental SnapshotType = "incremental"

	// SnapshotTypeDifferential represents a differential snapshot
	SnapshotTypeDifferential SnapshotType = "differential"
)

type State

type State string

State represents the current state of a VM

type StateConflict

type StateConflict struct {
	ConflictID    string                 `json:"conflict_id"`
	ConflictType  string                 `json:"conflict_type"`
	SourceNode    string                 `json:"source_node"`
	TargetNode    string                 `json:"target_node"`
	ConflictField string                 `json:"conflict_field"`
	SourceValue   interface{}            `json:"source_value"`
	TargetValue   interface{}            `json:"target_value"`
	DetectedAt    time.Time              `json:"detected_at"`
	Severity      ConflictSeverity       `json:"severity"`
	Metadata      map[string]interface{} `json:"metadata"`
}

StateConflict represents a state conflict between nodes

type StateSnapshot

type StateSnapshot struct {
	Timestamp      time.Time              `json:"timestamp"`
	StateVersion   uint64                 `json:"state_version"`
	VMState        State                  `json:"vm_state"`
	MemoryChecksum string                 `json:"memory_checksum"`
	ConfigChecksum string                 `json:"config_checksum"`
	Metadata       map[string]interface{} `json:"metadata"`
	Size           int64                  `json:"size"`
	Compressed     bool                   `json:"compressed"`
}

StateSnapshot represents a point-in-time state snapshot

type StateTransition

type StateTransition struct {
	From      State         `json:"from"`
	To        State         `json:"to"`
	Timestamp time.Time     `json:"timestamp"`
	Reason    string        `json:"reason"`
	Duration  time.Duration `json:"duration"`
	Success   bool          `json:"success"`
	Error     string        `json:"error,omitempty"`
}

StateTransition records a state change

type StorageDevice

type StorageDevice struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	Type        string `json:"type"` // ssd, nvme, hdd, etc.
	SizeGB      int64  `json:"size_gb"`
	Path        string `json:"path"`
	ReadIOPS    int64  `json:"read_iops,omitempty"`
	WriteIOPS   int64  `json:"write_iops,omitempty"`
	Passthrough bool   `json:"passthrough"`
	InUse       bool   `json:"in_use"`
}

StorageDevice represents a storage device

type StorageFormat

type StorageFormat string

StorageFormat represents the format of storage

const (
	// StorageFormatRaw represents raw storage format
	StorageFormatRaw StorageFormat = "raw"

	// StorageFormatQCOW2 represents QCOW2 storage format
	StorageFormatQCOW2 StorageFormat = "qcow2"

	// StorageFormatVMDK represents VMDK storage format
	StorageFormatVMDK StorageFormat = "vmdk"

	// StorageFormatVHD represents VHD storage format
	StorageFormatVHD StorageFormat = "vhd"
)

type StorageManagerInterface

type StorageManagerInterface interface {
}

StorageManagerInterface for migration

type StoragePool

type StoragePool struct {
	ID         string            `json:"id"`
	Name       string            `json:"name"`
	Type       StorageType       `json:"type"`
	Path       string            `json:"path"`
	TotalSpace int64             `json:"total_space"`
	UsedSpace  int64             `json:"used_space"`
	CreatedAt  time.Time         `json:"created_at"`
	UpdatedAt  time.Time         `json:"updated_at"`
	Tags       []string          `json:"tags,omitempty"`
	Metadata   map[string]string `json:"metadata,omitempty"`
}

StoragePool represents a storage pool

type StorageType

type StorageType string

StorageType represents the type of storage

const (
	// StorageTypeLocal represents local storage
	StorageTypeLocal StorageType = "local"

	// StorageTypeNFS represents NFS storage
	StorageTypeNFS StorageType = "nfs"

	// StorageTypeCeph represents Ceph storage
	StorageTypeCeph StorageType = "ceph"

	// StorageTypeISCSI represents iSCSI storage
	StorageTypeISCSI StorageType = "iscsi"
)

type StorageVolume

type StorageVolume struct {
	ID         string            `json:"id"`
	Name       string            `json:"name"`
	PoolID     string            `json:"pool_id"`
	Format     StorageFormat     `json:"format"`
	Capacity   int64             `json:"capacity"`
	Allocation int64             `json:"allocation"`
	Path       string            `json:"path"`
	CreatedAt  time.Time         `json:"created_at"`
	UpdatedAt  time.Time         `json:"updated_at"`
	Tags       []string          `json:"tags,omitempty"`
	Metadata   map[string]string `json:"metadata,omitempty"`
}

StorageVolume represents a storage volume

type SystemNUMATopology

type SystemNUMATopology struct {
	Nodes            []NUMANodeInfo `json:"nodes"`
	TotalNodes       int            `json:"total_nodes"`
	TotalCPUs        int            `json:"total_cpus"`
	TotalMemoryMB    int64          `json:"total_memory_mb"`
	InterconnectMap  map[string]int `json:"interconnect_map"` // Distance matrix
	HugePagesSupport bool           `json:"hugepages_support"`
	HugePageSizes    []int          `json:"hugepage_sizes"` // In KB
}

SystemNUMATopology represents the system's NUMA topology

type TenantQuotaConfig

type TenantQuotaConfig struct {
	Default   TenantQuotaLimits            `yaml:"default" json:"default"`
	Overrides map[string]TenantQuotaLimits `yaml:"overrides,omitempty" json:"overrides,omitempty"`
}

TenantQuotaConfig defines default and per-tenant quota overrides.

type TenantQuotaLimits

type TenantQuotaLimits struct {
	MaxVMs      int   `yaml:"max_vms" json:"max_vms"`
	MaxCPUUnits int   `yaml:"max_cpu_units" json:"max_cpu_units"`
	MaxMemoryMB int64 `yaml:"max_memory_mb" json:"max_memory_mb"`
}

TenantQuotaLimits defines per-tenant resource limits for VM admission.

type Ubuntu2404CloudInitOptions

type Ubuntu2404CloudInitOptions struct {
	Hostname          string
	SSHAuthorizedKeys []string
	Packages          []string
	UserData          string
}

Ubuntu2404CloudInitOptions configures the guest's NoCloud seed data.

type Ubuntu2404Profile

type Ubuntu2404Profile struct {
	BaseImagePath     string
	CloudInitBasePath string
}

Ubuntu2404Profile describes the canonical Ubuntu 24.04 guest pipeline.

func NewUbuntu2404Profile

func NewUbuntu2404Profile(baseImagePath, cloudInitBasePath string) (*Ubuntu2404Profile, error)

NewUbuntu2404Profile validates and returns the canonical Ubuntu 24.04 guest profile.

func (*Ubuntu2404Profile) PrepareConfig

func (p *Ubuntu2404Profile) PrepareConfig(vmID string, base VMConfig, options Ubuntu2404CloudInitOptions) (VMConfig, error)

PrepareConfig converts a generic VM config into the canonical Ubuntu 24.04 KVM config.

type VCPUPinning

type VCPUPinning struct {
	VCPU   int    `json:"vcpu"`
	CPUSet string `json:"cpuset"` // e.g., "0-3,8,9"
	Policy string `json:"policy,omitempty"`
}

VCPUPinning represents virtual CPU to physical CPU mapping

type VGPUProfile

type VGPUProfile struct {
	Name           string `json:"name"`
	Description    string `json:"description"`
	FrameBuffer    int64  `json:"frame_buffer_mb"`
	MaxInstances   int    `json:"max_instances"`
	MaxResX        int    `json:"max_resolution_x"`
	MaxResY        int    `json:"max_resolution_y"`
	MaxDisplays    int    `json:"max_displays"`
	CUDAEnabled    bool   `json:"cuda_enabled"`
	OpenGLVersion  string `json:"opengl_version"`
	DirectXVersion string `json:"directx_version"`
}

VGPUProfile represents vGPU profile information

type VM

type VM struct {
	// contains filtered or unexported fields
}

VM represents a virtual machine with distributed state management

func NewVM

func NewVM(config VMConfig) (*VM, error)

NewVM creates a new VM instance

func (*VM) AddConflict

func (vm *VM) AddConflict(conflict StateConflict) error

AddConflict adds a state conflict for resolution

func (*VM) AddStateSnapshot

func (vm *VM) AddStateSnapshot(snapshot StateSnapshot) error

AddStateSnapshot adds a state snapshot to the history

func (*VM) ApplyUpdateSpec

func (vm *VM) ApplyUpdateSpec(spec VMUpdateSpec) error

ApplyUpdateSpec applies an update specification to the VM

func (*VM) AttachStorageVolume

func (vm *VM) AttachStorageVolume(ctx context.Context, storageManager *VMStorageManagerIntegration, volumeID string) error

AttachStorageVolume attaches a storage volume to the VM

func (*VM) Cleanup

func (vm *VM) Cleanup() error

Cleanup cleans up VM resources

func (*VM) Clone

func (vm *VM) Clone(newName string) (*VM, error)

Clone creates a copy of the VM

func (*VM) Config

func (vm *VM) Config() VMConfig

Config returns the VM configuration

func (*VM) CreateStorageSnapshot

func (vm *VM) CreateStorageSnapshot(ctx context.Context, storageManager *VMStorageManagerIntegration, snapshotName string) (map[string]string, error)

CreateStorageSnapshot creates a snapshot of all VM storage volumes

func (*VM) CreatedAt

func (vm *VM) CreatedAt() time.Time

CreatedAt returns when the VM was created

func (*VM) Delete

func (vm *VM) Delete() error

Delete deletes the VM (stub implementation)

func (*VM) DetachStorageVolume

func (vm *VM) DetachStorageVolume(ctx context.Context, storageManager *VMStorageManagerIntegration, volumeID string) error

DetachStorageVolume detaches a storage volume from the VM

func (*VM) ErrorMessage

func (vm *VM) ErrorMessage() string

ErrorMessage returns the VM's error message

func (*VM) ForceKill

func (vm *VM) ForceKill() error

ForceKill forcefully kills the VM process

func (*VM) GetActiveConflicts

func (vm *VM) GetActiveConflicts() []StateConflict

GetActiveConflicts returns the list of active conflicts

func (*VM) GetArgs

func (vm *VM) GetArgs() []string

GetArgs returns the VM's arguments

func (*VM) GetCPUShares

func (vm *VM) GetCPUShares() int

GetCPUShares returns the VM's CPU shares

func (*VM) GetCommand

func (vm *VM) GetCommand() string

GetCommand returns the VM's command

func (*VM) GetCreatedAt

func (vm *VM) GetCreatedAt() time.Time

GetCreatedAt returns when the VM was created

func (*VM) GetDiskPaths

func (vm *VM) GetDiskPaths() ([]string, error)

GetDiskPaths returns the disk paths for the VM (stub implementation)

func (*VM) GetDiskSizeGB

func (vm *VM) GetDiskSizeGB() int

GetDiskSizeGB returns the VM's disk size in GB

func (*VM) GetDistributedState

func (vm *VM) GetDistributedState() *DistributedStateInfo

GetDistributedState returns the distributed state information

func (*VM) GetFederationContext

func (vm *VM) GetFederationContext() *FederationContext

GetFederationContext returns the federation context

func (*VM) GetInfo

func (vm *VM) GetInfo() VMInfo

GetInfo returns information about the VM

func (*VM) GetMemoryDeltaPath

func (vm *VM) GetMemoryDeltaPath(iteration int) (string, error)

GetMemoryDeltaPath returns the memory delta path for the VM (stub implementation)

func (*VM) GetMemoryDistribution

func (vm *VM) GetMemoryDistribution() *MemoryDistributionInfo

GetMemoryDistribution returns the memory distribution information

func (*VM) GetMemoryMB

func (vm *VM) GetMemoryMB() int

GetMemoryMB returns the VM's memory in MB

func (*VM) GetMemoryStatePath

func (vm *VM) GetMemoryStatePath() (string, error)

GetMemoryStatePath returns the memory state path for the VM (stub implementation)

func (*VM) GetNodeID

func (vm *VM) GetNodeID() string

GetNodeID returns the node ID

func (*VM) GetPerformanceMetrics

func (vm *VM) GetPerformanceMetrics() *DistributedMetrics

GetPerformanceMetrics returns the performance metrics

func (*VM) GetPredictiveCache

func (vm *VM) GetPredictiveCache() *PredictiveCache

GetPredictiveCache returns the predictive cache information

func (*VM) GetProcessInfo

func (vm *VM) GetProcessInfo() VMProcessInfo

GetProcessInfo returns the process information

func (*VM) GetProcessStats

func (vm *VM) GetProcessStats() (VMProcessStats, error)

GetProcessStats returns detailed process statistics

func (*VM) GetResourceID

func (vm *VM) GetResourceID() string

GetResourceID returns the resource ID

func (*VM) GetResourceUsage

func (vm *VM) GetResourceUsage() VMResourceUsage

GetResourceUsage returns current resource usage

func (*VM) GetShardID

func (vm *VM) GetShardID() string

GetShardID returns the shard ID for this VM

func (*VM) GetStateCoordinator

func (vm *VM) GetStateCoordinator() string

GetStateCoordinator returns the state coordinator node ID

func (*VM) GetStateHistory

func (vm *VM) GetStateHistory() []StateSnapshot

GetStateHistory returns the state history

func (*VM) GetStateVersion

func (vm *VM) GetStateVersion() uint64

GetStateVersion returns the current state version

func (*VM) GetStats

func (vm *VM) GetStats() VMStats

GetStats returns the VM's statistics

func (*VM) GetStorageStats

func (vm *VM) GetStorageStats(ctx context.Context, storageManager *VMStorageManagerIntegration) (VMStorageStats, error)

GetStorageStats returns storage statistics for the VM

func (*VM) GetStorageVolumes

func (vm *VM) GetStorageVolumes(ctx context.Context, storageManager *VMStorageManagerIntegration) ([]*storage.VolumeInfo, error)

GetStorageVolumes returns all storage volumes attached to the VM

func (*VM) GetTags

func (vm *VM) GetTags() map[string]string

GetTags returns the VM's tags

func (*VM) GetUpdatedAt

func (vm *VM) GetUpdatedAt() time.Time

GetUpdatedAt returns the last update time

func (*VM) HasActiveConflicts

func (vm *VM) HasActiveConflicts() bool

HasActiveConflicts returns whether there are any active conflicts

func (*VM) ID

func (vm *VM) ID() string

ID returns the VM's ID

func (*VM) InitializeDistributedState

func (vm *VM) InitializeDistributedState(ctx context.Context, shardID string, coordinatorNode string) error

InitializeDistributedState initializes distributed state management for the VM

func (*VM) IsDistributedStateEnabled

func (vm *VM) IsDistributedStateEnabled() bool

IsDistributedStateEnabled returns whether distributed state is enabled

func (*VM) IsRunning

func (vm *VM) IsRunning() bool

IsRunning returns true if the VM is running

func (*VM) IsStateDirty

func (vm *VM) IsStateDirty() bool

IsStateDirty returns whether the state needs synchronization

func (*VM) MarkStateClean

func (vm *VM) MarkStateClean()

MarkStateClean marks the state as synchronized

func (*VM) Name

func (vm *VM) Name() string

Name returns the VM's name

func (*VM) NodeID

func (vm *VM) NodeID() string

NodeID returns the node ID (compatibility method)

func (*VM) Pause

func (vm *VM) Pause() error

Pause pauses the VM

func (*VM) ProcessInfo

func (vm *VM) ProcessInfo() VMProcessInfo

ProcessInfo returns the process information (compatibility method)

func (*VM) Reboot

func (vm *VM) Reboot() error

RebootVM reboots the VM (stop and start)

func (*VM) ResolveConflict

func (vm *VM) ResolveConflict(conflictID string, resolution ConflictStrategy, resolvedBy string, finalValue interface{}) error

ResolveConflict resolves a state conflict

func (*VM) ResourceID

func (vm *VM) ResourceID() string

ResourceID returns the resource ID (compatibility method)

func (*VM) Resume

func (vm *VM) Resume() error

Resume resumes the VM (stub implementation)

func (*VM) ResumeFromState

func (vm *VM) ResumeFromState(statePath string) error

ResumeFromState resumes VM from a saved state (stub implementation)

func (*VM) ResumeInternal

func (vm *VM) ResumeInternal() error

ResumeInternal resumes a paused VM (internal use)

func (*VM) SendSignal

func (vm *VM) SendSignal(signal os.Signal) error

SendSignal sends a custom signal to the VM process

func (*VM) SetCPUShares

func (vm *VM) SetCPUShares(cpuShares int)

SetCPUShares sets the VM's CPU shares

func (*VM) SetDiskSizeGB

func (vm *VM) SetDiskSizeGB(diskSizeGB int)

SetDiskSizeGB sets the VM's disk size in GB

func (*VM) SetMemoryMB

func (vm *VM) SetMemoryMB(memoryMB int)

SetMemoryMB sets the VM's memory in MB

func (*VM) SetName

func (vm *VM) SetName(name string)

SetName sets the VM's name

func (*VM) SetNodeID

func (vm *VM) SetNodeID(nodeID string)

SetNodeID sets the node ID

func (*VM) SetProcessInfo

func (vm *VM) SetProcessInfo(processInfo VMProcessInfo)

SetProcessInfo sets the process information

func (*VM) SetResourceID

func (vm *VM) SetResourceID(resourceID string)

SetResourceID sets the resource ID

func (*VM) SetStartedAt

func (vm *VM) SetStartedAt(t time.Time)

SetStartedAt sets the started time

func (*VM) SetState

func (vm *VM) SetState(state State)

SetState sets the VM's state

func (*VM) SetStateCoordinator

func (vm *VM) SetStateCoordinator(coordinatorNode string)

SetStateCoordinator sets the state coordinator node

func (*VM) SetTags

func (vm *VM) SetTags(tags map[string]string)

SetTags sets the VM's tags

func (*VM) SetUpdatedAt

func (vm *VM) SetUpdatedAt(t time.Time)

SetUpdatedAt sets the updated time

func (*VM) Start

func (vm *VM) Start() error

Start starts the VM

func (*VM) State

func (vm *VM) State() State

State returns the VM's current state

func (*VM) Stop

func (vm *VM) Stop() error

Stop stops the VM

func (*VM) Suspend

func (vm *VM) Suspend() error

Suspend suspends the VM (stub implementation)

func (*VM) SuspendInternal

func (vm *VM) SuspendInternal() error

SuspendInternal suspends the VM to disk (hibernate) - internal use

func (*VM) UpdateDistributedState

func (vm *VM) UpdateDistributedState(updateFunc func(*DistributedStateInfo) error) error

UpdateDistributedState updates the distributed state with thread safety

func (*VM) UpdateFederationContext

func (vm *VM) UpdateFederationContext(updateFunc func(*FederationContext) error) error

UpdateFederationContext updates the federation context

func (*VM) UpdateMemoryDistribution

func (vm *VM) UpdateMemoryDistribution(updateFunc func(*MemoryDistributionInfo) error) error

UpdateMemoryDistribution updates the memory distribution information

func (*VM) UpdatePerformanceMetrics

func (vm *VM) UpdatePerformanceMetrics(updateFunc func(*DistributedMetrics) error) error

UpdatePerformanceMetrics updates performance metrics

func (*VM) UpdatePredictiveCache

func (vm *VM) UpdatePredictiveCache(updateFunc func(*PredictiveCache) error) error

UpdatePredictiveCache updates the predictive cache information

func (*VM) UpdateResourceLimits

func (vm *VM) UpdateResourceLimits(cpuShares int, memoryMB int) error

UpdateResourceLimits updates the resource limits for the VM

func (*VM) UpdatedAt

func (vm *VM) UpdatedAt() time.Time

UpdatedAt returns the last update time (compatibility method)

type VMBackup

type VMBackup struct {
	ID          string            `json:"id"`
	VMID        string            `json:"vm_id"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Type        BackupType        `json:"type"`
	Status      BackupStatus      `json:"status"`
	CreatedAt   time.Time         `json:"created_at"`
	UpdatedAt   time.Time         `json:"updated_at"`
	Size        int64             `json:"size"`
	ParentID    string            `json:"parent_id,omitempty"`
	Tags        []string          `json:"tags,omitempty"`
	Metadata    map[string]string `json:"metadata,omitempty"`
	StoragePath string            `json:"storage_path"`
	ExpiresAt   *time.Time        `json:"expires_at,omitempty"`
}

VMBackup represents a VM backup

type VMBackupManager

type VMBackupManager struct {
	// contains filtered or unexported fields
}

VMBackupManager manages VM backups

func NewVMBackupManager

func NewVMBackupManager(vmManager *VMManager, storageProvider BackupStorageProvider) *VMBackupManager

NewVMBackupManager creates a new VM backup manager

func (*VMBackupManager) CleanupExpiredBackups

func (m *VMBackupManager) CleanupExpiredBackups(ctx context.Context) error

CleanupExpiredBackups deletes expired backups

func (*VMBackupManager) CreateBackup

func (m *VMBackupManager) CreateBackup(ctx context.Context, vmID, name, description string, backupType BackupType, tags []string, metadata map[string]string, expiresIn *time.Duration) (*VMBackup, error)

CreateBackup creates a new VM backup

func (*VMBackupManager) DeleteBackup

func (m *VMBackupManager) DeleteBackup(ctx context.Context, backupID string) error

DeleteBackup deletes a backup

func (*VMBackupManager) GetBackup

func (m *VMBackupManager) GetBackup(backupID string) (*VMBackup, error)

GetBackup returns a backup by ID

func (*VMBackupManager) ListBackups

func (m *VMBackupManager) ListBackups() []*VMBackup

ListBackups returns all backups

func (*VMBackupManager) ListBackupsForVM

func (m *VMBackupManager) ListBackupsForVM(vmID string) []*VMBackup

ListBackupsForVM returns all backups for a VM

func (*VMBackupManager) RestoreBackup

func (m *VMBackupManager) RestoreBackup(ctx context.Context, backupID string) error

RestoreBackup restores a VM from a backup

type VMCheckpointer

type VMCheckpointer struct {
	// contains filtered or unexported fields
}

VMCheckpointer handles VM checkpoint operations

func NewVMCheckpointer

func NewVMCheckpointer() *VMCheckpointer

NewVMCheckpointer creates a new VM checkpointer

func (*VMCheckpointer) CreateCheckpoint

func (cp *VMCheckpointer) CreateCheckpoint(vm *VM, metadata map[string]string) (*Checkpoint, error)

CreateCheckpoint creates a checkpoint of a VM

func (*VMCheckpointer) DeleteCheckpoint

func (cp *VMCheckpointer) DeleteCheckpoint(checkpointID string) error

DeleteCheckpoint deletes a checkpoint

func (*VMCheckpointer) ListCheckpoints

func (cp *VMCheckpointer) ListCheckpoints(vmID string) ([]*Checkpoint, error)

ListCheckpoints lists all checkpoints for a VM

func (*VMCheckpointer) RestoreCheckpoint

func (cp *VMCheckpointer) RestoreCheckpoint(vm *VM, checkpoint *Checkpoint) error

RestoreCheckpoint restores a VM from a checkpoint

type VMCluster

type VMCluster struct {
	ID          string             `json:"id"`
	Name        string             `json:"name"`
	Description string             `json:"description"`
	State       ClusterState       `json:"state"`
	CreatedAt   time.Time          `json:"created_at"`
	UpdatedAt   time.Time          `json:"updated_at"`
	Members     []*VMClusterMember `json:"members"`
	Tags        []string           `json:"tags,omitempty"`
	Metadata    map[string]string  `json:"metadata,omitempty"`
}

VMCluster represents a cluster of VMs

type VMClusterManager

type VMClusterManager struct {
	// contains filtered or unexported fields
}

VMClusterManager manages VM clusters

func NewVMClusterManager

func NewVMClusterManager(vmManager *VMManager, scheduler *VMScheduler) *VMClusterManager

NewVMClusterManager creates a new VM cluster manager

func (*VMClusterManager) AddClusterMember

func (m *VMClusterManager) AddClusterMember(ctx context.Context, clusterID string, role ClusterRole, vmConfig VMConfig) (*VMClusterMember, error)

AddClusterMember adds a member to a cluster

func (*VMClusterManager) CreateCluster

func (m *VMClusterManager) CreateCluster(ctx context.Context, name, description string, masterCount, workerCount int, vmConfig VMConfig, tags []string, metadata map[string]string) (*VMCluster, error)

CreateCluster creates a new VM cluster

func (*VMClusterManager) DeleteCluster

func (m *VMClusterManager) DeleteCluster(ctx context.Context, clusterID string) error

DeleteCluster deletes a cluster

func (*VMClusterManager) GetCluster

func (m *VMClusterManager) GetCluster(clusterID string) (*VMCluster, error)

GetCluster returns a cluster by ID

func (*VMClusterManager) ListClusters

func (m *VMClusterManager) ListClusters() []*VMCluster

ListClusters returns all clusters

func (*VMClusterManager) RemoveClusterMember

func (m *VMClusterManager) RemoveClusterMember(ctx context.Context, clusterID, vmID string) error

RemoveClusterMember removes a member from a cluster

func (*VMClusterManager) StartCluster

func (m *VMClusterManager) StartCluster(ctx context.Context, clusterID string) error

StartCluster starts all VMs in a cluster

func (*VMClusterManager) StopCluster

func (m *VMClusterManager) StopCluster(ctx context.Context, clusterID string) error

StopCluster stops all VMs in a cluster

type VMClusterMember

type VMClusterMember struct {
	VMID      string      `json:"vm_id"`
	Role      ClusterRole `json:"role"`
	JoinedAt  time.Time   `json:"joined_at"`
	Status    State       `json:"status"`
	NodeID    string      `json:"node_id"`
	IPAddress string      `json:"ip_address,omitempty"`
	Hostname  string      `json:"hostname,omitempty"`
}

VMClusterMember represents a member of a VM cluster

type VMConfig

type VMConfig struct {
	ID                    string                       `yaml:"id" json:"id"`
	Name                  string                       `yaml:"name" json:"name"`
	Type                  VMType                       `yaml:"type" json:"type"`
	Command               string                       `yaml:"command" json:"command"`
	Args                  []string                     `yaml:"args" json:"args"`
	CPUShares             int                          `yaml:"cpu_shares" json:"cpu_shares"`
	MemoryMB              int                          `yaml:"memory_mb" json:"memory_mb"`
	DiskSizeGB            int                          `yaml:"disk_size_gb" json:"disk_size_gb"`
	RootFS                string                       `yaml:"rootfs" json:"rootfs"`
	Image                 string                       `yaml:"image" json:"image"`
	CloudInitISO          string                       `yaml:"cloud_init_iso" json:"cloud_init_iso"`
	Mounts                []Mount                      `yaml:"mounts" json:"mounts"`
	Env                   map[string]string            `yaml:"env" json:"env"`
	NetworkID             string                       `yaml:"network_id" json:"network_id"`
	OwnerID               string                       `yaml:"owner_id,omitempty" json:"owner_id,omitempty"`
	TenantID              string                       `yaml:"tenant_id,omitempty" json:"tenant_id,omitempty"`
	VolumeAttachments     []VMVolumeAttachment         `yaml:"volume_attachments,omitempty" json:"volume_attachments,omitempty"`
	NetworkAttachments    []VMNetworkAttachment        `yaml:"network_attachments,omitempty" json:"network_attachments,omitempty"`
	Placement             *VMPlacementSpec             `yaml:"placement,omitempty" json:"placement,omitempty"`
	Migration             *VMMigrationPolicy           `yaml:"migration,omitempty" json:"migration,omitempty"`
	Replication           *VMReplicationPolicy         `yaml:"replication,omitempty" json:"replication,omitempty"`
	WorkDir               string                       `yaml:"work_dir" json:"work_dir"`
	Tags                  map[string]string            `yaml:"tags" json:"tags"`
	PredictivePrefetching *PredictivePrefetchingConfig `yaml:"predictive_prefetching,omitempty" json:"predictive_prefetching,omitempty"`
}

VMConfig holds configuration for a VM

type VMDriver

type VMDriver interface {
	Create(ctx context.Context, config VMConfig) (string, error)
	Start(ctx context.Context, vmID string) error
	Stop(ctx context.Context, vmID string) error
	Delete(ctx context.Context, vmID string) error
	GetStatus(ctx context.Context, vmID string) (VMState, error)
	GetInfo(ctx context.Context, vmID string) (*VMInfo, error)
	GetMetrics(ctx context.Context, vmID string) (*VMInfo, error)
	ListVMs(ctx context.Context) ([]VMInfo, error)

	// Optional operations
	SupportsPause() bool
	SupportsResume() bool
	SupportsSnapshot() bool
	SupportsMigrate() bool
	SupportsLiveMigration() bool
	SupportsHotPlug() bool
	SupportsGPUPassthrough() bool
	SupportsSRIOV() bool
	SupportsNUMA() bool

	// Capability detection
	GetCapabilities(ctx context.Context) (*HypervisorCapabilities, error)
	GetHypervisorInfo(ctx context.Context) (*HypervisorInfo, error)

	Pause(ctx context.Context, vmID string) error
	Resume(ctx context.Context, vmID string) error
	Snapshot(ctx context.Context, vmID, name string, params map[string]string) (string, error)
	Migrate(ctx context.Context, vmID, target string, params map[string]string) error

	// Advanced operations for Phase 2
	HotPlugDevice(ctx context.Context, vmID string, device *DeviceConfig) error
	HotUnplugDevice(ctx context.Context, vmID string, deviceID string) error
	ConfigureCPUPinning(ctx context.Context, vmID string, pinning *CPUPinningConfig) error
	ConfigureNUMA(ctx context.Context, vmID string, topology *NUMATopology) error
}

VMDriver interface for different VM implementations

func NewContainerDriver

func NewContainerDriver(config map[string]interface{}) (VMDriver, error)

NewContainerDriver creates a new container driver

func NewContainerDriverStub

func NewContainerDriverStub(config map[string]interface{}) (VMDriver, error)

NewContainerDriverStub creates a stub container driver

func NewContainerdDriver

func NewContainerdDriver(config map[string]interface{}) (VMDriver, error)

NewContainerdDriver creates a new containerd driver

func NewCoreStubDriver

func NewCoreStubDriver(config map[string]interface{}) (VMDriver, error)

func NewKVMDriver

func NewKVMDriver(config map[string]interface{}) (VMDriver, error)

NewKVMDriver creates a new KVM driver (main entry point)

func NewKVMDriverEnhanced

func NewKVMDriverEnhanced(qemuPath string) (VMDriver, error)

NewKVMDriverEnhanced creates a new enhanced KVM driver

func NewKVMDriverStub

func NewKVMDriverStub(config map[string]interface{}) (VMDriver, error)

NewKVMDriverStub creates a stub KVM driver

func NewProcessDriver

func NewProcessDriver(config map[string]interface{}) (VMDriver, error)

NewProcessDriver creates a new process driver (stub for now)

func NewProcessDriverStub

func NewProcessDriverStub(config map[string]interface{}) (VMDriver, error)

NewProcessDriverStub creates a stub process driver

type VMDriverConfig

type VMDriverConfig struct {
	// Node ID
	NodeID string

	// Container driver config
	DockerPath string

	// Containerd driver config
	ContainerdAddress   string
	ContainerdNamespace string

	// KVM driver config
	QEMUBinaryPath string
	VMBasePath     string

	// Process driver config
	ProcessBasePath string
}

VMDriverConfig contains configuration for VM drivers

func DefaultVMDriverConfig

func DefaultVMDriverConfig(nodeID string) VMDriverConfig

DefaultVMDriverConfig returns a default VM driver configuration

type VMDriverConfigLegacy

type VMDriverConfigLegacy struct {
	Enabled bool
	Config  map[string]interface{}
}

VMDriverConfigLegacy contains legacy driver-specific configuration (use driver_factory.go VMDriverConfig instead)

type VMDriverConfigManager

type VMDriverConfigManager struct {
	Enabled bool
	Config  map[string]interface{}
}

VMDriverConfigManager contains driver-specific configuration for VM manager

type VMDriverFactory

type VMDriverFactory func(config VMConfig) (VMDriver, error)

VMDriverFactory is a function that creates a VM driver

func NewVMDriverFactory

func NewVMDriverFactory(config VMDriverConfig) VMDriverFactory

NewVMDriverFactory creates a new VM driver factory

type VMDriverManager

type VMDriverManager struct {
	// contains filtered or unexported fields
}

VMDriverManager manages VM drivers

func NewVMDriverManager

func NewVMDriverManager(config VMDriverConfig) *VMDriverManager

NewVMDriverManager creates a new VM driver manager

func (*VMDriverManager) Close

func (m *VMDriverManager) Close()

Close closes all drivers

func (*VMDriverManager) GetDriver

func (m *VMDriverManager) GetDriver(vmConfig VMConfig) (VMDriver, error)

GetDriver gets a driver for a VM type

func (*VMDriverManager) ListSupportedTypes

func (m *VMDriverManager) ListSupportedTypes() []VMType

ListSupportedTypes returns a list of supported VM types

type VMError

type VMError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
	Cause   error  `json:"-"`
}

func (*VMError) Error

func (e *VMError) Error() string

func (*VMError) Unwrap

func (e *VMError) Unwrap() error

type VMEvent

type VMEvent struct {
	Type      VMEventType            `json:"type"`
	VM        VM                     `json:"vm"`
	Timestamp time.Time              `json:"timestamp"`
	NodeID    string                 `json:"node_id"`
	Message   string                 `json:"message,omitempty"`
	Data      map[string]interface{} `json:"data,omitempty"`
}

VMEvent represents an event related to a VM

type VMEventHandler

type VMEventHandler func(event VMEvent)

VMEventHandler is a function that handles VM events

type VMEventManager

type VMEventManager struct {
	// contains filtered or unexported fields
}

VMEventManager manages VM events

func NewVMEventManager

func NewVMEventManager(maxHistory int) *VMEventManager

NewVMEventManager creates a new VM event manager

func (*VMEventManager) EmitEvent

func (m *VMEventManager) EmitEvent(event VMEvent)

EmitEvent emits a VM event

func (*VMEventManager) GetEventHistory

func (m *VMEventManager) GetEventHistory() []VMEvent

GetEventHistory returns the event history

func (*VMEventManager) GetEventHistoryForVM

func (m *VMEventManager) GetEventHistoryForVM(vmID string) []VMEvent

GetEventHistoryForVM returns the event history for a VM

func (*VMEventManager) RegisterHandler

func (m *VMEventManager) RegisterHandler(eventType string, handler VMEventHandler)

RegisterHandler registers a handler for VM events

func (*VMEventManager) RegisterHandlerForAll

func (m *VMEventManager) RegisterHandlerForAll(handler VMEventHandler)

RegisterHandlerForAll registers a handler for all VM events

func (*VMEventManager) UnregisterHandler

func (m *VMEventManager) UnregisterHandler(eventType string, handler VMEventHandler)

UnregisterHandler unregisters a handler for VM events

type VMEventType

type VMEventType string

VMEventType represents VM event types

const (
	// VMEventCreated is emitted when a VM is created
	VMEventCreated VMEventType = "created"

	// VMEventStarted is emitted when a VM is started
	VMEventStarted VMEventType = "started"

	// VMEventStopped is emitted when a VM is stopped
	VMEventStopped VMEventType = "stopped"

	// VMEventRestarted is emitted when a VM is restarted
	VMEventRestarted VMEventType = "restarted"

	// VMEventDeleted is emitted when a VM is deleted
	VMEventDeleted VMEventType = "deleted"

	// VMEventPaused is emitted when a VM is paused
	VMEventPaused VMEventType = "paused"

	// VMEventResumed is emitted when a VM is resumed
	VMEventResumed VMEventType = "resumed"

	// VMEventMigrating is emitted when a VM is being migrated
	VMEventMigrating VMEventType = "migrating"

	// VMEventMigrated is emitted when a VM has been migrated
	VMEventMigrated VMEventType = "migrated"

	// VMEventSnapshot is emitted when a VM snapshot is created
	VMEventSnapshot VMEventType = "snapshot"

	// VMEventBackup is emitted when a VM backup is created
	VMEventBackup VMEventType = "backup"

	// VMEventRestore is emitted when a VM is restored from a snapshot or backup
	VMEventRestore VMEventType = "restore"

	// VMEventUpdated is emitted when a VM is updated
	VMEventUpdated VMEventType = "updated"

	// VMEventError is emitted on VM errors
	VMEventError VMEventType = "error"
)

type VMHealth

type VMHealth struct {
	VMID        string                  `json:"vm_id"`
	Status      HealthStatus            `json:"status"`
	LastChecked time.Time               `json:"last_checked"`
	Checks      map[string]*HealthCheck `json:"checks"`
}

VMHealth represents the health of a VM

type VMHealthManager

type VMHealthManager struct {
	// contains filtered or unexported fields
}

VMHealthManager manages VM health checks

func NewVMHealthManager

func NewVMHealthManager(vmManager *VMManager, eventManager *VMEventManager, checkInterval time.Duration) *VMHealthManager

NewVMHealthManager creates a new VM health manager

func (*VMHealthManager) CheckVMHealth

func (m *VMHealthManager) CheckVMHealth(ctx context.Context, vmID string) (*VMHealth, error)

CheckVMHealth checks the health of a VM

func (*VMHealthManager) GetAllVMHealth

func (m *VMHealthManager) GetAllVMHealth() map[string]*VMHealth

GetAllVMHealth returns the health of all VMs

func (*VMHealthManager) GetVMHealth

func (m *VMHealthManager) GetVMHealth(vmID string) (*VMHealth, error)

GetVMHealth returns the health of a VM

func (*VMHealthManager) RegisterCheck

func (m *VMHealthManager) RegisterCheck(id, name, description string, check HealthCheckFunc)

RegisterCheck registers a health check

func (*VMHealthManager) Start

func (m *VMHealthManager) Start()

Start starts the health check manager

func (*VMHealthManager) Stop

func (m *VMHealthManager) Stop()

Stop stops the health check manager

func (*VMHealthManager) UnregisterCheck

func (m *VMHealthManager) UnregisterCheck(id string)

UnregisterCheck unregisters a health check

type VMInfo

type VMInfo struct {
	ID           string            `json:"id"`
	Name         string            `json:"name"`
	State        State             `json:"state"`
	PID          int               `json:"pid"`
	CPUShares    int               `json:"cpu_shares"`
	MemoryMB     int               `json:"memory_mb"`
	CPUUsage     float64           `json:"cpu_usage"`
	MemoryUsage  int64             `json:"memory_usage"`
	NetworkSent  int64             `json:"network_sent"`
	NetworkRecv  int64             `json:"network_recv"`
	CreatedAt    time.Time         `json:"created_at"`
	StartedAt    *time.Time        `json:"started_at"`
	StoppedAt    *time.Time        `json:"stopped_at"`
	Tags         map[string]string `json:"tags"`
	NetworkID    string            `json:"network_id"`
	IPAddress    string            `json:"ip_address"`
	RootFS       string            `json:"rootfs"`
	Image        string            `json:"image"`
	ErrorMessage string            `json:"error_message,omitempty"`
}

VMInfo contains runtime information about a VM

type VMManager

type VMManager struct {
	// contains filtered or unexported fields
}

VMManager manages virtual machines across different drivers

func NewVMManager

func NewVMManager(config VMManagerConfig) (*VMManager, error)

NewVMManager creates a new VM manager instance

func (*VMManager) AddEventListener

func (m *VMManager) AddEventListener(listener VMManagerEventListener)

AddEventListener adds an event listener

func (*VMManager) AddVM

func (m *VMManager) AddVM(vm *VM)

AddVM adds a VM to the manager

func (*VMManager) CanAdmitVM

func (m *VMManager) CanAdmitVM(vm *VM) error

CanAdmitVM checks aggregate scheduler inventory before VM creation proceeds.

func (*VMManager) CountVMsByState

func (m *VMManager) CountVMsByState() map[VMState]int

CountVMsByState counts VMs by state

func (*VMManager) CreateSnapshot

func (m *VMManager) CreateSnapshot(ctx context.Context, vmID string, snapshotName string, options map[string]string) (string, error)

CreateSnapshot creates a VM snapshot

func (*VMManager) CreateUbuntu2404VM

func (m *VMManager) CreateUbuntu2404VM(
	ctx context.Context,
	req CreateVMRequest,
	profile *Ubuntu2404Profile,
	options Ubuntu2404CloudInitOptions,
) (*VM, error)

CreateUbuntu2404VM creates a VM using the canonical Ubuntu 24.04 profile.

func (*VMManager) CreateVM

func (m *VMManager) CreateVM(ctx context.Context, req CreateVMRequest) (*VM, error)

CreateVM creates a new VM

func (*VMManager) CreateVMWithStorage

func (m *VMManager) CreateVMWithStorage(ctx context.Context, config VMConfig, storageManager *VMStorageManagerIntegration, bootSizeGB, dataSizeGB int) (*VM, error)

CreateVMWithStorage creates a VM with initial storage volumes

func (*VMManager) DeleteVM

func (m *VMManager) DeleteVM(ctx context.Context, vmID string) error

DeleteVM deletes a VM by ID

func (*VMManager) DeleteVMWithStorage

func (m *VMManager) DeleteVMWithStorage(ctx context.Context, vmID string, storageManager *VMStorageManagerIntegration) error

DeleteVMWithStorage deletes a VM and all its associated storage

func (*VMManager) GetCurrentAllocations

func (m *VMManager) GetCurrentAllocations() (cpu int, memoryMB int64)

GetCurrentAllocations returns the current resource allocations

func (*VMManager) GetDriverForConfig

func (m *VMManager) GetDriverForConfig(config VMConfig) (VMDriver, error)

GetDriverForConfig is an exported helper to obtain a driver for a VM config

func (*VMManager) GetVM

func (m *VMManager) GetVM(vmID string) (*VM, error)

GetVM returns a VM by ID

func (*VMManager) GetVMFromCache

func (m *VMManager) GetVMFromCache(vmID string) (*VM, bool)

GetVMFromCache gets a VM by ID from cache

func (*VMManager) GetVMMetrics

func (m *VMManager) GetVMMetrics(ctx context.Context, vmID string) (*VMMetrics, error)

GetVMMetrics returns metrics for a VM

func (*VMManager) GetVMStatus

func (m *VMManager) GetVMStatus(ctx context.Context, vmID string) (*VMStatus, error)

GetVMStatus returns status of a VM

func (*VMManager) ListMigrations

func (m *VMManager) ListMigrations(ctx context.Context) ([]*Migration, error)

ListMigrations returns list of VM migrations

func (*VMManager) ListSchedulerNodes

func (m *VMManager) ListSchedulerNodes() []*NodeResourceInfo

ListSchedulerNodes returns the scheduler's registered node inventory.

func (*VMManager) ListVMs

func (m *VMManager) ListVMs() map[string]*VM

ListVMs returns all VMs

func (*VMManager) ListVMsByNode

func (m *VMManager) ListVMsByNode(nodeID string) []*VM

ListVMsByNode returns all VMs on a specific node

func (*VMManager) ListVMsByState

func (m *VMManager) ListVMsByState(state VMState) []*VM

ListVMsByState returns all VMs with a specific state

func (*VMManager) MigrateVM

func (m *VMManager) MigrateVM(ctx context.Context, vmID string, targetNode string, options map[string]string) error

MigrateVM migrates a VM to another node

func (*VMManager) PauseVM

func (m *VMManager) PauseVM(ctx context.Context, vmID string) error

PauseVM pauses a VM by ID

func (*VMManager) PerformVMOperation

func (m *VMManager) PerformVMOperation(ctx context.Context, req VMOperationRequest) (*VMOperationResponse, error)

PerformVMOperation performs an operation on a VM

func (*VMManager) RegisterSchedulerNode

func (m *VMManager) RegisterSchedulerNode(nodeInfo *NodeResourceInfo) error

RegisterSchedulerNode registers or updates a scheduler node for local admission control.

func (*VMManager) RemoveEventListener

func (m *VMManager) RemoveEventListener(listener VMManagerEventListener)

RemoveEventListener removes an event listener

func (*VMManager) RemoveVM

func (m *VMManager) RemoveVM(vmID string)

RemoveVM removes a VM from the manager

func (*VMManager) RestartVM

func (m *VMManager) RestartVM(ctx context.Context, vmID string) error

RestartVM restarts a VM by ID

func (*VMManager) ResumeVM

func (m *VMManager) ResumeVM(ctx context.Context, vmID string) error

ResumeVM resumes a VM by ID

func (*VMManager) RunHealthCheck

func (m *VMManager) RunHealthCheck() map[string]string

RunHealthCheck performs a comprehensive health check of all VMs

func (*VMManager) Shutdown

func (m *VMManager) Shutdown()

Shutdown gracefully shuts down the VM manager

func (*VMManager) Start

func (m *VMManager) Start() error

Start starts the VM manager

func (*VMManager) StartVM

func (m *VMManager) StartVM(ctx context.Context, vmID string) error

StartVM starts a VM by ID

func (*VMManager) Stop

func (m *VMManager) Stop() error

Stop stops the VM manager

func (*VMManager) StopVM

func (m *VMManager) StopVM(ctx context.Context, vmID string) error

StopVM stops a VM by ID

func (*VMManager) UpdateVM

func (m *VMManager) UpdateVM(ctx context.Context, vmID string, updateSpec VMUpdateSpec) error

UpdateVM updates VM configuration for stopped VMs

type VMManagerConfig

type VMManagerConfig struct {
	DefaultDriver   VMType                           `yaml:"default_driver"`
	Drivers         map[VMType]VMDriverConfigManager `yaml:"drivers"`
	Scheduler       VMSchedulerConfig                `yaml:"scheduler"`
	TenantQuota     TenantQuotaConfig                `yaml:"tenant_quota"`
	UpdateInterval  time.Duration                    `yaml:"update_interval"`
	CleanupInterval time.Duration                    `yaml:"cleanup_interval"`
	DefaultVMType   VMType                           `yaml:"default_vm_type"`
	RetentionPeriod time.Duration                    `yaml:"retention_period"`
}

VMManagerConfig contains configuration for the VM manager

func DefaultVMManagerConfig

func DefaultVMManagerConfig() VMManagerConfig

DefaultVMManagerConfig returns a default VM manager configuration

type VMManagerEventListener

type VMManagerEventListener interface {
	OnVMEvent(event VMEvent)
}

VMManagerEventListener defines the interface for VM event listeners

type VMManagerInterface

type VMManagerInterface interface {
	GetVM(vmID string) (*VM, error)
}

VMManagerInterface for migration

type VMMetrics

type VMMetrics struct {
	VMID        string                 `json:"vm_id"`
	NodeID      string                 `json:"node_id"`
	Timestamp   time.Time              `json:"timestamp"`
	CPU         CPUMetrics             `json:"cpu"`
	Memory      MemoryMetrics          `json:"memory"`
	Disk        map[string]DiskMetrics `json:"disk"`
	Network     map[string]NetMetrics  `json:"network"`
	Labels      map[string]string      `json:"labels,omitempty"`
	Annotations map[string]string      `json:"annotations,omitempty"`
}

VMMetrics represents metrics for a VM

type VMMetricsCollector

type VMMetricsCollector struct {
	// contains filtered or unexported fields
}

VMMetricsCollector collects metrics from VMs

func NewVMMetricsCollector

func NewVMMetricsCollector(config VMMetricsCollectorConfig, nodeID string) *VMMetricsCollector

NewVMMetricsCollector creates a new VM metrics collector

func (*VMMetricsCollector) GetLatestMetrics

func (c *VMMetricsCollector) GetLatestMetrics(vmID string) (*VMMetrics, error)

GetLatestMetrics returns the latest metrics for a VM

func (*VMMetricsCollector) GetMetrics

func (c *VMMetricsCollector) GetMetrics(vmID string, limit int) ([]VMMetrics, error)

GetMetrics returns metrics for a VM

func (*VMMetricsCollector) RegisterVM

func (c *VMMetricsCollector) RegisterVM(vmID string, provider VMMetricsProvider) error

RegisterVM registers a VM for metrics collection

func (*VMMetricsCollector) Start

func (c *VMMetricsCollector) Start() error

Start starts the VM metrics collector

func (*VMMetricsCollector) Stop

func (c *VMMetricsCollector) Stop() error

Stop stops the VM metrics collector

func (*VMMetricsCollector) UnregisterVM

func (c *VMMetricsCollector) UnregisterVM(vmID string) error

UnregisterVM unregisters a VM from metrics collection

type VMMetricsCollectorConfig

type VMMetricsCollectorConfig struct {
	CollectionInterval time.Duration `json:"collection_interval"`
	RetentionPeriod    time.Duration `json:"retention_period"`
	MaxSamplesPerVM    int           `json:"max_samples_per_vm"`
	DetailLevel        string        `json:"detail_level"` // "basic", "standard", "detailed"
}

VMMetricsCollectorConfig holds configuration for the VM metrics collector

func DefaultVMMetricsCollectorConfig

func DefaultVMMetricsCollectorConfig() VMMetricsCollectorConfig

DefaultVMMetricsCollectorConfig returns a default configuration

type VMMetricsProvider

type VMMetricsProvider interface {
	// GetMetrics returns metrics for a VM
	GetMetrics(ctx context.Context) (*VMMetrics, error)

	// GetVMID returns the VM ID
	GetVMID() string

	// Close closes the metrics provider
	Close() error
}

VMMetricsProvider is an interface for collecting VM metrics

type VMMetricsType

type VMMetricsType string

VMMetricsType defines the type of VM metrics

const (
	// VMMetricsTypeCPU represents CPU metrics
	VMMetricsTypeCPU VMMetricsType = "cpu"

	// VMMetricsTypeMemory represents memory metrics
	VMMetricsTypeMemory VMMetricsType = "memory"

	// VMMetricsTypeDisk represents disk metrics
	VMMetricsTypeDisk VMMetricsType = "disk"

	// VMMetricsTypeNetwork represents network metrics
	VMMetricsTypeNetwork VMMetricsType = "network"
)

type VMMigration

type VMMigration struct {
	ID                string
	VMID              string
	SourceNodeID      string
	DestinationNodeID string
	Type              MigrationType
	Status            MigrationStatus
	VMSpec            VMSpec
	Progress          float64
	StartTime         time.Time
	EndTime           time.Time
	CreatedAt         time.Time
	UpdatedAt         time.Time
	Error             string
	Options           map[string]string
}

VMMigration represents a VM migration operation

type VMMigrationManager

type VMMigrationManager struct {
	// contains filtered or unexported fields
}

VMMigrationManager manages VM migrations

func NewVMMigrationManager

func NewVMMigrationManager(nodeID, storageDir string) *VMMigrationManager

NewVMMigrationManager creates a new VMMigrationManager

func (*VMMigrationManager) ExecuteMigration

func (m *VMMigrationManager) ExecuteMigration(ctx context.Context, migration *VMMigration, destManager *VMMigrationManager) error

ExecuteMigration executes a VM migration

func (*VMMigrationManager) GetVM

func (m *VMMigrationManager) GetVM(vmID string) (*VM, error)

GetVM gets a VM by ID

type VMMigrationPolicy

type VMMigrationPolicy struct {
	Type             string `yaml:"type,omitempty" json:"type,omitempty"`
	BandwidthLimit   int64  `yaml:"bandwidth_limit,omitempty" json:"bandwidth_limit,omitempty"`
	CompressionLevel int    `yaml:"compression_level,omitempty" json:"compression_level,omitempty"`
	Priority         int    `yaml:"priority,omitempty" json:"priority,omitempty"`
}

VMMigrationPolicy captures migration intent for a VM.

type VMMonitor

type VMMonitor struct {
	// contains filtered or unexported fields
}

VMMonitor monitors VMs

func NewVMMonitor

func NewVMMonitor(vmManager *VMManager, eventManager *VMEventManager, config MonitoringConfig) *VMMonitor

NewVMMonitor creates a new VM monitor

func (*VMMonitor) GetActiveAlerts

func (m *VMMonitor) GetActiveAlerts(vmID string) []*Alert

GetActiveAlerts returns all active (unresolved) alerts for a VM

func (*VMMonitor) GetAlerts

func (m *VMMonitor) GetAlerts(vmID string) []*Alert

GetAlerts returns all alerts for a VM

func (*VMMonitor) RegisterAlertHandler

func (m *VMMonitor) RegisterAlertHandler(handler AlertHandler)

RegisterAlertHandler registers an alert handler

func (*VMMonitor) ResolveAlert

func (m *VMMonitor) ResolveAlert(vmID, alertID string) error

ResolveAlert resolves an alert

func (*VMMonitor) Start

func (m *VMMonitor) Start()

Start starts the VM monitor

func (*VMMonitor) Stop

func (m *VMMonitor) Stop()

Stop stops the VM monitor

type VMNetwork

type VMNetwork struct {
	ID        string            `json:"id"`
	Name      string            `json:"name"`
	Type      NetworkType       `json:"type"`
	Subnet    string            `json:"subnet"`
	Gateway   string            `json:"gateway"`
	DHCP      bool              `json:"dhcp"`
	DHCPRange string            `json:"dhcp_range,omitempty"`
	Bridge    string            `json:"bridge,omitempty"`
	MTU       int               `json:"mtu"`
	VLAN      int               `json:"vlan,omitempty"`
	CreatedAt time.Time         `json:"created_at"`
	UpdatedAt time.Time         `json:"updated_at"`
	Tags      []string          `json:"tags,omitempty"`
	Metadata  map[string]string `json:"metadata,omitempty"`
}

VMNetwork represents a VM network

type VMNetworkAttachment

type VMNetworkAttachment struct {
	NetworkID     string `yaml:"network_id" json:"network_id"`
	InterfaceName string `yaml:"interface_name,omitempty" json:"interface_name,omitempty"`
	MACAddress    string `yaml:"mac_address,omitempty" json:"mac_address,omitempty"`
	IPAddress     string `yaml:"ip_address,omitempty" json:"ip_address,omitempty"`
	Primary       bool   `yaml:"primary,omitempty" json:"primary,omitempty"`
}

VMNetworkAttachment describes a network attachment request for a VM.

type VMNetworkInterface

type VMNetworkInterface struct {
	ID         string    `json:"id"`
	VMID       string    `json:"vm_id"`
	NetworkID  string    `json:"network_id"`
	MACAddress string    `json:"mac_address"`
	IPAddress  string    `json:"ip_address,omitempty"`
	Model      string    `json:"model"`
	MTU        int       `json:"mtu"`
	Index      int       `json:"index"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

VMNetworkInterface represents a VM network interface

type VMNetworkManager

type VMNetworkManager struct {
	// contains filtered or unexported fields
}

VMNetworkManager manages VM networks

func NewVMNetworkManager

func NewVMNetworkManager(vmManager *VMManager) *VMNetworkManager

NewVMNetworkManager creates a new VM network manager

func (*VMNetworkManager) AttachNetworkInterface

func (m *VMNetworkManager) AttachNetworkInterface(ctx context.Context, vmID, networkID, macAddress, ipAddress, model string, mtu int) (*VMNetworkInterface, error)

AttachNetworkInterface attaches a network interface to a VM

func (*VMNetworkManager) CreateNetwork

func (m *VMNetworkManager) CreateNetwork(ctx context.Context, name string, networkType NetworkType, subnet string, gateway string, dhcp bool, dhcpRange string, bridge string, mtu int, vlan int, tags []string, metadata map[string]string) (*VMNetwork, error)

CreateNetwork creates a new VM network

func (*VMNetworkManager) DeleteNetwork

func (m *VMNetworkManager) DeleteNetwork(ctx context.Context, networkID string) error

DeleteNetwork deletes a network

func (*VMNetworkManager) DetachNetworkInterface

func (m *VMNetworkManager) DetachNetworkInterface(ctx context.Context, vmID, interfaceID string) error

DetachNetworkInterface detaches a network interface from a VM

func (*VMNetworkManager) GetNetwork

func (m *VMNetworkManager) GetNetwork(networkID string) (*VMNetwork, error)

GetNetwork returns a network by ID

func (*VMNetworkManager) GetNetworkInterface

func (m *VMNetworkManager) GetNetworkInterface(vmID, interfaceID string) (*VMNetworkInterface, error)

GetNetworkInterface returns a network interface by ID

func (*VMNetworkManager) ListNetworkInterfaces

func (m *VMNetworkManager) ListNetworkInterfaces(vmID string) ([]*VMNetworkInterface, error)

ListNetworkInterfaces returns all network interfaces for a VM

func (*VMNetworkManager) ListNetworks

func (m *VMNetworkManager) ListNetworks() []*VMNetwork

ListNetworks returns all networks

func (*VMNetworkManager) UpdateNetworkInterface

func (m *VMNetworkManager) UpdateNetworkInterface(ctx context.Context, vmID, interfaceID string, ipAddress string, mtu int) (*VMNetworkInterface, error)

UpdateNetworkInterface updates a network interface

type VMOperationRequest

type VMOperationRequest struct {
	VMID      string                 `json:"vm_id"`
	Operation string                 `json:"operation"`
	Params    map[string]interface{} `json:"params"`
}

VMOperationRequest represents a request for VM operations

type VMOperationResponse

type VMOperationResponse struct {
	Success      bool              `json:"success"`
	ErrorMessage string            `json:"error_message,omitempty"`
	VM           *VM               `json:"vm,omitempty"`
	Data         map[string]string `json:"data,omitempty"`
}

VMOperationResponse represents a response to a VM operation

type VMPlacementSpec

type VMPlacementSpec struct {
	Policy         string   `yaml:"policy,omitempty" json:"policy,omitempty"`
	PreferredNodes []string `yaml:"preferred_nodes,omitempty" json:"preferred_nodes,omitempty"`
	ExcludedNodes  []string `yaml:"excluded_nodes,omitempty" json:"excluded_nodes,omitempty"`
}

VMPlacementSpec captures placement intent for a VM.

type VMProcessInfo

type VMProcessInfo struct {
	PID             int
	PPID            int
	Command         string
	Args            []string
	StartTime       time.Time
	CPUTime         time.Duration
	MemoryRSS       int64
	MemoryVSZ       int64
	CPUUsagePercent float64
	MemoryUsageMB   int64
}

VMProcessInfo holds process information for a VM

type VMProcessStats

type VMProcessStats struct {
	PID       int       `json:"pid"`
	State     string    `json:"state"`
	CPUTime   int64     `json:"cpu_time_ms"`
	MemoryRSS int64     `json:"memory_rss_bytes"`
	MemoryVSZ int64     `json:"memory_vsz_bytes"`
	OpenFiles int       `json:"open_files"`
	Threads   int       `json:"threads"`
	StartTime time.Time `json:"start_time"`
}

VMProcessStats contains detailed process statistics

type VMReplicationPolicy

type VMReplicationPolicy struct {
	Enabled bool   `yaml:"enabled,omitempty" json:"enabled,omitempty"`
	Factor  int    `yaml:"factor,omitempty" json:"factor,omitempty"`
	Mode    string `yaml:"mode,omitempty" json:"mode,omitempty"`
}

VMReplicationPolicy captures replication intent for a VM.

type VMResourceUsage

type VMResourceUsage struct {
	CPUPercent    float64   `json:"cpu_percent"`
	MemoryBytes   int64     `json:"memory_bytes"`
	NetworkSent   int64     `json:"network_sent"`
	NetworkRecv   int64     `json:"network_recv"`
	LastCollected time.Time `json:"last_collected"`
}

VMResourceUsage contains resource usage information

type VMScheduler

type VMScheduler struct {
	// contains filtered or unexported fields
}

VMScheduler schedules VMs on nodes

func NewVMScheduler

func NewVMScheduler(config SchedulerConfig) *VMScheduler

NewVMScheduler creates a new VM scheduler

func (*VMScheduler) GetActiveAllocations

func (s *VMScheduler) GetActiveAllocations() map[string]ResourceAllocation

GetActiveAllocations returns all active resource allocations

func (*VMScheduler) GetNode

func (s *VMScheduler) GetNode(nodeID string) (*NodeResourceInfo, error)

GetNode returns a node's resource information

func (*VMScheduler) ListNodes

func (s *VMScheduler) ListNodes() []*NodeResourceInfo

ListNodes returns all registered nodes

func (*VMScheduler) RegisterNode

func (s *VMScheduler) RegisterNode(nodeInfo *NodeResourceInfo) error

RegisterNode registers a node with the scheduler

func (*VMScheduler) ReleaseResources

func (s *VMScheduler) ReleaseResources(nodeID string, vm *VM) error

ReleaseResources releases resources on a node for a VM

func (*VMScheduler) ReserveResources

func (s *VMScheduler) ReserveResources(nodeID string, vm *VM) error

ReserveResources reserves resources on a node for a VM

func (*VMScheduler) ScheduleVM

func (s *VMScheduler) ScheduleVM(ctx context.Context, vm *VM) (string, error)

ScheduleVM schedules a VM on a node

func (*VMScheduler) SetCustomScheduler

func (s *VMScheduler) SetCustomScheduler(scheduler func(vm *VM, nodes []*NodeResourceInfo) (string, error))

SetCustomScheduler sets a custom scheduler function

func (*VMScheduler) UnregisterNode

func (s *VMScheduler) UnregisterNode(nodeID string) error

UnregisterNode unregisters a node from the scheduler

func (*VMScheduler) UpdateNode

func (s *VMScheduler) UpdateNode(nodeInfo *NodeResourceInfo) error

UpdateNode updates a node's resource information

func (*VMScheduler) UpdateReservation

func (s *VMScheduler) UpdateReservation(vmID string, config VMConfig) error

UpdateReservation updates an existing node reservation for a VM after a stopped-VM resize.

type VMSchedulerConfig

type VMSchedulerConfig struct {
	Type   string
	Config map[string]interface{}
}

VMSchedulerConfig contains scheduler configuration

type VMSecurityManager

type VMSecurityManager struct {
	// contains filtered or unexported fields
}

VMSecurityManager manages VM security

func NewVMSecurityManager

func NewVMSecurityManager(vmManager *VMManager, certsDir string) *VMSecurityManager

NewVMSecurityManager creates a new VM security manager

func (*VMSecurityManager) ApplySecurityProfile

func (m *VMSecurityManager) ApplySecurityProfile(ctx context.Context, vmID, profileID string) error

ApplySecurityProfile applies a security profile to a VM

func (*VMSecurityManager) CreateCertificate

func (m *VMSecurityManager) CreateCertificate(ctx context.Context, name, description, certType string, validityDays int, tags []string, metadata map[string]string) (*Certificate, error)

CreateCertificate creates a new certificate

func (*VMSecurityManager) CreateSecurityProfile

func (m *VMSecurityManager) CreateSecurityProfile(ctx context.Context, name, description string, secureBoot, tpmEnabled, encryptionEnabled bool, encryptionType string, tags []string, metadata map[string]string) (*SecurityProfile, error)

CreateSecurityProfile creates a new security profile

func (*VMSecurityManager) DeleteCertificate

func (m *VMSecurityManager) DeleteCertificate(ctx context.Context, certID string) error

DeleteCertificate deletes a certificate

func (*VMSecurityManager) DeleteSecurityProfile

func (m *VMSecurityManager) DeleteSecurityProfile(ctx context.Context, profileID string) error

DeleteSecurityProfile deletes a security profile

func (*VMSecurityManager) GetCertificate

func (m *VMSecurityManager) GetCertificate(certID string) (*Certificate, error)

GetCertificate returns a certificate by ID

func (*VMSecurityManager) GetSecurityProfile

func (m *VMSecurityManager) GetSecurityProfile(profileID string) (*SecurityProfile, error)

GetSecurityProfile returns a security profile by ID

func (*VMSecurityManager) GetVMSecurityInfo

func (m *VMSecurityManager) GetVMSecurityInfo(ctx context.Context, vmID string) (map[string]interface{}, error)

GetVMSecurityInfo returns security information for a VM

func (*VMSecurityManager) ListCertificates

func (m *VMSecurityManager) ListCertificates() []*Certificate

ListCertificates returns all certificates

func (*VMSecurityManager) ListSecurityProfiles

func (m *VMSecurityManager) ListSecurityProfiles() []*SecurityProfile

ListSecurityProfiles returns all security profiles

func (*VMSecurityManager) UpdateSecurityProfile

func (m *VMSecurityManager) UpdateSecurityProfile(ctx context.Context, profileID, name, description string, secureBoot, tpmEnabled, encryptionEnabled bool, encryptionType string, tags []string, metadata map[string]string) (*SecurityProfile, error)

UpdateSecurityProfile updates a security profile

type VMSnapshot

type VMSnapshot struct {
	ID          string            `json:"id"`
	VMID        string            `json:"vm_id"`
	Name        string            `json:"name"`
	Description string            `json:"description"`
	Type        SnapshotType      `json:"type"`
	Status      SnapshotStatus    `json:"status"`
	CreatedAt   time.Time         `json:"created_at"`
	UpdatedAt   time.Time         `json:"updated_at"`
	Size        int64             `json:"size"`
	ParentID    string            `json:"parent_id,omitempty"`
	Tags        []string          `json:"tags,omitempty"`
	Metadata    map[string]string `json:"metadata,omitempty"`
}

VMSnapshot represents a VM snapshot

type VMSnapshotManager

type VMSnapshotManager struct {
	// contains filtered or unexported fields
}

VMSnapshotManager manages VM snapshots

func NewVMSnapshotManager

func NewVMSnapshotManager(vmManager *VMManager, storageDir string) *VMSnapshotManager

NewVMSnapshotManager creates a new VM snapshot manager

func (*VMSnapshotManager) CreateSnapshot

func (m *VMSnapshotManager) CreateSnapshot(ctx context.Context, vmID, name, description string, snapshotType SnapshotType, tags []string, metadata map[string]string) (*VMSnapshot, error)

CreateSnapshot creates a new VM snapshot

func (*VMSnapshotManager) DeleteSnapshot

func (m *VMSnapshotManager) DeleteSnapshot(ctx context.Context, snapshotID string) error

DeleteSnapshot deletes a snapshot

func (*VMSnapshotManager) GetSnapshot

func (m *VMSnapshotManager) GetSnapshot(snapshotID string) (*VMSnapshot, error)

GetSnapshot returns a snapshot by ID

func (*VMSnapshotManager) ListSnapshots

func (m *VMSnapshotManager) ListSnapshots() []*VMSnapshot

ListSnapshots returns all snapshots

func (*VMSnapshotManager) ListSnapshotsForVM

func (m *VMSnapshotManager) ListSnapshotsForVM(vmID string) []*VMSnapshot

ListSnapshotsForVM returns all snapshots for a VM

func (*VMSnapshotManager) RestoreSnapshot

func (m *VMSnapshotManager) RestoreSnapshot(ctx context.Context, snapshotID string) error

RestoreSnapshot restores a VM from a snapshot

type VMSnapshotter

type VMSnapshotter struct {
	// contains filtered or unexported fields
}

VMSnapshotter handles VM snapshot operations

func NewVMSnapshotter

func NewVMSnapshotter() *VMSnapshotter

NewVMSnapshotter creates a new VM snapshotter

func (*VMSnapshotter) CreateSnapshot

func (ss *VMSnapshotter) CreateSnapshot(vm *VM, name, description string) (*Snapshot, error)

CreateSnapshot creates a snapshot of a VM

func (*VMSnapshotter) DeleteSnapshot

func (ss *VMSnapshotter) DeleteSnapshot(snapshotID string) error

DeleteSnapshot deletes a snapshot

func (*VMSnapshotter) ListSnapshots

func (ss *VMSnapshotter) ListSnapshots(vmID string) ([]*Snapshot, error)

ListSnapshots lists all snapshots for a VM

func (*VMSnapshotter) RestoreSnapshot

func (ss *VMSnapshotter) RestoreSnapshot(vm *VM, snapshot *Snapshot) error

RestoreSnapshot restores a VM from a snapshot

type VMSpec

type VMSpec struct {
	ID       string
	Name     string
	VCPU     int
	MemoryMB int
	DiskMB   int
	Image    string
}

VMSpec contains the specification for a VM

type VMState

type VMState = State

Alias VMState to State for compatibility

type VMStateMachine

type VMStateMachine struct {
	// contains filtered or unexported fields
}

VMStateMachine manages valid state transitions for VM lifecycle

func NewVMStateMachine

func NewVMStateMachine() *VMStateMachine

NewVMStateMachine creates a new VM state machine

func (*VMStateMachine) CanTransition

func (sm *VMStateMachine) CanTransition(from, to State) bool

CanTransition checks if a state transition is valid

func (*VMStateMachine) GetStateGraph

func (sm *VMStateMachine) GetStateGraph() map[State][]State

GetStateGraph returns the complete state transition graph

func (*VMStateMachine) GetValidTransitions

func (sm *VMStateMachine) GetValidTransitions(from State) []State

GetValidTransitions returns all valid transitions from a given state

func (*VMStateMachine) IsTerminalState

func (sm *VMStateMachine) IsTerminalState(state State) bool

IsTerminalState checks if a state is terminal (no further transitions possible)

func (*VMStateMachine) ValidateTransition

func (sm *VMStateMachine) ValidateTransition(from, to State) error

ValidateTransition validates a state transition and returns an error if invalid

type VMStats

type VMStats struct {
	CPUUsage    float64
	MemoryUsage int64
	NetworkSent int64
	NetworkRecv int64
	LastUpdated time.Time
}

VMStats holds runtime statistics for a VM

type VMStatus

type VMStatus struct {
	VMID   string `json:"vm_id"`
	Status string `json:"status"`
	CPU    int    `json:"cpu"`
	Memory int64  `json:"memory"`
}

VMStatus represents VM status information

type VMStorageManager

type VMStorageManager struct {
	// contains filtered or unexported fields
}

VMStorageManager manages VM storage

func NewVMStorageManager

func NewVMStorageManager(vmManager *VMManager) *VMStorageManager

NewVMStorageManager creates a new VM storage manager

func (*VMStorageManager) CloneStorageVolume

func (m *VMStorageManager) CloneStorageVolume(ctx context.Context, sourceVolumeID, name string, tags []string, metadata map[string]string) (*StorageVolume, error)

CloneStorageVolume clones a storage volume

func (*VMStorageManager) CreateStoragePool

func (m *VMStorageManager) CreateStoragePool(ctx context.Context, name string, storageType StorageType, path string, tags []string, metadata map[string]string) (*StoragePool, error)

CreateStoragePool creates a new storage pool

func (*VMStorageManager) CreateStorageVolume

func (m *VMStorageManager) CreateStorageVolume(ctx context.Context, name string, poolID string, format StorageFormat, capacity int64, tags []string, metadata map[string]string) (*StorageVolume, error)

CreateStorageVolume creates a new storage volume

func (*VMStorageManager) DeleteStoragePool

func (m *VMStorageManager) DeleteStoragePool(ctx context.Context, poolID string) error

DeleteStoragePool deletes a storage pool

func (*VMStorageManager) DeleteStorageVolume

func (m *VMStorageManager) DeleteStorageVolume(ctx context.Context, volumeID string) error

DeleteStorageVolume deletes a storage volume

func (*VMStorageManager) GetStoragePool

func (m *VMStorageManager) GetStoragePool(poolID string) (*StoragePool, error)

GetStoragePool returns a storage pool by ID

func (*VMStorageManager) GetStorageVolume

func (m *VMStorageManager) GetStorageVolume(volumeID string) (*StorageVolume, error)

GetStorageVolume returns a storage volume by ID

func (*VMStorageManager) ListStoragePools

func (m *VMStorageManager) ListStoragePools() []*StoragePool

ListStoragePools returns all storage pools

func (*VMStorageManager) ListStorageVolumes

func (m *VMStorageManager) ListStorageVolumes() []*StorageVolume

ListStorageVolumes returns all storage volumes

func (*VMStorageManager) ListStorageVolumesInPool

func (m *VMStorageManager) ListStorageVolumesInPool(poolID string) []*StorageVolume

ListStorageVolumesInPool returns all storage volumes in a pool

func (*VMStorageManager) ResizeStorageVolume

func (m *VMStorageManager) ResizeStorageVolume(ctx context.Context, volumeID string, newCapacity int64) (*StorageVolume, error)

ResizeStorageVolume resizes a storage volume

type VMStorageManagerIntegration

type VMStorageManagerIntegration struct {
	// contains filtered or unexported fields
}

VMStorageManagerIntegration handles storage operations for VMs (renamed to avoid conflict)

func NewVMStorageManagerIntegration

func NewVMStorageManagerIntegration(storageService *storage.BaseStorageService) *VMStorageManagerIntegration

NewVMStorageManagerIntegration creates a new VM storage manager

func (*VMStorageManagerIntegration) AttachVolume

func (vsm *VMStorageManagerIntegration) AttachVolume(ctx context.Context, vmID, volumeID string) error

AttachVolume attaches a volume to a VM

func (*VMStorageManagerIntegration) CreateBootVolume

func (vsm *VMStorageManagerIntegration) CreateBootVolume(ctx context.Context, vmID, vmName string, sizeGB int) (*storage.VolumeInfo, error)

CreateBootVolume creates a boot volume for a VM

func (*VMStorageManagerIntegration) CreateDataVolume

func (vsm *VMStorageManagerIntegration) CreateDataVolume(ctx context.Context, vmID, vmName, volumeName string, sizeGB int) (*storage.VolumeInfo, error)

CreateDataVolume creates a data volume for a VM

func (*VMStorageManagerIntegration) CreateVMSnapshot

func (vsm *VMStorageManagerIntegration) CreateVMSnapshot(ctx context.Context, vmID, snapshotName string) (map[string]string, error)

CreateVMSnapshot creates snapshots of all VM volumes

func (*VMStorageManagerIntegration) DeleteVMVolumes

func (vsm *VMStorageManagerIntegration) DeleteVMVolumes(ctx context.Context, vmID string) error

DeleteVMVolumes deletes all volumes associated with a VM

func (*VMStorageManagerIntegration) DetachVolume

func (vsm *VMStorageManagerIntegration) DetachVolume(ctx context.Context, vmID, volumeID string) error

DetachVolume detaches a volume from a VM

func (*VMStorageManagerIntegration) GetBootVolume

func (vsm *VMStorageManagerIntegration) GetBootVolume(ctx context.Context, vmID string) (*storage.VolumeInfo, error)

GetBootVolume returns the boot volume for a VM

func (*VMStorageManagerIntegration) GetVMStorageStats

func (vsm *VMStorageManagerIntegration) GetVMStorageStats(ctx context.Context, vmID string) (VMStorageStats, error)

GetVMStorageStats returns storage statistics for a VM

func (*VMStorageManagerIntegration) GetVMVolumes

func (vsm *VMStorageManagerIntegration) GetVMVolumes(ctx context.Context, vmID string) ([]*storage.VolumeInfo, error)

GetVMVolumes returns all volumes attached to a VM

type VMStorageStats

type VMStorageStats struct {
	VMID        string               `json:"vm_id"`
	VolumeCount int                  `json:"volume_count"`
	TotalSizeGB float64              `json:"total_size_gb"`
	UsedSizeGB  float64              `json:"used_size_gb"`
	VolumeStats []VolumeStorageStats `json:"volume_stats"`
}

VMStorageStats contains storage statistics for a VM

type VMType

type VMType string

VMType represents the type of VM

const (
	// Legacy/existing types
	VMTypeKVM            VMType = "kvm"
	VMTypeContainer      VMType = "container"
	VMTypeContainerd     VMType = "containerd"
	VMTypeKataContainers VMType = "kata-containers"
	VMTypeProcess        VMType = "process"

	// Phase 2: Comprehensive Hypervisor Integration
	VMTypeVMware    VMType = "vmware"
	VMTypeVSphere   VMType = "vsphere"
	VMTypeHyperV    VMType = "hyperv"
	VMTypeXen       VMType = "xen"
	VMTypeXenServer VMType = "xenserver"
	VMTypeProxmox   VMType = "proxmox"
	VMTypeProxmoxVE VMType = "proxmox-ve"
)

type VMTypeMigrationExecutor

type VMTypeMigrationExecutor interface {
	// Execute different types of migrations
	ExecuteColdMigration(migrationID string, vm *VM, targetNode Node) error
	ExecuteWarmMigration(migrationID string, vm *VM, targetNode Node) error
	ExecuteLiveMigration(migrationID string, vm *VM, targetNode Node) error

	// Rollback migrations
	RollbackMigration(migrationID string, vm *VM, sourceNode Node) error
}

VMTypeMigrationExecutor defines the interface for migration execution (renamed to avoid conflict)

type VMUpdateSpec

type VMUpdateSpec struct {
	Name   *string           `json:"name,omitempty"`   // VM name update
	CPU    *int              `json:"cpu,omitempty"`    // CPU shares update
	Memory *int64            `json:"memory,omitempty"` // Memory update in MB
	Disk   *int64            `json:"disk,omitempty"`   // Disk size update in GB
	Tags   map[string]string `json:"tags,omitempty"`   // Tag updates
}

VMUpdateSpec represents specification for updating VM configuration

type VMVolumeAttachment

type VMVolumeAttachment struct {
	VolumeID string `yaml:"volume_id" json:"volume_id"`
	Device   string `yaml:"device,omitempty" json:"device,omitempty"`
	ReadOnly bool   `yaml:"read_only,omitempty" json:"read_only,omitempty"`
	Boot     bool   `yaml:"boot,omitempty" json:"boot,omitempty"`
}

VMVolumeAttachment describes a pre-existing storage LUN or volume to attach to a VM.

type VMwareConfig

type VMwareConfig struct {
	Enabled    bool
	URL        string
	Username   string
	Password   string
	Insecure   bool
	Datacenter string
}

VMwareConfig contains VMware vSphere specific configuration

type VirtualFunction

type VirtualFunction struct {
	ID         string `json:"id"`
	PCIAddress string `json:"pci_address"`
	Driver     string `json:"driver,omitempty"`
	MACAddress string `json:"mac_address,omitempty"`
	VLAN       int    `json:"vlan,omitempty"`
	InUse      bool   `json:"in_use"`
	AssignedTo string `json:"assigned_to,omitempty"`
	IOMMUGroup int    `json:"iommu_group"`
}

VirtualFunction represents an SR-IOV virtual function

type VolumeStorageStats

type VolumeStorageStats struct {
	VolumeID   string                 `json:"volume_id"`
	VolumeName string                 `json:"volume_name"`
	SizeGB     float64                `json:"size_gb"`
	UsedGB     float64                `json:"used_gb"`
	Type       string                 `json:"type"`
	State      string                 `json:"state"`
	Bootable   bool                   `json:"bootable"`
	Stats      map[string]interface{} `json:"stats"`
}

VolumeStorageStats contains statistics for a single volume

type XenConfig

type XenConfig struct {
	Enabled  bool
	URL      string
	Username string
	Password string
	Pool     string
}

XenConfig contains XenServer specific configuration

Directories

Path Synopsis
drivers
kvm

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL