Files
jagacloud/pkg/compute/libvirt/libvirt.go
2025-11-23 11:29:12 +07:00

54 lines
967 B
Go

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.