Documentation ¶
Index ¶
- Constants
- func AddIntToIp(ip net.IP, value uint) net.IP
- func CompareIp(ip1 net.IP, ip2 net.IP) int
- func GenerateRandomMac() (string, error)
- func GenerateUniqueRandomMac(macMap map[string]bool, limit int) (string, error)
- func IncrementIp(ip net.IP)
- func Ip2Int(ip net.IP) *big.Int
- type GetResult
- type Image
- type ImageDetectSpec
- type ImageResource
- type ImageResources
- type ImageSpec
- type ImageUrlSpec
- type Network
- type NetworkDetectSpec
- type NetworkLocalSpec
- type NetworkNat
- type NetworkPort
- type NetworkResource
- type NetworkResources
- type NetworkSpec
- type ParsedNetwork
- type Resolver
- type Resource
- type SystemdService
- type VirtController
- func (self *VirtController) AssignNetworkPorts(tctx *logger.TraceContext, tx *gorm.DB, vm *Vm, ...) (assignedPorts []NetworkPort, err error)
- func (self *VirtController) BootstrapImage(tctx *logger.TraceContext) (err error)
- func (self *VirtController) BootstrapNetwork(tctx *logger.TraceContext) (err error)
- func (self *VirtController) BootstrapVm(tctx *logger.TraceContext) (err error)
- func (self *VirtController) Create(tctx *logger.TraceContext, resourcesBytes [][]byte) (err error)
- func (self *VirtController) CreateOrUpdateImage(tctx *logger.TraceContext, spec *ImageSpec) (err error)
- func (self *VirtController) CreateOrUpdateNetwork(tctx *logger.TraceContext, spec *NetworkSpec) (err error)
- func (self *VirtController) CreateOrUpdateVm(tctx *logger.TraceContext, spec *VmSpec) (err error)
- func (self *VirtController) DetectImage(tctx *logger.TraceContext, tx *gorm.DB, detectSpec *ImageDetectSpec) (image *Image, err error)
- func (self *VirtController) Get(tctx *logger.TraceContext, kind string, args []string) (result *GetResult, err error)
- func (self *VirtController) GetImage(name string) (image *Image, err error)
- func (self *VirtController) GetImageResources(tctx *logger.TraceContext, names []string) (imageResources ImageResources, err error)
- func (self *VirtController) GetNetwork(name string) (network *Network, err error)
- func (self *VirtController) GetNetworkResources(tctx *logger.TraceContext, names []string) (networkResources NetworkResources, err error)
- func (self *VirtController) GetVm(name string) (vm *Vm, err error)
- func (self *VirtController) GetVmResources(tctx *logger.TraceContext, names []string) (vmResources VmResources, err error)
- func (self *VirtController) MustBootstrap()
- func (self *VirtController) MustInit()
- func (self *VirtController) PrepareImages(tctx *logger.TraceContext, vmResources VmResources) (err error)
- func (self *VirtController) PrepareNetworks(tctx *logger.TraceContext, vmResources VmResources) (err error)
- func (self *VirtController) Start(tctx *logger.TraceContext, kind string, args []string) (result *GetResult, err error)
- func (self *VirtController) StartVmResources(tctx *logger.TraceContext, names []string) (vmResources VmResources, err error)
- type VirtControllerConfig
- type Vm
- type VmImage
- type VmNetwork
- type VmNetworkPort
- type VmQemuSpec
- type VmResource
- type VmResources
- type VmSpec
Constants ¶
View Source
const ( StatusRunning = "Running" StatusCreated = "Created" )
View Source
const ( KindAll = "all" KindVm = "vm" KindImage = "image" KindNetwork = "network" )
View Source
const (
KindImageUrl = "url"
)
View Source
const (
KindNetworkLocal = "local"
)
View Source
const (
KindVmQemu = "qemu"
)
Variables ¶
This section is empty.
Functions ¶
func GenerateRandomMac ¶
func GenerateUniqueRandomMac ¶
func IncrementIp ¶
Types ¶
type GetResult ¶
type GetResult struct { Vms VmResources Networks NetworkResources Images ImageResources }
type ImageDetectSpec ¶
type ImageDetectSpec struct {
Name string
}
type ImageResource ¶
type ImageResources ¶
type ImageResources []ImageResource
func (ImageResources) String ¶
func (self ImageResources) String() string
type ImageUrlSpec ¶
type NetworkDetectSpec ¶
type NetworkLocalSpec ¶
type NetworkLocalSpec struct { Resolvers []Resolver `gorm:"-"` Nat NetworkNat `gorm:"-"` }
type NetworkNat ¶
type NetworkPort ¶
type NetworkResource ¶
type NetworkResources ¶
type NetworkResources []NetworkResource
func (NetworkResources) String ¶
func (self NetworkResources) String() string
type NetworkSpec ¶
type NetworkSpec struct { Name string `gorm:"not null;uniqueIndex:udx_name;" validate:"required"` Namespace string `gorm:"not null;uniqueIndex:udx_name;" validate:"required"` Kind string `gorm:"not null;"` Subnet string `gorm:"not null;"` StartIp string `gorm:"not null;"` EndIp string `gorm:"not null;"` Gateway string `gorm:"not null;"` Spec interface{} `gorm:"-"` }
type ParsedNetwork ¶
type ParsedNetwork struct { Subnet *net.IPNet Gateway net.IP StartIp net.IP EndIp net.IP AvailableIps uint64 }
func ParseNetwork ¶
func ParseNetwork(spec *NetworkSpec) (network *ParsedNetwork, err error)
type SystemdService ¶
type SystemdService struct {
Restart string `oneof=always`
}
type VirtController ¶
type VirtController struct {
// contains filtered or unexported fields
}
func NewVirtContoller ¶
func NewVirtContoller(conf *VirtControllerConfig) (virtController *VirtController)
func (*VirtController) AssignNetworkPorts ¶
func (self *VirtController) AssignNetworkPorts(tctx *logger.TraceContext, tx *gorm.DB, vm *Vm, detectSpecs []NetworkDetectSpec) (assignedPorts []NetworkPort, err error)
func (*VirtController) BootstrapImage ¶
func (self *VirtController) BootstrapImage(tctx *logger.TraceContext) (err error)
func (*VirtController) BootstrapNetwork ¶
func (self *VirtController) BootstrapNetwork(tctx *logger.TraceContext) (err error)
func (*VirtController) BootstrapVm ¶
func (self *VirtController) BootstrapVm(tctx *logger.TraceContext) (err error)
func (*VirtController) Create ¶
func (self *VirtController) Create(tctx *logger.TraceContext, resourcesBytes [][]byte) (err error)
func (*VirtController) CreateOrUpdateImage ¶
func (self *VirtController) CreateOrUpdateImage(tctx *logger.TraceContext, spec *ImageSpec) (err error)
func (*VirtController) CreateOrUpdateNetwork ¶
func (self *VirtController) CreateOrUpdateNetwork(tctx *logger.TraceContext, spec *NetworkSpec) (err error)
func (*VirtController) CreateOrUpdateVm ¶
func (self *VirtController) CreateOrUpdateVm(tctx *logger.TraceContext, spec *VmSpec) (err error)
func (*VirtController) DetectImage ¶
func (self *VirtController) DetectImage(tctx *logger.TraceContext, tx *gorm.DB, detectSpec *ImageDetectSpec) (image *Image, err error)
func (*VirtController) Get ¶
func (self *VirtController) Get(tctx *logger.TraceContext, kind string, args []string) (result *GetResult, err error)
func (*VirtController) GetImage ¶
func (self *VirtController) GetImage(name string) (image *Image, err error)
func (*VirtController) GetImageResources ¶
func (self *VirtController) GetImageResources(tctx *logger.TraceContext, names []string) (imageResources ImageResources, err error)
func (*VirtController) GetNetwork ¶
func (self *VirtController) GetNetwork(name string) (network *Network, err error)
func (*VirtController) GetNetworkResources ¶
func (self *VirtController) GetNetworkResources(tctx *logger.TraceContext, names []string) (networkResources NetworkResources, err error)
func (*VirtController) GetVmResources ¶
func (self *VirtController) GetVmResources(tctx *logger.TraceContext, names []string) (vmResources VmResources, err error)
func (*VirtController) MustBootstrap ¶
func (self *VirtController) MustBootstrap()
func (*VirtController) MustInit ¶
func (self *VirtController) MustInit()
func (*VirtController) PrepareImages ¶
func (self *VirtController) PrepareImages(tctx *logger.TraceContext, vmResources VmResources) (err error)
func (*VirtController) PrepareNetworks ¶
func (self *VirtController) PrepareNetworks(tctx *logger.TraceContext, vmResources VmResources) (err error)
func (*VirtController) Start ¶
func (self *VirtController) Start(tctx *logger.TraceContext, kind string, args []string) (result *GetResult, err error)
func (*VirtController) StartVmResources ¶
func (self *VirtController) StartVmResources(tctx *logger.TraceContext, names []string) (vmResources VmResources, err error)
type VirtControllerConfig ¶
type VmNetworkPort ¶
type VmNetworkPort struct { *VmNetwork NetworkPort }
type VmQemuSpec ¶
type VmQemuSpec struct {
Service SystemdService `gorm:"-"`
}
type VmResource ¶
type VmResources ¶
type VmResources []VmResource
func (VmResources) String ¶
func (self VmResources) String() string
type VmSpec ¶
type VmSpec struct { Name string `gorm:"not null;uniqueIndex:udx_name;" validate:"required"` Namespace string `gorm:"not null;uniqueIndex:udx_name;" validate:"required"` Kind string `gorm:"not null;" validate:"required"` Vcpus uint `gorm:"not null;" validate:"required"` MemoryMb uint `gorm:"not null;" validate:"required"` DiskGb uint `gorm:"not null;" validate:"required"` Image ImageDetectSpec `gorm:"-"` Networks []NetworkDetectSpec `gorm:"-"` Spec interface{} `gorm:"-"` }
Click to show internal directories.
Click to hide internal directories.