mockpve

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleClusterNextID added in v1.2.0

func HandleClusterNextID(state *MockState) http.HandlerFunc

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 HandleDownloadStorageContent added in v1.2.0

func HandleDownloadStorageContent(state *MockState) http.HandlerFunc

func HandleGuestCreate added in v1.2.0

func HandleGuestCreate(state *MockState) http.HandlerFunc

func HandleGuestIndex added in v1.2.0

func HandleGuestIndex(state *MockState) http.HandlerFunc

func HandleNodeStatus

func HandleNodeStatus(state *MockState) http.HandlerFunc

func HandleNodeStorages added in v1.2.0

func HandleNodeStorages(state *MockState) http.HandlerFunc

func HandleOCIPullStorageContent added in v1.2.0

func HandleOCIPullStorageContent(state *MockState) http.HandlerFunc

func HandleResizeGuestDisk added in v1.2.0

func HandleResizeGuestDisk(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
	StorageContent map[string]map[string]*MockStorageVolume // Key: node/storage -> volid -> volume
	Backups        map[string]*MockBackup                   // Key: volid
	Tasks          map[string]*MockTask                     // Key: upid
	NextID         int
	// 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) GetNextID added in v1.2.0

func (s *MockState) GetNextID(requested int) (int, error)

func (*MockState) ListGuests added in v1.2.0

func (s *MockState) ListGuests(node, vmType string) []map[string]interface{}

func (*MockState) ListNodeStorages added in v1.2.0

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

func (*MockState) ListStorageContent added in v1.2.0

func (s *MockState) ListStorageContent(node, storage, content string, vmid int) []map[string]interface{}

func (*MockState) QueueCreateGuest added in v1.2.0

func (s *MockState) QueueCreateGuest(node, vmType string, params map[string]interface{}, isRestore bool) (string, error)

func (*MockState) QueueDeleteStorageContent added in v1.2.0

func (s *MockState) QueueDeleteStorageContent(volume string) (string, error)

func (*MockState) QueueDownloadStorageContent added in v1.2.0

func (s *MockState) QueueDownloadStorageContent(node, storage string, params map[string]interface{}) (string, error)

func (*MockState) QueueOCIPullStorageContent added in v1.2.0

func (s *MockState) QueueOCIPullStorageContent(node, storage string, params map[string]interface{}) (string, error)

func (*MockState) QueueResizeGuestDisk added in v1.2.0

func (s *MockState) QueueResizeGuestDisk(node, vmType, vmid, disk, size string) (string, error)

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 MockStorageVolume added in v1.2.0

type MockStorageVolume struct {
	VolID     string
	Node      string
	Storage   string
	Content   string
	Format    string
	Size      int64
	Used      int64
	VMID      int
	CreatedAt int64
	Notes     string
	Parent    string
	Protected bool
}

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"
	// contains filtered or unexported fields
}

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