Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrDomainNotFound = errors.New("domain not found")
ErrDomainNotFound error is returned by VirtDomainConnection's Lookup*() methods when the domain in question cannot be found
var ErrSecretNotFound = errors.New("secret not found")
ErrSecretNotFound error is returned by VirtDomainConnection's Lookup*() methods when the domain in question cannot be found
var ErrStoragePoolNotFound = errors.New("storage pool not found")
ErrStoragePoolNotFound error is returned by VirtStorageConnection's LookupByName() method when the pool in question cannot be found
var ErrStorageVolumeNotFound = errors.New("storage volume not found")
ErrStorageVolumeNotFound error is returned by VirtStoragePool's LookupVolumeByName() method when the volume in question cannot be found
Functions ¶
This section is empty.
Types ¶
type DomainState ¶
type DomainState int
DomainState represents a state of a domain
const ( // DOMAIN_NOSTATE means "no state", i.e. that the domain state is undefined DOMAIN_NOSTATE DomainState = iota // DOMAIN_RUNNING means that the domain is running DOMAIN_RUNNING // DOMAIN_BLOCKED means that the domain is blocked on resource DOMAIN_BLOCKED // DOMAIN_PAUSED means that the domain is paused by user DOMAIN_PAUSED // DOMAIN_SHUTDOWN means that the domain is being shut down DOMAIN_SHUTDOWN // DOMAIN_CRASHED means that the domain is crashed DOMAIN_CRASHED // DOMAIN_PMSUSPENDED means that the domain is suspended DOMAIN_PMSUSPENDED // DOMAIN_SHUTOFF means that the domain is shut off DOMAIN_SHUTOFF )
type VirtDomain ¶
type VirtDomain interface { // Create boots the domain Create() error // Destroy destroys the domain Destroy() error // Undefine removes the domain so it will no longer be possible // to locate it using LookupByName() or LookupByUUIDString() Undefine() error // Shutdown shuts down the domain Shutdown() error // State obtains the current state of the domain State() (DomainState, error) // UUIDString returns UUID string for this domain UUIDString() (string, error) // Name returns the name of this domain Name() (string, error) // Xml retrieves xml definition of the domain Xml() (*libvirtxml.Domain, error) }
VirtDomain represents a domain which corresponds to a VM
type VirtDomainConnection ¶
type VirtDomainConnection interface { // Define creates and returns a new domain based on the specified definition DefineDomain(def *libvirtxml.Domain) (VirtDomain, error) // ListAll lists all the domains available on the system ListDomains() ([]VirtDomain, error) // LookupByName tries to locate the domain by name. In case if the // domain cannot be found but no other error occurred, it returns // ErrDomainNotFound LookupDomainByName(name string) (VirtDomain, error) // LookupDomainByUUIDString tries to locate the domain by its UUID. In case if the // domain cannot be found but no other error occurred, it returns // ErrDomainNotFound LookupDomainByUUIDString(uuid string) (VirtDomain, error) // DefineSecret defines a Secret with the specified value DefineSecret(def *libvirtxml.Secret) (VirtSecret, error) // LookupSecretByUUIDString tries to locate the secret by its UUID. In case if the // secret cannot be found but no other error occurred, it returns // ErrSecretNotFound LookupSecretByUUIDString(uuid string) (VirtSecret, error) // LookupSecretByUsageName tries to locate the secret by its Usage name. In case if the // secret cannot be found but no other error occurred, it returns // ErrSecretNotFound LookupSecretByUsageName(usageType string, usageName string) (VirtSecret, error) }
VirtDomainConnection provides operations on domains that correspond to VMs
type VirtSecret ¶
type VirtSecret interface { // SetValue sets the value of the secret SetValue(value []byte) error // Remove removes the secret Remove() error }
Secret represents a secret that's used by the domain
type VirtStorageConnection ¶
type VirtStorageConnection interface { // CreateStoragePool creates a storage pool based on the specified definition CreateStoragePool(def *libvirtxml.StoragePool) (VirtStoragePool, error) // LookupByName tries to locate the storage pool by its // UUID. In case if the domain cannot be found but no other // error occurred, it returns ErrStoragePoolNotFound LookupStoragePoolByName(name string) (VirtStoragePool, error) }
VirtStorageConnection provides operations on the storage pools and storage volumes
type VirtStoragePool ¶
type VirtStoragePool interface { // CreateStorageVol creates a new storage volume based on the specified definition CreateStorageVol(def *libvirtxml.StorageVolume) (VirtStorageVolume, error) // ListAllVolumes lists all storage volumes available in the pool ListAllVolumes() ([]VirtStorageVolume, error) // LookupVolumeByName tries to locate the storage volume by its // UUID. In case if the domain cannot be found but no other // error occurred, it returns ErrStorageVolumeNotFound LookupVolumeByName(name string) (VirtStorageVolume, error) // RemoveVolumeByName removes the storage volume with the // specified name RemoveVolumeByName(name string) error }
VirtStoragePool represents a pool of volumes
type VirtStorageVolume ¶
type VirtStorageVolume interface { // Name returns the name of this storage volume Name() string // Size returns the size of this storage volume Size() (uint64, error) // Size returns the path to the file representing this storage volume Path() (string, error) // Remove removes this storage volume Remove() error // Format formats the volume as ext4 filesystem Format() error }