mockpve

package
v1.0.19 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleClusterResources

func HandleClusterResources(state *MockState) http.HandlerFunc

func HandleClusterStatus

func HandleClusterStatus(state *MockState) http.HandlerFunc

func HandleDeleteStorageContent

func HandleDeleteStorageContent(state *MockState) http.HandlerFunc

func HandleDeleteVM

func HandleDeleteVM(state *MockState) http.HandlerFunc

func HandleNodeStatus

func HandleNodeStatus(state *MockState) http.HandlerFunc

func HandleRestore

func HandleRestore(state *MockState) http.HandlerFunc

func HandleStopTask

func HandleStopTask(state *MockState) http.HandlerFunc

func HandleStorageContent

func HandleStorageContent(state *MockState) http.HandlerFunc

func HandleTaskStatus

func HandleTaskStatus(state *MockState) http.HandlerFunc

func HandleVMConfig

func HandleVMConfig(state *MockState) http.HandlerFunc

func HandleVMStatusAction

func HandleVMStatusAction(state *MockState) http.HandlerFunc

func HandleVMStatusCurrent

func HandleVMStatusCurrent(state *MockState) http.HandlerFunc

func HandleVzdump

func HandleVzdump(state *MockState) http.HandlerFunc

Types

type MockBackup

type MockBackup struct {
	VolID   string
	VMID    int
	Date    int64 // Unix timestamp
	Size    int64
	Storage string
	Format  string
	Notes   string
	Content string // "backup"
}

type MockNode

type MockNode struct {
	Name    string
	ID      string
	Online  int // 1 or 0
	IP      string
	Uptime  int64
	MaxCPU  float64
	MaxMem  int64
	MaxDisk int64
	// Detailed stats
	KernelVersion string
	PVEVersion    string
	CPUModel      string
	CPUSockets    int
	CPUCores      int
}

type MockState

type MockState struct {
	Nodes   []*MockNode
	VMs     map[string]*MockVM // Key: vmid (string)
	Storage []*MockStorage
	Backups map[string]*MockBackup // Key: volid
	Tasks   map[string]*MockTask   // Key: upid
	// contains filtered or unexported fields
}

func NewMockState

func NewMockState() *MockState

func (*MockState) CompleteTask

func (s *MockState) CompleteTask(upid, exitStatus string)

func (*MockState) CreateBackup

func (s *MockState) CreateBackup(vmid int, storage string, mode string, notes string) string

func (*MockState) CreateTask

func (s *MockState) CreateTask(node, taskType, id, user string) string

func (*MockState) CreateVM

func (s *MockState) CreateVM(vmid int, name string, vmType string, node string)

func (*MockState) DeleteBackup

func (s *MockState) DeleteBackup(volID string) error

func (*MockState) DeleteVM

func (s *MockState) DeleteVM(vmid string) error

func (*MockState) GetBackups

func (s *MockState) GetBackups(storage string) []*MockBackup

func (*MockState) GetClusterResources

func (s *MockState) GetClusterResources() []map[string]interface{}

func (*MockState) UpdateVMConfig

func (s *MockState) UpdateVMConfig(vmid string, config map[string]interface{}) error

func (*MockState) UpdateVMStatus

func (s *MockState) UpdateVMStatus(vmid string, action string) (string, error)

type MockStorage

type MockStorage struct {
	ID      string // "local"
	Node    string
	Type    string
	Content string
	Disk    int64
	MaxDisk int64
	Status  string // "active"
	Shared  int
}

type MockTask

type MockTask struct {
	UPID       string
	Node       string
	Type       string
	ID         string // e.g. "100"
	User       string
	StartTime  int64
	EndTime    int64
	Status     string // "running", "stopped", "OK", "ERR"
	ExitStatus string // "OK", "ERROR"
}

type MockVM

type MockVM struct {
	ID        int
	Name      string
	Node      string
	Type      string // "qemu" or "lxc"
	Status    string // "running", "stopped"
	MaxMem    int64
	MaxDisk   int64
	CPUs      float64
	Uptime    int64
	NetIn     int64
	NetOut    int64
	DiskRead  int64
	DiskWrite int64

	// Configuration
	Config map[string]interface{}
}

Jump to

Keyboard shortcuts

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