Documentation
¶
Index ¶
- Constants
- func CreateUserForTests(user *User)
- func FindHostForTests(hostId string, host *Host)
- func FindIsoStorageRepositoryForTests(pool Pool, sr *StorageRepository, tag, isoSrEnvVar string)
- func FindNetworkForTests(poolId string, network *Network)
- func FindOrCreateVmForTests(vm *Vm, poolId, srId, templateName, tag string)
- func FindPIFForTests(pif *PIF)
- func FindPoolForTests(pool *Pool)
- func FindStorageRepositoryForTests(pool Pool, sr *StorageRepository, tag string)
- func FindTemplateForTests(template *Template, poolId, templateEnvVar string)
- func FindVDIForTests(pool Pool, isoVdi *VDI, isoNameEnvVar string)
- func GetVmPowerState(c *Client, id string) func() (result interface{}, state string, err error)
- func RemoveCloudConfigsWithPrefix(cloudConfigPrefix string) func(string) error
- func RemoveNetworksWithNamePrefixForTests(prefix string) func(string) error
- func RemoveResourceSetsWithNamePrefixForTests(rsNamePrefix string) func(string) error
- func RemoveTagFromAllObjectsForTests(tag string) func(string) error
- func RemoveUsersWithPrefixForTests(usernamePrefix string) func(string) error
- func RemoveVDIsWithPrefixForTests(prefix string) func(string) error
- func RemoveVmsWithNamePrefixForTests(prefix string) func(string) error
- type Acl
- type Bond
- type Boot
- type CPUs
- type Client
- func (c Client) AddResourceSetLimit(rsReq ResourceSet, limit string, quantity int) error
- func (c Client) AddResourceSetObject(rsReq ResourceSet, object string) error
- func (c Client) AddResourceSetSubject(rsReq ResourceSet, subject string) error
- func (c *Client) AddTag(id, tag string) error
- func (c *Client) Call(method string, params, result interface{}) error
- func (c *Client) ConnectDisk(d Disk) error
- func (c *Client) ConnectVIF(vifReq *VIF) (err error)
- func (c *Client) CreateAcl(acl Acl) (*Acl, error)
- func (c *Client) CreateBondedNetwork(netReq CreateBondedNetworkRequest) (*Network, error)
- func (c *Client) CreateCloudConfig(name, template string) (*CloudConfig, error)
- func (c *Client) CreateDisk(vm Vm, d Disk) (string, error)
- func (c *Client) CreateNetwork(netReq CreateNetworkRequest) (*Network, error)
- func (c Client) CreateResourceSet(rsReq ResourceSet) (*ResourceSet, error)
- func (c *Client) CreateUser(user User) (*User, error)
- func (c *Client) CreateVDI(vdiReq CreateVDIReq) (VDI, error)
- func (c *Client) CreateVIF(vm *Vm, vif *VIF) (*VIF, error)
- func (c *Client) CreateVm(vmReq Vm, createTime time.Duration) (*Vm, error)
- func (c *Client) DeleteAcl(acl Acl) error
- func (c *Client) DeleteCloudConfig(id string) error
- func (c *Client) DeleteDisk(vm Vm, d Disk) error
- func (c *Client) DeleteNetwork(id string) error
- func (c Client) DeleteResourceSet(rsReq ResourceSet) error
- func (c *Client) DeleteUser(user User) error
- func (c *Client) DeleteVDI(id string) error
- func (c *Client) DeleteVIF(vifReq *VIF) (err error)
- func (c *Client) DeleteVm(id string) error
- func (c *Client) DisconnectDisk(d Disk) error
- func (c *Client) DisconnectVIF(vifReq *VIF) (err error)
- func (c *Client) EjectCd(id string) error
- func (c *Client) EjectVmCd(vm *Vm) error
- func (c *Client) FindFromGetAllObjects(obj XoObject) (interface{}, error)
- func (c *Client) GetAcl(aclReq Acl) (*Acl, error)
- func (c *Client) GetAcls() ([]Acl, error)
- func (c *Client) GetAllCloudConfigs() ([]CloudConfig, error)
- func (c *Client) GetAllObjectsOfType(obj XoObject, response interface{}) error
- func (c *Client) GetAllUsers() ([]User, error)
- func (c *Client) GetAllVDIs() ([]VDI, error)
- func (c *Client) GetBond(bondReq Bond) (*Bond, error)
- func (c *Client) GetBonds(bondReq Bond) ([]Bond, error)
- func (c *Client) GetCdroms(vm *Vm) ([]Disk, error)
- func (c *Client) GetCloudConfig(id string) (*CloudConfig, error)
- func (c *Client) GetCloudConfigByName(name string) ([]CloudConfig, error)
- func (c *Client) GetCurrentUser() (*User, error)
- func (c *Client) GetDisks(vm *Vm) ([]Disk, error)
- func (c *Client) GetHostById(id string) (host Host, err error)
- func (c *Client) GetHostByName(nameLabel string) (hosts []Host, err error)
- func (c *Client) GetNetwork(netReq Network) (*Network, error)
- func (c *Client) GetNetworks() ([]Network, error)
- func (c *Client) GetObjectsWithTags(tags []string) ([]Object, error)
- func (c *Client) GetPIF(pifReq PIF) (pifs []PIF, err error)
- func (c *Client) GetPIFByDevice(dev string, vlan int) ([]PIF, error)
- func (c *Client) GetParentVDI(vbd VBD) (VDI, error)
- func (c *Client) GetPoolByName(name string) (pools []Pool, err error)
- func (c *Client) GetPools(pool Pool) (pools []Pool, err error)
- func (c Client) GetResourceSet(rsReq ResourceSet) ([]ResourceSet, error)
- func (c Client) GetResourceSetById(id string) (*ResourceSet, error)
- func (c Client) GetResourceSets() ([]ResourceSet, error)
- func (c *Client) GetSortedHosts(host Host, sortBy, sortOrder string) (hosts []Host, err error)
- func (c *Client) GetStorageRepository(sr StorageRepository) ([]StorageRepository, error)
- func (c *Client) GetStorageRepositoryById(id string) (StorageRepository, error)
- func (c *Client) GetTemplate(template Template) ([]Template, error)
- func (c *Client) GetTemplateVBDs(template Template) (map[string]VBD, error)
- func (c *Client) GetUser(userReq User) (*User, error)
- func (c *Client) GetVBD(vbdReq VBD) (VBD, error)
- func (c *Client) GetVDI(vdiReq VDI) (VDI, error)
- func (c *Client) GetVDIs(vdiReq VDI) ([]VDI, error)
- func (c *Client) GetVIF(vifReq *VIF) (*VIF, error)
- func (c *Client) GetVIFs(vm *Vm) ([]VIF, error)
- func (c *Client) GetVm(vmReq Vm) (*Vm, error)
- func (c *Client) GetVms(vm Vm) ([]Vm, error)
- func (c *Client) HaltVm(id string) error
- func (c *Client) InsertCd(vmId, cdId string) error
- func (c *Client) IsRetryableError(err jsonrpc2.Error) bool
- func (c *Client) PauseVm(id string) error
- func (c Client) RemoveResourceSetLimit(rsReq ResourceSet, limit string) error
- func (c Client) RemoveResourceSetObject(rsReq ResourceSet, object string) error
- func (c Client) RemoveResourceSetSubject(rsReq ResourceSet, subject string) error
- func (c *Client) RemoveTag(id, tag string) error
- func (c *Client) ResizeVDI(d Disk) error
- func (c *Client) StartVm(id string) error
- func (c *Client) SuspendVm(id string) error
- func (c *Client) UpdateNetwork(netReq UpdateNetworkRequest) (*Network, error)
- func (c *Client) UpdateVDI(d Disk) error
- func (c *Client) UpdateVm(vmReq Vm) (*Vm, error)
- type CloudConfig
- type CloudConfigResponse
- type Config
- type CpuInfo
- type CreateBondedNetworkRequest
- type CreateNetworkRequest
- type CreateVDIReq
- type Disk
- type FlatResourceSet
- type Host
- type HostMemoryObject
- type Installation
- type MemoryObject
- type Network
- type NotFound
- type NotFoundError
- type Object
- type PIF
- type Pool
- type Preferences
- type RefreshComparison
- type ResourceSet
- type ResourceSetLimit
- type ResourceSetLimits
- type RetryMode
- type SshKey
- type StateChangeConf
- type StateRefreshFunc
- type StorageRepository
- type Template
- type TemplateBoot
- type TemplateDisk
- type TemplateInfo
- type TimeoutError
- type UnexpectedStateError
- type UpdateNetworkRequest
- type User
- type VBD
- type VDI
- type VIF
- type Videoram
- type Vm
- type XOClient
- type XoObject
Constants ¶
const ( // Maximum message size allowed from peer. MaxMessageSize = 4096 PongWait = 60 * time.Second )
const ( HaltedPowerState string = "Halted" PausedPowerState string = "Paused" RunningPowerState string = "Running" SuspendedPowerState string = "Suspended" )
const ( WaitingState string = "Waiting" ReadyState string = "Ready" )
const ( CloneTypeFastClone string = "fast" CloneTypeFullClone string = "full" )
Variables ¶
This section is empty.
Functions ¶
func CreateUserForTests ¶ added in v1.5.0
func CreateUserForTests(user *User)
func FindHostForTests ¶
func FindIsoStorageRepositoryForTests ¶
func FindIsoStorageRepositoryForTests(pool Pool, sr *StorageRepository, tag, isoSrEnvVar string)
func FindNetworkForTests ¶
func FindOrCreateVmForTests ¶
func FindPIFForTests ¶
func FindPIFForTests(pif *PIF)
func FindPoolForTests ¶
func FindPoolForTests(pool *Pool)
func FindStorageRepositoryForTests ¶
func FindStorageRepositoryForTests(pool Pool, sr *StorageRepository, tag string)
func FindTemplateForTests ¶
func FindVDIForTests ¶
func GetVmPowerState ¶
func RemoveNetworksWithNamePrefixForTests ¶ added in v1.5.0
func RemoveResourceSetsWithNamePrefixForTests ¶ added in v1.5.0
func RemoveTagFromAllObjectsForTests ¶ added in v1.5.0
func RemoveUsersWithPrefixForTests ¶ added in v1.5.0
func RemoveVDIsWithPrefixForTests ¶ added in v1.5.0
func RemoveVmsWithNamePrefixForTests ¶ added in v1.5.0
Types ¶
type Bond ¶ added in v1.2.0
type Client ¶
type Client struct {
RetryMode RetryMode
RetryMaxTime time.Duration
// contains filtered or unexported fields
}
func (Client) AddResourceSetLimit ¶
func (c Client) AddResourceSetLimit(rsReq ResourceSet, limit string, quantity int) error
func (Client) AddResourceSetObject ¶
func (c Client) AddResourceSetObject(rsReq ResourceSet, object string) error
func (Client) AddResourceSetSubject ¶
func (c Client) AddResourceSetSubject(rsReq ResourceSet, subject string) error
func (*Client) ConnectDisk ¶
func (*Client) ConnectVIF ¶
func (*Client) CreateBondedNetwork ¶
func (c *Client) CreateBondedNetwork(netReq CreateBondedNetworkRequest) (*Network, error)
func (*Client) CreateCloudConfig ¶
func (c *Client) CreateCloudConfig(name, template string) (*CloudConfig, error)
func (*Client) CreateNetwork ¶
func (c *Client) CreateNetwork(netReq CreateNetworkRequest) (*Network, error)
func (Client) CreateResourceSet ¶
func (c Client) CreateResourceSet(rsReq ResourceSet) (*ResourceSet, error)
func (*Client) DeleteCloudConfig ¶
func (*Client) DeleteDisk ¶
DeleteDisk detaches the specified disk from the given virtual machine if it is attached, and then deletes the disk's VDI. Returns an error if any operation fails.
func (*Client) DeleteNetwork ¶
func (Client) DeleteResourceSet ¶
func (c Client) DeleteResourceSet(rsReq ResourceSet) error
func (*Client) DeleteUser ¶
func (*Client) DisconnectDisk ¶
func (*Client) DisconnectVIF ¶
func (*Client) FindFromGetAllObjects ¶
func (*Client) GetAllCloudConfigs ¶
func (c *Client) GetAllCloudConfigs() ([]CloudConfig, error)
func (*Client) GetAllObjectsOfType ¶
func (*Client) GetAllUsers ¶
func (*Client) GetAllVDIs ¶
func (*Client) GetCloudConfig ¶
func (c *Client) GetCloudConfig(id string) (*CloudConfig, error)
func (*Client) GetCloudConfigByName ¶
func (c *Client) GetCloudConfigByName(name string) ([]CloudConfig, error)
func (*Client) GetCurrentUser ¶
func (*Client) GetHostByName ¶
func (*Client) GetNetworks ¶
func (*Client) GetObjectsWithTags ¶
func (*Client) GetPIFByDevice ¶
func (*Client) GetPoolByName ¶
func (Client) GetResourceSet ¶
func (c Client) GetResourceSet(rsReq ResourceSet) ([]ResourceSet, error)
func (Client) GetResourceSetById ¶
func (c Client) GetResourceSetById(id string) (*ResourceSet, error)
func (Client) GetResourceSets ¶
func (c Client) GetResourceSets() ([]ResourceSet, error)
func (*Client) GetSortedHosts ¶
func (*Client) GetStorageRepository ¶
func (c *Client) GetStorageRepository(sr StorageRepository) ([]StorageRepository, error)
func (*Client) GetStorageRepositoryById ¶
func (c *Client) GetStorageRepositoryById(id string) (StorageRepository, error)
func (*Client) GetTemplateVBDs ¶ added in v1.7.0
GetTemplateVBDs retrieves all VBDs for a given template and returns them as a map where the key is the VBD's position.
func (Client) RemoveResourceSetLimit ¶
func (c Client) RemoveResourceSetLimit(rsReq ResourceSet, limit string) error
func (Client) RemoveResourceSetObject ¶
func (c Client) RemoveResourceSetObject(rsReq ResourceSet, object string) error
func (Client) RemoveResourceSetSubject ¶
func (c Client) RemoveResourceSetSubject(rsReq ResourceSet, subject string) error
func (*Client) UpdateNetwork ¶
func (c *Client) UpdateNetwork(netReq UpdateNetworkRequest) (*Network, error)
type CloudConfig ¶
type CloudConfig struct {
Name string `json:"name"`
Template string `json:"template"`
Id string `json:"id"`
}
func (CloudConfig) Compare ¶
func (c CloudConfig) Compare(obj interface{}) bool
type CloudConfigResponse ¶
type CloudConfigResponse struct {
Result []CloudConfig `json:"result"`
}
type Config ¶
type Config struct {
Url string
Username string
Password string
Token string
InsecureSkipVerify bool
RetryMode RetryMode
RetryMaxTime time.Duration
}
func GetConfigFromEnv ¶
func GetConfigFromEnv() Config
type CreateBondedNetworkRequest ¶
type CreateBondedNetworkRequest struct {
// The first set of members are shared between bonded and non bonded networks
// These should be kept in sync with the CreateNetworkRequest struct
Automatic bool `mapstructure:"automatic"`
DefaultIsLocked bool `mapstructure:"defaultIsLocked"`
Pool string `mapstructure:"pool"`
Name string `mapstructure:"name"`
Description string `mapstructure:"description,omitempty"`
Mtu int `mapstructure:"mtu,omitempty"`
BondMode string `mapstructure:"bondMode,omitempty"`
PIFs []string `mapstructure:"pifs,omitempty"`
}
func (CreateBondedNetworkRequest) Propagated ¶
func (c CreateBondedNetworkRequest) Propagated(obj interface{}) bool
type CreateNetworkRequest ¶
type CreateNetworkRequest struct {
// The first set of members are shared between bonded and non bonded networks
// These should be kept in sync with the CreateBondedNetworkRequest struct
// Refactoring these fields to an embedded struct means that the caller must
// know the embedded structs existence. Since the list is relatively small
// this was deemed a more appropriate tradeoff to make the API nicer.
Automatic bool `mapstructure:"automatic"`
DefaultIsLocked bool `mapstructure:"defaultIsLocked"`
Pool string `mapstructure:"pool"`
Name string `mapstructure:"name"`
Description string `mapstructure:"description,omitempty"`
Mtu int `mapstructure:"mtu,omitempty"`
Nbd bool `mapstructure:"nbd,omitempty"`
PIF string `mapstructure:"pif,omitempty"`
Vlan int `mapstructure:"vlan,omitempty"`
}
func (CreateNetworkRequest) Propagated ¶
func (c CreateNetworkRequest) Propagated(obj interface{}) bool
Nbd and Automatic are eventually consistent. This ensures that waitForModifyNetwork will poll until the values are correct.
type CreateVDIReq ¶
type FlatResourceSet ¶
type FlatResourceSet struct {
Id string
}
This resource set type is used to allow differentiating between when a user wants to remove a resource set from a VM (during an update) and when a resource set parameter should be omitted from a vm.set RPC call.
func (*FlatResourceSet) MarshalJSON ¶
func (rs *FlatResourceSet) MarshalJSON() ([]byte, error)
func (*FlatResourceSet) String ¶
func (rs *FlatResourceSet) String() string
This ensures when a FlatResourceSet is printed in debug logs that the string value of the Id is used rather than the pointer value. Since the purpose of this struct is to flatten resource sets to a string, it makes the logs properly reflect what is being logged.
func (*FlatResourceSet) UnmarshalJSON ¶
func (rs *FlatResourceSet) UnmarshalJSON(data []byte) (err error)
type Host ¶
type Host struct {
Id string `json:"id"`
NameLabel string `json:"name_label"`
Tags []interface{} `json:"tags,omitempty"`
Pool string `json:"$pool"`
Memory HostMemoryObject `json:"memory"`
Cpus CpuInfo `json:"cpus"`
}
type HostMemoryObject ¶
type Installation ¶
type MemoryObject ¶
type Network ¶
type Network struct {
Automatic bool `json:"automatic,omitempty"`
Id string `json:"id"`
NameLabel string `json:"name_label"`
NameDescription string `json:"name_description"`
Bridge string `json:"bridge"`
DefaultIsLocked bool `json:"defaultIsLocked"`
PoolId string `json:"$poolId"`
MTU int `json:"MTU"`
PIFs []string `json:"PIFs"`
Nbd bool `json:"nbd"`
InsecureNbd bool `json:"insecureNbd"`
}
type NotFoundError ¶
type NotFoundError struct {
LastError error
LastRequest interface{}
LastResponse interface{}
Message string
Retries int
}
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
type PIF ¶
type PIF struct {
Device string `json:"device"`
Host string `json:"$host"`
Network string `json:"$network"`
Id string `json:"id"`
Uuid string `json:"uuid"`
PoolId string `json:"$poolId"`
Attached bool `json:"attached"`
Vlan int `json:"vlan"`
IsBondMaster bool `json:"isBondMaster,omitempty"`
IsBondSlave bool `json:"isBondSlave,omitempty"`
BondSlaves []string `json:"bondSlaves,omitempty"`
BondMaster string `json:"bondMaster,omitempty"`
}
type Pool ¶
type Preferences ¶
type Preferences struct {
SshKeys []SshKey `json:"sshKeys,omitempty"`
}
type RefreshComparison ¶
type RefreshComparison interface {
Propagated(obj interface{}) bool
}
type ResourceSet ¶
type ResourceSet struct {
Id string `json:"id"`
Limits ResourceSetLimits `json:"limits"`
Name string `json:"name"`
Subjects []string `json:"subjects"`
Objects []string `json:"objects"`
}
func (ResourceSet) Compare ¶
func (rs ResourceSet) Compare(obj interface{}) bool
type ResourceSetLimit ¶
type ResourceSetLimits ¶
type ResourceSetLimits struct {
Cpus ResourceSetLimit `json:"cpus,omitempty"`
Memory ResourceSetLimit `json:"memory,omitempty"`
Disk ResourceSetLimit `json:"disk,omitempty"`
}
type RetryMode ¶
type RetryMode int
const ( None RetryMode = iota // specifies that no retries will be made // Specifies that exponential backoff will be used for certain retryable errors. When // a guest is booting there is the potential for a race condition if the given action // relies on the existence of a PV driver (unplugging / plugging a device). This open // allows the provider to retry these errors until the guest is initialized. Backoff )
type StateChangeConf ¶
type StateChangeConf struct {
Delay time.Duration // Wait this time before starting checks
Pending []string // States that are "allowed" and will continue trying
Refresh StateRefreshFunc // Refreshes the current state
Target []string // Target state
Timeout time.Duration // The amount of time to wait before timeout
MinTimeout time.Duration // Smallest time to wait before refreshes
PollInterval time.Duration // Override MinTimeout/backoff and only poll this often
NotFoundChecks int // Number of times to allow not found
// This is to work around inconsistent APIs
ContinuousTargetOccurence int // Number of times the Target state has to occur continuously
// contains filtered or unexported fields
}
StateChangeConf is the configuration struct used for `WaitForState`.
func (*StateChangeConf) Logger ¶ added in v1.5.0
func (conf *StateChangeConf) Logger() *slog.Logger
Use this method to avoid nil pointer
func (*StateChangeConf) WaitForState ¶
func (conf *StateChangeConf) WaitForState() (interface{}, error)
WaitForState watches an object and waits for it to achieve the state specified in the configuration using the specified Refresh() func, waiting the number of seconds specified in the timeout configuration.
If the Refresh function returns an error, exit immediately with that error.
If the Refresh function returns a state other than the Target state or one listed in Pending, return immediately with an error.
If the Timeout is exceeded before reaching the Target state, return an error.
Otherwise, the result is the result of the first call to the Refresh function to reach the target state.
type StateRefreshFunc ¶
StateRefreshFunc is a function type used for StateChangeConf that is responsible for refreshing the item being watched for a state change.
It returns three results. `result` is any object that will be returned as the final object after waiting for state change. This allows you to return the final updated object, for example an EC2 instance after refreshing it.
`state` is the latest state of that object. And `err` is any error that may have happened while refreshing the state.
type StorageRepository ¶
type StorageRepository struct {
Id string `json:"id"`
Uuid string `json:"uuid"`
NameLabel string `json:"name_label"`
PoolId string `json:"$poolId"`
SRType string `json:"SR_type"`
Container string `json:"$container"`
PhysicalUsage int `json:"physical_usage"`
Size int `json:"size"`
Usage int `json:"usage"`
Tags []string `json:"tags,omitempty"`
}
func (StorageRepository) Compare ¶
func (s StorageRepository) Compare(obj interface{}) bool
type Template ¶
type Template struct {
Id string `json:"id"`
Uuid string `json:"uuid"`
Boot TemplateBoot `json:"boot"`
NameLabel string `json:"name_label"`
PoolId string `json:"$poolId"`
TemplateInfo TemplateInfo `json:"template_info"`
// Array of VDI ids
VBDs []string `json:"$VBDs"`
}
type TemplateBoot ¶ added in v1.7.0
type TemplateDisk ¶
type TemplateInfo ¶
type TemplateInfo struct {
Arch string `json:"arch"`
Disks []TemplateDisk `json:"disks"`
}
type TimeoutError ¶
type TimeoutError struct {
LastError error
LastState string
Timeout time.Duration
ExpectedState []string
}
TimeoutError is returned when WaitForState times out
func (*TimeoutError) Error ¶
func (e *TimeoutError) Error() string
type UnexpectedStateError ¶
UnexpectedStateError is returned when Refresh returns a state that's neither in Target nor Pending
func (*UnexpectedStateError) Error ¶
func (e *UnexpectedStateError) Error() string
type UpdateNetworkRequest ¶
type UpdateNetworkRequest struct {
Id string `mapstructure:"id"`
Automatic bool `mapstructure:"automatic"`
DefaultIsLocked *bool `mapstructure:"defaultIsLocked,omitempty"`
NameDescription *string `mapstructure:"name_description,omitempty"`
NameLabel *string `mapstructure:"name_label,omitempty"`
Nbd bool `mapstructure:"nbd"`
}
func (UpdateNetworkRequest) Propagated ¶
func (c UpdateNetworkRequest) Propagated(obj interface{}) bool
Nbd and Automatic are eventually consistent. This ensures that waitForModifyNetwork will poll until the values are correct.
type User ¶
type VBD ¶
type VBD struct {
Id string `json:"id"`
Attached bool
Device string
ReadOnly bool `json:"read_only"`
VmId string `json:"VM"`
VDI string `json:"VDI"`
IsCdDrive bool `json:"is_cd_drive"`
Position string `json:"position,omitempty"`
Bootable bool
PoolId string `json:"$poolId"`
}
TODO: Change this file to storage or disks?
type VDI ¶
type VDI struct {
VDIId string `json:"id"`
SrId string `json:"$SR"`
NameLabel string `json:"name_label"`
NameDescription string `json:"name_description"`
Size int `json:"size"`
VBDs []string `json:"$VBDs"`
Parent string `json:"parent,omitempty"`
PoolId string `json:"$poolId"`
Tags []string `json:"tags,omitempty"`
}
type VIF ¶
type Videoram ¶
type Videoram struct {
Value int `json:"-"`
}
The XO api sometimes returns the videoram field as an int and sometimes as a string. This overrides the default json unmarshalling so that we can handle both of these cases
func (*Videoram) UnmarshalJSON ¶
type Vm ¶
type Vm struct {
Addresses map[string]string `json:"addresses,omitempty"`
BlockedOperations map[string]string `json:"blockedOperations,omitempty"`
Boot Boot `json:"boot,omitempty"`
Type string `json:"type,omitempty"`
Id string `json:"id,omitempty"`
AffinityHost *string `json:"affinityHost,omitempty"`
NameDescription string `json:"name_description"`
NameLabel string `json:"name_label"`
CPUs CPUs `json:"CPUs"`
ExpNestedHvm bool `json:"expNestedHvm,omitempty"`
Memory MemoryObject `json:"memory"`
PowerState string `json:"power_state"`
VIFs []string `json:"VIFs"`
VBDs []string `json:"$VBDs"`
VirtualizationMode string `json:"virtualizationMode"`
PoolId string `json:"$poolId"`
Template string `json:"template"`
AutoPoweron bool `json:"auto_poweron"`
HA string `json:"high_availability"`
CloudConfig string `json:"cloudConfig"`
ResourceSet *FlatResourceSet `json:"resourceSet"`
SecureBoot bool `json:"secureBoot,omitempty"`
Tags []string `json:"tags"`
Videoram Videoram `json:"videoram,omitempty"`
Vga string `json:"vga,omitempty"`
StartDelay int `json:"startDelay,omitempty"`
Host string `json:"$container"`
XenstoreData map[string]interface{} `json:"xenStoreData,omitempty"`
// These fields are used for passing in disk inputs when
// creating Vms, however, this is not a real field as far
// as the XO api or XAPI is concerned
Disks []Disk `json:"-"`
CloudNetworkConfig string `json:"-"`
VIFsMap []map[string]string `json:"-"`
// Map where the key is the network interface index and the
// value is a cidr range parsable by net.ParseCIDR
WaitForIps map[string]string `json:"-"`
Installation Installation `json:"-"`
ManagementAgentDetected bool `json:"managementAgentDetected"`
PVDriversDetected bool `json:"pvDriversDetected"`
DestroyCloudConfigVdiAfterBoot bool `json:"-"`
CloneType string `json:"-"`
}
type XOClient ¶
type XOClient interface {
GetObjectsWithTags(tags []string) ([]Object, error)
GetAllObjectsOfType(obj XoObject, response interface{}) error
CreateVm(vmReq Vm, d time.Duration) (*Vm, error)
GetVm(vmReq Vm) (*Vm, error)
GetVms(vm Vm) ([]Vm, error)
UpdateVm(vmReq Vm) (*Vm, error)
DeleteVm(id string) error
HaltVm(id string) error
StartVm(id string) error
SuspendVm(id string) error
PauseVm(id string) error
GetCloudConfigByName(name string) ([]CloudConfig, error)
CreateCloudConfig(name, template string) (*CloudConfig, error)
GetCloudConfig(id string) (*CloudConfig, error)
DeleteCloudConfig(id string) error
GetAllCloudConfigs() ([]CloudConfig, error)
GetHostById(id string) (host Host, err error)
GetHostByName(nameLabel string) (hosts []Host, err error)
GetPools(pool Pool) ([]Pool, error)
GetPoolByName(name string) (pools []Pool, err error)
GetSortedHosts(host Host, sortBy, sortOrder string) (hosts []Host, err error)
CreateResourceSet(rsReq ResourceSet) (*ResourceSet, error)
GetResourceSets() ([]ResourceSet, error)
GetResourceSet(rsReq ResourceSet) ([]ResourceSet, error)
GetResourceSetById(id string) (*ResourceSet, error)
DeleteResourceSet(rsReq ResourceSet) error
AddResourceSetSubject(rsReq ResourceSet, subject string) error
AddResourceSetObject(rsReq ResourceSet, object string) error
AddResourceSetLimit(rsReq ResourceSet, limit string, quantity int) error
RemoveResourceSetSubject(rsReq ResourceSet, subject string) error
RemoveResourceSetObject(rsReq ResourceSet, object string) error
RemoveResourceSetLimit(rsReq ResourceSet, limit string) error
CreateUser(user User) (*User, error)
GetAllUsers() ([]User, error)
GetUser(userReq User) (*User, error)
GetCurrentUser() (*User, error)
DeleteUser(userReq User) error
CreateNetwork(netReq CreateNetworkRequest) (*Network, error)
GetNetwork(netReq Network) (*Network, error)
UpdateNetwork(netReq UpdateNetworkRequest) (*Network, error)
CreateBondedNetwork(netReq CreateBondedNetworkRequest) (*Network, error)
GetNetworks() ([]Network, error)
DeleteNetwork(id string) error
GetPIF(pifReq PIF) (pifs []PIF, err error)
GetPIFByDevice(dev string, vlan int) ([]PIF, error)
GetStorageRepository(sr StorageRepository) ([]StorageRepository, error)
GetStorageRepositoryById(id string) (StorageRepository, error)
GetTemplate(template Template) ([]Template, error)
GetAllVDIs() ([]VDI, error)
GetVDIs(vdiReq VDI) ([]VDI, error)
GetVDI(vdiReq VDI) (VDI, error)
CreateVDI(vdiReq CreateVDIReq) (VDI, error)
UpdateVDI(d Disk) error
ResizeVDI(d Disk) error
DeleteVDI(id string) error
CreateAcl(acl Acl) (*Acl, error)
GetAcl(aclReq Acl) (*Acl, error)
DeleteAcl(acl Acl) error
AddTag(id, tag string) error
RemoveTag(id, tag string) error
GetDisks(vm *Vm) ([]Disk, error)
CreateDisk(vm Vm, d Disk) (string, error)
DeleteDisk(vm Vm, d Disk) error
ConnectDisk(d Disk) error
DisconnectDisk(d Disk) error
GetVIF(vifReq *VIF) (*VIF, error)
GetVIFs(vm *Vm) ([]VIF, error)
CreateVIF(vm *Vm, vif *VIF) (*VIF, error)
DeleteVIF(vifReq *VIF) (err error)
DisconnectVIF(vifReq *VIF) (err error)
ConnectVIF(vifReq *VIF) (err error)
GetCdroms(vm *Vm) ([]Disk, error)
EjectCd(id string) error
InsertCd(vmId, cdId string) error
GetBond(bondReq Bond) (*Bond, error)
GetBonds(bondReq Bond) ([]Bond, error)
}