Documentation ¶
Index ¶
- Constants
- Variables
- func ClusterGroupToAPI(clusterGroup *cluster.ClusterGroup, nodes []string) *api.ClusterGroup
- func CreateInstanceConfig(ctx context.Context, tx *sql.Tx, id int, config map[string]string) error
- func DqliteLatestSegment() (string, error)
- func ExpandInstanceConfig(config map[string]string, profiles []api.Profile) map[string]string
- func ExpandInstanceDevices(devices deviceConfig.Devices, profiles []api.Profile) deviceConfig.Devices
- func NetworkStateToAPIStatus(state NetworkState) string
- func NewTestDqliteServer(t *testing.T) (string, driver.NodeStore, func())
- func StoragePoolStateToAPIStatus(state StoragePoolState) string
- func StoragePoolVolumeTypeToName(volumeType int) (string, error)
- func TxCommit(tx *sql.Tx) error
- func UpdateInstance(tx *sql.Tx, id int, description string, architecture int, ephemeral bool, ...) error
- type Cluster
- func (c *Cluster) Begin() (*sql.Tx, error)
- func (c *Cluster) Close() error
- func (c *Cluster) DB() *sql.DB
- func (c *Cluster) DeleteNetworkPeer(networkID int64, peerID int64) error
- func (c *Cluster) EnterExclusive() error
- func (c *Cluster) ExitExclusive(ctx context.Context, f func(context.Context, *ClusterTx) error) error
- func (c *Cluster) GetNetworkPeersTargetNetworkIDs(projectName string, networkType NetworkType) (map[NetworkPeer]int64, error)
- func (c *Cluster) GetNodeID() int64
- func (c *Cluster) LocalNodeIsEvacuated() bool
- func (c *Cluster) NodeID(id int64)
- func (c *Cluster) Transaction(ctx context.Context, f func(context.Context, *ClusterTx) error) error
- func (c *Cluster) UpdateNetworkZone(id int64, config *api.NetworkZonePut) error
- type ClusterRole
- type ClusterTx
- func (c *ClusterTx) AddImageToLocalNode(ctx context.Context, project, fingerprint string) error
- func (c *ClusterTx) AddNodeToClusterGroup(ctx context.Context, groupName string, nodeName string) error
- func (c *ClusterTx) BootstrapNode(name string, address string) error
- func (c *ClusterTx) ClearNode(ctx context.Context, id int64) error
- func (c *ClusterTx) Config(ctx context.Context) (map[string]string, error)
- func (c *ClusterTx) CopyDefaultImageProfiles(ctx context.Context, id int, newID int) error
- func (c *ClusterTx) CreateImage(ctx context.Context, project string, fp string, fname string, sz int64, ...) error
- func (c *ClusterTx) CreateImageAlias(ctx context.Context, projectName, aliasName string, imageID int, desc string) error
- func (c *ClusterTx) CreateImageSource(ctx context.Context, id int, server string, protocol string, ...) error
- func (c *ClusterTx) CreateInstanceBackup(ctx context.Context, args InstanceBackup) error
- func (c *ClusterTx) CreateInstanceConfig(ctx context.Context, id int, config map[string]string) error
- func (c *ClusterTx) CreateNetwork(ctx context.Context, projectName string, name string, description string, ...) (int64, error)
- func (c *ClusterTx) CreateNetworkACL(ctx context.Context, projectName string, info *api.NetworkACLsPost) (int64, error)
- func (c *ClusterTx) CreateNetworkConfig(networkID, nodeID int64, config map[string]string) error
- func (c *ClusterTx) CreateNetworkForward(ctx context.Context, networkID int64, memberSpecific bool, ...) (int64, error)
- func (c *ClusterTx) CreateNetworkLoadBalancer(ctx context.Context, networkID int64, memberSpecific bool, ...) (int64, error)
- func (c *ClusterTx) CreateNetworkPeer(ctx context.Context, networkID int64, info *api.NetworkPeersPost) (int64, bool, error)
- func (c *ClusterTx) CreateNetworkZone(ctx context.Context, projectName string, info *api.NetworkZonesPost) (int64, error)
- func (c *ClusterTx) CreateNetworkZoneRecord(ctx context.Context, zone int64, info api.NetworkZoneRecordsPost) (int64, error)
- func (c *ClusterTx) CreateNode(name string, address string) (int64, error)
- func (c *ClusterTx) CreateNodeWithArch(name string, address string, arch int) (int64, error)
- func (c *ClusterTx) CreatePendingNetwork(ctx context.Context, node string, projectName string, name string, ...) error
- func (c *ClusterTx) CreatePendingStoragePool(ctx context.Context, node string, name string, driver string, ...) error
- func (c *ClusterTx) CreateStoragePool(ctx context.Context, poolName string, poolDescription string, ...) (int64, error)
- func (c *ClusterTx) CreateStoragePoolBucket(ctx context.Context, poolID int64, projectName string, memberSpecific bool, ...) (int64, error)
- func (c *ClusterTx) CreateStoragePoolBucketBackup(ctx context.Context, args StoragePoolBucketBackup) error
- func (c *ClusterTx) CreateStoragePoolBucketKey(ctx context.Context, bucketID int64, info api.StorageBucketKeysPost) (int64, error)
- func (c *ClusterTx) CreateStoragePoolConfig(poolID, nodeID int64, config map[string]string) error
- func (c *ClusterTx) CreateStoragePoolVolume(ctx context.Context, projectName string, volumeName string, ...) (int64, error)
- func (c *ClusterTx) CreateStoragePoolVolumeBackup(ctx context.Context, args StoragePoolVolumeBackup) error
- func (c *ClusterTx) CreateStorageVolumeSnapshot(ctx context.Context, projectName string, volumeName string, ...) (int64, error)
- func (c *ClusterTx) DeleteImage(ctx context.Context, id int) error
- func (c *ClusterTx) DeleteImageAlias(ctx context.Context, projectName string, name string) error
- func (c *ClusterTx) DeleteInstance(ctx context.Context, project, name string) error
- func (c *ClusterTx) DeleteInstanceBackup(ctx context.Context, name string) error
- func (c *ClusterTx) DeleteInstanceConfigKey(ctx context.Context, id int64, key string) error
- func (c *ClusterTx) DeleteNetwork(ctx context.Context, project string, name string) error
- func (c *ClusterTx) DeleteNetworkACL(ctx context.Context, id int64) error
- func (c *ClusterTx) DeleteNetworkForward(ctx context.Context, networkID int64, forwardID int64) error
- func (c *ClusterTx) DeleteNetworkLoadBalancer(ctx context.Context, networkID int64, loadBalancerID int64) error
- func (c *ClusterTx) DeleteNetworkZone(ctx context.Context, id int64) error
- func (c *ClusterTx) DeleteNetworkZoneRecord(ctx context.Context, id int64) error
- func (c *ClusterTx) DeleteReadyStateFromLocalInstances(ctx context.Context) error
- func (c *ClusterTx) DeleteStoragePoolBucket(ctx context.Context, poolID int64, bucketID int64) error
- func (c *ClusterTx) DeleteStoragePoolBucketBackup(ctx context.Context, name string) error
- func (c *ClusterTx) DeleteStoragePoolBucketKey(ctx context.Context, bucketID int64, keyID int64) error
- func (c *ClusterTx) DeleteStoragePoolVolumeBackup(ctx context.Context, name string) error
- func (c *ClusterTx) GetAllNodesWithOperations(ctx context.Context) ([]string, error)
- func (c *ClusterTx) GetCachedImageSourceFingerprint(ctx context.Context, server string, protocol string, alias string, ...) (string, error)
- func (c *ClusterTx) GetCandidateMembers(ctx context.Context, allMembers []NodeInfo, targetArchitectures []int, ...) ([]NodeInfo, error)
- func (c *ClusterTx) GetClusterGroupNodes(ctx context.Context, groupName string) ([]string, error)
- func (c *ClusterTx) GetClusterGroupURIs(ctx context.Context, filter cluster.ClusterGroupFilter) ([]string, error)
- func (c *ClusterTx) GetClusterGroupsWithNode(ctx context.Context, nodeName string) ([]string, error)
- func (c *ClusterTx) GetCreatedNetworkNamesByProject(ctx context.Context, project string) ([]string, error)
- func (c *ClusterTx) GetCreatedNetworks(ctx context.Context) (map[string]map[int64]api.Network, error)
- func (c *ClusterTx) GetCreatedNetworksByProject(ctx context.Context, projectName string) (map[int64]api.Network, error)
- func (c *ClusterTx) GetCreatedStoragePoolNames(ctx context.Context) ([]string, error)
- func (c *ClusterTx) GetCustomVolumesInProject(ctx context.Context, project string) ([]StorageVolumeArgs, error)
- func (c *ClusterTx) GetExpiredInstanceBackups(ctx context.Context) ([]InstanceBackup, error)
- func (c *ClusterTx) GetExpiredStorageBucketBackups(ctx context.Context) ([]StoragePoolBucketBackup, error)
- func (c *ClusterTx) GetExpiredStorageVolumeBackups(ctx context.Context) ([]StoragePoolVolumeBackup, error)
- func (c *ClusterTx) GetExpiredStorageVolumeSnapshots(ctx context.Context, memberSpecific bool) ([]StorageVolumeArgs, error)
- func (c *ClusterTx) GetFailureDomainsNames(ctx context.Context) (map[uint64]string, error)
- func (c *ClusterTx) GetImage(ctx context.Context, fingerprintPrefix string, filter cluster.ImageFilter) (int, *api.Image, error)
- func (c *ClusterTx) GetImageAlias(ctx context.Context, projectName string, imageName string, ...) (int, api.ImageAliasesEntry, error)
- func (c *ClusterTx) GetImageAliases(ctx context.Context, projectName string) ([]string, error)
- func (c *ClusterTx) GetImageByFingerprintPrefix(ctx context.Context, fingerprintPrefix string, filter cluster.ImageFilter) (int, *api.Image, error)
- func (c *ClusterTx) GetImageFromAnyProject(ctx context.Context, fingerprint string) (int, *api.Image, error)
- func (c *ClusterTx) GetImageSource(ctx context.Context, imageID int) (int, api.ImageSource, error)
- func (c *ClusterTx) GetImages(ctx context.Context) (map[string][]string, error)
- func (c *ClusterTx) GetImagesFingerprints(ctx context.Context, projectName string, publicOnly bool) ([]string, error)
- func (c *ClusterTx) GetImagesOnLocalNode(ctx context.Context) (map[string][]string, error)
- func (c *ClusterTx) GetImagesOnNode(ctx context.Context, id int64) (map[string][]string, error)
- func (c *ClusterTx) GetInstanceBackup(ctx context.Context, projectName string, name string) (InstanceBackup, error)
- func (c *ClusterTx) GetInstanceBackupWithID(ctx context.Context, backupID int) (InstanceBackup, error)
- func (c *ClusterTx) GetInstanceBackups(ctx context.Context, projectName string, name string) ([]string, error)
- func (c *ClusterTx) GetInstanceConfig(ctx context.Context, id int, key string) (string, error)
- func (c *ClusterTx) GetInstanceID(ctx context.Context, project, name string) (int, error)
- func (c *ClusterTx) GetInstanceNames(ctx context.Context, project string) ([]string, error)
- func (c *ClusterTx) GetInstancePool(ctx context.Context, projectName string, instanceName string) (string, error)
- func (c *ClusterTx) GetInstanceProjectAndName(ctx context.Context, id int) (string, string, error)
- func (c *ClusterTx) GetInstanceSnapshotID(ctx context.Context, project, instance, name string) (int, error)
- func (c *ClusterTx) GetInstanceSnapshotsNames(ctx context.Context, project, name string) ([]string, error)
- func (c *ClusterTx) GetInstanceSnapshotsWithName(ctx context.Context, project string, name string) ([]cluster.Instance, error)
- func (c *ClusterTx) GetInstancesByMemberAddress(ctx context.Context, offlineThreshold time.Duration, projects []string, ...) (map[string][]Instance, error)
- func (c *ClusterTx) GetInstancesWithProfile(ctx context.Context, project, profile string) (map[string][]string, error)
- func (c *ClusterTx) GetLocalExpiredInstanceSnapshots(ctx context.Context) ([]cluster.InstanceSnapshot, error)
- func (c *ClusterTx) GetLocalImagesFingerprints(ctx context.Context) ([]string, error)
- func (c *ClusterTx) GetLocalInstanceWithVsockID(ctx context.Context, vsockID int) (*cluster.Instance, error)
- func (c *ClusterTx) GetLocalInstancesInProject(ctx context.Context, filter cluster.InstanceFilter) ([]cluster.Instance, error)
- func (c *ClusterTx) GetLocalNodeAddress(ctx context.Context) (string, error)
- func (c *ClusterTx) GetLocalNodeName(ctx context.Context) (string, error)
- func (c *ClusterTx) GetLocalStoragePoolVolumeSnapshotsWithType(ctx context.Context, projectName string, volumeName string, volumeType int, ...) ([]StorageVolumeArgs, error)
- func (c *ClusterTx) GetNetworkACL(ctx context.Context, projectName string, name string) (int64, *api.NetworkACL, error)
- func (c *ClusterTx) GetNetworkACLIDsByNames(ctx context.Context, project string) (map[string]int64, error)
- func (c *ClusterTx) GetNetworkACLNameAndProjectWithID(ctx context.Context, networkACLID int) (string, string, error)
- func (c *ClusterTx) GetNetworkACLURIs(ctx context.Context, projectID int, project string) ([]string, error)
- func (c *ClusterTx) GetNetworkACLs(ctx context.Context, project string) ([]string, error)
- func (c *ClusterTx) GetNetworkForward(ctx context.Context, networkID int64, memberSpecific bool, ...) (int64, *api.NetworkForward, error)
- func (c *ClusterTx) GetNetworkForwardListenAddresses(ctx context.Context, networkID int64, memberSpecific bool) (map[int64]string, error)
- func (c *ClusterTx) GetNetworkForwards(ctx context.Context, networkID int64, memberSpecific bool, ...) (map[int64]*api.NetworkForward, error)
- func (c *ClusterTx) GetNetworkID(ctx context.Context, projectName string, name string) (int64, error)
- func (c *ClusterTx) GetNetworkInAnyState(ctx context.Context, projectName string, networkName string) (int64, *api.Network, map[int64]NetworkNode, error)
- func (c *ClusterTx) GetNetworkLoadBalancer(ctx context.Context, networkID int64, memberSpecific bool, ...) (int64, *api.NetworkLoadBalancer, error)
- func (c *ClusterTx) GetNetworkLoadBalancerListenAddresses(ctx context.Context, networkID int64, memberSpecific bool) (map[int64]string, error)
- func (c *ClusterTx) GetNetworkLoadBalancers(ctx context.Context, networkID int64, memberSpecific bool, ...) (map[int64]*api.NetworkLoadBalancer, error)
- func (c *ClusterTx) GetNetworkNameAndProjectWithID(ctx context.Context, networkID int) (string, string, error)
- func (c *ClusterTx) GetNetworkPeer(ctx context.Context, networkID int64, peerName string) (int64, *api.NetworkPeer, error)
- func (c *ClusterTx) GetNetworkPeerNames(ctx context.Context, networkID int64) (map[int64]string, error)
- func (c *ClusterTx) GetNetworkPeers(ctx context.Context, networkID int64) (map[int64]*api.NetworkPeer, error)
- func (c *ClusterTx) GetNetworkPeersURLByIntegration(ctx context.Context, networkIntegration string) ([]string, error)
- func (c *ClusterTx) GetNetworkURIs(ctx context.Context, projectID int, project string) ([]string, error)
- func (c *ClusterTx) GetNetworkZone(ctx context.Context, name string) (int64, string, *api.NetworkZone, error)
- func (c *ClusterTx) GetNetworkZoneByProject(ctx context.Context, projectName string, name string) (int64, *api.NetworkZone, error)
- func (c *ClusterTx) GetNetworkZoneKeys(ctx context.Context) (map[string]string, error)
- func (c *ClusterTx) GetNetworkZoneRecord(ctx context.Context, zone int64, name string) (int64, *api.NetworkZoneRecord, error)
- func (c *ClusterTx) GetNetworkZoneRecordNames(ctx context.Context, zone int64) ([]string, error)
- func (c *ClusterTx) GetNetworkZones(ctx context.Context) (map[string]string, error)
- func (c *ClusterTx) GetNetworkZonesByProject(ctx context.Context, project string) ([]string, error)
- func (c *ClusterTx) GetNetworks(ctx context.Context, project string) ([]string, error)
- func (c *ClusterTx) GetNetworksLocalConfig(ctx context.Context) (map[string]map[string]string, error)
- func (c *ClusterTx) GetNextInstanceSnapshotIndex(ctx context.Context, project string, name string, pattern string) int
- func (c *ClusterTx) GetNextStorageVolumeSnapshotIndex(ctx context.Context, pool, name string, typ int, pattern string) int
- func (c *ClusterTx) GetNodeAddressOfInstance(ctx context.Context, project string, name string, instType instancetype.Type) (string, error)
- func (c *ClusterTx) GetNodeByAddress(ctx context.Context, address string) (NodeInfo, error)
- func (c *ClusterTx) GetNodeByName(ctx context.Context, name string) (NodeInfo, error)
- func (c *ClusterTx) GetNodeFailureDomain(ctx context.Context, id int64) (string, error)
- func (c *ClusterTx) GetNodeID() int64
- func (c *ClusterTx) GetNodeMaxVersion(ctx context.Context) ([2]int, error)
- func (c *ClusterTx) GetNodeOfflineThreshold(ctx context.Context) (time.Duration, error)
- func (c *ClusterTx) GetNodeWithID(ctx context.Context, nodeID int) (NodeInfo, error)
- func (c *ClusterTx) GetNodeWithLeastInstances(ctx context.Context, members []NodeInfo) (*NodeInfo, error)
- func (c *ClusterTx) GetNodes(ctx context.Context) ([]NodeInfo, error)
- func (c *ClusterTx) GetNodesCount(ctx context.Context) (int, error)
- func (c *ClusterTx) GetNodesFailureDomains(ctx context.Context) (map[string]uint64, error)
- func (c *ClusterTx) GetNodesWithImage(ctx context.Context, fingerprint string) ([]string, error)
- func (c *ClusterTx) GetNodesWithImageAndAutoUpdate(ctx context.Context, fingerprint string, autoUpdate bool) ([]string, error)
- func (c *ClusterTx) GetNodesWithOperations(ctx context.Context, project string) ([]string, error)
- func (c *ClusterTx) GetNodesWithoutImage(ctx context.Context, fingerprint string) ([]string, error)
- func (c *ClusterTx) GetNonPendingNetworkIDs(ctx context.Context) (map[string]map[string]int64, error)
- func (c *ClusterTx) GetNonPendingStoragePoolsNamesToIDs(ctx context.Context) (map[string]int64, error)
- func (c *ClusterTx) GetOperationsOfType(ctx context.Context, projectName string, opType operationtype.Type) ([]cluster.Operation, error)
- func (c *ClusterTx) GetPendingNodeByAddress(ctx context.Context, address string) (NodeInfo, error)
- func (c *ClusterTx) GetPoolNamesFromIDs(ctx context.Context, poolIDs []int64) ([]string, error)
- func (c *ClusterTx) GetPoolsWithImage(ctx context.Context, imageFingerprint string) ([]int64, error)
- func (c *ClusterTx) GetProfile(ctx context.Context, project, name string) (int64, *api.Profile, error)
- func (c *ClusterTx) GetProfileNames(ctx context.Context, project string) ([]string, error)
- func (c *ClusterTx) GetProfiles(ctx context.Context, projectName string, profileNames []string) ([]api.Profile, error)
- func (c *ClusterTx) GetProjectNetworkForwardListenAddressesByUplink(ctx context.Context, uplinkNetworkName string, memberSpecific bool) (map[string]map[string][]string, error)
- func (c *ClusterTx) GetProjectNetworkForwardListenAddressesOnMember(ctx context.Context) (map[string]map[int64][]string, error)
- func (c *ClusterTx) GetProjectNetworkLoadBalancerListenAddressesByUplink(ctx context.Context, uplinkNetworkName string, memberSpecific bool) (map[string]map[string][]string, error)
- func (c *ClusterTx) GetProjectNetworkLoadBalancerListenAddressesOnMember(ctx context.Context) (map[string]map[int64][]string, error)
- func (c *ClusterTx) GetProjectsUsingImage(ctx context.Context, fingerprint string) ([]string, error)
- func (c *ClusterTx) GetStoragePool(ctx context.Context, poolName string) (int64, *api.StoragePool, map[int64]StoragePoolNode, error)
- func (c *ClusterTx) GetStoragePoolBucket(ctx context.Context, poolID int64, projectName string, memberSpecific bool, ...) (*StorageBucket, error)
- func (c *ClusterTx) GetStoragePoolBucketBackup(ctx context.Context, projectName string, poolName string, backupName string) (StoragePoolBucketBackup, error)
- func (c *ClusterTx) GetStoragePoolBucketBackupsName(ctx context.Context, projectName string, bucketName string) ([]string, error)
- func (c *ClusterTx) GetStoragePoolBucketKey(ctx context.Context, bucketID int64, keyName string) (*StorageBucketKey, error)
- func (c *ClusterTx) GetStoragePoolBucketKeys(ctx context.Context, bucketID int64, filters ...StorageBucketKeyFilter) ([]*StorageBucketKey, error)
- func (c *ClusterTx) GetStoragePoolBucketWithID(ctx context.Context, bucketID int) (StorageBucket, error)
- func (c *ClusterTx) GetStoragePoolBuckets(ctx context.Context, memberSpecific bool, filters ...StorageBucketFilter) ([]*StorageBucket, error)
- func (c *ClusterTx) GetStoragePoolDriver(ctx context.Context, id int64) (string, error)
- func (c *ClusterTx) GetStoragePoolDrivers(ctx context.Context) ([]string, error)
- func (c *ClusterTx) GetStoragePoolID(ctx context.Context, name string) (int64, error)
- func (c *ClusterTx) GetStoragePoolInAnyState(ctx context.Context, poolName string) (int64, *api.StoragePool, map[int64]StoragePoolNode, error)
- func (c *ClusterTx) GetStoragePoolLocalBucket(ctx context.Context, bucketName string) (*StorageBucket, error)
- func (c *ClusterTx) GetStoragePoolLocalBucketByAccessKey(ctx context.Context, accessKey string) (*StorageBucket, error)
- func (c *ClusterTx) GetStoragePoolNames(ctx context.Context) ([]string, error)
- func (c *ClusterTx) GetStoragePoolNodeConfigs(ctx context.Context, poolID int64) (map[string]map[string]string, error)
- func (c *ClusterTx) GetStoragePoolNodeVolumeID(ctx context.Context, projectName string, volumeName string, volumeType int, ...) (int64, error)
- func (c *ClusterTx) GetStoragePoolVolume(ctx context.Context, poolID int64, projectName string, volumeType int, ...) (*StorageVolume, error)
- func (c *ClusterTx) GetStoragePoolVolumeBackup(ctx context.Context, projectName string, poolName string, backupName string) (StoragePoolVolumeBackup, error)
- func (c *ClusterTx) GetStoragePoolVolumeBackupWithID(ctx context.Context, backupID int) (StoragePoolVolumeBackup, error)
- func (c *ClusterTx) GetStoragePoolVolumeBackups(ctx context.Context, projectName string, volumeName string, poolID int64) ([]StoragePoolVolumeBackup, error)
- func (c *ClusterTx) GetStoragePoolVolumeBackupsNames(ctx context.Context, projectName string, volumeName string, poolID int64) ([]string, error)
- func (c *ClusterTx) GetStoragePoolVolumeWithID(ctx context.Context, volumeID int) (StorageVolumeArgs, error)
- func (c *ClusterTx) GetStoragePoolVolumes(ctx context.Context, poolID int64, memberSpecific bool, ...) ([]*StorageVolume, error)
- func (c *ClusterTx) GetStoragePoolVolumesWithType(ctx context.Context, volumeType int, memberSpecific bool) ([]StorageVolumeArgs, error)
- func (c *ClusterTx) GetStoragePoolWithID(ctx context.Context, poolID int) (int64, *api.StoragePool, map[int64]StoragePoolNode, error)
- func (c *ClusterTx) GetStoragePools(ctx context.Context, state *StoragePoolState, poolNames ...string) (map[int64]api.StoragePool, map[int64]map[int64]StoragePoolNode, error)
- func (c *ClusterTx) GetStoragePoolsLocalConfig(ctx context.Context) (map[string]map[string]string, error)
- func (c *ClusterTx) GetStorageVolumeNodes(ctx context.Context, poolID int64, projectName string, volumeName string, ...) ([]NodeInfo, error)
- func (c *ClusterTx) GetStorageVolumeSnapshotExpiry(ctx context.Context, volumeID int64) (time.Time, error)
- func (c *ClusterTx) GetStorageVolumeSnapshotWithID(ctx context.Context, snapshotID int) (StorageVolumeArgs, error)
- func (c *ClusterTx) GetStorageVolumeURIs(ctx context.Context, project string) ([]string, error)
- func (c *ClusterTx) GetURIFromEntity(ctx context.Context, entityType int, entityID int) (string, error)
- func (c *ClusterTx) ImageExists(ctx context.Context, project string, fingerprint string) (bool, error)
- func (c *ClusterTx) ImageIsReferencedByOtherProjects(ctx context.Context, project string, fingerprint string) (bool, error)
- func (c *ClusterTx) InstanceList(ctx context.Context, ...) error
- func (c *ClusterTx) InstancesToInstanceArgs(ctx context.Context, fillProfiles bool, instances ...cluster.Instance) (map[int]InstanceArgs, error)
- func (c *ClusterTx) IsRemoteStorage(ctx context.Context, poolID int64) (bool, error)
- func (c *ClusterTx) LocateImage(ctx context.Context, fingerprint string) (string, error)
- func (c *ClusterTx) MoveImageAlias(ctx context.Context, source int, destination int) error
- func (c *ClusterTx) NetworkCreated(project string, name string) error
- func (c *ClusterTx) NetworkErrored(project string, name string) error
- func (c *ClusterTx) NetworkNodeConfigs(ctx context.Context, networkID int64) (map[string]map[string]string, error)
- func (c *ClusterTx) NetworkNodeCreated(networkID int64) error
- func (c *ClusterTx) NetworkNodeJoin(networkID, nodeID int64) error
- func (c *ClusterTx) NetworkNodes(ctx context.Context, networkID int64) (map[int64]NetworkNode, error)
- func (c *ClusterTx) NodeID(id int64)
- func (c *ClusterTx) NodeIsEmpty(ctx context.Context, id int64) (string, error)
- func (c *ClusterTx) NodeIsOutdated(ctx context.Context) (bool, error)
- func (c *ClusterTx) RemoveNode(id int64) error
- func (c *ClusterTx) RemoveNodeFromClusterGroup(ctx context.Context, groupName string, nodeName string) error
- func (c *ClusterTx) RemoveStoragePool(ctx context.Context, poolName string) (*api.StoragePool, error)
- func (c *ClusterTx) RemoveStoragePoolVolume(ctx context.Context, projectName string, volumeName string, volumeType int, ...) error
- func (c *ClusterTx) RemoveUnreferencedProfiles(ctx context.Context) error
- func (c *ClusterTx) RenameBucketBackup(ctx context.Context, oldName, newName string) error
- func (c *ClusterTx) RenameImageAlias(ctx context.Context, id int, name string) error
- func (c *ClusterTx) RenameInstanceBackup(ctx context.Context, oldName, newName string) error
- func (c *ClusterTx) RenameNetwork(ctx context.Context, project string, oldName string, newName string) error
- func (c *ClusterTx) RenameNetworkACL(ctx context.Context, id int64, newName string) error
- func (c *ClusterTx) RenameNode(ctx context.Context, old string, new string) error
- func (c *ClusterTx) RenameStoragePoolVolume(ctx context.Context, projectName string, oldVolumeName string, ...) error
- func (c *ClusterTx) RenameVolumeBackup(ctx context.Context, oldName, newName string) error
- func (c *ClusterTx) SetDescription(id int64, description string) error
- func (c *ClusterTx) SetImageCachedAndLastUseDate(ctx context.Context, projectName string, fingerprint string, ...) error
- func (c *ClusterTx) SetNodeHeartbeat(address string, heartbeat time.Time) error
- func (c *ClusterTx) SetNodePendingFlag(id int64, pending bool) error
- func (c *ClusterTx) SetNodeVersion(id int64, version [2]int) error
- func (c *ClusterTx) StoragePoolCreated(name string) error
- func (c *ClusterTx) StoragePoolErrored(name string) error
- func (c *ClusterTx) StoragePoolNodeCreated(poolID int64) error
- func (c *ClusterTx) Tx() *sql.Tx
- func (c *ClusterTx) UpdateClusterConfig(values map[string]string) error
- func (c *ClusterTx) UpdateImage(ctx context.Context, id int, fname string, sz int64, public bool, ...) error
- func (c *ClusterTx) UpdateImageAlias(ctx context.Context, aliasID int, imageID int, desc string) error
- func (c *ClusterTx) UpdateImageLastUseDate(ctx context.Context, projectName string, fingerprint string, ...) error
- func (c *ClusterTx) UpdateInstanceConfig(id int, values map[string]string) error
- func (c *ClusterTx) UpdateInstanceLastUsedDate(id int, date time.Time) error
- func (c *ClusterTx) UpdateInstanceNode(ctx context.Context, project string, oldName string, newName string, ...) error
- func (c *ClusterTx) UpdateInstancePowerState(id int, state string) error
- func (c *ClusterTx) UpdateInstanceSnapshot(id int, description string, expiryDate time.Time) error
- func (c *ClusterTx) UpdateInstanceSnapshotConfig(id int, values map[string]string) error
- func (c *ClusterTx) UpdateInstanceSnapshotCreationDate(ctx context.Context, instanceID int, date time.Time) error
- func (c *ClusterTx) UpdateInstanceStatefulFlag(ctx context.Context, id int, stateful bool) error
- func (c *ClusterTx) UpdateNetwork(ctx context.Context, project string, name, description string, ...) error
- func (c *ClusterTx) UpdateNetworkACL(ctx context.Context, id int64, config *api.NetworkACLPut) error
- func (c *ClusterTx) UpdateNetworkForward(ctx context.Context, networkID int64, forwardID int64, ...) error
- func (c *ClusterTx) UpdateNetworkLoadBalancer(ctx context.Context, networkID int64, loadBalancerID int64, ...) error
- func (c *ClusterTx) UpdateNetworkPeer(ctx context.Context, networkID int64, peerID int64, info *api.NetworkPeerPut) error
- func (c *ClusterTx) UpdateNetworkZoneRecord(ctx context.Context, id int64, config api.NetworkZoneRecordPut) error
- func (c *ClusterTx) UpdateNodeClusterGroups(ctx context.Context, id int64, groups []string) error
- func (c *ClusterTx) UpdateNodeConfig(ctx context.Context, id int64, config map[string]string) error
- func (c *ClusterTx) UpdateNodeFailureDomain(ctx context.Context, id int64, domain string) error
- func (c *ClusterTx) UpdateNodeRoles(id int64, roles []ClusterRole) error
- func (c *ClusterTx) UpdateNodeStatus(id int64, state int) error
- func (c *ClusterTx) UpdateRemoteStoragePoolAfterNodeJoin(ctx context.Context, poolID int64, nodeID int64) error
- func (c *ClusterTx) UpdateStoragePool(ctx context.Context, poolName, description string, ...) error
- func (c *ClusterTx) UpdateStoragePoolAfterNodeJoin(poolID, nodeID int64) error
- func (c *ClusterTx) UpdateStoragePoolBucket(ctx context.Context, poolID int64, bucketID int64, info *api.StorageBucketPut) error
- func (c *ClusterTx) UpdateStoragePoolBucketKey(ctx context.Context, bucketID int64, bucketKeyID int64, ...) error
- func (c *ClusterTx) UpdateStoragePoolVolume(ctx context.Context, projectName string, volumeName string, volumeType int, ...) error
- func (c *ClusterTx) UpdateStorageVolumeNode(ctx context.Context, projectName string, oldName string, newName string, ...) error
- func (c *ClusterTx) UpdateStorageVolumeSnapshot(ctx context.Context, projectName string, volumeName string, volumeType int, ...) error
- func (c *ClusterTx) UpdateWarningState(UUID string, message string, status warningtype.Status) error
- func (c *ClusterTx) UpdateWarningStatus(UUID string, status warningtype.Status) error
- func (c *ClusterTx) UpsertWarning(ctx context.Context, nodeName string, projectName string, entityTypeCode int, ...) error
- func (c *ClusterTx) UpsertWarningLocalNode(ctx context.Context, projectName string, entityTypeCode int, entityID int, ...) error
- type DB
- type Instance
- type InstanceArgs
- type InstanceBackup
- type NetworkNode
- type NetworkPeer
- type NetworkState
- type NetworkType
- type Node
- type NodeInfo
- type NodeInfoArgs
- type NodeTx
- func (n *NodeTx) Config(ctx context.Context) (map[string]string, error)
- func (n *NodeTx) CreateFirstRaftNode(address string, name string) error
- func (n *NodeTx) CreateRaftNode(address string, name string) (int64, error)
- func (n *NodeTx) GetCertificates(ctx context.Context) ([]cluster.Certificate, error)
- func (n *NodeTx) GetRaftNodeAddress(ctx context.Context, id int64) (string, error)
- func (n *NodeTx) GetRaftNodeAddresses(ctx context.Context) ([]string, error)
- func (n *NodeTx) GetRaftNodes(ctx context.Context) ([]RaftNode, error)
- func (n *NodeTx) RemoveRaftNode(id int64) error
- func (n *NodeTx) ReplaceCertificates(certs []cluster.Certificate) error
- func (n *NodeTx) ReplaceRaftNodes(nodes []RaftNode) error
- func (n *NodeTx) UpdateConfig(values map[string]string) error
- type RaftNode
- type RaftRole
- type StorageBucket
- type StorageBucketFilter
- type StorageBucketKey
- type StorageBucketKeyFilter
- type StoragePoolBucketBackup
- type StoragePoolNode
- type StoragePoolState
- type StoragePoolVolumeBackup
- type StorageVolume
- type StorageVolumeArgs
- type StorageVolumeFilter
Constants ¶
const ( ClusterMemberStateCreated = 0 ClusterMemberStatePending = 1 ClusterMemberStateEvacuated = 2 )
Numeric type codes identifying different cluster member states.
const ( RaftVoter = client.Voter RaftStandBy = client.StandBy RaftSpare = client.Spare )
RaftNode roles.
const ( StoragePoolVolumeTypeContainer = iota StoragePoolVolumeTypeImage StoragePoolVolumeTypeCustom StoragePoolVolumeTypeVM )
XXX: this was extracted from storage_volume_utils.go, we find a way to factor it independently from both the db and main packages.
const ( StoragePoolVolumeTypeNameContainer string = "container" StoragePoolVolumeTypeNameVM string = "virtual-machine" StoragePoolVolumeTypeNameImage string = "image" StoragePoolVolumeTypeNameCustom string = "custom" )
Leave the string type in here! This guarantees that go treats this is as a typed string constant. Removing it causes go to treat these as untyped string constants which is not what we want.
const ( StoragePoolVolumeContentTypeFS = iota StoragePoolVolumeContentTypeBlock StoragePoolVolumeContentTypeISO )
Content types.
const ( StoragePoolVolumeContentTypeNameFS string = "filesystem" StoragePoolVolumeContentTypeNameBlock string = "block" StoragePoolVolumeContentTypeNameISO string = "iso" )
Content type names.
const ClusterRoleDatabase = ClusterRole("database")
ClusterRoleDatabase represents the database role in a cluster.
const ClusterRoleDatabaseLeader = ClusterRole("database-leader")
ClusterRoleDatabaseLeader represents the database leader role in a cluster.
const ClusterRoleDatabaseStandBy = ClusterRole("database-standby")
ClusterRoleDatabaseStandBy represents the database stand-by role in a cluster.
const ClusterRoleEventHub = ClusterRole("event-hub")
ClusterRoleEventHub represents a cluster member who operates as an event hub.
const ClusterRoleOVNChassis = ClusterRole("ovn-chassis")
ClusterRoleOVNChassis represents a cluster member who operates as an OVN chassis.
const DefaultOfflineThreshold = 20
DefaultOfflineThreshold is the default value for the cluster.offline_threshold configuration key, expressed in seconds.
Variables ¶
var ( // ErrAlreadyDefined hapens when the given entry already exists, // for example a container. ErrAlreadyDefined = fmt.Errorf("The record already exists") // ErrNoClusterMember is used to indicate no cluster member has been found for a resource. ErrNoClusterMember = fmt.Errorf("No cluster member found") )
var ClusterRoles = map[int]ClusterRole{ 1: ClusterRoleEventHub, 2: ClusterRoleOVNChassis, }
ClusterRoles maps role ids into human-readable names.
Note: the database role is currently stored directly in the raft configuration which acts as single source of truth for it. This map should only contain Incus-specific cluster roles.
var ErrInstanceListStop = fmt.Errorf("search stopped")
ErrInstanceListStop used as return value from InstanceList's instanceFunc when prematurely stopping the search.
var ErrSomeNodesAreBehind = fmt.Errorf("some nodes are behind this node's version")
ErrSomeNodesAreBehind is returned by OpenCluster if some of the nodes in the cluster have a schema or API version that is less recent than this node.
var ErrUnknownEntityID = fmt.Errorf("Unknown entity ID")
ErrUnknownEntityID describes the unknown entity ID error.
var ImageSourceProtocol = map[int]string{
0: "incus",
1: "direct",
2: "simplestreams",
}
ImageSourceProtocol maps image source protocol codes to human-readable names.
var NodeSpecificNetworkConfig = []string{
"bgp.ipv4.nexthop",
"bgp.ipv6.nexthop",
"bridge.external_interfaces",
"parent",
}
NodeSpecificNetworkConfig lists all network config keys which are node-specific.
var NodeSpecificStorageConfig = []string{
"size",
"source",
"source.wipe",
"volatile.initial_source",
"zfs.pool_name",
"lvm.thinpool_name",
"lvm.vg_name",
"lvm.vg.force_reuse",
}
NodeSpecificStorageConfig lists all storage pool config keys which are node-specific.
var StoragePoolVolumeTypeNames = map[int]string{ StoragePoolVolumeTypeContainer: "container", StoragePoolVolumeTypeImage: "image", StoragePoolVolumeTypeCustom: "custom", StoragePoolVolumeTypeVM: "virtual-machine", }
StoragePoolVolumeTypeNames represents a map of storage volume types and their names.
var StorageRemoteDriverNames func() []string
StorageRemoteDriverNames returns a list of remote storage driver names.
Functions ¶
func ClusterGroupToAPI ¶
func ClusterGroupToAPI(clusterGroup *cluster.ClusterGroup, nodes []string) *api.ClusterGroup
ClusterGroupToAPI is a convenience to convert a ClusterGroup db struct into an API cluster group struct.
func CreateInstanceConfig ¶
CreateInstanceConfig inserts a new config for the instance with the given ID.
func DqliteLatestSegment ¶
DqliteLatestSegment returns the latest segment ID in the global database.
func ExpandInstanceConfig ¶
ExpandInstanceConfig expands the given instance config with the config values of the given profiles.
func ExpandInstanceDevices ¶
func ExpandInstanceDevices(devices deviceConfig.Devices, profiles []api.Profile) deviceConfig.Devices
ExpandInstanceDevices expands the given instance devices with the devices defined in the given profiles.
func NetworkStateToAPIStatus ¶
func NetworkStateToAPIStatus(state NetworkState) string
NetworkStateToAPIStatus converts DB NetworkState to API status string.
func NewTestDqliteServer ¶
NewTestDqliteServer creates a new test dqlite server.
Return the directory backing the test server and a newly created server store that can be used to connect to it.
func StoragePoolStateToAPIStatus ¶
func StoragePoolStateToAPIStatus(state StoragePoolState) string
StoragePoolStateToAPIStatus converts DB StoragePoolState to API status string.
func StoragePoolVolumeTypeToName ¶
StoragePoolVolumeTypeToName converts a volume integer type code to its human-readable name.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster mediates access to data stored in the cluster dqlite database.
func ForLocalInspection ¶
ForLocalInspection is a aid for the hack in initializeDbObject, which sets the db-related Deamon attributes upfront, to be backward compatible with the legacy patches that need to interact with the database.
func ForLocalInspectionWithPreparedStmts ¶
ForLocalInspectionWithPreparedStmts is the same as ForLocalInspection but it also prepares the statements used in auto-generated database code.
func NewTestCluster ¶
NewTestCluster creates a new Cluster for testing purposes, along with a function that can be used to clean it up when done.
func OpenCluster ¶
func OpenCluster(closingCtx context.Context, name string, store driver.NodeStore, address, dir string, timeout time.Duration, options ...driver.Option) (*Cluster, error)
OpenCluster creates a new Cluster object for interacting with the dqlite database.
- name: Basename of the database file holding the data. Typically "db.bin". - dialer: Function used to connect to the dqlite backend via gRPC SQL. - address: Network address of this node (or empty string). - dir: Base database directory (e.g. /var/lib/incus/database) - timeout: Give up trying to open the database after this amount of time.
The address and api parameters will be used to determine if the cluster database matches our version, and possibly trigger a schema update. If the schema update can't be performed right now, because some nodes are still behind, an Upgrading error is returned. Accepts a closingCtx context argument used to indicate when the daemon is shutting down.
func (*Cluster) DB ¶
DB returns the low level database handle to the cluster database.
FIXME: this is used for compatibility with some legacy code, and should be dropped once there are no call sites left.
func (*Cluster) DeleteNetworkPeer ¶
DeleteNetworkPeer deletes an existing Network Peer.
func (*Cluster) EnterExclusive ¶
EnterExclusive acquires a lock on the cluster db, so any successive call to Transaction will block until ExitExclusive has been called.
func (*Cluster) ExitExclusive ¶
func (c *Cluster) ExitExclusive(ctx context.Context, f func(context.Context, *ClusterTx) error) error
ExitExclusive runs the given transaction and then releases the lock acquired with EnterExclusive.
func (*Cluster) GetNetworkPeersTargetNetworkIDs ¶
func (c *Cluster) GetNetworkPeersTargetNetworkIDs(projectName string, networkType NetworkType) (map[NetworkPeer]int64, error)
GetNetworkPeersTargetNetworkIDs returns a map of peer connections to target network IDs for networks in the specified project and network type.
func (*Cluster) LocalNodeIsEvacuated ¶
LocalNodeIsEvacuated returns whether the local member is in the evacuated state.
func (*Cluster) NodeID ¶
NodeID sets the node NodeID associated with this cluster instance. It's used for backward-compatibility of all db-related APIs that were written before clustering and don't accept a node NodeID, so in those cases we automatically use this value as implicit node NodeID.
func (*Cluster) Transaction ¶
Transaction creates a new ClusterTx object and transactionally executes the cluster database interactions invoked by the given function. If the function returns no error, all database changes are committed to the cluster database database, otherwise they are rolled back.
If EnterExclusive has been called before, calling Transaction will block until ExitExclusive has been called as well to release the lock.
func (*Cluster) UpdateNetworkZone ¶
func (c *Cluster) UpdateNetworkZone(id int64, config *api.NetworkZonePut) error
UpdateNetworkZone updates the Network zone with the given ID.
type ClusterRole ¶
type ClusterRole string
ClusterRole represents the role of a member in a cluster.
type ClusterTx ¶
type ClusterTx struct {
// contains filtered or unexported fields
}
ClusterTx models a single interaction with a cluster database.
It wraps low-level sql.Tx objects and offers a high-level API to fetch and update data.
func NewTestClusterTx ¶
NewTestClusterTx returns a fresh ClusterTx object, along with a function that can be called to cleanup state when done with it.
func (*ClusterTx) AddImageToLocalNode ¶
AddImageToLocalNode creates a new entry in the images_nodes table for tracking that the local member has the given image.
func (*ClusterTx) AddNodeToClusterGroup ¶
func (c *ClusterTx) AddNodeToClusterGroup(ctx context.Context, groupName string, nodeName string) error
AddNodeToClusterGroup adds a given node to the given cluster group.
func (*ClusterTx) BootstrapNode ¶
BootstrapNode sets the name and address of the first cluster member, with id: 1.
func (*ClusterTx) CopyDefaultImageProfiles ¶
CopyDefaultImageProfiles copies default profiles from id to new_id.
func (*ClusterTx) CreateImage ¶
func (c *ClusterTx) CreateImage(ctx context.Context, project string, fp string, fname string, sz int64, public bool, autoUpdate bool, architecture string, createdAt time.Time, expiresAt time.Time, properties map[string]string, typeName string, profileIds []int64) error
CreateImage creates a new image.
func (*ClusterTx) CreateImageAlias ¶
func (c *ClusterTx) CreateImageAlias(ctx context.Context, projectName, aliasName string, imageID int, desc string) error
CreateImageAlias inserts an alias ento the database.
func (*ClusterTx) CreateImageSource ¶
func (c *ClusterTx) CreateImageSource(ctx context.Context, id int, server string, protocol string, certificate string, alias string) error
CreateImageSource inserts a new image source.
func (*ClusterTx) CreateInstanceBackup ¶
func (c *ClusterTx) CreateInstanceBackup(ctx context.Context, args InstanceBackup) error
CreateInstanceBackup creates a new backup.
func (*ClusterTx) CreateInstanceConfig ¶
func (c *ClusterTx) CreateInstanceConfig(ctx context.Context, id int, config map[string]string) error
CreateInstanceConfig inserts a new config for the container with the given ID.
func (*ClusterTx) CreateNetwork ¶
func (c *ClusterTx) CreateNetwork(ctx context.Context, projectName string, name string, description string, netType NetworkType, config map[string]string) (int64, error)
CreateNetwork creates a new network.
func (*ClusterTx) CreateNetworkACL ¶
func (c *ClusterTx) CreateNetworkACL(ctx context.Context, projectName string, info *api.NetworkACLsPost) (int64, error)
CreateNetworkACL creates a new Network ACL.
func (*ClusterTx) CreateNetworkConfig ¶
CreateNetworkConfig adds a new entry in the networks_config table.
func (*ClusterTx) CreateNetworkForward ¶
func (c *ClusterTx) CreateNetworkForward(ctx context.Context, networkID int64, memberSpecific bool, info *api.NetworkForwardsPost) (int64, error)
CreateNetworkForward creates a new Network Forward. If memberSpecific is true, then the forward is associated to the current member, rather than being associated to all members.
func (*ClusterTx) CreateNetworkLoadBalancer ¶
func (c *ClusterTx) CreateNetworkLoadBalancer(ctx context.Context, networkID int64, memberSpecific bool, info *api.NetworkLoadBalancersPost) (int64, error)
CreateNetworkLoadBalancer creates a new Network Load Balancer. If memberSpecific is true, then the load balancer is associated to the current member, rather than being associated to all members.
func (*ClusterTx) CreateNetworkPeer ¶
func (c *ClusterTx) CreateNetworkPeer(ctx context.Context, networkID int64, info *api.NetworkPeersPost) (int64, bool, error)
CreateNetworkPeer creates a new Network Peer and returns its ID. If there is a mutual peering on the target network side the both peer entries are upated to link to each other's repspective network ID. Returns the local peer ID and true if a mutual peering has been created.
func (*ClusterTx) CreateNetworkZone ¶
func (c *ClusterTx) CreateNetworkZone(ctx context.Context, projectName string, info *api.NetworkZonesPost) (int64, error)
CreateNetworkZone creates a new Network zone.
func (*ClusterTx) CreateNetworkZoneRecord ¶
func (c *ClusterTx) CreateNetworkZoneRecord(ctx context.Context, zone int64, info api.NetworkZoneRecordsPost) (int64, error)
CreateNetworkZoneRecord creates a new network zone record.
func (*ClusterTx) CreateNode ¶
CreateNode adds a node to the current list of members that are part of the cluster. The node's architecture will be the architecture of the machine the method is being run on. It returns the ID of the newly inserted row.
func (*ClusterTx) CreateNodeWithArch ¶
CreateNodeWithArch is the same as NodeAdd, but lets setting the node architecture explicitly.
func (*ClusterTx) CreatePendingNetwork ¶
func (c *ClusterTx) CreatePendingNetwork(ctx context.Context, node string, projectName string, name string, netType NetworkType, conf map[string]string) error
CreatePendingNetwork creates a new pending network on the node with the given name.
func (*ClusterTx) CreatePendingStoragePool ¶
func (c *ClusterTx) CreatePendingStoragePool(ctx context.Context, node string, name string, driver string, conf map[string]string) error
CreatePendingStoragePool creates a new pending storage pool on the node with the given name.
func (*ClusterTx) CreateStoragePool ¶
func (c *ClusterTx) CreateStoragePool(ctx context.Context, poolName string, poolDescription string, poolDriver string, poolConfig map[string]string) (int64, error)
CreateStoragePool creates new storage pool. Also creates a local member entry with state storagePoolPending.
func (*ClusterTx) CreateStoragePoolBucket ¶
func (c *ClusterTx) CreateStoragePoolBucket(ctx context.Context, poolID int64, projectName string, memberSpecific bool, info api.StorageBucketsPost) (int64, error)
CreateStoragePoolBucket creates a new Storage Bucket. If memberSpecific is true, then the storage bucket is associated to the current member, rather than being associated to all members.
func (*ClusterTx) CreateStoragePoolBucketBackup ¶
func (c *ClusterTx) CreateStoragePoolBucketBackup(ctx context.Context, args StoragePoolBucketBackup) error
CreateStoragePoolBucketBackup creates a new storage bucket backup.
func (*ClusterTx) CreateStoragePoolBucketKey ¶
func (c *ClusterTx) CreateStoragePoolBucketKey(ctx context.Context, bucketID int64, info api.StorageBucketKeysPost) (int64, error)
CreateStoragePoolBucketKey creates a new Storage Bucket Key.
func (*ClusterTx) CreateStoragePoolConfig ¶
CreateStoragePoolConfig adds a new entry in the storage_pools_config table.
func (*ClusterTx) CreateStoragePoolVolume ¶
func (c *ClusterTx) CreateStoragePoolVolume(ctx context.Context, projectName string, volumeName string, volumeDescription string, volumeType int, poolID int64, volumeConfig map[string]string, contentType int, creationDate time.Time) (int64, error)
CreateStoragePoolVolume creates a new storage volume attached to a given storage pool.
func (*ClusterTx) CreateStoragePoolVolumeBackup ¶
func (c *ClusterTx) CreateStoragePoolVolumeBackup(ctx context.Context, args StoragePoolVolumeBackup) error
CreateStoragePoolVolumeBackup creates a new storage volume backup.
func (*ClusterTx) CreateStorageVolumeSnapshot ¶
func (c *ClusterTx) CreateStorageVolumeSnapshot(ctx context.Context, projectName string, volumeName string, volumeDescription string, volumeType int, poolID int64, volumeConfig map[string]string, creationDate time.Time, expiryDate time.Time) (int64, error)
CreateStorageVolumeSnapshot creates a new storage volume snapshot attached to a given storage pool.
func (*ClusterTx) DeleteImage ¶
DeleteImage deletes the image with the given ID.
func (*ClusterTx) DeleteImageAlias ¶
DeleteImageAlias deletes the alias with the given name.
func (*ClusterTx) DeleteInstance ¶
DeleteInstance removes the instance with the given name from the database.
func (*ClusterTx) DeleteInstanceBackup ¶
DeleteInstanceBackup removes the instance backup with the given name from the database.
func (*ClusterTx) DeleteInstanceConfigKey ¶
DeleteInstanceConfigKey removes the given key from the config of the instance with the given ID.
func (*ClusterTx) DeleteNetwork ¶
DeleteNetwork deletes the network with the given name.
func (*ClusterTx) DeleteNetworkACL ¶
DeleteNetworkACL deletes the Network ACL.
func (*ClusterTx) DeleteNetworkForward ¶
func (c *ClusterTx) DeleteNetworkForward(ctx context.Context, networkID int64, forwardID int64) error
DeleteNetworkForward deletes an existing Network Forward.
func (*ClusterTx) DeleteNetworkLoadBalancer ¶
func (c *ClusterTx) DeleteNetworkLoadBalancer(ctx context.Context, networkID int64, loadBalancerID int64) error
DeleteNetworkLoadBalancer deletes an existing Network Load Balancer.
func (*ClusterTx) DeleteNetworkZone ¶
DeleteNetworkZone deletes the Network zone.
func (*ClusterTx) DeleteNetworkZoneRecord ¶
DeleteNetworkZoneRecord deletes the network zone record.
func (*ClusterTx) DeleteReadyStateFromLocalInstances ¶
DeleteReadyStateFromLocalInstances deletes the volatile.last_state.ready config key from all local instances.
func (*ClusterTx) DeleteStoragePoolBucket ¶
func (c *ClusterTx) DeleteStoragePoolBucket(ctx context.Context, poolID int64, bucketID int64) error
DeleteStoragePoolBucket deletes an existing Storage Bucket.
func (*ClusterTx) DeleteStoragePoolBucketBackup ¶
DeleteStoragePoolBucketBackup removes the storage bucket backup with the given name from the database.
func (*ClusterTx) DeleteStoragePoolBucketKey ¶
func (c *ClusterTx) DeleteStoragePoolBucketKey(ctx context.Context, bucketID int64, keyID int64) error
DeleteStoragePoolBucketKey deletes an existing Storage Bucket Key.
func (*ClusterTx) DeleteStoragePoolVolumeBackup ¶
DeleteStoragePoolVolumeBackup removes the storage volume backup with the given name from the database.
func (*ClusterTx) GetAllNodesWithOperations ¶
GetAllNodesWithOperations returns a list of nodes that have operations in any project.
func (*ClusterTx) GetCachedImageSourceFingerprint ¶
func (c *ClusterTx) GetCachedImageSourceFingerprint(ctx context.Context, server string, protocol string, alias string, typeName string, architecture int) (string, error)
GetCachedImageSourceFingerprint tries to find a source entry of a locally cached image that matches the given remote details (server, protocol and alias). Return the fingerprint linked to the matching entry, if any.
func (*ClusterTx) GetCandidateMembers ¶
func (c *ClusterTx) GetCandidateMembers(ctx context.Context, allMembers []NodeInfo, targetArchitectures []int, targetClusterGroup string, allowedClusterGroups []string, offlineThreshold time.Duration) ([]NodeInfo, error)
GetCandidateMembers returns cluster members that are online, in created state and don't need manual targeting. It excludes members that do not support any of the targetArchitectures (if non-nil) or not in targetClusterGroup (if non-empty). It also takes into account any restrictions on allowedClusterGroups (if non-nil).
func (*ClusterTx) GetClusterGroupNodes ¶
GetClusterGroupNodes returns a list of nodes of the given cluster group.
func (*ClusterTx) GetClusterGroupURIs ¶
func (c *ClusterTx) GetClusterGroupURIs(ctx context.Context, filter cluster.ClusterGroupFilter) ([]string, error)
GetClusterGroupURIs returns all available ClusterGroup URIs. generator: ClusterGroup URIs
func (*ClusterTx) GetClusterGroupsWithNode ¶
func (c *ClusterTx) GetClusterGroupsWithNode(ctx context.Context, nodeName string) ([]string, error)
GetClusterGroupsWithNode returns a list of cluster group names the given node belongs to.
func (*ClusterTx) GetCreatedNetworkNamesByProject ¶
func (c *ClusterTx) GetCreatedNetworkNamesByProject(ctx context.Context, project string) ([]string, error)
GetCreatedNetworkNamesByProject returns the names of all networks that are in state networkCreated.
func (*ClusterTx) GetCreatedNetworks ¶
func (c *ClusterTx) GetCreatedNetworks(ctx context.Context) (map[string]map[int64]api.Network, error)
GetCreatedNetworks returns a map of api.Network associated to project and network ID. Only networks that have are in state networkCreated are returned.
func (*ClusterTx) GetCreatedNetworksByProject ¶
func (c *ClusterTx) GetCreatedNetworksByProject(ctx context.Context, projectName string) (map[int64]api.Network, error)
GetCreatedNetworksByProject returns a map of api.Network in a project associated to network ID. Only networks that have are in state networkCreated are returned.
func (*ClusterTx) GetCreatedStoragePoolNames ¶
GetCreatedStoragePoolNames returns the names of all storage pools that are created.
func (*ClusterTx) GetCustomVolumesInProject ¶
func (c *ClusterTx) GetCustomVolumesInProject(ctx context.Context, project string) ([]StorageVolumeArgs, error)
GetCustomVolumesInProject returns all custom volumes in the given project.
func (*ClusterTx) GetExpiredInstanceBackups ¶
func (c *ClusterTx) GetExpiredInstanceBackups(ctx context.Context) ([]InstanceBackup, error)
GetExpiredInstanceBackups returns a list of expired instance backups.
func (*ClusterTx) GetExpiredStorageBucketBackups ¶
func (c *ClusterTx) GetExpiredStorageBucketBackups(ctx context.Context) ([]StoragePoolBucketBackup, error)
GetExpiredStorageBucketBackups returns a list of expired storage bucket backups.
func (*ClusterTx) GetExpiredStorageVolumeBackups ¶
func (c *ClusterTx) GetExpiredStorageVolumeBackups(ctx context.Context) ([]StoragePoolVolumeBackup, error)
GetExpiredStorageVolumeBackups returns a list of expired storage volume backups.
func (*ClusterTx) GetExpiredStorageVolumeSnapshots ¶
func (c *ClusterTx) GetExpiredStorageVolumeSnapshots(ctx context.Context, memberSpecific bool) ([]StorageVolumeArgs, error)
GetExpiredStorageVolumeSnapshots returns a list of expired volume snapshots. If memberSpecific is true, then the search is restricted to volumes that belong to this member or belong to all members.
func (*ClusterTx) GetFailureDomainsNames ¶
GetFailureDomainsNames return a map associating failure domain IDs to their names.
func (*ClusterTx) GetImage ¶
func (c *ClusterTx) GetImage(ctx context.Context, fingerprintPrefix string, filter cluster.ImageFilter) (int, *api.Image, error)
GetImage gets an Image object from the database.
The fingerprint argument will be queried with a LIKE query, means you can pass a shortform and will get the full fingerprint. However in case the shortform matches more than one image, an error will be returned. publicOnly, when true, will return the image only if it is public; a false value will return any image matching the fingerprint prefix.
func (*ClusterTx) GetImageAlias ¶
func (c *ClusterTx) GetImageAlias(ctx context.Context, projectName string, imageName string, isTrustedClient bool) (int, api.ImageAliasesEntry, error)
GetImageAlias returns the alias with the given name in the given project.
func (*ClusterTx) GetImageAliases ¶
GetImageAliases returns the names of the aliases of all images.
func (*ClusterTx) GetImageByFingerprintPrefix ¶
func (c *ClusterTx) GetImageByFingerprintPrefix(ctx context.Context, fingerprintPrefix string, filter cluster.ImageFilter) (int, *api.Image, error)
GetImageByFingerprintPrefix gets an Image object from the database.
The fingerprint argument will be queried with a LIKE query, means you can pass a shortform and will get the full fingerprint. However in case the shortform matches more than one image, an error will be returned. publicOnly, when true, will return the image only if it is public; a false value will return any image matching the fingerprint prefix.
func (*ClusterTx) GetImageFromAnyProject ¶
func (c *ClusterTx) GetImageFromAnyProject(ctx context.Context, fingerprint string) (int, *api.Image, error)
GetImageFromAnyProject returns an image matching the given fingerprint, if it exists in any project.
func (*ClusterTx) GetImageSource ¶
GetImageSource returns the image source with the given ID.
func (*ClusterTx) GetImagesFingerprints ¶
func (c *ClusterTx) GetImagesFingerprints(ctx context.Context, projectName string, publicOnly bool) ([]string, error)
GetImagesFingerprints returns the names of all images (optionally only the public ones).
func (*ClusterTx) GetImagesOnLocalNode ¶
GetImagesOnLocalNode returns all images that the local server holds.
func (*ClusterTx) GetImagesOnNode ¶
GetImagesOnNode returns all images that the node with the given id has.
func (*ClusterTx) GetInstanceBackup ¶
func (c *ClusterTx) GetInstanceBackup(ctx context.Context, projectName string, name string) (InstanceBackup, error)
GetInstanceBackup returns the backup with the given name.
func (*ClusterTx) GetInstanceBackupWithID ¶
func (c *ClusterTx) GetInstanceBackupWithID(ctx context.Context, backupID int) (InstanceBackup, error)
GetInstanceBackupWithID returns the backup with the given ID.
func (*ClusterTx) GetInstanceBackups ¶
func (c *ClusterTx) GetInstanceBackups(ctx context.Context, projectName string, name string) ([]string, error)
GetInstanceBackups returns the names of all backups of the instance with the given name.
func (*ClusterTx) GetInstanceConfig ¶
GetInstanceConfig returns the value of the given key in the configuration of the instance with the given ID.
func (*ClusterTx) GetInstanceID ¶
GetInstanceID returns the ID of the instance with the given name.
func (*ClusterTx) GetInstanceNames ¶
GetInstanceNames returns the names of all containers the given project.
func (*ClusterTx) GetInstancePool ¶
func (c *ClusterTx) GetInstancePool(ctx context.Context, projectName string, instanceName string) (string, error)
GetInstancePool returns the storage pool of a given instance (or snapshot).
func (*ClusterTx) GetInstanceProjectAndName ¶
GetInstanceProjectAndName returns the project and the name of the instance with the given ID.
func (*ClusterTx) GetInstanceSnapshotID ¶
func (c *ClusterTx) GetInstanceSnapshotID(ctx context.Context, project, instance, name string) (int, error)
GetInstanceSnapshotID returns the ID of the snapshot with the given name.
func (*ClusterTx) GetInstanceSnapshotsNames ¶
func (c *ClusterTx) GetInstanceSnapshotsNames(ctx context.Context, project, name string) ([]string, error)
GetInstanceSnapshotsNames returns the names of all snapshots of the instance in the given project with the given name. Returns snapshots slice ordered by when they were created, oldest first.
func (*ClusterTx) GetInstanceSnapshotsWithName ¶
func (c *ClusterTx) GetInstanceSnapshotsWithName(ctx context.Context, project string, name string) ([]cluster.Instance, error)
GetInstanceSnapshotsWithName returns all snapshots of a given instance in date created order, oldest first.
func (*ClusterTx) GetInstancesByMemberAddress ¶
func (c *ClusterTx) GetInstancesByMemberAddress(ctx context.Context, offlineThreshold time.Duration, projects []string, instType instancetype.Type) (map[string][]Instance, error)
GetInstancesByMemberAddress returns the instances associated to each cluster member address. The member address of instances running on the local member is set to the empty string, to distinguish it from remote nodes. Instances whose member is down are added to the special address "0.0.0.0".
func (*ClusterTx) GetInstancesWithProfile ¶
func (c *ClusterTx) GetInstancesWithProfile(ctx context.Context, project, profile string) (map[string][]string, error)
GetInstancesWithProfile gets the names of the instance associated with the profile with the given name in the given project.
func (*ClusterTx) GetLocalExpiredInstanceSnapshots ¶
func (c *ClusterTx) GetLocalExpiredInstanceSnapshots(ctx context.Context) ([]cluster.InstanceSnapshot, error)
GetLocalExpiredInstanceSnapshots returns a list of expired snapshots.
func (*ClusterTx) GetLocalImagesFingerprints ¶
GetLocalImagesFingerprints returns the fingerprints of all local images.
func (*ClusterTx) GetLocalInstanceWithVsockID ¶
func (c *ClusterTx) GetLocalInstanceWithVsockID(ctx context.Context, vsockID int) (*cluster.Instance, error)
GetLocalInstanceWithVsockID returns all available instances with the given config key and value.
func (*ClusterTx) GetLocalInstancesInProject ¶
func (c *ClusterTx) GetLocalInstancesInProject(ctx context.Context, filter cluster.InstanceFilter) ([]cluster.Instance, error)
GetLocalInstancesInProject retuurns all instances of the given type on the local member in the given project. If projectName is empty then all instances in all projects are returned.
func (*ClusterTx) GetLocalNodeAddress ¶
GetLocalNodeAddress returns the address of the node this method is invoked on.
func (*ClusterTx) GetLocalNodeName ¶
GetLocalNodeName returns the name of the node this method is invoked on. Usually you should not use this function directly but instead use the cached State.ServerName value.
func (*ClusterTx) GetLocalStoragePoolVolumeSnapshotsWithType ¶
func (c *ClusterTx) GetLocalStoragePoolVolumeSnapshotsWithType(ctx context.Context, projectName string, volumeName string, volumeType int, poolID int64) ([]StorageVolumeArgs, error)
GetLocalStoragePoolVolumeSnapshotsWithType get all snapshots of a storage volume attached to a given storage pool of a given volume type, on the local member. Returns snapshots slice ordered by when they were created, oldest first.
func (*ClusterTx) GetNetworkACL ¶
func (c *ClusterTx) GetNetworkACL(ctx context.Context, projectName string, name string) (int64, *api.NetworkACL, error)
GetNetworkACL returns the Network ACL with the given name in the given project.
func (*ClusterTx) GetNetworkACLIDsByNames ¶
func (c *ClusterTx) GetNetworkACLIDsByNames(ctx context.Context, project string) (map[string]int64, error)
GetNetworkACLIDsByNames returns a map of names to IDs of existing Network ACLs.
func (*ClusterTx) GetNetworkACLNameAndProjectWithID ¶
func (c *ClusterTx) GetNetworkACLNameAndProjectWithID(ctx context.Context, networkACLID int) (string, string, error)
GetNetworkACLNameAndProjectWithID returns the network ACL name and project name for the given ID.
func (*ClusterTx) GetNetworkACLURIs ¶
func (c *ClusterTx) GetNetworkACLURIs(ctx context.Context, projectID int, project string) ([]string, error)
GetNetworkACLURIs returns the URIs for the network ACLs with the given project.
func (*ClusterTx) GetNetworkACLs ¶
GetNetworkACLs returns the names of existing Network ACLs.
func (*ClusterTx) GetNetworkForward ¶
func (c *ClusterTx) GetNetworkForward(ctx context.Context, networkID int64, memberSpecific bool, listenAddress string) (int64, *api.NetworkForward, error)
GetNetworkForward returns the Network Forward ID and info for the given network ID and listen address. If memberSpecific is true, then the search is restricted to forwards that belong to this member or belong to all members.
func (*ClusterTx) GetNetworkForwardListenAddresses ¶
func (c *ClusterTx) GetNetworkForwardListenAddresses(ctx context.Context, networkID int64, memberSpecific bool) (map[int64]string, error)
GetNetworkForwardListenAddresses returns map of Network Forward Listen Addresses for the given network ID keyed on Forward ID. If memberSpecific is true, then the search is restricted to forwards that belong to this member or belong to all members.
func (*ClusterTx) GetNetworkForwards ¶
func (c *ClusterTx) GetNetworkForwards(ctx context.Context, networkID int64, memberSpecific bool, listenAddresses ...string) (map[int64]*api.NetworkForward, error)
GetNetworkForwards returns map of Network Forwards for the given network ID keyed on Forward ID. If memberSpecific is true, then the search is restricted to forwards that belong to this member or belong to all members. Can optionally retrieve only specific network forwards by listen address.
func (*ClusterTx) GetNetworkID ¶
func (c *ClusterTx) GetNetworkID(ctx context.Context, projectName string, name string) (int64, error)
GetNetworkID returns the ID of the network with the given name.
func (*ClusterTx) GetNetworkInAnyState ¶
func (c *ClusterTx) GetNetworkInAnyState(ctx context.Context, projectName string, networkName string) (int64, *api.Network, map[int64]NetworkNode, error)
GetNetworkInAnyState returns the network with the given name. The network can be in any state. Returns network ID, network info, and network cluster member info.
func (*ClusterTx) GetNetworkLoadBalancer ¶
func (c *ClusterTx) GetNetworkLoadBalancer(ctx context.Context, networkID int64, memberSpecific bool, listenAddress string) (int64, *api.NetworkLoadBalancer, error)
GetNetworkLoadBalancer returns the Network Load Balancer ID and info for the given network ID and listen address. If memberSpecific is true, then the search is restricted to load balancers that belong to this member or belong to all members.
func (*ClusterTx) GetNetworkLoadBalancerListenAddresses ¶
func (c *ClusterTx) GetNetworkLoadBalancerListenAddresses(ctx context.Context, networkID int64, memberSpecific bool) (map[int64]string, error)
GetNetworkLoadBalancerListenAddresses returns map of Network Load Balancer Listen Addresses for the given network ID keyed on Load Balancer ID. If memberSpecific is true, then the search is restricted to load balancers that belong to this member or belong to all members.
func (*ClusterTx) GetNetworkLoadBalancers ¶
func (c *ClusterTx) GetNetworkLoadBalancers(ctx context.Context, networkID int64, memberSpecific bool, listenAddresses ...string) (map[int64]*api.NetworkLoadBalancer, error)
GetNetworkLoadBalancers returns map of Network Load Balancers for the given network ID keyed on Load Balancer ID. If memberSpecific is true, then the search is restricted to load balancers that belong to this member or belong to all members. Can optionally retrieve only specific network load balancers by listen address.
func (*ClusterTx) GetNetworkNameAndProjectWithID ¶
func (c *ClusterTx) GetNetworkNameAndProjectWithID(ctx context.Context, networkID int) (string, string, error)
GetNetworkNameAndProjectWithID returns the network name and project name for the given ID.
func (*ClusterTx) GetNetworkPeer ¶
func (c *ClusterTx) GetNetworkPeer(ctx context.Context, networkID int64, peerName string) (int64, *api.NetworkPeer, error)
GetNetworkPeer returns the Network Peer ID and info for the given network ID and peer name.
func (*ClusterTx) GetNetworkPeerNames ¶
func (c *ClusterTx) GetNetworkPeerNames(ctx context.Context, networkID int64) (map[int64]string, error)
GetNetworkPeerNames returns map of Network Peer names for the given network ID keyed on Peer ID.
func (*ClusterTx) GetNetworkPeers ¶
func (c *ClusterTx) GetNetworkPeers(ctx context.Context, networkID int64) (map[int64]*api.NetworkPeer, error)
GetNetworkPeers returns map of Network Peers for the given network ID keyed on Peer ID.
func (*ClusterTx) GetNetworkPeersURLByIntegration ¶
func (c *ClusterTx) GetNetworkPeersURLByIntegration(ctx context.Context, networkIntegration string) ([]string, error)
GetNetworkPeersURLByIntegration returns a slice of API paths for the peers using the integration.
func (*ClusterTx) GetNetworkURIs ¶
func (c *ClusterTx) GetNetworkURIs(ctx context.Context, projectID int, project string) ([]string, error)
GetNetworkURIs returns the URIs for the networks with the given project.
func (*ClusterTx) GetNetworkZone ¶
func (c *ClusterTx) GetNetworkZone(ctx context.Context, name string) (int64, string, *api.NetworkZone, error)
GetNetworkZone returns the Network zone with the given name.
func (*ClusterTx) GetNetworkZoneByProject ¶
func (c *ClusterTx) GetNetworkZoneByProject(ctx context.Context, projectName string, name string) (int64, *api.NetworkZone, error)
GetNetworkZoneByProject returns the Network zone with the given name in the given project.
func (*ClusterTx) GetNetworkZoneKeys ¶
GetNetworkZoneKeys returns a map of key names to keys.
func (*ClusterTx) GetNetworkZoneRecord ¶
func (c *ClusterTx) GetNetworkZoneRecord(ctx context.Context, zone int64, name string) (int64, *api.NetworkZoneRecord, error)
GetNetworkZoneRecord returns the network zone record for the given zone and name.
func (*ClusterTx) GetNetworkZoneRecordNames ¶
GetNetworkZoneRecordNames returns the names of existing Network zone records.
func (*ClusterTx) GetNetworkZones ¶
GetNetworkZones returns the names of existing Network zones mapped to project name.
func (*ClusterTx) GetNetworkZonesByProject ¶
GetNetworkZonesByProject returns the names of existing Network zones.
func (*ClusterTx) GetNetworks ¶
GetNetworks returns the names of existing networks.
func (*ClusterTx) GetNetworksLocalConfig ¶
func (c *ClusterTx) GetNetworksLocalConfig(ctx context.Context) (map[string]map[string]string, error)
GetNetworksLocalConfig returns a map associating each network name to its node-specific config values on the local member (i.e. the ones where node_id equals the ID of the local member).
func (*ClusterTx) GetNextInstanceSnapshotIndex ¶
func (c *ClusterTx) GetNextInstanceSnapshotIndex(ctx context.Context, project string, name string, pattern string) int
GetNextInstanceSnapshotIndex returns the index that the next snapshot of the instance with the given name and pattern should have.
func (*ClusterTx) GetNextStorageVolumeSnapshotIndex ¶
func (c *ClusterTx) GetNextStorageVolumeSnapshotIndex(ctx context.Context, pool, name string, typ int, pattern string) int
GetNextStorageVolumeSnapshotIndex returns the index of the next snapshot of the storage volume with the given name should have.
Note, the code below doesn't deal with snapshots of snapshots. To do that, we'll need to weed out based on # slashes in names.
func (*ClusterTx) GetNodeAddressOfInstance ¶
func (c *ClusterTx) GetNodeAddressOfInstance(ctx context.Context, project string, name string, instType instancetype.Type) (string, error)
GetNodeAddressOfInstance returns the address of the node hosting the instance with the given name in the given project.
It returns the empty string if the container is hosted on this node.
func (*ClusterTx) GetNodeByAddress ¶
GetNodeByAddress returns the node with the given network address.
func (*ClusterTx) GetNodeByName ¶
GetNodeByName returns the node with the given name.
func (*ClusterTx) GetNodeFailureDomain ¶
GetNodeFailureDomain returns the failure domain associated with the node with the given ID.
func (*ClusterTx) GetNodeID ¶
GetNodeID gets the ID of the node associated with this cluster transaction.
func (*ClusterTx) GetNodeMaxVersion ¶
GetNodeMaxVersion returns the highest schema and API versions possible on the cluster.
func (*ClusterTx) GetNodeOfflineThreshold ¶
GetNodeOfflineThreshold returns the amount of time that needs to elapse after which a series of unsuccessful heartbeat will make the node be considered offline.
func (*ClusterTx) GetNodeWithID ¶
GetNodeWithID returns the node with the given ID.
func (*ClusterTx) GetNodeWithLeastInstances ¶
func (c *ClusterTx) GetNodeWithLeastInstances(ctx context.Context, members []NodeInfo) (*NodeInfo, error)
GetNodeWithLeastInstances returns the name of the member with the least number of instances that are either already created or being created with an operation.
func (*ClusterTx) GetNodes ¶
GetNodes returns all cluster members that are part of the cluster.
If this server is not clustered, a list with a single member whose address is 0.0.0.0 is returned.
func (*ClusterTx) GetNodesCount ¶
GetNodesCount returns the number of members in the cluster.
Since there's always at least one node row, even when not-clustered, the return value is greater than zero.
func (*ClusterTx) GetNodesFailureDomains ¶
GetNodesFailureDomains returns a map associating each node address with its failure domain code.
func (*ClusterTx) GetNodesWithImage ¶
GetNodesWithImage returns the addresses of online nodes which already have the image.
func (*ClusterTx) GetNodesWithImageAndAutoUpdate ¶
func (c *ClusterTx) GetNodesWithImageAndAutoUpdate(ctx context.Context, fingerprint string, autoUpdate bool) ([]string, error)
GetNodesWithImageAndAutoUpdate returns the addresses of online nodes which already have the image.
func (*ClusterTx) GetNodesWithOperations ¶
GetNodesWithOperations returns a list of nodes that have operations.
func (*ClusterTx) GetNodesWithoutImage ¶
GetNodesWithoutImage returns the addresses of online nodes which don't have the image.
func (*ClusterTx) GetNonPendingNetworkIDs ¶
func (c *ClusterTx) GetNonPendingNetworkIDs(ctx context.Context) (map[string]map[string]int64, error)
GetNonPendingNetworkIDs returns a map associating each network name to its ID.
Pending networks are skipped.
func (*ClusterTx) GetNonPendingStoragePoolsNamesToIDs ¶
func (c *ClusterTx) GetNonPendingStoragePoolsNamesToIDs(ctx context.Context) (map[string]int64, error)
GetNonPendingStoragePoolsNamesToIDs returns a map associating each storage pool name to its ID.
Pending storage pools are skipped.
func (*ClusterTx) GetOperationsOfType ¶
func (c *ClusterTx) GetOperationsOfType(ctx context.Context, projectName string, opType operationtype.Type) ([]cluster.Operation, error)
GetOperationsOfType returns a list operations that belong to the specified project and have the desired type.
func (*ClusterTx) GetPendingNodeByAddress ¶
GetPendingNodeByAddress returns the pending node with the given network address.
func (*ClusterTx) GetPoolNamesFromIDs ¶
GetPoolNamesFromIDs get the names of the storage pools with the given IDs.
func (*ClusterTx) GetPoolsWithImage ¶
func (c *ClusterTx) GetPoolsWithImage(ctx context.Context, imageFingerprint string) ([]int64, error)
GetPoolsWithImage get the IDs of all storage pools on which a given image exists.
func (*ClusterTx) GetProfile ¶
func (c *ClusterTx) GetProfile(ctx context.Context, project, name string) (int64, *api.Profile, error)
GetProfile returns the profile with the given name.
func (*ClusterTx) GetProfileNames ¶
GetProfileNames returns the names of all profiles in the given project.
func (*ClusterTx) GetProfiles ¶
func (c *ClusterTx) GetProfiles(ctx context.Context, projectName string, profileNames []string) ([]api.Profile, error)
GetProfiles returns the profiles with the given names in the given project.
func (*ClusterTx) GetProjectNetworkForwardListenAddressesByUplink ¶
func (c *ClusterTx) GetProjectNetworkForwardListenAddressesByUplink(ctx context.Context, uplinkNetworkName string, memberSpecific bool) (map[string]map[string][]string, error)
GetProjectNetworkForwardListenAddressesByUplink returns map of Network Forward Listen Addresses that belong to networks connected to the specified uplinkNetworkName. Returns a map keyed on project name and network name containing a slice of listen addresses.
func (*ClusterTx) GetProjectNetworkForwardListenAddressesOnMember ¶
func (c *ClusterTx) GetProjectNetworkForwardListenAddressesOnMember(ctx context.Context) (map[string]map[int64][]string, error)
GetProjectNetworkForwardListenAddressesOnMember returns map of Network Forward Listen Addresses that belong to to this specific cluster member. Will not include forwards that do not have a specific member. Returns a map keyed on project name and network ID containing a slice of listen addresses.
func (*ClusterTx) GetProjectNetworkLoadBalancerListenAddressesByUplink ¶
func (c *ClusterTx) GetProjectNetworkLoadBalancerListenAddressesByUplink(ctx context.Context, uplinkNetworkName string, memberSpecific bool) (map[string]map[string][]string, error)
GetProjectNetworkLoadBalancerListenAddressesByUplink returns map of Network Load Balancer Listen Addresses that belong to networks connected to the specified uplinkNetworkName. Returns a map keyed on project name and network name containing a slice of listen addresses.
func (*ClusterTx) GetProjectNetworkLoadBalancerListenAddressesOnMember ¶
func (c *ClusterTx) GetProjectNetworkLoadBalancerListenAddressesOnMember(ctx context.Context) (map[string]map[int64][]string, error)
GetProjectNetworkLoadBalancerListenAddressesOnMember returns map of Network Load Balancer Listen Addresses that belong to to this specific cluster member. Will not include load balancers that do not have a specific member. Returns a map keyed on project name and network ID containing a slice of listen addresses.
func (*ClusterTx) GetProjectsUsingImage ¶
func (c *ClusterTx) GetProjectsUsingImage(ctx context.Context, fingerprint string) ([]string, error)
GetProjectsUsingImage get the project names using an image by fingerprint.
func (*ClusterTx) GetStoragePool ¶
func (c *ClusterTx) GetStoragePool(ctx context.Context, poolName string) (int64, *api.StoragePool, map[int64]StoragePoolNode, error)
GetStoragePool returns a single storage pool.
The pool must be in the created stated, not pending.
func (*ClusterTx) GetStoragePoolBucket ¶
func (c *ClusterTx) GetStoragePoolBucket(ctx context.Context, poolID int64, projectName string, memberSpecific bool, bucketName string) (*StorageBucket, error)
GetStoragePoolBucket returns the Storage Bucket for the given Storage Pool ID, Project Name and Bucket Name. If memberSpecific is true, then the search is restricted to buckets that belong to this member or belong to all members.
func (*ClusterTx) GetStoragePoolBucketBackup ¶
func (c *ClusterTx) GetStoragePoolBucketBackup(ctx context.Context, projectName string, poolName string, backupName string) (StoragePoolBucketBackup, error)
GetStoragePoolBucketBackup returns the bucket backup with the given name.
func (*ClusterTx) GetStoragePoolBucketBackupsName ¶
func (c *ClusterTx) GetStoragePoolBucketBackupsName(ctx context.Context, projectName string, bucketName string) ([]string, error)
GetStoragePoolBucketBackupsName returns the names of all backups of the storage bucket with the given name.
func (*ClusterTx) GetStoragePoolBucketKey ¶
func (c *ClusterTx) GetStoragePoolBucketKey(ctx context.Context, bucketID int64, keyName string) (*StorageBucketKey, error)
GetStoragePoolBucketKey returns the Storage Bucket Key for the given Bucket ID and Key Name.
func (*ClusterTx) GetStoragePoolBucketKeys ¶
func (c *ClusterTx) GetStoragePoolBucketKeys(ctx context.Context, bucketID int64, filters ...StorageBucketKeyFilter) ([]*StorageBucketKey, error)
GetStoragePoolBucketKeys returns all storage buckets keys attached to a given storage bucket. If there are no bucket keys, it returns an empty list and no error. Accepts filters for narrowing down the results returned.
func (*ClusterTx) GetStoragePoolBucketWithID ¶
func (c *ClusterTx) GetStoragePoolBucketWithID(ctx context.Context, bucketID int) (StorageBucket, error)
GetStoragePoolBucketWithID returns the volume with the given ID.
func (*ClusterTx) GetStoragePoolBuckets ¶
func (c *ClusterTx) GetStoragePoolBuckets(ctx context.Context, memberSpecific bool, filters ...StorageBucketFilter) ([]*StorageBucket, error)
GetStoragePoolBuckets returns all storage buckets. If there are no buckets, it returns an empty list and no error. Accepts filters for narrowing down the results returned. If memberSpecific is true, then the search is restricted to buckets that belong to this member or belong to all members.
func (*ClusterTx) GetStoragePoolDriver ¶
GetStoragePoolDriver returns the driver of the pool with the given ID.
func (*ClusterTx) GetStoragePoolDrivers ¶
GetStoragePoolDrivers returns the names of all storage drivers currently being used by at least one storage pool.
func (*ClusterTx) GetStoragePoolID ¶
GetStoragePoolID returns the ID of the pool with the given name.
func (*ClusterTx) GetStoragePoolInAnyState ¶
func (c *ClusterTx) GetStoragePoolInAnyState(ctx context.Context, poolName string) (int64, *api.StoragePool, map[int64]StoragePoolNode, error)
GetStoragePoolInAnyState returns the storage pool with the given name.
The pool can be in any state.
func (*ClusterTx) GetStoragePoolLocalBucket ¶
func (c *ClusterTx) GetStoragePoolLocalBucket(ctx context.Context, bucketName string) (*StorageBucket, error)
GetStoragePoolLocalBucket returns the local Storage Bucket for the given bucket name. The search is restricted to buckets that belong to this member.
func (*ClusterTx) GetStoragePoolLocalBucketByAccessKey ¶
func (c *ClusterTx) GetStoragePoolLocalBucketByAccessKey(ctx context.Context, accessKey string) (*StorageBucket, error)
GetStoragePoolLocalBucketByAccessKey returns the local Storage Bucket for the given bucket access key. The search is restricted to buckets that belong to this member.
func (*ClusterTx) GetStoragePoolNames ¶
GetStoragePoolNames returns the names of all storage pools.
func (*ClusterTx) GetStoragePoolNodeConfigs ¶
func (c *ClusterTx) GetStoragePoolNodeConfigs(ctx context.Context, poolID int64) (map[string]map[string]string, error)
GetStoragePoolNodeConfigs returns the node-specific configuration of all nodes grouped by node name, for the given poolID.
If the storage pool is not defined on all nodes, an error is returned.
func (*ClusterTx) GetStoragePoolNodeVolumeID ¶
func (c *ClusterTx) GetStoragePoolNodeVolumeID(ctx context.Context, projectName string, volumeName string, volumeType int, poolID int64) (int64, error)
GetStoragePoolNodeVolumeID gets the ID of a storage volume on a given storage pool of a given storage volume type and project, on the current node.
func (*ClusterTx) GetStoragePoolVolume ¶
func (c *ClusterTx) GetStoragePoolVolume(ctx context.Context, poolID int64, projectName string, volumeType int, volumeName string, memberSpecific bool) (*StorageVolume, error)
GetStoragePoolVolume returns the storage volume attached to a given storage pool.
func (*ClusterTx) GetStoragePoolVolumeBackup ¶
func (c *ClusterTx) GetStoragePoolVolumeBackup(ctx context.Context, projectName string, poolName string, backupName string) (StoragePoolVolumeBackup, error)
GetStoragePoolVolumeBackup returns the volume backup with the given name.
func (*ClusterTx) GetStoragePoolVolumeBackupWithID ¶
func (c *ClusterTx) GetStoragePoolVolumeBackupWithID(ctx context.Context, backupID int) (StoragePoolVolumeBackup, error)
GetStoragePoolVolumeBackupWithID returns the volume backup with the given ID.
func (*ClusterTx) GetStoragePoolVolumeBackups ¶
func (c *ClusterTx) GetStoragePoolVolumeBackups(ctx context.Context, projectName string, volumeName string, poolID int64) ([]StoragePoolVolumeBackup, error)
GetStoragePoolVolumeBackups returns a list of volume backups.
func (*ClusterTx) GetStoragePoolVolumeBackupsNames ¶
func (c *ClusterTx) GetStoragePoolVolumeBackupsNames(ctx context.Context, projectName string, volumeName string, poolID int64) ([]string, error)
GetStoragePoolVolumeBackupsNames returns the names of all backups of the storage volume with the given name.
func (*ClusterTx) GetStoragePoolVolumeWithID ¶
func (c *ClusterTx) GetStoragePoolVolumeWithID(ctx context.Context, volumeID int) (StorageVolumeArgs, error)
GetStoragePoolVolumeWithID returns the volume with the given ID.
func (*ClusterTx) GetStoragePoolVolumes ¶
func (c *ClusterTx) GetStoragePoolVolumes(ctx context.Context, poolID int64, memberSpecific bool, filters ...StorageVolumeFilter) ([]*StorageVolume, error)
GetStoragePoolVolumes returns all storage volumes attached to a given storage pool. If there are no volumes, it returns an empty list and no error. Accepts filters for narrowing down the results returned. If memberSpecific is true, then the search is restricted to volumes that belong to this member or belong to all members.
func (*ClusterTx) GetStoragePoolVolumesWithType ¶
func (c *ClusterTx) GetStoragePoolVolumesWithType(ctx context.Context, volumeType int, memberSpecific bool) ([]StorageVolumeArgs, error)
GetStoragePoolVolumesWithType return a list of all volumes of the given type. If memberSpecific is true, then the search is restricted to volumes that belong to this member or belong to all members.
func (*ClusterTx) GetStoragePoolWithID ¶
func (c *ClusterTx) GetStoragePoolWithID(ctx context.Context, poolID int) (int64, *api.StoragePool, map[int64]StoragePoolNode, error)
GetStoragePoolWithID returns the storage pool with the given ID.
func (*ClusterTx) GetStoragePools ¶
func (c *ClusterTx) GetStoragePools(ctx context.Context, state *StoragePoolState, poolNames ...string) (map[int64]api.StoragePool, map[int64]map[int64]StoragePoolNode, error)
GetStoragePools returns map of Storage Pools keyed on ID and Storage Pool member info keyed on ID and Member ID. Can optionally accept a state filter, if nil, then pools in any state are returned. Can optionally accept one or more poolNames to further filter the returned pools.
func (*ClusterTx) GetStoragePoolsLocalConfig ¶
func (c *ClusterTx) GetStoragePoolsLocalConfig(ctx context.Context) (map[string]map[string]string, error)
GetStoragePoolsLocalConfig returns a map associating each storage pool name to its node-specific config values (i.e. the ones where node_id is not NULL).
func (*ClusterTx) GetStorageVolumeNodes ¶
func (c *ClusterTx) GetStorageVolumeNodes(ctx context.Context, poolID int64, projectName string, volumeName string, volumeType int) ([]NodeInfo, error)
GetStorageVolumeNodes returns the node info of all nodes on which the volume with the given name is defined. The volume name can be either a regular name or a volume snapshot name. If the volume is defined, but without a specific node, then the ErrNoClusterMember error is returned. If the volume is not found then an api.StatusError with code set to http.StatusNotFound is returned.
func (*ClusterTx) GetStorageVolumeSnapshotExpiry ¶
func (c *ClusterTx) GetStorageVolumeSnapshotExpiry(ctx context.Context, volumeID int64) (time.Time, error)
GetStorageVolumeSnapshotExpiry gets the expiry date of a storage volume snapshot.
func (*ClusterTx) GetStorageVolumeSnapshotWithID ¶
func (c *ClusterTx) GetStorageVolumeSnapshotWithID(ctx context.Context, snapshotID int) (StorageVolumeArgs, error)
GetStorageVolumeSnapshotWithID returns the volume snapshot with the given ID.
func (*ClusterTx) GetStorageVolumeURIs ¶
GetStorageVolumeURIs returns the URIs of the storage volumes, specifying target node if applicable.
func (*ClusterTx) GetURIFromEntity ¶
func (c *ClusterTx) GetURIFromEntity(ctx context.Context, entityType int, entityID int) (string, error)
GetURIFromEntity returns the URI for the given entity type and entity ID.
func (*ClusterTx) ImageExists ¶
func (c *ClusterTx) ImageExists(ctx context.Context, project string, fingerprint string) (bool, error)
ImageExists returns whether an image with the given fingerprint exists.
func (*ClusterTx) ImageIsReferencedByOtherProjects ¶
func (c *ClusterTx) ImageIsReferencedByOtherProjects(ctx context.Context, project string, fingerprint string) (bool, error)
ImageIsReferencedByOtherProjects returns true if the image with the given fingerprint is referenced by projects other than the given one.
func (*ClusterTx) InstanceList ¶
func (c *ClusterTx) InstanceList(ctx context.Context, instanceFunc func(inst InstanceArgs, project api.Project) error, filters ...cluster.InstanceFilter) error
InstanceList loads all instances across all projects and for each instance runs the instanceFunc passing in the instance and it's project and profiles. Accepts optional filter arguments to specify a subset of instances.
func (*ClusterTx) InstancesToInstanceArgs ¶
func (c *ClusterTx) InstancesToInstanceArgs(ctx context.Context, fillProfiles bool, instances ...cluster.Instance) (map[int]InstanceArgs, error)
InstancesToInstanceArgs converts many cluster.Instance to a map of InstanceArgs in as few queries as possible. Accepts fillProfiles argument that controls whether or not the returned InstanceArgs have their Profiles field populated. This avoids the need to load profile info from the database if it is already available in the caller's context and can be populated afterwards.
func (*ClusterTx) IsRemoteStorage ¶
IsRemoteStorage return whether a given pool is backed by remote storage.
func (*ClusterTx) LocateImage ¶
LocateImage returns the address of an online node that has a local copy of the given image, or an empty string if the image is already available on this node.
If the image is not available on any online node, an error is returned.
func (*ClusterTx) MoveImageAlias ¶
MoveImageAlias changes the image ID associated with an alias.
func (*ClusterTx) NetworkCreated ¶
NetworkCreated sets the state of the given network to networkCreated.
func (*ClusterTx) NetworkErrored ¶
NetworkErrored sets the state of the given network to networkErrored.
func (*ClusterTx) NetworkNodeConfigs ¶
func (c *ClusterTx) NetworkNodeConfigs(ctx context.Context, networkID int64) (map[string]map[string]string, error)
NetworkNodeConfigs returns the node-specific configuration of all nodes grouped by node name, for the given networkID.
If the network is not defined on all nodes, an error is returned.
func (*ClusterTx) NetworkNodeCreated ¶
NetworkNodeCreated sets the state of the given network for the local member to networkCreated.
func (*ClusterTx) NetworkNodeJoin ¶
NetworkNodeJoin adds a new entry in the networks_nodes table.
It should only be used when a new node joins the cluster, when it's safe to assume that the relevant network has already been created on the joining node, and we just need to track it.
func (*ClusterTx) NetworkNodes ¶
func (c *ClusterTx) NetworkNodes(ctx context.Context, networkID int64) (map[int64]NetworkNode, error)
NetworkNodes returns the nodes keyed by node ID that the given network is defined on.
func (*ClusterTx) NodeIsEmpty ¶
NodeIsEmpty returns an empty string if the node with the given ID has no instances or images associated with it. Otherwise, it returns a message say what's left.
func (*ClusterTx) NodeIsOutdated ¶
NodeIsOutdated returns true if there's some cluster node having an API or schema version greater than the node this method is invoked on.
func (*ClusterTx) RemoveNode ¶
RemoveNode removes the node with the given id.
func (*ClusterTx) RemoveNodeFromClusterGroup ¶
func (c *ClusterTx) RemoveNodeFromClusterGroup(ctx context.Context, groupName string, nodeName string) error
RemoveNodeFromClusterGroup removes a given node from the given group name.
func (*ClusterTx) RemoveStoragePool ¶
func (c *ClusterTx) RemoveStoragePool(ctx context.Context, poolName string) (*api.StoragePool, error)
RemoveStoragePool deletes storage pool.
func (*ClusterTx) RemoveStoragePoolVolume ¶
func (c *ClusterTx) RemoveStoragePoolVolume(ctx context.Context, projectName string, volumeName string, volumeType int, poolID int64) error
RemoveStoragePoolVolume deletes the storage volume attached to a given storage pool.
func (*ClusterTx) RemoveUnreferencedProfiles ¶
RemoveUnreferencedProfiles removes unreferenced profiles.
func (*ClusterTx) RenameBucketBackup ¶
RenameBucketBackup renames a bucket backup from the given current name to the new one.
func (*ClusterTx) RenameImageAlias ¶
RenameImageAlias renames the alias with the given ID.
func (*ClusterTx) RenameInstanceBackup ¶
RenameInstanceBackup renames an instance backup from the given current name to the new one.
func (*ClusterTx) RenameNetwork ¶
func (c *ClusterTx) RenameNetwork(ctx context.Context, project string, oldName string, newName string) error
RenameNetwork renames a network.
func (*ClusterTx) RenameNetworkACL ¶
RenameNetworkACL renames a Network ACL.
func (*ClusterTx) RenameNode ¶
RenameNode changes the name of an existing node.
Return an error if a node with the same name already exists.
func (*ClusterTx) RenameStoragePoolVolume ¶
func (c *ClusterTx) RenameStoragePoolVolume(ctx context.Context, projectName string, oldVolumeName string, newVolumeName string, volumeType int, poolID int64) error
RenameStoragePoolVolume renames the storage volume attached to a given storage pool.
func (*ClusterTx) RenameVolumeBackup ¶
RenameVolumeBackup renames a volume backup from the given current name to the new one.
func (*ClusterTx) SetDescription ¶
SetDescription changes the description of the given node.
func (*ClusterTx) SetImageCachedAndLastUseDate ¶
func (c *ClusterTx) SetImageCachedAndLastUseDate(ctx context.Context, projectName string, fingerprint string, lastUsed time.Time) error
SetImageCachedAndLastUseDate sets the cached and last_use_date field of the image with the given fingerprint.
func (*ClusterTx) SetNodeHeartbeat ¶
SetNodeHeartbeat updates the heartbeat column of the node with the given address.
func (*ClusterTx) SetNodePendingFlag ¶
SetNodePendingFlag toggles the pending flag for the node. A node is pending when it's been accepted in the cluster, but has not yet actually joined it.
func (*ClusterTx) SetNodeVersion ¶
SetNodeVersion updates the schema and API version of the node with the given id. This is used only in tests.
func (*ClusterTx) StoragePoolCreated ¶
StoragePoolCreated sets the state of the given pool to storagePoolCreated.
func (*ClusterTx) StoragePoolErrored ¶
StoragePoolErrored sets the state of the given pool to storagePoolErrored.
func (*ClusterTx) StoragePoolNodeCreated ¶
StoragePoolNodeCreated sets the state of the given storage pool for the local member to storagePoolCreated.
func (*ClusterTx) UpdateClusterConfig ¶
UpdateClusterConfig updates the given cluster configuration keys in the config table. Config keys set to empty values will be deleted.
func (*ClusterTx) UpdateImage ¶
func (c *ClusterTx) UpdateImage(ctx context.Context, id int, fname string, sz int64, public bool, autoUpdate bool, architecture string, createdAt time.Time, expiresAt time.Time, properties map[string]string, project string, profileIds []int64) error
UpdateImage updates the image with the given ID.
func (*ClusterTx) UpdateImageAlias ¶
func (c *ClusterTx) UpdateImageAlias(ctx context.Context, aliasID int, imageID int, desc string) error
UpdateImageAlias updates the alias with the given ID.
func (*ClusterTx) UpdateImageLastUseDate ¶
func (c *ClusterTx) UpdateImageLastUseDate(ctx context.Context, projectName string, fingerprint string, lastUsed time.Time) error
UpdateImageLastUseDate updates the last_use_date field of the image with the given fingerprint.
func (*ClusterTx) UpdateInstanceConfig ¶
UpdateInstanceConfig inserts/updates/deletes the provided keys.
func (*ClusterTx) UpdateInstanceLastUsedDate ¶
UpdateInstanceLastUsedDate updates the last_use_date field of the instance with the given ID.
func (*ClusterTx) UpdateInstanceNode ¶
func (c *ClusterTx) UpdateInstanceNode(ctx context.Context, project string, oldName string, newName string, newMemberName string, poolID int64, volumeType int) error
UpdateInstanceNode changes the name of an instance and the cluster member hosting it. It's meant to be used when moving a non-running instance backed by remote storage from one cluster node to another.
func (*ClusterTx) UpdateInstancePowerState ¶
UpdateInstancePowerState sets the power state of the container with the given ID.
func (*ClusterTx) UpdateInstanceSnapshot ¶
UpdateInstanceSnapshot updates the description and expiry date of the instance snapshot with the given ID.
func (*ClusterTx) UpdateInstanceSnapshotConfig ¶
UpdateInstanceSnapshotConfig inserts/updates/deletes the provided config keys.
func (*ClusterTx) UpdateInstanceSnapshotCreationDate ¶
func (c *ClusterTx) UpdateInstanceSnapshotCreationDate(ctx context.Context, instanceID int, date time.Time) error
UpdateInstanceSnapshotCreationDate updates the creation_date field of the instance snapshot with ID.
func (*ClusterTx) UpdateInstanceStatefulFlag ¶
UpdateInstanceStatefulFlag toggles the stateful flag of the instance with the given ID.
func (*ClusterTx) UpdateNetwork ¶
func (c *ClusterTx) UpdateNetwork(ctx context.Context, project string, name, description string, config map[string]string) error
UpdateNetwork updates the network with the given name.
func (*ClusterTx) UpdateNetworkACL ¶
func (c *ClusterTx) UpdateNetworkACL(ctx context.Context, id int64, config *api.NetworkACLPut) error
UpdateNetworkACL updates the Network ACL with the given ID.
func (*ClusterTx) UpdateNetworkForward ¶
func (c *ClusterTx) UpdateNetworkForward(ctx context.Context, networkID int64, forwardID int64, info *api.NetworkForwardPut) error
UpdateNetworkForward updates an existing Network Forward.
func (*ClusterTx) UpdateNetworkLoadBalancer ¶
func (c *ClusterTx) UpdateNetworkLoadBalancer(ctx context.Context, networkID int64, loadBalancerID int64, info *api.NetworkLoadBalancerPut) error
UpdateNetworkLoadBalancer updates an existing Network Load Balancer.
func (*ClusterTx) UpdateNetworkPeer ¶
func (c *ClusterTx) UpdateNetworkPeer(ctx context.Context, networkID int64, peerID int64, info *api.NetworkPeerPut) error
UpdateNetworkPeer updates an existing Network Peer.
func (*ClusterTx) UpdateNetworkZoneRecord ¶
func (c *ClusterTx) UpdateNetworkZoneRecord(ctx context.Context, id int64, config api.NetworkZoneRecordPut) error
UpdateNetworkZoneRecord updates the network zone record with the given ID.
func (*ClusterTx) UpdateNodeClusterGroups ¶
UpdateNodeClusterGroups changes the list of cluster groups the member belongs to.
func (*ClusterTx) UpdateNodeConfig ¶
UpdateNodeConfig updates the replaces the node's config with the specified config.
func (*ClusterTx) UpdateNodeFailureDomain ¶
UpdateNodeFailureDomain changes the failure domain of a node.
func (*ClusterTx) UpdateNodeRoles ¶
func (c *ClusterTx) UpdateNodeRoles(id int64, roles []ClusterRole) error
UpdateNodeRoles changes the list of roles on a member.
func (*ClusterTx) UpdateNodeStatus ¶
UpdateNodeStatus changes the state of a node.
func (*ClusterTx) UpdateRemoteStoragePoolAfterNodeJoin ¶
func (c *ClusterTx) UpdateRemoteStoragePoolAfterNodeJoin(ctx context.Context, poolID int64, nodeID int64) error
UpdateRemoteStoragePoolAfterNodeJoin updates internal state to reflect that nodeID is joining a cluster where poolID is a remote pool.
func (*ClusterTx) UpdateStoragePool ¶
func (c *ClusterTx) UpdateStoragePool(ctx context.Context, poolName, description string, poolConfig map[string]string) error
UpdateStoragePool updates a storage pool.
func (*ClusterTx) UpdateStoragePoolAfterNodeJoin ¶
UpdateStoragePoolAfterNodeJoin adds a new entry in the storage_pools_nodes table.
It should only be used when a new node joins the cluster, when it's safe to assume that the relevant pool has already been created on the joining node, and we just need to track it.
func (*ClusterTx) UpdateStoragePoolBucket ¶
func (c *ClusterTx) UpdateStoragePoolBucket(ctx context.Context, poolID int64, bucketID int64, info *api.StorageBucketPut) error
UpdateStoragePoolBucket updates an existing Storage Bucket.
func (*ClusterTx) UpdateStoragePoolBucketKey ¶
func (c *ClusterTx) UpdateStoragePoolBucketKey(ctx context.Context, bucketID int64, bucketKeyID int64, info *api.StorageBucketKeyPut) error
UpdateStoragePoolBucketKey updates an existing Storage Bucket Key.
func (*ClusterTx) UpdateStoragePoolVolume ¶
func (c *ClusterTx) UpdateStoragePoolVolume(ctx context.Context, projectName string, volumeName string, volumeType int, poolID int64, volumeDescription string, volumeConfig map[string]string) error
UpdateStoragePoolVolume updates the storage volume attached to a given storage pool.
func (*ClusterTx) UpdateStorageVolumeNode ¶
func (c *ClusterTx) UpdateStorageVolumeNode(ctx context.Context, projectName string, oldName string, newName string, newMemberName string, poolID int64, volumeType int) error
UpdateStorageVolumeNode changes the name of a storage volume and the cluster member hosting it. It's meant to be used when moving a storage volume backed by a remote storage pool from one cluster node to another.
func (*ClusterTx) UpdateStorageVolumeSnapshot ¶
func (c *ClusterTx) UpdateStorageVolumeSnapshot(ctx context.Context, projectName string, volumeName string, volumeType int, poolID int64, volumeDescription string, volumeConfig map[string]string, expiryDate time.Time) error
UpdateStorageVolumeSnapshot updates the storage volume snapshot attached to a given storage pool.
func (*ClusterTx) UpdateWarningState ¶
func (c *ClusterTx) UpdateWarningState(UUID string, message string, status warningtype.Status) error
UpdateWarningState updates the warning message and status with the given ID.
func (*ClusterTx) UpdateWarningStatus ¶
func (c *ClusterTx) UpdateWarningStatus(UUID string, status warningtype.Status) error
UpdateWarningStatus updates the status of the warning with the given UUID.
func (*ClusterTx) UpsertWarning ¶
func (c *ClusterTx) UpsertWarning(ctx context.Context, nodeName string, projectName string, entityTypeCode int, entityID int, typeCode warningtype.Type, message string) error
UpsertWarning creates or updates a warning.
func (*ClusterTx) UpsertWarningLocalNode ¶
func (c *ClusterTx) UpsertWarningLocalNode(ctx context.Context, projectName string, entityTypeCode int, entityID int, typeCode warningtype.Type, message string) error
UpsertWarningLocalNode creates or updates a warning for the local member. Returns error if no local member name.
type DB ¶
DB represents access to global and local databases.
func (*DB) GetProject ¶
GetProject returns the project with the given key.
func (*DB) UpdateCertificate ¶
func (db *DB) UpdateCertificate(ctx context.Context, fingerprint string, cert cluster.Certificate, projectNames []string) error
UpdateCertificate updates a certificate in the db.
type InstanceArgs ¶
type InstanceArgs struct { // Don't set manually ID int Node string Type instancetype.Type Snapshot bool // Creation only Project string BaseImage string CreationDate time.Time Architecture int Config map[string]string Description string Devices deviceConfig.Devices Ephemeral bool LastUsedDate time.Time Name string Profiles []api.Profile Stateful bool ExpiryDate time.Time }
InstanceArgs is a value object holding all db-related details about an instance.
type InstanceBackup ¶
type InstanceBackup struct { ID int InstanceID int Name string CreationDate time.Time ExpiryDate time.Time InstanceOnly bool OptimizedStorage bool CompressionAlgorithm string }
InstanceBackup is a value object holding all db-related details about an instance backup.
type NetworkNode ¶
type NetworkNode struct { ID int64 Name string State NetworkState }
NetworkNode represents a network node.
type NetworkPeer ¶
NetworkPeer represents a peer connection.
type NetworkState ¶
type NetworkState int
NetworkState indicates the state of the network or network node.
type NetworkType ¶
type NetworkType int
NetworkType indicates type of network.
const ( NetworkTypeBridge NetworkType = iota // Network type bridge. NetworkTypeMacvlan // Network type macvlan. NetworkTypeSriov // Network type sriov. NetworkTypeOVN // Network type ovn. NetworkTypePhysical // Network type physical. )
Network types.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node mediates access to data stored in the node-local SQLite database.
func DirectAccess ¶
DirectAccess is a bit of a hack which allows getting a database Node struct from any standard Go sql.DB. This is primarily used to access the "db.bin" read-only copy of the database during startup.
func NewTestNode ¶
NewTestNode creates a new Node for testing purposes, along with a function that can be used to clean it up when done.
func OpenNode ¶
OpenNode creates a new Node object.
The fresh hook parameter is used by the daemon to mark all known patch names as applied when a brand new database is created.
Return the newly created Node object.
func (*Node) DB ¶
DB returns the low level database handle to the node-local SQLite database.
FIXME: this is used for compatibility with some legacy code, and should be dropped once there are no call sites left.
func (*Node) GetAppliedPatches ¶
GetAppliedPatches returns the names of all patches currently applied on this node.
func (*Node) MarkPatchAsApplied ¶
MarkPatchAsApplied marks the patch with the given name as applied on this node.
func (*Node) Transaction ¶
Transaction creates a new NodeTx object and transactionally executes the node-level database interactions invoked by the given function. If the function returns no error, all database changes are committed to the node-level database, otherwise they are rolled back.
type NodeInfo ¶
type NodeInfo struct { ID int64 // Stable node identifier Name string // User-assigned name of the node Address string // Network address of the node Description string // Node description (optional) Schema int // Schema version of the daemon running the member APIExtensions int // Number of API extensions of the daemon running the member Heartbeat time.Time // Timestamp of the last heartbeat Roles []ClusterRole // List of cluster roles Architecture int // Node architecture State int // Node state Config map[string]string // Configuration for the node Groups []string // Cluster groups }
NodeInfo holds information about a single member in a cluster.
func (NodeInfo) IsOffline ¶
IsOffline returns true if the last successful heartbeat time of the node is older than the given threshold.
func (NodeInfo) ToAPI ¶
func (n NodeInfo) ToAPI(ctx context.Context, tx *ClusterTx, args NodeInfoArgs) (*api.ClusterMember, error)
ToAPI returns an API entry.
type NodeInfoArgs ¶
type NodeInfoArgs struct { LeaderAddress string FailureDomains map[uint64]string MemberFailureDomains map[string]uint64 OfflineThreshold time.Duration MaxMemberVersion [2]int RaftNodes []RaftNode }
NodeInfoArgs provides information about the cluster environment for use with NodeInfo.ToAPI().
type NodeTx ¶
type NodeTx struct {
// contains filtered or unexported fields
}
NodeTx models a single interaction with a server-local database.
It wraps low-level sql.Tx objects and offers a high-level API to fetch and update data.
func NewTestNodeTx ¶
NewTestNodeTx returns a fresh NodeTx object, along with a function that can be called to cleanup state when done with it.
func (*NodeTx) CreateFirstRaftNode ¶
CreateFirstRaftNode adds a the first node of the cluster. It ensures that the database ID is 1, to match the server ID of the first raft log entry.
This method is supposed to be called when there are no rows in raft_nodes, and it will replace whatever existing row has ID 1.
func (*NodeTx) CreateRaftNode ¶
CreateRaftNode adds a node to the current list of nodes that are part of the dqlite Raft cluster. It returns the ID of the newly inserted row.
func (*NodeTx) GetCertificates ¶
GetCertificates returns all available local certificates.
func (*NodeTx) GetRaftNodeAddress ¶
GetRaftNodeAddress returns the address of the raft node with the given ID, if any matching row exists.
func (*NodeTx) GetRaftNodeAddresses ¶
GetRaftNodeAddresses returns the addresses of all servers that are members of the dqlite Raft cluster (possibly including the local member). If this server is not running in clustered mode, an empty list is returned.
func (*NodeTx) GetRaftNodes ¶
GetRaftNodes returns information about all cluster members that are members of the dqlite Raft cluster (possibly including the local member). If this server is not running in clustered mode, an empty list is returned.
func (*NodeTx) RemoveRaftNode ¶
RemoveRaftNode removes a node from the current list of nodes that are part of the dqlite Raft cluster.
func (*NodeTx) ReplaceCertificates ¶
func (n *NodeTx) ReplaceCertificates(certs []cluster.Certificate) error
ReplaceCertificates removes all existing certificates from the local certificates table and replaces them with the ones provided.
func (*NodeTx) ReplaceRaftNodes ¶
ReplaceRaftNodes replaces the current list of raft nodes.
type RaftNode ¶
RaftNode holds information about a single node in the dqlite raft cluster.
This is just a convenience alias for the equivalent data structure in the dqlite client package.
type StorageBucket ¶
type StorageBucket struct { api.StorageBucket ID int64 Project string PoolID int64 PoolName string }
StorageBucket represents a database storage bucket record.
type StorageBucketFilter ¶
StorageBucketFilter used for filtering storage buckets with GetStorageBuckets().
type StorageBucketKey ¶
type StorageBucketKey struct { api.StorageBucketKey ID int64 }
StorageBucketKey represents a database storage bucket key record.
type StorageBucketKeyFilter ¶
type StorageBucketKeyFilter struct {
Name *string
}
StorageBucketKeyFilter used for filtering storage bucket keys with GetStoragePoolBucketKeys().
type StoragePoolBucketBackup ¶
type StoragePoolBucketBackup struct { ID int BucketID int64 Name string CreationDate time.Time ExpiryDate time.Time CompressionAlgorithm string }
StoragePoolBucketBackup is a value object holding all db-related details about a storage bucket backup.
type StoragePoolNode ¶
type StoragePoolNode struct { ID int64 Name string State StoragePoolState }
StoragePoolNode represents a storage pool node.
type StoragePoolState ¶
type StoragePoolState int
StoragePoolState indicates the state of the storage pool or storage pool node.
const ( StoragePoolPending StoragePoolState = iota // Storage pool defined but not yet created globally or on specific node. StoragePoolCreated // Storage pool created globally or on specific node. )
Storage pools state.
type StoragePoolVolumeBackup ¶
type StoragePoolVolumeBackup struct { ID int VolumeID int64 Name string CreationDate time.Time ExpiryDate time.Time VolumeOnly bool OptimizedStorage bool CompressionAlgorithm string }
StoragePoolVolumeBackup is a value object holding all db-related details about a storage volume backup.
type StorageVolume ¶
type StorageVolume struct { api.StorageVolume ID int64 }
StorageVolume represents a database storage volume record.
type StorageVolumeArgs ¶
type StorageVolumeArgs struct { ID int64 Name string // At least one of Type or TypeName must be set. Type int TypeName string // At least one of PoolID or PoolName must be set. PoolID int64 PoolName string Snapshot bool Config map[string]string Description string CreationDate time.Time ExpiryDate time.Time // At least on of ProjectID or ProjectName must be set. ProjectID int64 ProjectName string ContentType string NodeID int64 }
StorageVolumeArgs is a value object holding all db-related details about a storage volume.
type StorageVolumeFilter ¶
StorageVolumeFilter used for filtering storage volumes with GetStoragePoolVolumes().
Source Files ¶
- backups.go
- certificates.go
- cluster.go
- config.go
- db.go
- entity.go
- errors.go
- images.go
- instances.go
- network_acls.go
- network_forwards.go
- network_load_balancers.go
- network_peers.go
- network_zones.go
- networks.go
- node.go
- operations.go
- patches.go
- profiles.go
- projects.go
- raft.go
- schema.go
- snapshots.go
- storage_buckets.go
- storage_pools.go
- storage_volume_snapshots.go
- storage_volumes.go
- testing.go
- transaction.go
- warnings.go
Directories ¶
Path | Synopsis |
---|---|
file
Package file contains helpers to write auto-generated Go source files.
|
Package file contains helpers to write auto-generated Go source files. |
Package query implements helpers around database/sql to execute various kinds of very common SQL queries.
|
Package query implements helpers around database/sql to execute various kinds of very common SQL queries. |
Package schema offers utilities to create and maintain a database schema.
|
Package schema offers utilities to create and maintain a database schema. |