initial commit

This commit is contained in:
2025-11-23 11:29:12 +07:00
commit 382b57ed83
33 changed files with 2360 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
package libvirt
// Client abstracts libvirt operations needed by the node-agent.
type Client interface {
ListVMs() ([]VM, error)
CreateVM(spec VMSpec) (VM, error)
StartVM(id string) error
StopVM(id string) error
RebootVM(id string) error
DeleteVM(id string) error
}
type VMSpec struct {
ID string
Name string
CPU int
MemoryMB int
Disks []DiskSpec
NICs []NICSpec
CloudInit *CloudInitSpec
CloudInitISO string
}
type DiskSpec struct {
Name string
Pool string
SizeGB int
Bus string
Path string
Prealloc string // "", "metadata", "full"
}
type NICSpec struct {
Bridge string
VLAN int
Model string
}
type CloudInitSpec struct {
User string
SSHKeys []string
UserData string
}
type VM struct {
ID string
Name string
Status string
CPU int
MemoryMB int
}
// TODO: implement a real libvirt-go backed client that renders domain XML from templates.