...

Package client

import "github.com/LINBIT/golinstor/client"
Overview
Index
Examples

Overview ▾

Example (Error)

Code:

ctx := context.TODO()

u, err := url.Parse("http://controller:3370")
if err != nil {
    log.Fatal(err)
}

c, err := client.NewClient(client.BaseURL(u), client.Log(log.StandardLogger()))
if err != nil {
    log.Fatal(err)
}

rs, err := c.Resources.GetAll(ctx, "foo")
if errs, ok := err.(client.ApiCallError); ok {
    log.Error("A LINSTOR API error occurred:")
    for i, e := range errs {
        log.Errorf("  Message #%d:", i)
        log.Errorf("    Code: %d", e.RetCode)
        log.Errorf("    Message: %s", e.Message)
        log.Errorf("    Cause: %s", e.Cause)
        log.Errorf("    Details: %s", e.Details)
        log.Errorf("    Correction: %s", e.Correction)
        log.Errorf("    Error Reports: %v", e.ErrorReportIds)
    }
    return
}
if err != nil {
    log.Fatalf("Some other error occurred: %s", err.Error())
}

for _, r := range rs {
    fmt.Printf("Resource with name '%s' on node with name '%s'\n", r.Name, r.NodeName)
}

Example (Events)

Code:

ctx := context.TODO()

u, err := url.Parse("http://controller:3370")
if err != nil {
    log.Fatal(err)
}

c, err := client.NewClient(client.BaseURL(u))
if err != nil {
    log.Fatal(err)
}

mayPromoteStream, err := c.Events.DRBDPromotion(ctx, "")
if err != nil {
    log.Fatal(err)
}
defer mayPromoteStream.Close()

for ev := range mayPromoteStream.Events {
    fmt.Printf("Resource '%s' on node with name '%s' may promote: %t\n", ev.ResourceName, ev.NodeName, ev.MayPromote)
}

Example (Https)

Code:

ctx := context.TODO()

u, err := url.Parse("https://controller:3371")
if err != nil {
    log.Fatal(err)
}

// Be careful if that is really what you want!
trSkipVerify := &http.Transport{
    TLSClientConfig: &tls.Config{
        InsecureSkipVerify: true,
    },
}
httpClient := &http.Client{
    Transport: trSkipVerify,
}

c, err := client.NewClient(client.BaseURL(u), client.HTTPClient(httpClient))
if err != nil {
    log.Fatal(err)
}

rs, err := c.Resources.GetAll(ctx, "foo")
if err != nil {
    log.Fatal(err)
}

for _, r := range rs {
    fmt.Printf("Resource with name '%s' on node with name '%s'\n", r.Name, r.NodeName)
}

Example (Httpsauth)

Code:

ctx := context.TODO()

u, err := url.Parse("https://controller:3371")
if err != nil {
    log.Fatal(err)
}

// Be careful if that is really what you want!
trSkipVerify := &http.Transport{
    TLSClientConfig: &tls.Config{
        InsecureSkipVerify: true,
    },
}
httpClient := &http.Client{
    Transport: trSkipVerify,
}

c, err := client.NewClient(client.BaseURL(u), client.HTTPClient(httpClient),
    client.BasicAuth(&client.BasicAuthCfg{Username: "Username", Password: "Password"}))
if err != nil {
    log.Fatal(err)
}

rs, err := c.Resources.GetAll(ctx, "foo")
if err != nil {
    log.Fatal(err)
}

for _, r := range rs {
    fmt.Printf("Resource with name '%s' on node with name '%s'\n", r.Name, r.NodeName)
}

Example (MultipleControllers)

Code:

ctx := context.TODO()
controllers := []string{"alfa:3370", "bravo:3370", "charlie:3370"}

c, err := client.NewClient(client.Controllers(controllers))
if err != nil {
    log.Fatal(err)
}

// This call will try each of the controllers and use the first one that responds
version, err := c.Controller.GetVersion(ctx)
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Controller Version: %v", version)

Example (Simple)

Code:

ctx := context.TODO()

u, err := url.Parse("http://controller:3370")
if err != nil {
    log.Fatal(err)
}

c, err := client.NewClient(client.BaseURL(u), client.Log(log.StandardLogger()))
if err != nil {
    log.Fatal(err)
}

rs, err := c.Resources.GetAll(ctx, "foo")
if err != nil {
    log.Fatal(err)
}

for _, r := range rs {
    fmt.Printf("Resource with name '%s' on node with name '%s'\n", r.Name, r.NodeName)
}

Index ▾

Constants
func IsApiCallError(err error, mask uint64) bool
type ApiCallError
    func (e ApiCallError) Error() string
    func (e ApiCallError) Is(mask uint64) bool
type ApiCallRc
    func (r ApiCallRc) Is(mask uint64) bool
    func (rc *ApiCallRc) String() string
type AutoPlaceRequest
type AutoSelectFilter
type BCacheResource
type BCacheVolume
type Backup
type BackupAbortRequest
type BackupCreate
type BackupDeleteOpts
type BackupInfo
type BackupInfoRequest
type BackupInfoStorPool
type BackupInfoVolume
type BackupList
type BackupOther
type BackupProvider
type BackupRestoreRequest
type BackupS3
type BackupService
    func (b *BackupService) Abort(ctx context.Context, remoteName string, request BackupAbortRequest) error
    func (b *BackupService) Create(ctx context.Context, remoteName string, request BackupCreate) (string, error)
    func (b *BackupService) DeleteAll(ctx context.Context, remoteName string, filter BackupDeleteOpts) error
    func (b *BackupService) GetAll(ctx context.Context, remoteName string, rscName string, snapName string) (*BackupList, error)
    func (b *BackupService) Info(ctx context.Context, remoteName string, request BackupInfoRequest) (*BackupInfo, error)
    func (b *BackupService) Restore(ctx context.Context, remoteName string, request BackupRestoreRequest) error
    func (b *BackupService) Ship(ctx context.Context, remoteName string, request BackupShipRequest) (string, error)
type BackupShipRequest
type BackupVolumes
type BackupVolumesS3
type BasicAuthCfg
type CacheResource
type CacheVolume
type Candidate
type Client
    func NewClient(options ...Option) (*Client, error)
    func (c *Client) BaseURL() *url.URL
type Connection
type ConnectionProvider
type ConnectionService
    func (c *ConnectionService) GetNodeConnections(ctx context.Context, nodeA, nodeB string) ([]Connection, error)
    func (c *ConnectionService) GetResourceConnection(ctx context.Context, resource, nodeA, nodeB string) (*Connection, error)
    func (c *ConnectionService) GetResourceConnections(ctx context.Context, resource string) ([]Connection, error)
    func (c *ConnectionService) SetNodeConnection(ctx context.Context, nodeA, nodeB string, props GenericPropsModify) error
    func (c *ConnectionService) SetResourceConnection(ctx context.Context, resource, nodeA, nodeB string, props GenericPropsModify) error
type ControllerConfig
type ControllerConfigConfig
type ControllerConfigDb
type ControllerConfigDbEtcd
type ControllerConfigDebug
type ControllerConfigHttp
type ControllerConfigHttps
type ControllerConfigLdap
type ControllerConfigLog
type ControllerProps
type ControllerProvider
type ControllerService
    func (s *ControllerService) CreateSOSReport(ctx context.Context, opts ...*ListOpts) error
    func (s *ControllerService) DeleteErrorReports(ctx context.Context, del ErrorReportDelete) error
    func (s *ControllerService) DeleteExternalFile(ctx context.Context, name string) error
    func (s *ControllerService) DeleteProp(ctx context.Context, prop string) error
    func (s *ControllerService) DownloadSOSReport(ctx context.Context, opts ...*ListOpts) error
    func (s *ControllerService) GetConfig(ctx context.Context, opts ...*ListOpts) (ControllerConfig, error)
    func (s *ControllerService) GetErrorReport(ctx context.Context, id string, opts ...*ListOpts) (ErrorReport, error)
    func (s *ControllerService) GetErrorReports(ctx context.Context, opts ...*ListOpts) ([]ErrorReport, error)
    func (s *ControllerService) GetErrorReportsSince(ctx context.Context, since time.Time, opts ...*ListOpts) ([]ErrorReport, error)
    func (s *ControllerService) GetExternalFile(ctx context.Context, name string) (ExternalFile, error)
    func (s *ControllerService) GetExternalFiles(ctx context.Context, opts ...*ListOpts) ([]ExternalFile, error)
    func (s *ControllerService) GetProps(ctx context.Context, opts ...*ListOpts) (ControllerProps, error)
    func (s *ControllerService) GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)
    func (s *ControllerService) GetPropsInfosAll(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)
    func (s *ControllerService) GetSatelliteConfig(ctx context.Context, node string) (SatelliteConfig, error)
    func (s *ControllerService) GetVersion(ctx context.Context, opts ...*ListOpts) (ControllerVersion, error)
    func (s *ControllerService) Modify(ctx context.Context, props GenericPropsModify) error
    func (s *ControllerService) ModifyExternalFile(ctx context.Context, name string, file ExternalFile) error
    func (s *ControllerService) ModifySatelliteConfig(ctx context.Context, node string, cfg SatelliteConfig) error
type ControllerVersion
type DRBDMayPromoteStream
    func (dmp *DRBDMayPromoteStream) Close()
type DeleteNamespaces
type DeleteProps
type DrbdConnection
type DrbdProxyModify
type DrbdResource
type DrbdResourceDefinitionLayer
type DrbdVolume
type DrbdVolumeDefinition
type EbsRemote
type EncryptionProvider
type EncryptionService
    func (n *EncryptionService) Create(ctx context.Context, passphrase Passphrase) error
    func (n *EncryptionService) Enter(ctx context.Context, password string) error
    func (n *EncryptionService) Modify(ctx context.Context, passphrase Passphrase) error
type ErrorReport
type ErrorReportDelete
type EventMayPromoteChange
type EventProvider
type EventService
    func (e *EventService) DRBDPromotion(ctx context.Context, lastEventId string) (*DRBDMayPromoteStream, error)
type ExosConnectionMap
type ExosDefaults
type ExosDefaultsModify
type ExosDefaultsModifyAllOf
type ExosEnclosure
type ExosEnclosureEvent
type ExosEnclosureHealth
type ExternalFile
    func (e *ExternalFile) MarshalJSON() ([]byte, error)
    func (e *ExternalFile) UnmarshalJSON(text []byte) error
type GenericPropsModify
type KV
type KeyValueStoreProvider
type KeyValueStoreService
    func (k *KeyValueStoreService) CreateOrModify(ctx context.Context, kv string, modify GenericPropsModify) error
    func (k *KeyValueStoreService) Delete(ctx context.Context, kv string) error
    func (k *KeyValueStoreService) Get(ctx context.Context, kv string) (*KV, error)
    func (k *KeyValueStoreService) List(ctx context.Context) ([]KV, error)
type LeveledLogger
type LinstorRemote
type ListOpts
type LogLevel
type Logger
type LuksResource
type LuksVolume
type MaxVolumeSizes
type NetInterface
type Node
type NodeModify
type NodeProvider
type NodeRestore
type NodeService
    func (n *NodeService) Create(ctx context.Context, node Node) error
    func (n *NodeService) CreateDevicePool(ctx context.Context, nodeName string, psc PhysicalStorageCreate) error
    func (n *NodeService) CreateEbsNode(ctx context.Context, name, remoteName string) error
    func (n *NodeService) CreateNetInterface(ctx context.Context, nodeName string, nif NetInterface) error
    func (n *NodeService) CreateStoragePool(ctx context.Context, nodeName string, sp StoragePool) error
    func (n *NodeService) Delete(ctx context.Context, nodeName string) error
    func (n *NodeService) DeleteNetinterface(ctx context.Context, nodeName, nifName string) error
    func (n *NodeService) DeleteStoragePool(ctx context.Context, nodeName, spName string) error
    func (n NodeService) Evacuate(ctx context.Context, nodeName string) error
    func (n NodeService) Evict(ctx context.Context, nodeName string) error
    func (n *NodeService) Get(ctx context.Context, nodeName string, opts ...*ListOpts) (Node, error)
    func (n *NodeService) GetAll(ctx context.Context, opts ...*ListOpts) ([]Node, error)
    func (n *NodeService) GetNetInterface(ctx context.Context, nodeName, nifName string, opts ...*ListOpts) (NetInterface, error)
    func (n *NodeService) GetNetInterfaces(ctx context.Context, nodeName string, opts ...*ListOpts) ([]NetInterface, error)
    func (n *NodeService) GetPhysicalStorage(ctx context.Context, nodeName string) ([]PhysicalStorageNode, error)
    func (n *NodeService) GetPhysicalStorageView(ctx context.Context, opts ...*ListOpts) ([]PhysicalStorageViewItem, error)
    func (n *NodeService) GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)
    func (n *NodeService) GetStoragePool(ctx context.Context, nodeName, spName string, opts ...*ListOpts) (StoragePool, error)
    func (n *NodeService) GetStoragePoolPropsInfos(ctx context.Context, nodeName string, opts ...*ListOpts) ([]PropsInfo, error)
    func (n *NodeService) GetStoragePoolView(ctx context.Context, opts ...*ListOpts) ([]StoragePool, error)
    func (n *NodeService) GetStoragePools(ctx context.Context, nodeName string, opts ...*ListOpts) ([]StoragePool, error)
    func (n *NodeService) Lost(ctx context.Context, nodeName string) error
    func (n *NodeService) Modify(ctx context.Context, nodeName string, props NodeModify) error
    func (n *NodeService) ModifyNetInterface(ctx context.Context, nodeName, nifName string, nif NetInterface) error
    func (n *NodeService) ModifyStoragePool(ctx context.Context, nodeName, spName string, genericProps GenericPropsModify) error
    func (n *NodeService) Reconnect(ctx context.Context, nodeName string) error
    func (n *NodeService) Restore(ctx context.Context, nodeName string, restore NodeRestore) error
type NvmeResource
type NvmeVolume
type OneOfDrbdVolumeDefinition
type OneOfDrbdVolumeLuksVolumeStorageVolumeNvmeVolumeWritecacheVolumeCacheVolumeBCacheVolume
type Option
    func BaseURL(URL *url.URL) Option
    func BasicAuth(basicauth *BasicAuthCfg) Option
    func BearerToken(token string) Option
    func Controllers(controllers []string) Option
    func HTTPClient(httpClient *http.Client) Option
    func Limit(r rate.Limit, b int) Option
    func Limiter(limiter *rate.Limiter) Option
    func Log(logger interface{}) Option
    func UserAgent(ua string) Option
type OverrideProps
type Passphrase
type PhysicalStorageCreate
type PhysicalStorageDevice
type PhysicalStorageNode
type PhysicalStorageStoragePoolCreate
type PhysicalStorageViewItem
type PropsInfo
type ProviderKind
type RDGetAllRequest
type RemoteList
type RemoteProvider
type RemoteService
    func (r *RemoteService) CreateEbs(ctx context.Context, create EbsRemote) error
    func (r *RemoteService) CreateLinstor(ctx context.Context, create LinstorRemote) error
    func (r *RemoteService) CreateS3(ctx context.Context, create S3Remote) error
    func (r *RemoteService) Delete(ctx context.Context, remoteName string) error
    func (r *RemoteService) GetAll(ctx context.Context, opts ...*ListOpts) (RemoteList, error)
    func (r *RemoteService) GetAllEbs(ctx context.Context, opts ...*ListOpts) ([]EbsRemote, error)
    func (r *RemoteService) GetAllLinstor(ctx context.Context, opts ...*ListOpts) ([]LinstorRemote, error)
    func (r *RemoteService) GetAllS3(ctx context.Context, opts ...*ListOpts) ([]S3Remote, error)
    func (r *RemoteService) ModifyEbs(ctx context.Context, remoteName string, modify EbsRemote) error
    func (r *RemoteService) ModifyLinstor(ctx context.Context, remoteName string, modify LinstorRemote) error
    func (r *RemoteService) ModifyS3(ctx context.Context, remoteName string, modify S3Remote) error
type Resource
type ResourceConnection
type ResourceCreate
type ResourceDefinition
type ResourceDefinitionCloneRequest
type ResourceDefinitionCloneStarted
type ResourceDefinitionCloneStatus
type ResourceDefinitionCreate
type ResourceDefinitionLayer
    func (rd *ResourceDefinitionLayer) UnmarshalJSON(b []byte) error
type ResourceDefinitionModify
type ResourceDefinitionProvider
type ResourceDefinitionService
    func (n *ResourceDefinitionService) AttachExternalFile(ctx context.Context, resDefName string, filePath string) error
    func (n *ResourceDefinitionService) Clone(ctx context.Context, srcResDef string, request ResourceDefinitionCloneRequest) (ResourceDefinitionCloneStarted, error)
    func (n *ResourceDefinitionService) CloneStatus(ctx context.Context, srcResDef, targetResDef string) (ResourceDefinitionCloneStatus, error)
    func (n *ResourceDefinitionService) Create(ctx context.Context, resDef ResourceDefinitionCreate) error
    func (n *ResourceDefinitionService) CreateVolumeDefinition(ctx context.Context, resDefName string, volDef VolumeDefinitionCreate) error
    func (n *ResourceDefinitionService) Delete(ctx context.Context, resDefName string) error
    func (n *ResourceDefinitionService) DeleteVolumeDefinition(ctx context.Context, resDefName string, volNr int) error
    func (n *ResourceDefinitionService) DetachExternalFile(ctx context.Context, resDefName string, filePath string) error
    func (n *ResourceDefinitionService) Get(ctx context.Context, resDefName string, opts ...*ListOpts) (ResourceDefinition, error)
    func (n *ResourceDefinitionService) GetAll(ctx context.Context, request RDGetAllRequest) ([]ResourceDefinitionWithVolumeDefinition, error)
    func (n *ResourceDefinitionService) GetDRBDProxyPropsInfos(ctx context.Context, resDefName string, opts ...*ListOpts) ([]PropsInfo, error)
    func (n *ResourceDefinitionService) GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)
    func (n *ResourceDefinitionService) GetVolumeDefinition(ctx context.Context, resDefName string, volNr int, opts ...*ListOpts) (VolumeDefinition, error)
    func (n *ResourceDefinitionService) GetVolumeDefinitions(ctx context.Context, resDefName string, opts ...*ListOpts) ([]VolumeDefinition, error)
    func (n *ResourceDefinitionService) Modify(ctx context.Context, resDefName string, props GenericPropsModify) error
    func (n *ResourceDefinitionService) ModifyVolumeDefinition(ctx context.Context, resDefName string, volNr int, props VolumeDefinitionModify) error
    func (n *ResourceDefinitionService) SyncStatus(ctx context.Context, resDef string) (ResourceDefinitionSyncStatus, error)
type ResourceDefinitionSyncStatus
type ResourceDefinitionWithVolumeDefinition
type ResourceGroup
type ResourceGroupAdjust
type ResourceGroupModify
type ResourceGroupProvider
type ResourceGroupService
    func (n *ResourceGroupService) Adjust(ctx context.Context, resGrpName string, adjust ResourceGroupAdjust) error
    func (n *ResourceGroupService) AdjustAll(ctx context.Context, adjust ResourceGroupAdjust) error
    func (n *ResourceGroupService) Create(ctx context.Context, resGrp ResourceGroup) error
    func (n *ResourceGroupService) CreateVolumeGroup(ctx context.Context, resGrpName string, volGrp VolumeGroup) error
    func (n *ResourceGroupService) Delete(ctx context.Context, resGrpName string) error
    func (n *ResourceGroupService) DeleteVolumeGroup(ctx context.Context, resGrpName string, volNr int) error
    func (n *ResourceGroupService) Get(ctx context.Context, resGrpName string, opts ...*ListOpts) (ResourceGroup, error)
    func (n *ResourceGroupService) GetAll(ctx context.Context, opts ...*ListOpts) ([]ResourceGroup, error)
    func (n *ResourceGroupService) GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)
    func (n *ResourceGroupService) GetVolumeGroup(ctx context.Context, resGrpName string, volNr int, opts ...*ListOpts) (VolumeGroup, error)
    func (n *ResourceGroupService) GetVolumeGroupPropsInfos(ctx context.Context, resGrpName string, opts ...*ListOpts) ([]PropsInfo, error)
    func (n *ResourceGroupService) GetVolumeGroups(ctx context.Context, resGrpName string, opts ...*ListOpts) ([]VolumeGroup, error)
    func (n *ResourceGroupService) Modify(ctx context.Context, resGrpName string, props ResourceGroupModify) error
    func (n *ResourceGroupService) ModifyVolumeGroup(ctx context.Context, resGrpName string, volNr int, props VolumeGroupModify) error
    func (n *ResourceGroupService) Spawn(ctx context.Context, resGrpName string, resGrpSpwn ResourceGroupSpawn) error
type ResourceGroupSpawn
type ResourceLayer
type ResourceMakeAvailable
type ResourceProvider
type ResourceService
    func (n *ResourceService) Activate(ctx context.Context, resName, nodeName string) error
    func (n *ResourceService) Autoplace(ctx context.Context, resName string, apr AutoPlaceRequest) error
    func (n *ResourceService) Create(ctx context.Context, res ResourceCreate) error
    func (n *ResourceService) CreateSnapshot(ctx context.Context, snapshot Snapshot) error
    func (n *ResourceService) Deactivate(ctx context.Context, resName, nodeName string) error
    func (n *ResourceService) Delete(ctx context.Context, resName, nodeName string) error
    func (n *ResourceService) DeleteSnapshot(ctx context.Context, resName, snapName string, nodes ...string) error
    func (n *ResourceService) DisableDRBDProxy(ctx context.Context, resName, nodeAName, nodeBName string) error
    func (n *ResourceService) Diskful(ctx context.Context, resName, nodeName, storagePoolName string, props *ToggleDiskDiskfulProps) error
    func (n *ResourceService) Diskless(ctx context.Context, resName, nodeName, disklessPoolName string) error
    func (n *ResourceService) EnableDRBDProxy(ctx context.Context, resName, nodeAName, nodeBName string) error
    func (n *ResourceService) EnableSnapshotShipping(ctx context.Context, resName string, ship SnapshotShipping) error
    func (n *ResourceService) Get(ctx context.Context, resName, nodeName string, opts ...*ListOpts) (Resource, error)
    func (n *ResourceService) GetAll(ctx context.Context, resName string, opts ...*ListOpts) ([]Resource, error)
    func (n *ResourceService) GetConnectionPropsInfos(ctx context.Context, resName string, opts ...*ListOpts) ([]PropsInfo, error)
    func (n *ResourceService) GetConnections(ctx context.Context, resName, nodeAName, nodeBName string, opts ...*ListOpts) ([]ResourceConnection, error)
    func (n *ResourceService) GetPropsInfos(ctx context.Context, resName string, opts ...*ListOpts) ([]PropsInfo, error)
    func (n *ResourceService) GetResourceView(ctx context.Context, opts ...*ListOpts) ([]ResourceWithVolumes, error)
    func (n *ResourceService) GetSnapshot(ctx context.Context, resName, snapName string, opts ...*ListOpts) (Snapshot, error)
    func (n *ResourceService) GetSnapshotShippings(ctx context.Context, opts ...*ListOpts) ([]SnapshotShippingStatus, error)
    func (r *ResourceService) GetSnapshotView(ctx context.Context, opts ...*ListOpts) ([]Snapshot, error)
    func (n *ResourceService) GetSnapshots(ctx context.Context, resName string, opts ...*ListOpts) ([]Snapshot, error)
    func (n *ResourceService) GetVolume(ctx context.Context, resName, nodeName string, volNr int, opts ...*ListOpts) (Volume, error)
    func (n *ResourceService) GetVolumeDefinitionPropsInfos(ctx context.Context, resName string, opts ...*ListOpts) ([]PropsInfo, error)
    func (n *ResourceService) GetVolumePropsInfos(ctx context.Context, resName, nodeName string, opts ...*ListOpts) ([]PropsInfo, error)
    func (n *ResourceService) GetVolumes(ctx context.Context, resName, nodeName string, opts ...*ListOpts) ([]Volume, error)
    func (n *ResourceService) MakeAvailable(ctx context.Context, resName, nodeName string, makeAvailable ResourceMakeAvailable) error
    func (n *ResourceService) Migrate(ctx context.Context, resName, fromNodeName, toNodeName, storagePoolName string) error
    func (n *ResourceService) Modify(ctx context.Context, resName, nodeName string, props GenericPropsModify) error
    func (n *ResourceService) ModifyConnection(ctx context.Context, resName, nodeAName, nodeBName string, props GenericPropsModify) error
    func (n *ResourceService) ModifyDRBDProxy(ctx context.Context, resName string, props DrbdProxyModify) error
    func (n *ResourceService) ModifyVolume(ctx context.Context, resName, nodeName string, volNr int, props GenericPropsModify) error
    func (n *ResourceService) QueryMaxVolumeSize(ctx context.Context, filter AutoSelectFilter) (MaxVolumeSizes, error)
    func (n *ResourceService) RestoreSnapshot(ctx context.Context, origResName, snapName string, snapRestoreConf SnapshotRestore) error
    func (n *ResourceService) RestoreVolumeDefinitionSnapshot(ctx context.Context, origResName, snapName string, snapRestoreConf SnapshotRestore) error
    func (n *ResourceService) RollbackSnapshot(ctx context.Context, resName, snapName string) error
type ResourceState
type ResourceWithVolumes
type S3Remote
type SatelliteConfig
type SatelliteConfigLog
type SatelliteConfigNet
type Snapshot
type SnapshotNode
type SnapshotRestore
type SnapshotShipping
type SnapshotShippingStatus
type SnapshotVolumeDefinition
type SnapshotVolumeNode
type StoragePool
type StoragePoolDefinition
type StoragePoolDefinitionModify
type StoragePoolDefinitionProvider
type StoragePoolDefinitionService
    func (s *StoragePoolDefinitionService) Create(ctx context.Context, spd StoragePoolDefinition) error
    func (s *StoragePoolDefinitionService) Delete(ctx context.Context, spdName string) error
    func (s *StoragePoolDefinitionService) Get(ctx context.Context, spdName string, opts ...*ListOpts) (StoragePoolDefinition, error)
    func (s *StoragePoolDefinitionService) GetAll(ctx context.Context, opts ...*ListOpts) ([]StoragePoolDefinition, error)
    func (s *StoragePoolDefinitionService) GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)
    func (s *StoragePoolDefinitionService) Modify(ctx context.Context, spdName string, props StoragePoolDefinitionModify) error
type StorageResource
type StorageVolume
type TimeStampMs
    func (t TimeStampMs) EncodeValues(key string, v *url.Values) error
    func (t TimeStampMs) MarshalJSON() ([]byte, error)
    func (t *TimeStampMs) UnmarshalJSON(s []byte) (err error)
type ToggleDiskDiskfulProps
type VendorProvider
type VendorService
    func (s *VendorService) CreateExosEnclosure(ctx context.Context, enclosure ExosEnclosure) error
    func (s *VendorService) DeleteExosEnclosure(ctx context.Context, name string) error
    func (s *VendorService) GetExosConnectionMap(ctx context.Context) (ExosConnectionMap, error)
    func (s *VendorService) GetExosDefaults(ctx context.Context) (ExosDefaults, error)
    func (s *VendorService) GetExosEnclosures(ctx context.Context, noCache bool) ([]ExosEnclosure, error)
    func (s *VendorService) GetExosEvents(ctx context.Context, name string, count int32) ([]ExosEnclosureEvent, error)
    func (s *VendorService) ModifyExosDefaults(ctx context.Context, defaults ExosDefaultsModify) error
    func (s *VendorService) ModifyExosEnclosure(ctx context.Context, name string, enclosure ExosEnclosure) error
type Volume
type VolumeDefinition
type VolumeDefinitionCreate
type VolumeDefinitionLayer
    func (vd *VolumeDefinitionLayer) UnmarshalJSON(b []byte) error
type VolumeDefinitionModify
type VolumeGroup
type VolumeGroupModify
type VolumeLayer
    func (v *VolumeLayer) UnmarshalJSON(b []byte) error
type VolumeState
type WritecacheResource
type WritecacheVolume

Package files

apicallerror.go backup.go cache.go client.go connection.go controller.go controllerconfig.go encryption.go keyvaluestore.go node.go option.go physicalstorage.go remote.go resource.go resourcedefinition.go resourcegroup.go sse.go storagepooldefinition.go timestamp.go vendor.go

Constants

const (
    // NotFoundError is the error type returned in case of a 404 error. This is required to test for this kind of error.
    NotFoundError = clientError("404 Not Found")
    // Name of the environment variable that stores the certificate used for TLS client authentication
    UserCertEnv = "LS_USER_CERTIFICATE"
    // Name of the environment variable that stores the key used for TLS client authentication
    UserKeyEnv = "LS_USER_KEY"
    // Name of the environment variable that stores the certificate authority for the LINSTOR HTTPS API
    RootCAEnv = "LS_ROOT_CA"
    // Name of the environment variable that holds the URL(s) of LINSTOR controllers
    ControllerUrlEnv = "LS_CONTROLLERS"
    // Name of the environment variable that holds the username for authentication
    UsernameEnv = "LS_USERNAME"
    // Name of the environment variable that holds the password for authentication
    PasswordEnv = "LS_PASSWORD"
    // Name of the environment variable that points to the file containing the token for authentication
    BearerTokenFileEnv = "LS_BEARER_TOKEN_FILE"
)

func IsApiCallError

func IsApiCallError(err error, mask uint64) bool

IsApiCallError checks if an error is a specific type of LINSTOR error.

type ApiCallError

type ApiCallError []ApiCallRc

func (ApiCallError) Error

func (e ApiCallError) Error() string

func (ApiCallError) Is

func (e ApiCallError) Is(mask uint64) bool

Is is a shorthand for checking all ApiCallRcs of an ApiCallError against a given mask.

type ApiCallRc

ApiCallRc represents the struct returned by LINSTOR, when accessing its REST API.

type ApiCallRc struct {
    // A masked error number
    RetCode int64  `json:"ret_code"`
    Message string `json:"message"`
    // Cause of the error
    Cause string `json:"cause,omitempty"`
    // Details to the error message
    Details string `json:"details,omitempty"`
    // Possible correction options
    Correction string `json:"correction,omitempty"`
    // List of error report ids related to this api call return code.
    ErrorReportIds []string `json:"error_report_ids,omitempty"`
    // Map of objection that have been involved by the operation.
    ObjRefs map[string]string `json:"obj_refs,omitempty"`
}

func (ApiCallRc) Is

func (r ApiCallRc) Is(mask uint64) bool

Is can be used to check the return code against a given mask. Since LINSTOR return codes are designed to be machine readable, this can be used to check for a very specific type of error. Refer to package apiconsts.go in package linstor for a list of possible mask values.

func (*ApiCallRc) String

func (rc *ApiCallRc) String() string

type AutoPlaceRequest

AutoPlaceRequest is a struct to store the paramters for the linstor auto-place command

type AutoPlaceRequest struct {
    DisklessOnRemaining bool                              `json:"diskless_on_remaining,omitempty"`
    SelectFilter        AutoSelectFilter                  `json:"select_filter,omitempty"`
    LayerList           []devicelayerkind.DeviceLayerKind `json:"layer_list,omitempty"`
}

type AutoSelectFilter

AutoSelectFilter is a struct used to have information about the auto-select function

type AutoSelectFilter struct {
    PlaceCount              int32    `json:"place_count,omitempty"`
    AdditionalPlaceCount    int32    `json:"additional_place_count,omitempty"`
    NodeNameList            []string `json:"node_name_list,omitempty"`
    StoragePool             string   `json:"storage_pool,omitempty"`
    StoragePoolList         []string `json:"storage_pool_list,omitempty"`
    StoragePoolDisklessList []string `json:"storage_pool_diskless_list,omitempty"`
    NotPlaceWithRsc         []string `json:"not_place_with_rsc,omitempty"`
    NotPlaceWithRscRegex    string   `json:"not_place_with_rsc_regex,omitempty"`
    ReplicasOnSame          []string `json:"replicas_on_same,omitempty"`
    ReplicasOnDifferent     []string `json:"replicas_on_different,omitempty"`
    LayerStack              []string `json:"layer_stack,omitempty"`
    ProviderList            []string `json:"provider_list,omitempty"`
    DisklessOnRemaining     bool     `json:"diskless_on_remaining,omitempty"`
    DisklessType            string   `json:"diskless_type,omitempty"`
    Overprovision           *float64 `json:"overprovision,omitempty"`
}

type BCacheResource

type BCacheResource struct {
    BCacheVolumes []BCacheVolume `json:"bcache_volumes,omitempty"`
}

type BCacheVolume

type BCacheVolume struct {
    VolumeNumber int32 `json:"volume_number,omitempty"`
    // block device path
    DevicePath string `json:"device_path,omitempty"`
    // block device path used as cache device
    DevicePathCache  string `json:"device_path_cache,omitempty"`
    AllocatedSizeKib int64  `json:"allocated_size_kib,omitempty"`
    UsableSizeKib    int64  `json:"usable_size_kib,omitempty"`
    // String describing current volume state
    DiskState string `json:"disk_state,omitempty"`
}

type Backup

type Backup struct {
    Id                string          `json:"id"`
    StartTime         string          `json:"start_time,omitempty"`
    StartTimestamp    *TimeStampMs    `json:"start_timestamp,omitempty"`
    FinishedTime      string          `json:"finished_time,omitempty"`
    FinishedTimestamp *TimeStampMs    `json:"finished_timestamp,omitempty"`
    OriginRsc         string          `json:"origin_rsc"`
    OriginSnap        string          `json:"origin_snap"`
    OriginNode        string          `json:"origin_node,omitempty"`
    FailMessages      string          `json:"fail_messages,omitempty"`
    Vlms              []BackupVolumes `json:"vlms"`
    Success           bool            `json:"success,omitempty"`
    Shipping          bool            `json:"shipping,omitempty"`
    Restorable        bool            `json:"restorable,omitempty"`
    S3                BackupS3        `json:"s3,omitempty"`
    BasedOnId         string          `json:"based_on_id,omitempty"`
}

type BackupAbortRequest

type BackupAbortRequest struct {
    RscName string `json:"rsc_name"`
    Restore *bool  `json:"restore,omitempty"`
    Create  *bool  `json:"create,omitempty"`
}

type BackupCreate

type BackupCreate struct {
    RscName     string `json:"rsc_name"`
    SnapName    string `json:"snap_name,omitempty"`
    NodeName    string `json:"node_name,omitempty"`
    Incremental bool   `json:"incremental,omitempty"`
}

type BackupDeleteOpts

type BackupDeleteOpts struct {
    ID              string       `url:"id,omitempty"`
    IDPrefix        string       `url:"id_prefix,omitempty"`
    Cascading       bool         `url:"cascading,omitempty"`
    Timestamp       *TimeStampMs `url:"timestamp,omitempty"`
    ResourceName    string       `url:"resource_name,omitempty"`
    NodeName        string       `url:"node_name,omitempty"`
    AllLocalCluster bool         `url:"all_local_cluster,omitempty"`
    All             bool         `url:"all,omitempty"`
    S3Key           string       `url:"s3key,omitempty"`
    S3KeyForce      string       `url:"s3key_force,omitempty"`
    DryRun          bool         `url:"dryrun,omitempty"`
}

type BackupInfo

type BackupInfo struct {
    Rsc          string               `json:"rsc"`
    Snap         string               `json:"snap"`
    Full         string               `json:"full"`
    Latest       string               `json:"latest"`
    Count        int32                `json:"count,omitempty"`
    DlSizeKib    int64                `json:"dl_size_kib"`
    AllocSizeKib int64                `json:"alloc_size_kib"`
    Storpools    []BackupInfoStorPool `json:"storpools"`
}

type BackupInfoRequest

type BackupInfoRequest struct {
    SrcRscName  string            `json:"src_rsc_name,omitempty"`
    SrcSnapName string            `json:"src_snap_name,omitempty"`
    LastBackup  string            `json:"last_backup,omitempty"`
    StorPoolMap map[string]string `json:"stor_pool_map,omitempty"`
    NodeName    string            `json:"node_name,omitempty"`
}

type BackupInfoStorPool

type BackupInfoStorPool struct {
    Name              string             `json:"name"`
    ProviderKind      ProviderKind       `json:"provider_kind,omitempty"`
    TargetName        string             `json:"target_name,omitempty"`
    RemainingSpaceKib int64              `json:"remaining_space_kib,omitempty"`
    Vlms              []BackupInfoVolume `json:"vlms"`
}

type BackupInfoVolume

type BackupInfoVolume struct {
    Name          string                          `json:"name,omitempty"`
    LayerType     devicelayerkind.DeviceLayerKind `json:"layer_type"`
    DlSizeKib     int64                           `json:"dl_size_kib,omitempty"`
    AllocSizeKib  int64                           `json:"alloc_size_kib"`
    UsableSizeKib int64                           `json:"usable_size_kib,omitempty"`
}

type BackupList

type BackupList struct {
    // Linstor is a map of all entries found that could be parsed as LINSTOR backups.
    Linstor map[string]Backup `json:"linstor,omitempty"`
    // Other are files that could not be parsed as LINSTOR backups.
    Other BackupOther `json:"other,omitempty"`
}

type BackupOther

type BackupOther struct {
    Files *[]string `json:"files,omitempty"`
}

type BackupProvider

type BackupProvider interface {
    // GetAll fetches information on all backups stored at the given remote. Optionally limited to the given
    // resource names.
    GetAll(ctx context.Context, remoteName string, rscName string, snapName string) (*BackupList, error)
    // DeleteAll backups that fit the given criteria.
    DeleteAll(ctx context.Context, remoteName string, filter BackupDeleteOpts) error
    // Create a new backup operation.
    Create(ctx context.Context, remoteName string, request BackupCreate) (string, error)
    // Info retrieves information about a specific backup instance.
    Info(ctx context.Context, remoteName string, request BackupInfoRequest) (*BackupInfo, error)
    // Abort all running backup operations of a resource.
    Abort(ctx context.Context, remoteName string, request BackupAbortRequest) error
    // Ship ships a backup from one LINSTOR cluster to another.
    Ship(ctx context.Context, remoteName string, request BackupShipRequest) (string, error)
    // Restore starts to restore a resource from a backup.
    Restore(ctx context.Context, remoteName string, request BackupRestoreRequest) error
}

type BackupRestoreRequest

type BackupRestoreRequest struct {
    SrcRscName    string            `json:"src_rsc_name,omitempty"`
    SrcSnapName   string            `json:"src_snap_name,omitempty"`
    LastBackup    string            `json:"last_backup,omitempty"`
    StorPoolMap   map[string]string `json:"stor_pool_map,omitempty"`
    TargetRscName string            `json:"target_rsc_name"`
    Passphrase    string            `json:"passphrase,omitempty"`
    NodeName      string            `json:"node_name"`
    DownloadOnly  bool              `json:"download_only,omitempty"`
}

type BackupS3

type BackupS3 struct {
    MetaName string `json:"meta_name,omitempty"`
}

type BackupService

type BackupService struct {
    // contains filtered or unexported fields
}

func (*BackupService) Abort

func (b *BackupService) Abort(ctx context.Context, remoteName string, request BackupAbortRequest) error

func (*BackupService) Create

func (b *BackupService) Create(ctx context.Context, remoteName string, request BackupCreate) (string, error)

func (*BackupService) DeleteAll

func (b *BackupService) DeleteAll(ctx context.Context, remoteName string, filter BackupDeleteOpts) error

func (*BackupService) GetAll

func (b *BackupService) GetAll(ctx context.Context, remoteName string, rscName string, snapName string) (*BackupList, error)

func (*BackupService) Info

func (b *BackupService) Info(ctx context.Context, remoteName string, request BackupInfoRequest) (*BackupInfo, error)

func (*BackupService) Restore

func (b *BackupService) Restore(ctx context.Context, remoteName string, request BackupRestoreRequest) error

func (*BackupService) Ship

func (b *BackupService) Ship(ctx context.Context, remoteName string, request BackupShipRequest) (string, error)

type BackupShipRequest

type BackupShipRequest struct {
    SrcNodeName    string            `json:"src_node_name,omitempty"`
    SrcRscName     string            `json:"src_rsc_name"`
    DstRscName     string            `json:"dst_rsc_name"`
    DstNodeName    string            `json:"dst_node_name,omitempty"`
    DstNetIfName   string            `json:"dst_net_if_name,omitempty"`
    DstStorPool    string            `json:"dst_stor_pool,omitempty"`
    StorPoolRename map[string]string `json:"stor_pool_rename,omitempty"`
    DownloadOnly   *bool             `json:"download_only,omitempty"`
}

type BackupVolumes

type BackupVolumes struct {
    VlmNr             int64            `json:"vlm_nr"`
    FinishedTime      *string          `json:"finished_time,omitempty"`
    FinishedTimestamp *TimeStampMs     `json:"finished_timestamp,omitempty"`
    S3                *BackupVolumesS3 `json:"s3,omitempty"`
}

type BackupVolumesS3

type BackupVolumesS3 struct {
    Key *string `json:"key,omitempty"`
}

type BasicAuthCfg

type BasicAuthCfg struct {
    Username, Password string
}

type CacheResource

type CacheResource struct {
    CacheVolumes []CacheVolume `json:"cache_volumes,omitempty"`
}

type CacheVolume

type CacheVolume struct {
    VolumeNumber int32 `json:"volume_number,omitempty"`
    // block device path
    DevicePath string `json:"device_path,omitempty"`
    // block device path used as cache device
    DevicePathCache string `json:"device_path_cache,omitempty"`
    // block device path used as meta device
    DeviceMetaCache  string `json:"device_meta_cache,omitempty"`
    AllocatedSizeKib int64  `json:"allocated_size_kib,omitempty"`
    UsableSizeKib    int64  `json:"usable_size_kib,omitempty"`
    // String describing current volume state
    DiskState string `json:"disk_state,omitempty"`
}

type Candidate

Candidate struct for Candidate

type Candidate struct {
    StoragePool string `json:"storage_pool,omitempty"`
    // maximum size in KiB
    MaxVolumeSizeKib int64    `json:"max_volume_size_kib,omitempty"`
    NodeNames        []string `json:"node_names,omitempty"`
    AllThin          bool     `json:"all_thin,omitempty"`
}

type Client

Client is a struct representing a LINSTOR REST client.

type Client struct {
    Nodes                  NodeProvider
    ResourceDefinitions    ResourceDefinitionProvider
    Resources              ResourceProvider
    ResourceGroups         ResourceGroupProvider
    StoragePoolDefinitions StoragePoolDefinitionProvider
    Encryption             EncryptionProvider
    Controller             ControllerProvider
    Events                 EventProvider
    Vendor                 VendorProvider
    Remote                 RemoteProvider
    Backup                 BackupProvider
    KeyValueStore          KeyValueStoreProvider
    Connections            ConnectionProvider
    // contains filtered or unexported fields
}

func NewClient

func NewClient(options ...Option) (*Client, error)

NewClient takes an arbitrary number of options and returns a Client or an error. It recognizes several environment variables which can be used to configure the client at runtime:

- LS_CONTROLLERS: a comma-separated list of LINSTOR controllers to connect to.

- LS_USERNAME, LS_PASSWORD: can be used to authenticate against the LINSTOR controller using HTTP basic authentication.

- LS_USER_CERTIFICATE, LS_USER_KEY, LS_ROOT_CA: can be used to enable TLS on the HTTP client, enabling encrypted communication with the LINSTOR controller.

- LS_BEARER_TOKEN_FILE: can be set to a file containing the bearer token used for authentication.

Options passed to NewClient take precedence over options passed in via environment variables.

func (*Client) BaseURL

func (c *Client) BaseURL() *url.URL

type Connection

type Connection struct {
    NodeA string            `json:"node_a,omitempty"`
    NodeB string            `json:"node_b,omitempty"`
    Props map[string]string `json:"props,omitempty"`
    Flags []string          `json:"flags,omitempty"`
    Port  *int32            `json:"port,omitempty"`
}

type ConnectionProvider

ConnectionProvider acts as an abstraction for a ConnectionService. It can be swapped out for another ConnectionService implementation, for example for testing.

type ConnectionProvider interface {
    // GetNodeConnections lists all node connections, optionally limites to nodes A and B, if not empty.
    GetNodeConnections(ctx context.Context, nodeA, nodeB string) ([]Connection, error)
    // GetResourceConnections returns all connections of the given resource.
    GetResourceConnections(ctx context.Context, resource string) ([]Connection, error)
    // GetResourceConnection returns the connection between node A and B for the given resource.
    GetResourceConnection(ctx context.Context, resource, nodeA, nodeB string) (*Connection, error)
    // SetNodeConnection sets or updates the node connection between node A and B.
    SetNodeConnection(ctx context.Context, nodeA, nodeB string, props GenericPropsModify) error
    // SetResourceConnection sets or updates the connection between node A and B for a resource.
    SetResourceConnection(ctx context.Context, resource, nodeA, nodeB string, props GenericPropsModify) error
}

type ConnectionService

ConnectionService is the service that deals with connection related tasks.

type ConnectionService struct {
    // contains filtered or unexported fields
}

func (*ConnectionService) GetNodeConnections

func (c *ConnectionService) GetNodeConnections(ctx context.Context, nodeA, nodeB string) ([]Connection, error)

func (*ConnectionService) GetResourceConnection

func (c *ConnectionService) GetResourceConnection(ctx context.Context, resource, nodeA, nodeB string) (*Connection, error)

func (*ConnectionService) GetResourceConnections

func (c *ConnectionService) GetResourceConnections(ctx context.Context, resource string) ([]Connection, error)

func (*ConnectionService) SetNodeConnection

func (c *ConnectionService) SetNodeConnection(ctx context.Context, nodeA, nodeB string, props GenericPropsModify) error

func (*ConnectionService) SetResourceConnection

func (c *ConnectionService) SetResourceConnection(ctx context.Context, resource, nodeA, nodeB string, props GenericPropsModify) error

type ControllerConfig

type ControllerConfig struct {
    Config ControllerConfigConfig `json:"config,omitempty"`
    Debug  ControllerConfigDebug  `json:"debug,omitempty"`
    Log    ControllerConfigLog    `json:"log,omitempty"`
    Db     ControllerConfigDb     `json:"db,omitempty"`
    Http   ControllerConfigHttp   `json:"http,omitempty"`
    Https  ControllerConfigHttps  `json:"https,omitempty"`
    Ldap   ControllerConfigLdap   `json:"ldap,omitempty"`
}

type ControllerConfigConfig

type ControllerConfigConfig struct {
    Dir string `json:"dir,omitempty"`
}

type ControllerConfigDb

type ControllerConfigDb struct {
    ConnectionUrl        string                 `json:"connection_url,omitempty"`
    CaCertificate        string                 `json:"ca_certificate,omitempty"`
    ClientCertificate    string                 `json:"client_certificate,omitempty"`
    ClientKeyPkcs8Pem    string                 `json:"client_key_pkcs8_pem,omitempty"`
    InMemory             string                 `json:"in_memory,omitempty"`
    VersionCheckDisabled bool                   `json:"version_check_disabled,omitempty"`
    Etcd                 ControllerConfigDbEtcd `json:"etcd,omitempty"`
}

type ControllerConfigDbEtcd

type ControllerConfigDbEtcd struct {
    OperationsPerTransaction int32  `json:"operations_per_transaction,omitempty"`
    Prefix                   string `json:"prefix,omitempty"`
}

type ControllerConfigDebug

type ControllerConfigDebug struct {
    ConsoleEnabled bool `json:"console_enabled,omitempty"`
}

type ControllerConfigHttp

type ControllerConfigHttp struct {
    Enabled       bool   `json:"enabled,omitempty"`
    ListenAddress string `json:"listen_address,omitempty"`
    Port          int32  `json:"port,omitempty"`
}

type ControllerConfigHttps

type ControllerConfigHttps struct {
    Enabled            bool   `json:"enabled,omitempty"`
    ListenAddress      string `json:"listen_address,omitempty"`
    Port               int32  `json:"port,omitempty"`
    Keystore           string `json:"keystore,omitempty"`
    KeystorePassword   string `json:"keystore_password,omitempty"`
    Truststore         string `json:"truststore,omitempty"`
    TruststorePassword string `json:"truststore_password,omitempty"`
}

type ControllerConfigLdap

type ControllerConfigLdap struct {
    Enabled             bool   `json:"enabled,omitempty"`
    PublicAccessAllowed bool   `json:"public_access_allowed,omitempty"`
    Uri                 string `json:"uri,omitempty"`
    Dn                  string `json:"dn,omitempty"`
    SearchBase          string `json:"search_base,omitempty"`
    SearchFilter        string `json:"search_filter,omitempty"`
}

type ControllerConfigLog

type ControllerConfigLog struct {
    PrintStackTrace    bool     `json:"print_stack_trace,omitempty"`
    Directory          string   `json:"directory,omitempty"`
    Level              LogLevel `json:"level,omitempty"`
    LevelGlobal        LogLevel `json:"level_global,omitempty"`
    LevelLinstor       LogLevel `json:"level_linstor,omitempty"`
    LevelLinstorGlobal LogLevel `json:"level_linstor_global,omitempty"`
    RestAccessLogPath  string   `json:"rest_access_log_path,omitempty"`
    RestAccessMode     string   `json:"rest_access_mode,omitempty"`
}

type ControllerProps

type ControllerProps map[string]string

type ControllerProvider

ControllerProvider acts as an abstraction for a ControllerService. It can be swapped out for another ControllerService implementation, for example for testing.

type ControllerProvider interface {
    // GetVersion queries version information for the controller.
    GetVersion(ctx context.Context, opts ...*ListOpts) (ControllerVersion, error)
    // GetConfig queries the configuration of a controller
    GetConfig(ctx context.Context, opts ...*ListOpts) (ControllerConfig, error)
    // Modify modifies the controller node and sets/deletes the given properties.
    Modify(ctx context.Context, props GenericPropsModify) error
    // GetProps gets all properties of a controller
    GetProps(ctx context.Context, opts ...*ListOpts) (ControllerProps, error)
    // DeleteProp deletes the given property/key from the controller object.
    DeleteProp(ctx context.Context, prop string) error
    // GetErrorReports returns all error reports. The Text field is not populated,
    // use GetErrorReport to get the text of an error report.
    GetErrorReports(ctx context.Context, opts ...*ListOpts) ([]ErrorReport, error)
    // DeleteErrorReports deletes error reports as specified by the ErrorReportDelete struct.
    DeleteErrorReports(ctx context.Context, del ErrorReportDelete) error
    // GetErrorReportsSince returns all error reports created after a certain point in time.
    GetErrorReportsSince(ctx context.Context, since time.Time, opts ...*ListOpts) ([]ErrorReport, error)
    // GetErrorReport returns a specific error report, including its text.
    GetErrorReport(ctx context.Context, id string, opts ...*ListOpts) (ErrorReport, error)
    // CreateSOSReport creates an SOS report in the log directory of the controller
    CreateSOSReport(ctx context.Context, opts ...*ListOpts) error
    // DownloadSOSReport request sos report to download
    DownloadSOSReport(ctx context.Context, opts ...*ListOpts) error
    GetSatelliteConfig(ctx context.Context, node string) (SatelliteConfig, error)
    ModifySatelliteConfig(ctx context.Context, node string, cfg SatelliteConfig) error
    // GetPropsInfos gets meta information about the properties that can be
    // set on a controller.
    GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)
    // GetPropsInfosAll gets meta information about all properties that can
    // be set on a controller and all entities it contains (nodes, resource
    // definitions, ...).
    GetPropsInfosAll(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)
    // GetExternalFiles gets a list of previously registered external files.
    GetExternalFiles(ctx context.Context, opts ...*ListOpts) ([]ExternalFile, error)
    // GetExternalFile gets the requested external file including its content
    GetExternalFile(ctx context.Context, name string) (ExternalFile, error)
    // ModifyExternalFile registers or modifies a previously registered
    // external file
    ModifyExternalFile(ctx context.Context, name string, file ExternalFile) error
    // DeleteExternalFile deletes the given external file. This effectively
    // also deletes the file on all satellites
    DeleteExternalFile(ctx context.Context, name string) error
}

type ControllerService

ControllerService is the service that deals with the LINSTOR controller.

type ControllerService struct {
    // contains filtered or unexported fields
}

func (*ControllerService) CreateSOSReport

func (s *ControllerService) CreateSOSReport(ctx context.Context, opts ...*ListOpts) error

CreateSOSReport creates an SOS report in the log directory of the controller

func (*ControllerService) DeleteErrorReports

func (s *ControllerService) DeleteErrorReports(ctx context.Context, del ErrorReportDelete) error

DeleteErrorReports deletes error reports as specified by the ErrorReportDelete struct.

func (*ControllerService) DeleteExternalFile

func (s *ControllerService) DeleteExternalFile(ctx context.Context, name string) error

DeleteExternalFile deletes the given external file. This effectively also deletes the file on all satellites

func (*ControllerService) DeleteProp

func (s *ControllerService) DeleteProp(ctx context.Context, prop string) error

DeleteProp deletes the given property/key from the controller object.

func (*ControllerService) DownloadSOSReport

func (s *ControllerService) DownloadSOSReport(ctx context.Context, opts ...*ListOpts) error

DownloadSOSReport request sos report to download

func (*ControllerService) GetConfig

func (s *ControllerService) GetConfig(ctx context.Context, opts ...*ListOpts) (ControllerConfig, error)

GetConfig queries the configuration of a controller

func (*ControllerService) GetErrorReport

func (s *ControllerService) GetErrorReport(ctx context.Context, id string, opts ...*ListOpts) (ErrorReport, error)

GetErrorReport returns a specific error report, including its text.

func (*ControllerService) GetErrorReports

func (s *ControllerService) GetErrorReports(ctx context.Context, opts ...*ListOpts) ([]ErrorReport, error)

GetErrorReports returns all error reports. The Text field is not populated, use GetErrorReport to get the text of an error report.

func (*ControllerService) GetErrorReportsSince

func (s *ControllerService) GetErrorReportsSince(ctx context.Context, since time.Time, opts ...*ListOpts) ([]ErrorReport, error)

GetErrorReportsSince returns all error reports created after a certain point in time.

func (*ControllerService) GetExternalFile

func (s *ControllerService) GetExternalFile(ctx context.Context, name string) (ExternalFile, error)

GetExternalFile gets the requested external file including its content

func (*ControllerService) GetExternalFiles

func (s *ControllerService) GetExternalFiles(ctx context.Context, opts ...*ListOpts) ([]ExternalFile, error)

GetExternalFiles get a list of previously registered external files. File contents are not included, unless ListOpts.Content is true.

func (*ControllerService) GetProps

func (s *ControllerService) GetProps(ctx context.Context, opts ...*ListOpts) (ControllerProps, error)

GetProps gets all properties of a controller

func (*ControllerService) GetPropsInfos

func (s *ControllerService) GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)

GetPropsInfos gets meta information about the properties that can be set on a controller.

func (*ControllerService) GetPropsInfosAll

func (s *ControllerService) GetPropsInfosAll(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)

GetPropsInfosAll gets meta information about all properties that can be set on a controller and all entities it contains (nodes, resource definitions, ...).

func (*ControllerService) GetSatelliteConfig

func (s *ControllerService) GetSatelliteConfig(ctx context.Context, node string) (SatelliteConfig, error)

func (*ControllerService) GetVersion

func (s *ControllerService) GetVersion(ctx context.Context, opts ...*ListOpts) (ControllerVersion, error)

GetVersion queries version information for the controller.

func (*ControllerService) Modify

func (s *ControllerService) Modify(ctx context.Context, props GenericPropsModify) error

Modify modifies the controller node and sets/deletes the given properties.

func (*ControllerService) ModifyExternalFile

func (s *ControllerService) ModifyExternalFile(ctx context.Context, name string, file ExternalFile) error

ModifyExternalFile registers or modifies a previously registered external file

func (*ControllerService) ModifySatelliteConfig

func (s *ControllerService) ModifySatelliteConfig(ctx context.Context, node string, cfg SatelliteConfig) error

type ControllerVersion

ControllerVersion represents version information of the LINSTOR controller

type ControllerVersion struct {
    Version        string `json:"version,omitempty"`
    GitHash        string `json:"git_hash,omitempty"`
    BuildTime      string `json:"build_time,omitempty"`
    RestApiVersion string `json:"rest_api_version,omitempty"`
}

type DRBDMayPromoteStream

DRBDMayPromoteStream is a struct that contains a channel of EventMayPromoteChange events It has a Close() method that needs to be called/defered.

type DRBDMayPromoteStream struct {
    Events chan EventMayPromoteChange
    // contains filtered or unexported fields
}

func (*DRBDMayPromoteStream) Close

func (dmp *DRBDMayPromoteStream) Close()

Close is used to close the underlying stream and all Go routines

type DeleteNamespaces

Namespaces to delete

type DeleteNamespaces []string

type DeleteProps

DeleteProps is a slice of properties to delete.

type DeleteProps []string

type DrbdConnection

DrbdConnection is a struct representing the DRBD connection status

type DrbdConnection struct {
    Connected bool `json:"connected,omitempty"`
    // DRBD connection status
    Message string `json:"message,omitempty"`
}

type DrbdProxyModify

type DrbdProxyModify struct {
    // Compression type used by the proxy.
    CompressionType string `json:"compression_type,omitempty"`
    // A string to string property map.
    CompressionProps map[string]string `json:"compression_props,omitempty"`
    GenericPropsModify
}

type DrbdResource

DrbdResource is a struct used to give linstor drbd properties for a resource

type DrbdResource struct {
    DrbdResourceDefinition DrbdResourceDefinitionLayer `json:"drbd_resource_definition,omitempty"`
    NodeId                 int32                       `json:"node_id,omitempty"`
    PeerSlots              int32                       `json:"peer_slots,omitempty"`
    AlStripes              int32                       `json:"al_stripes,omitempty"`
    AlSize                 int64                       `json:"al_size,omitempty"`
    Flags                  []string                    `json:"flags,omitempty"`
    DrbdVolumes            []DrbdVolume                `json:"drbd_volumes,omitempty"`
    Connections            map[string]DrbdConnection   `json:"connections,omitempty"`
    PromotionScore         int32                       `json:"promotion_score,omitempty"`
    MayPromote             bool                        `json:"may_promote,omitempty"`
}

type DrbdResourceDefinitionLayer

DrbdResourceDefinitionLayer is a struct which contains the information about the layertype of a resource-definition on drbd level

type DrbdResourceDefinitionLayer struct {
    ResourceNameSuffix string `json:"resource_name_suffix,omitempty"`
    PeerSlots          int32  `json:"peer_slots,omitempty"`
    AlStripes          int64  `json:"al_stripes,omitempty"`
    // used drbd port for this resource
    Port          int32  `json:"port,omitempty"`
    TransportType string `json:"transport_type,omitempty"`
    // drbd resource secret
    Secret string `json:"secret,omitempty"`
    Down   bool   `json:"down,omitempty"`
}

type DrbdVolume

DrbdVolume is a struct for linstor to get inormation about a drbd-volume

type DrbdVolume struct {
    DrbdVolumeDefinition DrbdVolumeDefinition `json:"drbd_volume_definition,omitempty"`
    // drbd device path e.g. '/dev/drbd1000'
    DevicePath string `json:"device_path,omitempty"`
    // block device used by drbd
    BackingDevice    string `json:"backing_device,omitempty"`
    MetaDisk         string `json:"meta_disk,omitempty"`
    AllocatedSizeKib int64  `json:"allocated_size_kib,omitempty"`
    UsableSizeKib    int64  `json:"usable_size_kib,omitempty"`
    // String describing current volume state
    DiskState string `json:"disk_state,omitempty"`
    // Storage pool name used for external meta data; null for internal
    ExtMetaStorPool string `json:"ext_meta_stor_pool,omitempty"`
}

type DrbdVolumeDefinition

DrbdVolumeDefinition is a struct containing volume-definition on drbd level

type DrbdVolumeDefinition struct {
    ResourceNameSuffix string `json:"resource_name_suffix,omitempty"`
    VolumeNumber       int32  `json:"volume_number,omitempty"`
    MinorNumber        int32  `json:"minor_number,omitempty"`
}

type EbsRemote

type EbsRemote struct {
    RemoteName       string `json:"remote_name,omitempty"`
    Endpoint         string `json:"endpoint,omitempty"`
    Region           string `json:"region,omitempty"`
    AvailabilityZone string `json:"availability_zone,omitempty"`
    AccessKey        string `json:"access_key,omitempty"`
    SecretKey        string `json:"secret_key,omitempty"`
}

type EncryptionProvider

EncryptionProvider acts as an abstraction for an EncryptionService. It can be swapped out for another EncryptionService implementation, for example for testing.

type EncryptionProvider interface {
    // Create creates an encryption with the given passphrase
    Create(ctx context.Context, passphrase Passphrase) error
    // Modify modifies an existing passphrase
    Modify(ctx context.Context, passphrase Passphrase) error
    // Enter is used to enter a password so that content can be decrypted
    Enter(ctx context.Context, password string) error
}

type EncryptionService

EncryptionService is the service that deals with encyrption related tasks.

type EncryptionService struct {
    // contains filtered or unexported fields
}

func (*EncryptionService) Create

func (n *EncryptionService) Create(ctx context.Context, passphrase Passphrase) error

Create creates an encryption with the given passphrase

func (*EncryptionService) Enter

func (n *EncryptionService) Enter(ctx context.Context, password string) error

Enter is used to enter a password so that content can be decrypted

func (*EncryptionService) Modify

func (n *EncryptionService) Modify(ctx context.Context, passphrase Passphrase) error

Modify modifies an existing passphrase

type ErrorReport

ErrorReport struct for ErrorReport

type ErrorReport struct {
    NodeName  string      `json:"node_name,omitempty"`
    ErrorTime TimeStampMs `json:"error_time"`
    // Filename of the error report on the server.  Format is: ```ErrorReport-{instanceid}-{nodeid}-{sequencenumber}.log```
    Filename string `json:"filename,omitempty"`
    // Contains the full text of the error report file.
    Text string `json:"text,omitempty"`
    // Which module this error occurred.
    Module string `json:"module,omitempty"`
    // Linstor version this error report was created.
    Version string `json:"version,omitempty"`
    // Peer client that was involved.
    Peer string `json:"peer,omitempty"`
    // Exception that occurred
    Exception string `json:"exception,omitempty"`
    // Exception message
    ExceptionMessage string `json:"exception_message,omitempty"`
    // Origin file of the exception
    OriginFile string `json:"origin_file,omitempty"`
    // Origin method where the exception occurred
    OriginMethod string `json:"origin_method,omitempty"`
    // Origin line number
    OriginLine int32 `json:"origin_line,omitempty"`
}

type ErrorReportDelete

type ErrorReportDelete struct {
    Since *TimeStampMs `json:"since,omitempty"`
    To    *TimeStampMs `json:"to,omitempty"`
    // on which nodes to delete error-reports, if empty/null all nodes
    Nodes []string `json:"nodes,omitempty"`
    // delete all error reports with the given exception
    Exception string `json:"exception,omitempty"`
    // delete all error reports from the given version
    Version string `json:"version,omitempty"`
    // error report ids to delete
    Ids []string `json:"ids,omitempty"`
}

type EventMayPromoteChange

type EventMayPromoteChange struct {
    ResourceName string `json:"resource_name,omitempty"`
    NodeName     string `json:"node_name,omitempty"`
    MayPromote   bool   `json:"may_promote,omitempty"`
}

type EventProvider

EventProvider acts as an abstraction for an EventService. It can be swapped out for another EventService implementation, for example for testing.

type EventProvider interface {
    // DRBDPromotion is used to subscribe to LINSTOR DRBD Promotion events
    DRBDPromotion(ctx context.Context, lastEventId string) (*DRBDMayPromoteStream, error)
}

type EventService

EventService is the service that deals with LINSTOR server side event streams.

type EventService struct {
    // contains filtered or unexported fields
}

func (*EventService) DRBDPromotion

func (e *EventService) DRBDPromotion(ctx context.Context, lastEventId string) (*DRBDMayPromoteStream, error)

DRBDPromotion is used to subscribe to LINSTOR DRBD Promotion events

type ExosConnectionMap

ExosConnectionMap struct for ExosConnectionMap

type ExosConnectionMap struct {
    NodeName      string   `json:"node_name,omitempty"`
    EnclosureName string   `json:"enclosure_name,omitempty"`
    Connections   []string `json:"connections,omitempty"`
}

type ExosDefaults

ExosDefaults Default settings for EXOS enclosures

type ExosDefaults struct {
    Username    string `json:"username,omitempty"`
    UsernameEnv string `json:"username_env,omitempty"`
    Password    string `json:"password,omitempty"`
    PasswordEnv string `json:"password_env,omitempty"`
}

type ExosDefaultsModify

ExosDefaultsModify struct for ExosDefaultsModify

type ExosDefaultsModify struct {
    Username    string `json:"username,omitempty"`
    UsernameEnv string `json:"username_env,omitempty"`
    Password    string `json:"password,omitempty"`
    PasswordEnv string `json:"password_env,omitempty"`
    // A list of keys to unset. The keys have to exist in ExosDefaults
    UnsetKeys []string `json:"unset_keys,omitempty"`
}

type ExosDefaultsModifyAllOf

ExosDefaultsModifyAllOf struct for ExosDefaultsModifyAllOf

type ExosDefaultsModifyAllOf struct {
    // A list of keys to unset. The keys have to exist in ExosDefaults
    UnsetKeys []string `json:"unset_keys,omitempty"`
}

type ExosEnclosure

ExosEnclosure EXOS enclosure

type ExosEnclosure struct {
    Name        string `json:"name,omitempty"`
    CtrlAIp     string `json:"ctrl_a_ip,omitempty"`
    CtrlBIp     string `json:"ctrl_b_ip,omitempty"`
    Username    string `json:"username,omitempty"`
    UsernameEnv string `json:"username_env,omitempty"`
    Password    string `json:"password,omitempty"`
    PasswordEnv string `json:"password_env,omitempty"`
}

type ExosEnclosureEvent

ExosEnclosureEvent EXOS event

type ExosEnclosureEvent struct {
    Severity              string `json:"severity,omitempty"`
    EventId               string `json:"event_id,omitempty"`
    Controller            string `json:"controller,omitempty"`
    TimeStamp             string `json:"time_stamp,omitempty"`
    TimeStampNumeric      int64  `json:"time_stamp_numeric,omitempty"`
    Message               string `json:"message,omitempty"`
    AdditionalInformation string `json:"additional_information,omitempty"`
    RecommendedAction     string `json:"recommended_action,omitempty"`
}

type ExosEnclosureHealth

ExosEnclosureHealth EXOS enclosure name, controller IPs and health status

type ExosEnclosureHealth struct {
    Name         string `json:"name,omitempty"`
    CtrlAIp      string `json:"ctrl_a_ip,omitempty"`
    CtrlBIp      string `json:"ctrl_b_ip,omitempty"`
    Health       string `json:"health,omitempty"`
    HealthReason string `json:"health_reason,omitempty"`
}

type ExternalFile

ExternalFile is an external file which can be configured to be deployed by Linstor

type ExternalFile struct {
    Path    string
    Content []byte
}

func (*ExternalFile) MarshalJSON

func (e *ExternalFile) MarshalJSON() ([]byte, error)

func (*ExternalFile) UnmarshalJSON

func (e *ExternalFile) UnmarshalJSON(text []byte) error

type GenericPropsModify

GenericPropsModify is a struct combining DeleteProps and OverrideProps

type GenericPropsModify struct {
    DeleteProps      DeleteProps      `json:"delete_props,omitempty"`
    OverrideProps    OverrideProps    `json:"override_props,omitempty"`
    DeleteNamespaces DeleteNamespaces `json:"delete_namespaces,omitempty"`
}

type KV

type KV struct {
    Name  string            `json:"name"`
    Props map[string]string `json:"props"`
}

type KeyValueStoreProvider

type KeyValueStoreProvider interface {
    List(ctx context.Context) ([]KV, error)
    Get(ctx context.Context, kv string) (*KV, error)
    CreateOrModify(ctx context.Context, kv string, modify GenericPropsModify) error
    Delete(ctx context.Context, kv string) error
}

type KeyValueStoreService

type KeyValueStoreService struct {
    // contains filtered or unexported fields
}

func (*KeyValueStoreService) CreateOrModify

func (k *KeyValueStoreService) CreateOrModify(ctx context.Context, kv string, modify GenericPropsModify) error

func (*KeyValueStoreService) Delete

func (k *KeyValueStoreService) Delete(ctx context.Context, kv string) error

func (*KeyValueStoreService) Get

func (k *KeyValueStoreService) Get(ctx context.Context, kv string) (*KV, error)

func (*KeyValueStoreService) List

func (k *KeyValueStoreService) List(ctx context.Context) ([]KV, error)

List returns the name of key-value stores and their values

type LeveledLogger

LeveledLogger interface implements the basic methods that a logger library needs

type LeveledLogger interface {
    Errorf(string, ...interface{})
    Infof(string, ...interface{})
    Debugf(string, ...interface{})
    Warnf(string, ...interface{})
}

type LinstorRemote

type LinstorRemote struct {
    RemoteName string `json:"remote_name,omitempty"`
    Url        string `json:"url,omitempty"`
    Passphrase string `json:"passphrase,omitempty"`
    ClusterId  string `json:"cluster_id,omitempty"`
}

type ListOpts

ListOpts is a struct primarily used to define parameters used for pagination. It is also used for filtering (e.g., the /view/ calls)

type ListOpts struct {
    // Number of items to skip. Only used if Limit is a positive value
    Offset int `url:"offset"`
    // Maximum number of items to retrieve
    Limit int `url:"limit"`
    // Some responses can be cached controller side, such as snapshot lists
    Cached *bool `url:"cached,omitempty"`

    StoragePool []string `url:"storage_pools"`
    Resource    []string `url:"resources"`
    Node        []string `url:"nodes"`
    Prop        []string `url:"props"`
    Snapshots   []string `url:"snapshots"`
    Status      string   `url:"status,omitempty"`

    // Content is used in the files API. If true, fetching files will include the content.
    Content bool `url:"content,omitempty"`
}

type LogLevel

type LogLevel string

List of LogLevel

const (
    ERROR LogLevel = "ERROR"
    WARN  LogLevel = "WARN"
    INFO  LogLevel = "INFO"
    DEBUG LogLevel = "DEBUG"
    TRACE LogLevel = "TRACE"
)

type Logger

Logger represents a standard logger interface

type Logger interface {
    Printf(string, ...interface{})
}

type LuksResource

LuksResource is a struct to store storage-volumes for a luks-resource

type LuksResource struct {
    StorageVolumes []LuksVolume `json:"storage_volumes,omitempty"`
}

type LuksVolume

LuksVolume is a struct used for information about a luks-volume

type LuksVolume struct {
    VolumeNumber int32 `json:"volume_number,omitempty"`
    // block device path
    DevicePath string `json:"device_path,omitempty"`
    // block device used by luks
    BackingDevice    string `json:"backing_device,omitempty"`
    AllocatedSizeKib int64  `json:"allocated_size_kib,omitempty"`
    UsableSizeKib    int64  `json:"usable_size_kib,omitempty"`
    // String describing current volume state
    DiskState string `json:"disk_state,omitempty"`
    Opened    bool   `json:"opened,omitempty"`
}

type MaxVolumeSizes

MaxVolumeSizes struct for MaxVolumeSizes

type MaxVolumeSizes struct {
    Candidates                      []Candidate `json:"candidates,omitempty"`
    DefaultMaxOversubscriptionRatio float64     `json:"default_max_oversubscription_ratio,omitempty"`
}

type NetInterface

NetInterface represents a node's network interface.

type NetInterface struct {
    Name                    string `json:"name"`
    Address                 net.IP `json:"address"`
    SatellitePort           int32  `json:"satellite_port,omitempty"`
    SatelliteEncryptionType string `json:"satellite_encryption_type,omitempty"`
    // Defines if this netinterface should be used for the satellite connection
    IsActive bool `json:"is_active,omitempty"`
    // unique object id
    Uuid string `json:"uuid,omitempty"`
}

type Node

Node represents a node in LINSTOR

type Node struct {
    Name  string   `json:"name"`
    Type  string   `json:"type"`
    Flags []string `json:"flags,omitempty"`
    // A string to string property map.
    Props         map[string]string `json:"props,omitempty"`
    NetInterfaces []NetInterface    `json:"net_interfaces,omitempty"`
    // Enum describing the current connection status.
    ConnectionStatus string `json:"connection_status,omitempty"`
    // unique object id
    Uuid                 string                                       `json:"uuid,omitempty"`
    StorageProviders     []ProviderKind                               `json:"storage_providers,omitempty"`
    ResourceLayers       []devicelayerkind.DeviceLayerKind            `json:"resource_layers,omitempty"`
    UnsupportedProviders map[ProviderKind][]string                    `json:"unsupported_providers,omitempty"`
    UnsupportedLayers    map[devicelayerkind.DeviceLayerKind][]string `json:"unsupported_layers,omitempty"`
    // milliseconds since unix epoch in UTC
    EvictionTimestamp *TimeStampMs `json:"eviction_timestamp,omitempty"`
}

type NodeModify

type NodeModify struct {
    NodeType string `json:"node_type,omitempty"`
    // A string to string property map.
    GenericPropsModify
}

type NodeProvider

NodeProvider acts as an abstraction for a NodeService. It can be swapped out for another NodeService implementation, for example for testing.

type NodeProvider interface {
    // GetAll gets information for all registered nodes.
    GetAll(ctx context.Context, opts ...*ListOpts) ([]Node, error)
    // Get gets information for a particular node.
    Get(ctx context.Context, nodeName string, opts ...*ListOpts) (Node, error)
    // Create creates a new node object.
    Create(ctx context.Context, node Node) error
    // CreateEbsNode creates a special virtual satellite for interacting with EBS.
    CreateEbsNode(ctx context.Context, name string, remoteName string) error
    // Modify modifies the given node and sets/deletes the given properties.
    Modify(ctx context.Context, nodeName string, props NodeModify) error
    // Delete deletes the given node.
    Delete(ctx context.Context, nodeName string) error
    // Lost marks the given node as lost to delete an unrecoverable node.
    Lost(ctx context.Context, nodeName string) error
    // Reconnect reconnects a node to the controller.
    Reconnect(ctx context.Context, nodeName string) error
    // GetNetInterfaces gets information about all network interfaces of a given node.
    GetNetInterfaces(ctx context.Context, nodeName string, opts ...*ListOpts) ([]NetInterface, error)
    // GetNetInterface gets information about a particular network interface on a given node.
    GetNetInterface(ctx context.Context, nodeName, nifName string, opts ...*ListOpts) (NetInterface, error)
    // CreateNetInterface creates the given network interface on a given node.
    CreateNetInterface(ctx context.Context, nodeName string, nif NetInterface) error
    // ModifyNetInterface modifies the given network interface on a given node.
    ModifyNetInterface(ctx context.Context, nodeName, nifName string, nif NetInterface) error
    // DeleteNetinterface deletes the given network interface on a given node.
    DeleteNetinterface(ctx context.Context, nodeName, nifName string) error
    // GetStoragePoolView gets information about all storage pools in the cluster.
    GetStoragePoolView(ctx context.Context, opts ...*ListOpts) ([]StoragePool, error)
    // GetStoragePools gets information about all storage pools on a given node.
    GetStoragePools(ctx context.Context, nodeName string, opts ...*ListOpts) ([]StoragePool, error)
    // GetStoragePool gets information about a specific storage pool on a given node.
    GetStoragePool(ctx context.Context, nodeName, spName string, opts ...*ListOpts) (StoragePool, error)
    // CreateStoragePool creates a storage pool on a given node.
    CreateStoragePool(ctx context.Context, nodeName string, sp StoragePool) error
    // ModifyStoragePool modifies a storage pool on a given node.
    ModifyStoragePool(ctx context.Context, nodeName, spName string, genericProps GenericPropsModify) error
    // DeleteStoragePool deletes a storage pool on a given node.
    DeleteStoragePool(ctx context.Context, nodeName, spName string) error
    // CreateDevicePool creates an LVM, LVM-thin or ZFS pool, optional VDO under it on a given node.
    CreateDevicePool(ctx context.Context, nodeName string, psc PhysicalStorageCreate) error
    // GetPhysicalStorageView gets a grouped list of physical storage that can be turned into a LINSTOR storage-pool
    GetPhysicalStorageView(ctx context.Context, opts ...*ListOpts) ([]PhysicalStorageViewItem, error)
    // GetPhysicalStorage gets a list of unconfigured physical storage on a node.
    GetPhysicalStorage(ctx context.Context, nodeName string) ([]PhysicalStorageNode, error)
    // GetStoragePoolPropsInfos gets meta information about the properties
    // that can be set on a storage pool on a particular node.
    GetStoragePoolPropsInfos(ctx context.Context, nodeName string, opts ...*ListOpts) ([]PropsInfo, error)
    // GetPropsInfos gets meta information about the properties that can be
    // set on a node.
    GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)
    // Evict the given node, migrating resources to the remaining nodes, if possible. This is meant for offline nodes.
    Evict(ctx context.Context, nodeName string) error
    // Restore an evicted node, optionally keeping existing resources.
    Restore(ctx context.Context, nodeName string, restore NodeRestore) error
    // Evacuate the given node, migrating resources to remaining nodes. While Evict works only on offline nodes, this
    // is meant for online nodes.
    Evacuate(ctx context.Context, nodeName string) error
}

type NodeRestore

type NodeRestore struct {
    DeleteResources *bool `json:"delete_resources,omitempty"`
    DeleteSnapshots *bool `json:"delete_snapshots,omitempty"`
}

type NodeService

NodeService is the service that deals with node related tasks.

type NodeService struct {
    // contains filtered or unexported fields
}

func (*NodeService) Create

func (n *NodeService) Create(ctx context.Context, node Node) error

Create creates a new node object.

func (*NodeService) CreateDevicePool

func (n *NodeService) CreateDevicePool(ctx context.Context, nodeName string, psc PhysicalStorageCreate) error

CreateDevicePool creates an LVM, LVM-thin or ZFS pool, optional VDO under it on a given node.

func (*NodeService) CreateEbsNode

func (n *NodeService) CreateEbsNode(ctx context.Context, name, remoteName string) error

func (*NodeService) CreateNetInterface

func (n *NodeService) CreateNetInterface(ctx context.Context, nodeName string, nif NetInterface) error

CreateNetInterface creates the given network interface on a given node.

func (*NodeService) CreateStoragePool

func (n *NodeService) CreateStoragePool(ctx context.Context, nodeName string, sp StoragePool) error

CreateStoragePool creates a storage pool on a given node.

func (*NodeService) Delete

func (n *NodeService) Delete(ctx context.Context, nodeName string) error

Delete deletes the given node.

func (*NodeService) DeleteNetinterface

func (n *NodeService) DeleteNetinterface(ctx context.Context, nodeName, nifName string) error

DeleteNetinterface deletes the given network interface on a given node.

func (*NodeService) DeleteStoragePool

func (n *NodeService) DeleteStoragePool(ctx context.Context, nodeName, spName string) error

DeleteStoragePool deletes a storage pool on a given node.

func (NodeService) Evacuate

func (n NodeService) Evacuate(ctx context.Context, nodeName string) error

Evacuate the given node, migrating resources to remaining nodes. While Evict works only on offline nodes, this is meant for online nodes.

func (NodeService) Evict

func (n NodeService) Evict(ctx context.Context, nodeName string) error

Evict the given node, migrating resources to the remaining nodes, if possible.

func (*NodeService) Get

func (n *NodeService) Get(ctx context.Context, nodeName string, opts ...*ListOpts) (Node, error)

Get gets information for a particular node.

func (*NodeService) GetAll

func (n *NodeService) GetAll(ctx context.Context, opts ...*ListOpts) ([]Node, error)

GetAll gets information for all registered nodes.

func (*NodeService) GetNetInterface

func (n *NodeService) GetNetInterface(ctx context.Context, nodeName, nifName string, opts ...*ListOpts) (NetInterface, error)

GetNetInterface gets information about a particular network interface on a given node.

func (*NodeService) GetNetInterfaces

func (n *NodeService) GetNetInterfaces(ctx context.Context, nodeName string, opts ...*ListOpts) ([]NetInterface, error)

GetNetInterfaces gets information about all network interfaces of a given node.

func (*NodeService) GetPhysicalStorage

func (n *NodeService) GetPhysicalStorage(ctx context.Context, nodeName string) ([]PhysicalStorageNode, error)

func (*NodeService) GetPhysicalStorageView

func (n *NodeService) GetPhysicalStorageView(ctx context.Context, opts ...*ListOpts) ([]PhysicalStorageViewItem, error)

GetPhysicalStorageView gets a grouped list of physical storage that can be turned into a LINSTOR storage-pool

func (*NodeService) GetPropsInfos

func (n *NodeService) GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)

GetPropsInfos gets meta information about the properties that can be set on a node.

func (*NodeService) GetStoragePool

func (n *NodeService) GetStoragePool(ctx context.Context, nodeName, spName string, opts ...*ListOpts) (StoragePool, error)

GetStoragePool gets information about a specific storage pool on a given node.

func (*NodeService) GetStoragePoolPropsInfos

func (n *NodeService) GetStoragePoolPropsInfos(ctx context.Context, nodeName string, opts ...*ListOpts) ([]PropsInfo, error)

GetStoragePoolPropsInfos gets meta information about the properties that can be set on a storage pool on a particular node.

func (*NodeService) GetStoragePoolView

func (n *NodeService) GetStoragePoolView(ctx context.Context, opts ...*ListOpts) ([]StoragePool, error)

GetStoragePoolView gets information about all storage pools in the cluster.

func (*NodeService) GetStoragePools

func (n *NodeService) GetStoragePools(ctx context.Context, nodeName string, opts ...*ListOpts) ([]StoragePool, error)

GetStoragePools gets information about all storage pools on a given node.

func (*NodeService) Lost

func (n *NodeService) Lost(ctx context.Context, nodeName string) error

Lost marks the given node as lost to delete an unrecoverable node.

func (*NodeService) Modify

func (n *NodeService) Modify(ctx context.Context, nodeName string, props NodeModify) error

Modify modifies the given node and sets/deletes the given properties.

func (*NodeService) ModifyNetInterface

func (n *NodeService) ModifyNetInterface(ctx context.Context, nodeName, nifName string, nif NetInterface) error

ModifyNetInterface modifies the given network interface on a given node.

func (*NodeService) ModifyStoragePool

func (n *NodeService) ModifyStoragePool(ctx context.Context, nodeName, spName string, genericProps GenericPropsModify) error

ModifyStoragePool modifies a storage pool on a given node.

func (*NodeService) Reconnect

func (n *NodeService) Reconnect(ctx context.Context, nodeName string) error

Reconnect reconnects a node to the controller.

func (*NodeService) Restore

func (n *NodeService) Restore(ctx context.Context, nodeName string, restore NodeRestore) error

Restore an evicted node, optionally keeping existing resources.

type NvmeResource

type NvmeResource struct {
    NvmeVolumes []NvmeVolume `json:"nvme_volumes,omitempty"`
}

type NvmeVolume

type NvmeVolume struct {
    VolumeNumber int32 `json:"volume_number,omitempty"`
    // block device path
    DevicePath string `json:"device_path,omitempty"`
    // block device used by nvme
    BackingDevice    string `json:"backing_device,omitempty"`
    AllocatedSizeKib int64  `json:"allocated_size_kib,omitempty"`
    UsableSizeKib    int64  `json:"usable_size_kib,omitempty"`
    // String describing current volume state
    DiskState string `json:"disk_state,omitempty"`
}

type OneOfDrbdVolumeDefinition

OneOfDrbdVolumeDefinition is used to prevent other layertypes than drbd-volume-defintion

type OneOfDrbdVolumeDefinition interface {
    // contains filtered or unexported methods
}

type OneOfDrbdVolumeLuksVolumeStorageVolumeNvmeVolumeWritecacheVolumeCacheVolumeBCacheVolume

OneOfDrbdVolumeLuksVolumeStorageVolumeNvmeVolumeWritecacheVolumeCacheVolume is used to prevent that other types than drbd- luks- and storage-volume are used for a VolumeLayer

type OneOfDrbdVolumeLuksVolumeStorageVolumeNvmeVolumeWritecacheVolumeCacheVolumeBCacheVolume interface {
    // contains filtered or unexported methods
}

type Option

Option configures a LINSTOR Client

type Option func(*Client) error

func BaseURL

func BaseURL(URL *url.URL) Option

BaseURL is a client's option to set the baseURL of the REST client.

func BasicAuth

func BasicAuth(basicauth *BasicAuthCfg) Option

BasicAuth is a client's option to set username and password for the REST client.

func BearerToken

func BearerToken(token string) Option

BearerToken configures authentication via the given token send in the Authorization Header. If set, this will override any authentication happening via Basic Authentication.

func Controllers

func Controllers(controllers []string) Option

func HTTPClient

func HTTPClient(httpClient *http.Client) Option

HTTPClient is a client's option to set a specific http.Client.

func Limit

func Limit(r rate.Limit, b int) Option

Limit is the client's option to set number of requests per second and max number of bursts. Mutually exclusive with Limiter, last applied option wins. Deprecated: Use Limiter instead.

func Limiter

func Limiter(limiter *rate.Limiter) Option

Limiter to use when making queries. Mutually exclusive with Limit, last applied option wins.

func Log

func Log(logger interface{}) Option

Log is a client's option to set a Logger

func UserAgent

func UserAgent(ua string) Option

UserAgent sets the User-Agent header for every request to the given string.

type OverrideProps

OverrideProps is a map of properties to modify (key/value pairs)

type OverrideProps map[string]string

type Passphrase

Passphrase represents a LINSTOR passphrase

type Passphrase struct {
    NewPassphrase string `json:"new_passphrase,omitempty"`
    OldPassphrase string `json:"old_passphrase,omitempty"`
}

type PhysicalStorageCreate

PhysicalStorageCreate is a configuration struct used to represent pysical storage on a given node. If with_storage_pool is set a linstor storage pool will also be created using this device pool

type PhysicalStorageCreate struct {
    ProviderKind ProviderKind `json:"provider_kind"`
    DevicePaths  []string     `json:"device_paths"`
    // RAID level to use for pool.
    RaidLevel         string                           `json:"raid_level,omitempty"`
    PoolName          string                           `json:"pool_name,omitempty"`
    VdoEnable         bool                             `json:"vdo_enable,omitempty"`
    VdoSlabSizeKib    int64                            `json:"vdo_slab_size_kib,omitempty"`
    VdoLogicalSizeKib int64                            `json:"vdo_logical_size_kib,omitempty"`
    WithStoragePool   PhysicalStorageStoragePoolCreate `json:"with_storage_pool,omitempty"`
}

type PhysicalStorageDevice

PhysicalStorageDevice represents a physical storage device on a a node.

type PhysicalStorageDevice struct {
    Device string `json:"device,omitempty"`
    Model  string `json:"model,omitempty"`
    Serial string `json:"serial,omitempty"`
    Wwn    string `json:"wwn,omitempty"`
}

type PhysicalStorageNode

type PhysicalStorageNode struct {
    PhysicalStorageDevice
    Size       int64 `json:"size,omitempty"`
    Rotational bool  `json:"rotational,omitempty"`
}

type PhysicalStorageStoragePoolCreate

PhysicalStorageStoragePoolCreate is used for create physical-storage

type PhysicalStorageStoragePoolCreate struct {
    // Name of the linstor storage pool
    Name string `json:"name,omitempty"`
    // A string to string property map.
    Props map[string]string `json:"props,omitempty"`
    // Name of the shared space
    SharedSpace string `json:"shared_space,omitempty"`
    // true if a shared storage pool uses linstor-external locking, like cLVM
    ExternalLocking bool `json:"external_locking,omitempty"`
}

type PhysicalStorageViewItem

PhysicalStorageViewItem is a view on a physical storage on multiple nodes.

type PhysicalStorageViewItem struct {
    Size       int64                              `json:"size,omitempty"`
    Rotational bool                               `json:"rotational,omitempty"`
    Nodes      map[string][]PhysicalStorageDevice `json:"nodes,omitempty"`
}

type PropsInfo

type PropsInfo struct {
    Info     string `json:"info,omitempty"`
    PropType string `json:"prop_type,omitempty"`
    Value    string `json:"value,omitempty"`
    Dflt     string `json:"dflt,omitempty"`
    Unit     string `json:"unit,omitempty"`
}

type ProviderKind

ProviderKind is a type that represents various types of storage.

type ProviderKind string

List of ProviderKind

const (
    DISKLESS   ProviderKind = "DISKLESS"
    LVM        ProviderKind = "LVM"
    LVM_THIN   ProviderKind = "LVM_THIN"
    ZFS        ProviderKind = "ZFS"
    ZFS_THIN   ProviderKind = "ZFS_THIN"
    FILE       ProviderKind = "FILE"
    FILE_THIN  ProviderKind = "FILE_THIN"
    SPDK       ProviderKind = "SPDK"
    EBS_TARGET ProviderKind = "EBS_TARGET"
    EBS_INIT   ProviderKind = "EBS_INIT"
)

type RDGetAllRequest

type RDGetAllRequest struct {
    // ResourceDefinitions filters the returned resource definitions by the given names
    ResourceDefinitions []string `url:"resource_definitions,omitempty"`
    // Props filters the returned resource definitions on their property values (uses key=value syntax)
    Props  []string `url:"props,omitempty"`
    Offset int      `url:"offset,omitempty"`
    Limit  int      `url:"offset,omitempty"`
    // WithVolumeDefinitions, if set to true, LINSTOR will also include volume definitions in the response.
    WithVolumeDefinitions bool `url:"with_volume_definitions,omitempty"`
}

type RemoteList

type RemoteList struct {
    S3Remotes      []S3Remote      `json:"s3_remotes,omitempty"`
    LinstorRemotes []LinstorRemote `json:"linstor_remotes,omitempty"`
    EbsRemotes     []EbsRemote     `json:"ebs_remotes,omitempty"`
}

type RemoteProvider

type RemoteProvider interface {
    // GetAll returns the list of all registered remotes.
    GetAll(ctx context.Context, opts ...*ListOpts) (RemoteList, error)
    // GetAllLinstor returns the list of LINSTOR remotes.
    GetAllLinstor(ctx context.Context, opts ...*ListOpts) ([]LinstorRemote, error)
    // GetAllS3 returns the list of S3 remotes.
    GetAllS3(ctx context.Context, opts ...*ListOpts) ([]S3Remote, error)
    // GetAllEbs returns the list of EBS remotes.
    GetAllEbs(ctx context.Context, opts ...*ListOpts) ([]EbsRemote, error)
    // CreateLinstor creates a new LINSTOR remote.
    CreateLinstor(ctx context.Context, create LinstorRemote) error
    // CreateS3 creates a new S3 remote.
    CreateS3(ctx context.Context, create S3Remote) error
    // CreateEbs creates a new EBS remote.
    CreateEbs(ctx context.Context, create EbsRemote) error
    // Delete a named remote.
    Delete(ctx context.Context, remoteName string) error
    // ModifyLinstor modifies the given LINSTOR remote.
    ModifyLinstor(ctx context.Context, remoteName string, modify LinstorRemote) error
    // ModifyS3 modifies the given S3 remote.
    ModifyS3(ctx context.Context, remoteName string, modify S3Remote) error
    // ModifyEbs modifies the given EBS remote.
    ModifyEbs(ctx context.Context, remoteName string, modify EbsRemote) error
}

type RemoteService

type RemoteService struct {
    // contains filtered or unexported fields
}

func (*RemoteService) CreateEbs

func (r *RemoteService) CreateEbs(ctx context.Context, create EbsRemote) error

func (*RemoteService) CreateLinstor

func (r *RemoteService) CreateLinstor(ctx context.Context, create LinstorRemote) error

func (*RemoteService) CreateS3

func (r *RemoteService) CreateS3(ctx context.Context, create S3Remote) error

func (*RemoteService) Delete

func (r *RemoteService) Delete(ctx context.Context, remoteName string) error

func (*RemoteService) GetAll

func (r *RemoteService) GetAll(ctx context.Context, opts ...*ListOpts) (RemoteList, error)

func (*RemoteService) GetAllEbs

func (r *RemoteService) GetAllEbs(ctx context.Context, opts ...*ListOpts) ([]EbsRemote, error)

func (*RemoteService) GetAllLinstor

func (r *RemoteService) GetAllLinstor(ctx context.Context, opts ...*ListOpts) ([]LinstorRemote, error)

func (*RemoteService) GetAllS3

func (r *RemoteService) GetAllS3(ctx context.Context, opts ...*ListOpts) ([]S3Remote, error)

func (*RemoteService) ModifyEbs

func (r *RemoteService) ModifyEbs(ctx context.Context, remoteName string, modify EbsRemote) error

func (*RemoteService) ModifyLinstor

func (r *RemoteService) ModifyLinstor(ctx context.Context, remoteName string, modify LinstorRemote) error

func (*RemoteService) ModifyS3

func (r *RemoteService) ModifyS3(ctx context.Context, remoteName string, modify S3Remote) error

type Resource

Resource is a struct which holds the information of a resource

type Resource struct {
    Name     string `json:"name,omitempty"`
    NodeName string `json:"node_name,omitempty"`
    // A string to string property map.
    Props       map[string]string `json:"props,omitempty"`
    Flags       []string          `json:"flags,omitempty"`
    LayerObject *ResourceLayer    `json:"layer_object,omitempty"`
    State       *ResourceState    `json:"state,omitempty"`
    // unique object id
    Uuid string `json:"uuid,omitempty"`
    // milliseconds since unix epoch in UTC
    CreateTimestamp *TimeStampMs `json:"create_timestamp,omitempty"`
}

type ResourceConnection

ResourceConnection is a struct which holds information about a connection between to nodes

type ResourceConnection struct {
    // source node of the connection
    NodeA string `json:"node_a,omitempty"`
    // target node of the connection
    NodeB string `json:"node_b,omitempty"`
    // A string to string property map.
    Props map[string]string `json:"props,omitempty"`
    Flags []string          `json:"flags,omitempty"`
    Port  int32             `json:"port,omitempty"`
}

type ResourceCreate

ResourceCreate is a struct where the properties of a resource are stored to create it

type ResourceCreate struct {
    Resource   Resource                          `json:"resource,omitempty"`
    LayerList  []devicelayerkind.DeviceLayerKind `json:"layer_list,omitempty"`
    DrbdNodeId int32                             `json:"drbd_node_id,omitempty"`
}

type ResourceDefinition

ResourceDefinition is a struct to store the information about a resource-definition

type ResourceDefinition struct {
    Name string `json:"name,omitempty"`
    // External name can be used to have native resource names. If you need to store a non Linstor compatible resource name use this field and Linstor will generate a compatible name.
    ExternalName string `json:"external_name,omitempty"`
    // A string to string property map.
    Props     map[string]string         `json:"props,omitempty"`
    Flags     []string                  `json:"flags,omitempty"`
    LayerData []ResourceDefinitionLayer `json:"layer_data,omitempty"`
    // unique object id
    Uuid string `json:"uuid,omitempty"`
    // name of the linked resource group, if there is a link
    ResourceGroupName string `json:"resource_group_name,omitempty"`
}

type ResourceDefinitionCloneRequest

type ResourceDefinitionCloneRequest struct {
    Name         string `json:"name,omitempty"`
    ExternalName string `json:"external_name,omitempty"`
}

type ResourceDefinitionCloneStarted

type ResourceDefinitionCloneStarted struct {
    // Path for clone status
    Location string `json:"location"`
    // name of the source resource
    SourceName string `json:"source_name"`
    // name of the clone resource
    CloneName string       `json:"clone_name"`
    Messages  *[]ApiCallRc `json:"messages,omitempty"`
}

type ResourceDefinitionCloneStatus

type ResourceDefinitionCloneStatus struct {
    Status clonestatus.CloneStatus `json:"status"`
}

type ResourceDefinitionCreate

ResourceDefinitionCreate is a struct for holding the data needed to create a resource-defintion

type ResourceDefinitionCreate struct {
    // drbd port for resources
    DrbdPort int32 `json:"drbd_port,omitempty"`
    // drbd resource secret
    DrbdSecret         string             `json:"drbd_secret,omitempty"`
    DrbdTransportType  string             `json:"drbd_transport_type,omitempty"`
    ResourceDefinition ResourceDefinition `json:"resource_definition"`
}

type ResourceDefinitionLayer

ResourceDefinitionLayer is a struct for the storing the layertype of a resource-defintion

type ResourceDefinitionLayer struct {
    Type devicelayerkind.DeviceLayerKind `json:"type,omitempty"`
    Data *DrbdResourceDefinitionLayer    `json:"data,omitempty"`
}

func (*ResourceDefinitionLayer) UnmarshalJSON

func (rd *ResourceDefinitionLayer) UnmarshalJSON(b []byte) error

UnmarshalJSON is needed for the unmarshal interface for ResourceDefinitionLayer types

type ResourceDefinitionModify

type ResourceDefinitionModify struct {
    // drbd port for resources
    DrbdPort int32 `json:"drbd_port,omitempty"`
    // drbd peer slot number
    DrbdPeerSlots int32                             `json:"drbd_peer_slots,omitempty"`
    LayerStack    []devicelayerkind.DeviceLayerKind `json:"layer_stack,omitempty"`
    // change resource group to the given group name
    ResourceGroup string `json:"resource_group,omitempty"`
    GenericPropsModify
}

type ResourceDefinitionProvider

ResourceDefinitionProvider acts as an abstraction for a ResourceDefinitionService. It can be swapped out for another ResourceDefinitionService implementation, for example for testing.

type ResourceDefinitionProvider interface {
    // GetAll lists all resource-definitions
    GetAll(ctx context.Context, request RDGetAllRequest) ([]ResourceDefinitionWithVolumeDefinition, error)
    // Get return information about a resource-defintion
    Get(ctx context.Context, resDefName string, opts ...*ListOpts) (ResourceDefinition, error)
    // Create adds a new resource-definition
    Create(ctx context.Context, resDef ResourceDefinitionCreate) error
    // Modify allows to modify a resource-definition
    Modify(ctx context.Context, resDefName string, props GenericPropsModify) error
    // Delete completely deletes a resource-definition
    Delete(ctx context.Context, resDefName string) error
    // GetVolumeDefinitions returns all volume-definitions of a resource-definition
    GetVolumeDefinitions(ctx context.Context, resDefName string, opts ...*ListOpts) ([]VolumeDefinition, error)
    // GetVolumeDefinition shows the properties of a specific volume-definition
    GetVolumeDefinition(ctx context.Context, resDefName string, volNr int, opts ...*ListOpts) (VolumeDefinition, error)
    // CreateVolumeDefinition adds a volume-definition to a resource-definition. Only the size is required.
    CreateVolumeDefinition(ctx context.Context, resDefName string, volDef VolumeDefinitionCreate) error
    // ModifyVolumeDefinition give the abilty to modify a specific volume-definition
    ModifyVolumeDefinition(ctx context.Context, resDefName string, volNr int, props VolumeDefinitionModify) error
    // DeleteVolumeDefinition deletes a specific volume-definition
    DeleteVolumeDefinition(ctx context.Context, resDefName string, volNr int) error
    // GetPropsInfos gets meta information about the properties that can be
    // set on a resource definition.
    GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)
    // GetDRBDProxyPropsInfos gets meta information about the properties
    // that can be set on a resource definition for drbd proxy.
    GetDRBDProxyPropsInfos(ctx context.Context, resDefName string, opts ...*ListOpts) ([]PropsInfo, error)
    // AttachExternalFile adds an external file to the resource definition. This
    // means that the file will be deployed to every node the resource is deployed on.
    AttachExternalFile(ctx context.Context, resDefName string, filePath string) error
    // DetachExternalFile removes a binding between an external file and a resource definition.
    // This means that the file will no longer be deployed on every node the resource
    // is deployed on.
    DetachExternalFile(ctx context.Context, resDefName string, filePath string) error
    // Clone starts cloning a resource definition and all resources using a method optimized for the storage driver.
    Clone(ctx context.Context, srcResDef string, request ResourceDefinitionCloneRequest) (ResourceDefinitionCloneStarted, error)
    // CloneStatus fetches the current status of a clone operation started by Clone.
    CloneStatus(ctx context.Context, srcResDef, targetResDef string) (ResourceDefinitionCloneStatus, error)
    // SyncStatus checks if a resource is currently in sync on all nodes
    SyncStatus(ctx context.Context, resDef string) (ResourceDefinitionSyncStatus, error)
}

type ResourceDefinitionService

ResourceDefinitionService is a struct for the client pointer

type ResourceDefinitionService struct {
    // contains filtered or unexported fields
}

func (*ResourceDefinitionService) AttachExternalFile

func (n *ResourceDefinitionService) AttachExternalFile(ctx context.Context, resDefName string, filePath string) error

AttachExternalFile adds an external file to the resource definition. This means that the file will be deployed to every node the resource is deployed on.

func (*ResourceDefinitionService) Clone

func (n *ResourceDefinitionService) Clone(ctx context.Context, srcResDef string, request ResourceDefinitionCloneRequest) (ResourceDefinitionCloneStarted, error)

Clone starts cloning a resource definition and all resources using a method optimized for the storage driver.

func (*ResourceDefinitionService) CloneStatus

func (n *ResourceDefinitionService) CloneStatus(ctx context.Context, srcResDef, targetResDef string) (ResourceDefinitionCloneStatus, error)

CloneStatus fetches the current status of a clone operation started by Clone.

func (*ResourceDefinitionService) Create

func (n *ResourceDefinitionService) Create(ctx context.Context, resDef ResourceDefinitionCreate) error

Create adds a new resource-definition

func (*ResourceDefinitionService) CreateVolumeDefinition

func (n *ResourceDefinitionService) CreateVolumeDefinition(ctx context.Context, resDefName string, volDef VolumeDefinitionCreate) error

CreateVolumeDefinition adds a volume-definition to a resource-definition. Only the size is required.

func (*ResourceDefinitionService) Delete

func (n *ResourceDefinitionService) Delete(ctx context.Context, resDefName string) error

Delete completely deletes a resource-definition

func (*ResourceDefinitionService) DeleteVolumeDefinition

func (n *ResourceDefinitionService) DeleteVolumeDefinition(ctx context.Context, resDefName string, volNr int) error

DeleteVolumeDefinition deletes a specific volume-definition

func (*ResourceDefinitionService) DetachExternalFile

func (n *ResourceDefinitionService) DetachExternalFile(ctx context.Context, resDefName string, filePath string) error

DetachExternalFile removes a binding between an external file and a resource definition. This means that the file will no longer be deployed on every node the resource is deployed on.

func (*ResourceDefinitionService) Get

func (n *ResourceDefinitionService) Get(ctx context.Context, resDefName string, opts ...*ListOpts) (ResourceDefinition, error)

Get return information about a resource-defintion

func (*ResourceDefinitionService) GetAll

func (n *ResourceDefinitionService) GetAll(ctx context.Context, request RDGetAllRequest) ([]ResourceDefinitionWithVolumeDefinition, error)

GetAll lists all resource-definitions

func (*ResourceDefinitionService) GetDRBDProxyPropsInfos

func (n *ResourceDefinitionService) GetDRBDProxyPropsInfos(ctx context.Context, resDefName string, opts ...*ListOpts) ([]PropsInfo, error)

GetDRBDProxyPropsInfos gets meta information about the properties that can be set on a resource definition for drbd proxy.

func (*ResourceDefinitionService) GetPropsInfos

func (n *ResourceDefinitionService) GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)

GetPropsInfos gets meta information about the properties that can be set on a resource definition.

func (*ResourceDefinitionService) GetVolumeDefinition

func (n *ResourceDefinitionService) GetVolumeDefinition(ctx context.Context, resDefName string, volNr int, opts ...*ListOpts) (VolumeDefinition, error)

GetVolumeDefinition shows the properties of a specific volume-definition

func (*ResourceDefinitionService) GetVolumeDefinitions

func (n *ResourceDefinitionService) GetVolumeDefinitions(ctx context.Context, resDefName string, opts ...*ListOpts) ([]VolumeDefinition, error)

GetVolumeDefinitions returns all volume-definitions of a resource-definition

func (*ResourceDefinitionService) Modify

func (n *ResourceDefinitionService) Modify(ctx context.Context, resDefName string, props GenericPropsModify) error

Modify allows to modify a resource-definition

func (*ResourceDefinitionService) ModifyVolumeDefinition

func (n *ResourceDefinitionService) ModifyVolumeDefinition(ctx context.Context, resDefName string, volNr int, props VolumeDefinitionModify) error

ModifyVolumeDefinition give the abilty to modify a specific volume-definition

func (*ResourceDefinitionService) SyncStatus

func (n *ResourceDefinitionService) SyncStatus(ctx context.Context, resDef string) (ResourceDefinitionSyncStatus, error)

SyncStatus checks if a resource is currently in sync on all nodes

type ResourceDefinitionSyncStatus

type ResourceDefinitionSyncStatus struct {
    SyncedOnAll bool `json:"synced_on_all"`
}

type ResourceDefinitionWithVolumeDefinition

type ResourceDefinitionWithVolumeDefinition struct {
    ResourceDefinition
    VolumeDefinitions []VolumeDefinition `json:"volume_definitions,omitempty"`
}

type ResourceGroup

type ResourceGroup struct {
    Name        string `json:"name,omitempty"`
    Description string `json:"description,omitempty"`
    // A string to string property map.
    Props        map[string]string `json:"props,omitempty"`
    SelectFilter AutoSelectFilter  `json:"select_filter,omitempty"`
    // unique object id
    Uuid string `json:"uuid,omitempty"`
}

type ResourceGroupAdjust

type ResourceGroupAdjust struct {
    SelectFilter *AutoSelectFilter `json:"select_filter,omitempty"`
}

type ResourceGroupModify

type ResourceGroupModify struct {
    Description string `json:"description,omitempty"`
    // A string to string property map.
    OverrideProps    map[string]string `json:"override_props,omitempty"`
    DeleteProps      []string          `json:"delete_props,omitempty"`
    DeleteNamespaces []string          `json:"delete_namespaces,omitempty"`
    SelectFilter     AutoSelectFilter  `json:"select_filter,omitempty"`
}

type ResourceGroupProvider

ResourceGroupProvider acts as an abstraction for a ResourceGroupService. It can be swapped out for another ResourceGroupService implementation, for example for testing.

type ResourceGroupProvider interface {
    // GetAll lists all resource-groups
    GetAll(ctx context.Context, opts ...*ListOpts) ([]ResourceGroup, error)
    // Get return information about a resource-defintion
    Get(ctx context.Context, resGrpName string, opts ...*ListOpts) (ResourceGroup, error)
    // Create adds a new resource-group
    Create(ctx context.Context, resGrp ResourceGroup) error
    // Modify allows to modify a resource-group
    Modify(ctx context.Context, resGrpName string, props ResourceGroupModify) error
    // Delete deletes a resource-group
    Delete(ctx context.Context, resGrpName string) error
    // Spawn creates a new resource-definition and auto-deploys if configured to do so
    Spawn(ctx context.Context, resGrpName string, resGrpSpwn ResourceGroupSpawn) error
    // GetVolumeGroups lists all volume-groups for a resource-group
    GetVolumeGroups(ctx context.Context, resGrpName string, opts ...*ListOpts) ([]VolumeGroup, error)
    // GetVolumeGroup lists a volume-group for a resource-group
    GetVolumeGroup(ctx context.Context, resGrpName string, volNr int, opts ...*ListOpts) (VolumeGroup, error)
    // Create adds a new volume-group to a resource-group
    CreateVolumeGroup(ctx context.Context, resGrpName string, volGrp VolumeGroup) error
    // Modify allows to modify a volume-group of a resource-group
    ModifyVolumeGroup(ctx context.Context, resGrpName string, volNr int, props VolumeGroupModify) error
    DeleteVolumeGroup(ctx context.Context, resGrpName string, volNr int) error
    // GetPropsInfos gets meta information about the properties that can be
    // set on a resource group.
    GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)
    // GetVolumeGroupPropsInfos gets meta information about the properties
    // that can be set on a resource group.
    GetVolumeGroupPropsInfos(ctx context.Context, resGrpName string, opts ...*ListOpts) ([]PropsInfo, error)
    // Adjust all resource-definitions (calls autoplace for) of the given resource-group
    Adjust(ctx context.Context, resGrpName string, adjust ResourceGroupAdjust) error
    // AdjustAll adjusts all resource-definitions (calls autoplace) according to their associated resource group.
    AdjustAll(ctx context.Context, adjust ResourceGroupAdjust) error
}

type ResourceGroupService

ResourceGroupService is the service that deals with resource group related tasks.

type ResourceGroupService struct {
    // contains filtered or unexported fields
}

func (*ResourceGroupService) Adjust

func (n *ResourceGroupService) Adjust(ctx context.Context, resGrpName string, adjust ResourceGroupAdjust) error

Adjust all resource-definitions (calls autoplace for) of the given resource-group

func (*ResourceGroupService) AdjustAll

func (n *ResourceGroupService) AdjustAll(ctx context.Context, adjust ResourceGroupAdjust) error

AdjustAll adjusts all resource-definitions (calls autoplace) according to their associated resource group.

func (*ResourceGroupService) Create

func (n *ResourceGroupService) Create(ctx context.Context, resGrp ResourceGroup) error

Create adds a new resource-group

func (*ResourceGroupService) CreateVolumeGroup

func (n *ResourceGroupService) CreateVolumeGroup(ctx context.Context, resGrpName string, volGrp VolumeGroup) error

Create adds a new volume-group to a resource-group

func (*ResourceGroupService) Delete

func (n *ResourceGroupService) Delete(ctx context.Context, resGrpName string) error

Delete deletes a resource-group

func (*ResourceGroupService) DeleteVolumeGroup

func (n *ResourceGroupService) DeleteVolumeGroup(ctx context.Context, resGrpName string, volNr int) error

func (*ResourceGroupService) Get

func (n *ResourceGroupService) Get(ctx context.Context, resGrpName string, opts ...*ListOpts) (ResourceGroup, error)

Get return information about a resource-defintion

func (*ResourceGroupService) GetAll

func (n *ResourceGroupService) GetAll(ctx context.Context, opts ...*ListOpts) ([]ResourceGroup, error)

GetAll lists all resource-groups

func (*ResourceGroupService) GetPropsInfos

func (n *ResourceGroupService) GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)

GetPropsInfos gets meta information about the properties that can be set on a resource group.

func (*ResourceGroupService) GetVolumeGroup

func (n *ResourceGroupService) GetVolumeGroup(ctx context.Context, resGrpName string, volNr int, opts ...*ListOpts) (VolumeGroup, error)

GetVolumeGroup lists a volume-group for a resource-group

func (*ResourceGroupService) GetVolumeGroupPropsInfos

func (n *ResourceGroupService) GetVolumeGroupPropsInfos(ctx context.Context, resGrpName string, opts ...*ListOpts) ([]PropsInfo, error)

GetVolumeGroupPropsInfos gets meta information about the properties that can be set on a resource group.

func (*ResourceGroupService) GetVolumeGroups

func (n *ResourceGroupService) GetVolumeGroups(ctx context.Context, resGrpName string, opts ...*ListOpts) ([]VolumeGroup, error)

GetVolumeGroups lists all volume-groups for a resource-group

func (*ResourceGroupService) Modify

func (n *ResourceGroupService) Modify(ctx context.Context, resGrpName string, props ResourceGroupModify) error

Modify allows to modify a resource-group

func (*ResourceGroupService) ModifyVolumeGroup

func (n *ResourceGroupService) ModifyVolumeGroup(ctx context.Context, resGrpName string, volNr int, props VolumeGroupModify) error

Modify allows to modify a volume-group of a resource-group

func (*ResourceGroupService) Spawn

func (n *ResourceGroupService) Spawn(ctx context.Context, resGrpName string, resGrpSpwn ResourceGroupSpawn) error

Spawn creates a new resource-definition and auto-deploys if configured to do so

type ResourceGroupSpawn

type ResourceGroupSpawn struct {
    // name of the resulting resource-definition
    ResourceDefinitionName string `json:"resource_definition_name"`
    // External name can be used to have native resource names. If you need to store a non Linstor compatible resource name use this field and Linstor will generate a compatible name.
    ResourceDefinitionExternalName string `json:"resource_definition_external_name,omitempty"`
    // sizes (in kib) of the resulting volume-definitions
    VolumeSizes  []int64          `json:"volume_sizes,omitempty"`
    SelectFilter AutoSelectFilter `json:"select_filter,omitempty"`
    // If false, the length of the vlm_sizes has to match the number of volume-groups or an error is returned.  If true and there are more vlm_sizes than volume-groups, the additional volume-definitions will simply have no pre-set properties (i.e. \"empty\" volume-definitions) If true and there are less vlm_sizes than volume-groups, the additional volume-groups won't be used.  If the count of vlm_sizes matches the number of volume-groups, this \"partial\" parameter has no effect.
    Partial bool `json:"partial,omitempty"`
    // If true, the spawn command will only create the resource-definition with the volume-definitions but will not perform an auto-place, even if it is configured.
    DefinitionsOnly bool `json:"definitions_only,omitempty"`
}

type ResourceLayer

ResourceLayer is a struct to store layer-information abour a resource

type ResourceLayer struct {
    Children           []ResourceLayer                 `json:"children,omitempty"`
    ResourceNameSuffix string                          `json:"resource_name_suffix,omitempty"`
    Type               devicelayerkind.DeviceLayerKind `json:"type,omitempty"`
    Drbd               *DrbdResource                   `json:"drbd,omitempty"`
    Luks               *LuksResource                   `json:"luks,omitempty"`
    Storage            *StorageResource                `json:"storage,omitempty"`
    Nvme               *NvmeResource                   `json:"nvme,omitempty"`
    Writecache         *WritecacheResource             `json:"writecache,omitempty"`
    Cache              *CacheResource                  `json:"cache,omitempty"`
    BCache             *BCacheResource                 `json:"bcache,omitempty"`
}

type ResourceMakeAvailable

type ResourceMakeAvailable struct {
    LayerList []devicelayerkind.DeviceLayerKind `json:"layer_list,omitempty"`
    // if true resource will be created as diskful even if diskless would be possible
    Diskful bool `json:"diskful,omitempty"`
}

type ResourceProvider

ResourceProvider acts as an abstraction for an ResourceService. It can be swapped out for another ResourceService implementation, for example for testing.

type ResourceProvider interface {
    // GetResourceView returns all resources in the cluster. Filters can be set via ListOpts.
    GetResourceView(ctx context.Context, opts ...*ListOpts) ([]ResourceWithVolumes, error)
    // GetAll returns all resources for a resource-definition
    GetAll(ctx context.Context, resName string, opts ...*ListOpts) ([]Resource, error)
    // Get returns information about a resource on a specific node
    Get(ctx context.Context, resName, nodeName string, opts ...*ListOpts) (Resource, error)
    // Create is used to create a resource on a node
    Create(ctx context.Context, res ResourceCreate) error
    // Modify gives the ability to modify a resource on a node
    Modify(ctx context.Context, resName, nodeName string, props GenericPropsModify) error
    // Delete deletes a resource on a specific node
    Delete(ctx context.Context, resName, nodeName string) error
    // GetVolumes lists als volumes of a resource
    GetVolumes(ctx context.Context, resName, nodeName string, opts ...*ListOpts) ([]Volume, error)
    // GetVolume returns information about a specific volume defined by it resource,node and volume-number
    GetVolume(ctx context.Context, resName, nodeName string, volNr int, opts ...*ListOpts) (Volume, error)
    // ModifyVolume modifies an existing volume with the given props
    ModifyVolume(ctx context.Context, resName, nodeName string, volNr int, props GenericPropsModify) error
    // Diskless toggles a resource on a node to diskless - the parameter disklesspool can be set if its needed
    Diskless(ctx context.Context, resName, nodeName, disklessPoolName string) error
    // Diskful toggles a resource to diskful - the parameter storagepool can be set if its needed
    Diskful(ctx context.Context, resName, nodeName, storagePoolName string, props *ToggleDiskDiskfulProps) error
    // Migrate mirgates a resource from one node to another node
    Migrate(ctx context.Context, resName, fromNodeName, toNodeName, storagePoolName string) error
    // Autoplace places a resource on your nodes autmatically
    Autoplace(ctx context.Context, resName string, apr AutoPlaceRequest) error
    // GetConnections lists all resource connections if no node-names are given- if two node-names are given it shows the connection between them
    GetConnections(ctx context.Context, resName, nodeAName, nodeBName string, opts ...*ListOpts) ([]ResourceConnection, error)
    // ModifyConnection allows to modify the connection between two nodes
    ModifyConnection(ctx context.Context, resName, nodeAName, nodeBName string, props GenericPropsModify) error
    // GetSnapshots lists all snapshots of a resource
    GetSnapshots(ctx context.Context, resName string, opts ...*ListOpts) ([]Snapshot, error)
    // GetSnapshotView gets information about all snapshots
    GetSnapshotView(ctx context.Context, opts ...*ListOpts) ([]Snapshot, error)
    // GetSnapshot returns information about a specific Snapshot by its name
    GetSnapshot(ctx context.Context, resName, snapName string, opts ...*ListOpts) (Snapshot, error)
    // CreateSnapshot creates a snapshot of a resource
    CreateSnapshot(ctx context.Context, snapshot Snapshot) error
    // DeleteSnapshot deletes a snapshot by its name. Specify nodes to only delete snapshots on specific nodes.
    DeleteSnapshot(ctx context.Context, resName, snapName string, nodes ...string) error
    // RestoreSnapshot restores a snapshot on a resource
    RestoreSnapshot(ctx context.Context, origResName, snapName string, snapRestoreConf SnapshotRestore) error
    // RestoreVolumeDefinitionSnapshot restores a volume-definition-snapshot on a resource
    RestoreVolumeDefinitionSnapshot(ctx context.Context, origResName, snapName string, snapRestoreConf SnapshotRestore) error
    // RollbackSnapshot rolls back a snapshot from a specific resource
    RollbackSnapshot(ctx context.Context, resName, snapName string) error
    // EnableSnapshotShipping enables snapshot shipping for a resource
    EnableSnapshotShipping(ctx context.Context, resName string, ship SnapshotShipping) error
    // ModifyDRBDProxy is used to modify drbd-proxy properties
    ModifyDRBDProxy(ctx context.Context, resName string, props DrbdProxyModify) error
    // EnableDRBDProxy is used to enable drbd-proxy with the rest-api call from the function enableDisableDRBDProxy
    EnableDRBDProxy(ctx context.Context, resName, nodeAName, nodeBName string) error
    // DisableDRBDProxy is used to disable drbd-proxy with the rest-api call from the function enableDisableDRBDProxy
    DisableDRBDProxy(ctx context.Context, resName, nodeAName, nodeBName string) error
    // QueryMaxVolumeSize finds the maximum size of a volume for a given filter
    QueryMaxVolumeSize(ctx context.Context, filter AutoSelectFilter) (MaxVolumeSizes, error)
    // GetSnapshotShippings gets a view of all snapshot shippings
    GetSnapshotShippings(ctx context.Context, opts ...*ListOpts) ([]SnapshotShippingStatus, error)
    // GetPropsInfos gets meta information about the properties that can be
    // set on a resource.
    GetPropsInfos(ctx context.Context, resName string, opts ...*ListOpts) ([]PropsInfo, error)
    // GetVolumeDefinitionPropsInfos gets meta information about the
    // properties that can be set on a volume definition.
    GetVolumeDefinitionPropsInfos(ctx context.Context, resName string, opts ...*ListOpts) ([]PropsInfo, error)
    // GetVolumePropsInfos gets meta information about the properties that
    // can be set on a volume.
    GetVolumePropsInfos(ctx context.Context, resName, nodeName string, opts ...*ListOpts) ([]PropsInfo, error)
    // GetConnectionPropsInfos gets meta information about the properties
    // that can be set on a connection.
    GetConnectionPropsInfos(ctx context.Context, resName string, opts ...*ListOpts) ([]PropsInfo, error)
    // Activate starts an inactive resource on a given node.
    Activate(ctx context.Context, resName string, nodeName string) error
    // Deactivate stops an active resource on given node.
    Deactivate(ctx context.Context, resName string, nodeName string) error
    // MakeAvailable adds a resource on a node if not already deployed.
    // To use a specific storage pool add the StorPoolName property and use
    // the storage pool name as value. If the StorPoolName property is not
    // set, a storage pool will be chosen automatically using the
    // auto-placer.
    // To create a diskless resource you have to set the "DISKLESS" flag in
    // the flags list.
    MakeAvailable(ctx context.Context, resName, nodeName string, makeAvailable ResourceMakeAvailable) error
}

type ResourceService

ResourceService is a struct which contains the pointer of the client

type ResourceService struct {
    // contains filtered or unexported fields
}

func (*ResourceService) Activate

func (n *ResourceService) Activate(ctx context.Context, resName, nodeName string) error

func (*ResourceService) Autoplace

func (n *ResourceService) Autoplace(ctx context.Context, resName string, apr AutoPlaceRequest) error

Autoplace places a resource on your nodes autmatically

func (*ResourceService) Create

func (n *ResourceService) Create(ctx context.Context, res ResourceCreate) error

Create is used to create a resource on a node

func (*ResourceService) CreateSnapshot

func (n *ResourceService) CreateSnapshot(ctx context.Context, snapshot Snapshot) error

CreateSnapshot creates a snapshot of a resource

func (*ResourceService) Deactivate

func (n *ResourceService) Deactivate(ctx context.Context, resName, nodeName string) error

func (*ResourceService) Delete

func (n *ResourceService) Delete(ctx context.Context, resName, nodeName string) error

Delete deletes a resource on a specific node

func (*ResourceService) DeleteSnapshot

func (n *ResourceService) DeleteSnapshot(ctx context.Context, resName, snapName string, nodes ...string) error

DeleteSnapshot deletes a snapshot by its name. Specify nodes to only delete snapshots on specific nodes.

func (*ResourceService) DisableDRBDProxy

func (n *ResourceService) DisableDRBDProxy(ctx context.Context, resName, nodeAName, nodeBName string) error

DisableDRBDProxy is used to disable drbd-proxy with the rest-api call from the function enableDisableDRBDProxy

func (*ResourceService) Diskful

func (n *ResourceService) Diskful(ctx context.Context, resName, nodeName, storagePoolName string, props *ToggleDiskDiskfulProps) error

Diskful toggles a resource to diskful - the parameter storagepool can be set if its needed

func (*ResourceService) Diskless

func (n *ResourceService) Diskless(ctx context.Context, resName, nodeName, disklessPoolName string) error

Diskless toggles a resource on a node to diskless - the parameter disklesspool can be set if its needed

func (*ResourceService) EnableDRBDProxy

func (n *ResourceService) EnableDRBDProxy(ctx context.Context, resName, nodeAName, nodeBName string) error

EnableDRBDProxy is used to enable drbd-proxy with the rest-api call from the function enableDisableDRBDProxy

func (*ResourceService) EnableSnapshotShipping

func (n *ResourceService) EnableSnapshotShipping(ctx context.Context, resName string, ship SnapshotShipping) error

EnableSnapshotShipping enables snapshot shipping for a resource

func (*ResourceService) Get

func (n *ResourceService) Get(ctx context.Context, resName, nodeName string, opts ...*ListOpts) (Resource, error)

Get returns information about a resource on a specific node

func (*ResourceService) GetAll

func (n *ResourceService) GetAll(ctx context.Context, resName string, opts ...*ListOpts) ([]Resource, error)

GetAll returns all resources for a resource-definition

func (*ResourceService) GetConnectionPropsInfos

func (n *ResourceService) GetConnectionPropsInfos(ctx context.Context, resName string, opts ...*ListOpts) ([]PropsInfo, error)

GetConnectionPropsInfos gets meta information about the properties that can be set on a connection.

func (*ResourceService) GetConnections

func (n *ResourceService) GetConnections(ctx context.Context, resName, nodeAName, nodeBName string, opts ...*ListOpts) ([]ResourceConnection, error)

GetConnections lists all resource connections if no node-names are given- if two node-names are given it shows the connection between them

func (*ResourceService) GetPropsInfos

func (n *ResourceService) GetPropsInfos(ctx context.Context, resName string, opts ...*ListOpts) ([]PropsInfo, error)

GetPropsInfos gets meta information about the properties that can be set on a resource.

func (*ResourceService) GetResourceView

func (n *ResourceService) GetResourceView(ctx context.Context, opts ...*ListOpts) ([]ResourceWithVolumes, error)

GetResourceView returns all resources in the cluster. Filters can be set via ListOpts.

func (*ResourceService) GetSnapshot

func (n *ResourceService) GetSnapshot(ctx context.Context, resName, snapName string, opts ...*ListOpts) (Snapshot, error)

GetSnapshot returns information about a specific Snapshot by its name

func (*ResourceService) GetSnapshotShippings

func (n *ResourceService) GetSnapshotShippings(ctx context.Context, opts ...*ListOpts) ([]SnapshotShippingStatus, error)

GetSnapshotShippings gets a view of all snapshot shippings

func (*ResourceService) GetSnapshotView

func (r *ResourceService) GetSnapshotView(ctx context.Context, opts ...*ListOpts) ([]Snapshot, error)

GetSnapshotView gets information about all snapshots

func (*ResourceService) GetSnapshots

func (n *ResourceService) GetSnapshots(ctx context.Context, resName string, opts ...*ListOpts) ([]Snapshot, error)

GetSnapshots lists all snapshots of a resource

func (*ResourceService) GetVolume

func (n *ResourceService) GetVolume(ctx context.Context, resName, nodeName string, volNr int, opts ...*ListOpts) (Volume, error)

GetVolume returns information about a specific volume defined by it resource,node and volume-number

func (*ResourceService) GetVolumeDefinitionPropsInfos

func (n *ResourceService) GetVolumeDefinitionPropsInfos(ctx context.Context, resName string, opts ...*ListOpts) ([]PropsInfo, error)

GetVolumeDefinitionPropsInfos gets meta information about the properties that can be set on a volume definition.

func (*ResourceService) GetVolumePropsInfos

func (n *ResourceService) GetVolumePropsInfos(ctx context.Context, resName, nodeName string, opts ...*ListOpts) ([]PropsInfo, error)

GetVolumePropsInfos gets meta information about the properties that can be set on a volume.

func (*ResourceService) GetVolumes

func (n *ResourceService) GetVolumes(ctx context.Context, resName, nodeName string, opts ...*ListOpts) ([]Volume, error)

GetVolumes lists als volumes of a resource

func (*ResourceService) MakeAvailable

func (n *ResourceService) MakeAvailable(ctx context.Context, resName, nodeName string, makeAvailable ResourceMakeAvailable) error

MakeAvailable adds a resource on a node if not already deployed. To use a specific storage pool add the StorPoolName property and use the storage pool name as value. If the StorPoolName property is not set, a storage pool will be chosen automatically using the auto-placer. To create a diskless resource you have to set the "DISKLESS" flag in the flags list.

func (*ResourceService) Migrate

func (n *ResourceService) Migrate(ctx context.Context, resName, fromNodeName, toNodeName, storagePoolName string) error

Migrate mirgates a resource from one node to another node

func (*ResourceService) Modify

func (n *ResourceService) Modify(ctx context.Context, resName, nodeName string, props GenericPropsModify) error

Modify gives the ability to modify a resource on a node

func (*ResourceService) ModifyConnection

func (n *ResourceService) ModifyConnection(ctx context.Context, resName, nodeAName, nodeBName string, props GenericPropsModify) error

ModifyConnection allows to modify the connection between two nodes

func (*ResourceService) ModifyDRBDProxy

func (n *ResourceService) ModifyDRBDProxy(ctx context.Context, resName string, props DrbdProxyModify) error

ModifyDRBDProxy is used to modify drbd-proxy properties

func (*ResourceService) ModifyVolume

func (n *ResourceService) ModifyVolume(ctx context.Context, resName, nodeName string, volNr int, props GenericPropsModify) error

ModifyVolume modifies an existing volume with the given props

func (*ResourceService) QueryMaxVolumeSize

func (n *ResourceService) QueryMaxVolumeSize(ctx context.Context, filter AutoSelectFilter) (MaxVolumeSizes, error)

QueryMaxVolumeSize finds the maximum size of a volume for a given filter

func (*ResourceService) RestoreSnapshot

func (n *ResourceService) RestoreSnapshot(ctx context.Context, origResName, snapName string, snapRestoreConf SnapshotRestore) error

RestoreSnapshot restores a snapshot on a resource

func (*ResourceService) RestoreVolumeDefinitionSnapshot

func (n *ResourceService) RestoreVolumeDefinitionSnapshot(ctx context.Context, origResName, snapName string, snapRestoreConf SnapshotRestore) error

RestoreVolumeDefinitionSnapshot restores a volume-definition-snapshot on a resource

func (*ResourceService) RollbackSnapshot

func (n *ResourceService) RollbackSnapshot(ctx context.Context, resName, snapName string) error

RollbackSnapshot rolls back a snapshot from a specific resource

type ResourceState

ResourceState is a struct for getting the status of a resource

type ResourceState struct {
    InUse *bool `json:"in_use,omitempty"`
}

type ResourceWithVolumes

type ResourceWithVolumes struct {
    Resource
    // milliseconds since unix epoch in UTC
    CreateTimestamp *TimeStampMs `json:"create_timestamp,omitempty"`
    Volumes         []Volume     `json:"volumes,omitempty"`
    // shared space name of the data storage pool of the first volume of
    // the resource or empty if data storage pool is not shared
    SharedName string `json:"shared_name,omitempty"`
}

type S3Remote

type S3Remote struct {
    RemoteName   string `json:"remote_name,omitempty"`
    Endpoint     string `json:"endpoint,omitempty"`
    Bucket       string `json:"bucket,omitempty"`
    Region       string `json:"region,omitempty"`
    AccessKey    string `json:"access_key,omitempty"`
    SecretKey    string `json:"secret_key,omitempty"`
    UsePathStyle bool   `json:"use_path_style,omitempty"`
}

type SatelliteConfig

SatelliteConfig struct for SatelliteConfig

type SatelliteConfig struct {
    Config               ControllerConfigConfig `json:"config,omitempty"`
    Debug                ControllerConfigDebug  `json:"debug,omitempty"`
    Log                  SatelliteConfigLog     `json:"log,omitempty"`
    StltOverrideNodeName string                 `json:"stlt_override_node_name,omitempty"`
    RemoteSpdk           bool                   `json:"remote_spdk,omitempty"`
    Ebs                  bool                   `json:"ebs,omitempty"`
    SpecialSatellite     bool                   `json:"special_satellite,omitempty"`
    DrbdKeepResPattern   string                 `json:"drbd_keep_res_pattern,omitempty"`
    Net                  SatelliteConfigNet     `json:"net,omitempty"`
}

type SatelliteConfigLog

SatelliteConfigLog struct for SatelliteConfigLog

type SatelliteConfigLog struct {
    PrintStackTrace bool     `json:"print_stack_trace,omitempty"`
    Directory       string   `json:"directory,omitempty"`
    Level           LogLevel `json:"level,omitempty"`
    LevelLinstor    LogLevel `json:"level_linstor,omitempty"`
}

type SatelliteConfigNet

SatelliteConfigNet struct for SatelliteConfigNet

type SatelliteConfigNet struct {
    BindAddress string `json:"bind_address,omitempty"`
    Port        int32  `json:"port,omitempty"`
    ComType     string `json:"com_type,omitempty"`
}

type Snapshot

Snapshot is a struct for information about a snapshot

type Snapshot struct {
    Name         string   `json:"name,omitempty"`
    ResourceName string   `json:"resource_name,omitempty"`
    Nodes        []string `json:"nodes,omitempty"`
    // A string to string property map.
    Props             map[string]string          `json:"props,omitempty"`
    Flags             []string                   `json:"flags,omitempty"`
    VolumeDefinitions []SnapshotVolumeDefinition `json:"volume_definitions,omitempty"`
    // unique object id
    Uuid      string         `json:"uuid,omitempty"`
    Snapshots []SnapshotNode `json:"snapshots,omitempty"`
}

type SnapshotNode

SnapshotNode Actual snapshot data from a node

type SnapshotNode struct {
    // Snapshot name this snapshots belongs to
    SnapshotName string `json:"snapshot_name,omitempty"`
    // Node name where this snapshot was taken
    NodeName string `json:"node_name,omitempty"`
    // milliseconds since unix epoch in UTC
    CreateTimestamp *TimeStampMs `json:"create_timestamp,omitempty"`
    Flags           []string     `json:"flags,omitempty"`
    // unique object id
    Uuid string `json:"uuid,omitempty"`
    // SnapshotVolumes holds per-volume information about snapshots on this node.
    SnapshotVolumes []SnapshotVolumeNode `json:"snapshot_volumes,omitempty"`
}

type SnapshotRestore

SnapshotRestore is a struct used to hold the information about where a Snapshot has to be restored

type SnapshotRestore struct {
    // Resource where to restore the snapshot
    ToResource string `json:"to_resource"`
    // List of nodes where to place the restored snapshot
    Nodes []string `json:"nodes,omitempty"`
}

type SnapshotShipping

SnapshotShipping struct for SnapshotShipping

type SnapshotShipping struct {
    // Node where to ship the snapshot from
    FromNode string `json:"from_node"`
    // NetInterface of the source node
    FromNic string `json:"from_nic,omitempty"`
    // Node where to ship the snapshot
    ToNode string `json:"to_node"`
    // NetInterface of the destination node
    ToNic string `json:"to_nic,omitempty"`
}

type SnapshotShippingStatus

SnapshotShippingStatus struct for SnapshotShippingStatus

type SnapshotShippingStatus struct {
    Snapshot     Snapshot                              `json:"snapshot,omitempty"`
    FromNodeName string                                `json:"from_node_name,omitempty"`
    ToNodeName   string                                `json:"to_node_name,omitempty"`
    Status       snapshotshipstatus.SnapshotShipStatus `json:"status,omitempty"`
}

type SnapshotVolumeDefinition

SnapshotVolumeDefinition is a struct to store the properties of a volume from a snapshot

type SnapshotVolumeDefinition struct {
    VolumeNumber int32 `json:"volume_number,omitempty"`
    // Volume size in KiB
    SizeKib uint64 `json:"size_kib,omitempty"`
}

type SnapshotVolumeNode

type SnapshotVolumeNode struct {
    // unique object id
    Uuid string `json:"uuid,omitempty"`
    // Volume number of the snapshot
    VlmNr int32 `json:"vlm_nr,omitempty"`
    // A string to string property map.
    Props map[string]string `json:"props,omitempty"`
    // Optional state for the given snapshot
    State string `json:"state,omitempty"`
}

type StoragePool

StoragePool represents a nodes storage pool as defined in LINSTOR.

type StoragePool struct {
    StoragePoolName string       `json:"storage_pool_name"`
    NodeName        string       `json:"node_name,omitempty"`
    ProviderKind    ProviderKind `json:"provider_kind"`
    // A string to string property map.
    Props map[string]string `json:"props,omitempty"`
    // read only map of static storage pool traits
    StaticTraits map[string]string `json:"static_traits,omitempty"`
    // Kibi - read only
    FreeCapacity int64 `json:"free_capacity,omitempty"`
    // Kibi - read only
    TotalCapacity int64 `json:"total_capacity,omitempty"`
    // read only
    FreeSpaceMgrName string `json:"free_space_mgr_name,omitempty"`
    // unique object id
    Uuid string `json:"uuid,omitempty"`
    // Currently known report messages for this storage pool
    Reports []ApiCallRc `json:"reports,omitempty"`
    // true if the storage pool supports snapshots. false otherwise
    SupportsSnapshots bool `json:"supports_snapshots,omitempty"`
    // name of the shared space or null if none given
    SharedSpace string `json:"shared_space,omitempty"`
    // true if a shared storage pool uses linstor-external locking, like cLVM
    ExternalLocking bool `json:"external_locking,omitempty"`
}

type StoragePoolDefinition

StoragePoolDefinition represents a storage pool definition in LINSTOR

type StoragePoolDefinition struct {
    StoragePoolName string `json:"storage_pool_name,omitempty"`
    // A string to string property map.
    Props map[string]string `json:"props,omitempty"`
}

type StoragePoolDefinitionModify

StoragePoolDefinitionModify holds properties of a storage pool definition to modify such a definition.

type StoragePoolDefinitionModify struct {
    GenericPropsModify
}

type StoragePoolDefinitionProvider

StoragePoolDefinitionProvider acts as an abstraction for a StoragePoolDefinitionService. It can be swapped out for another StoragePoolDefinitionService implementation, for example for testing.

type StoragePoolDefinitionProvider interface {
    // GetAll gets information for all existing storage pool definitions.
    GetAll(ctx context.Context, opts ...*ListOpts) ([]StoragePoolDefinition, error)
    // Get gets information for a particular storage pool definition.
    Get(ctx context.Context, spdName string, opts ...*ListOpts) (StoragePoolDefinition, error)
    // Create creates a new storage pool definition
    Create(ctx context.Context, spd StoragePoolDefinition) error
    // Modify modifies the given storage pool definition and sets/deletes the given properties.
    Modify(ctx context.Context, spdName string, props StoragePoolDefinitionModify) error
    // Delete deletes the given storage pool definition.
    Delete(ctx context.Context, spdName string) error
    // GetPropsInfos gets meta information about the properties that can be
    // set on a storage pool definition.
    GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)
}

type StoragePoolDefinitionService

StoragePoolDefinitionService is the service that deals with storage pool definition related tasks.

type StoragePoolDefinitionService struct {
    // contains filtered or unexported fields
}

func (*StoragePoolDefinitionService) Create

func (s *StoragePoolDefinitionService) Create(ctx context.Context, spd StoragePoolDefinition) error

Create creates a new storage pool definition

func (*StoragePoolDefinitionService) Delete

func (s *StoragePoolDefinitionService) Delete(ctx context.Context, spdName string) error

Delete deletes the given storage pool definition.

func (*StoragePoolDefinitionService) Get

func (s *StoragePoolDefinitionService) Get(ctx context.Context, spdName string, opts ...*ListOpts) (StoragePoolDefinition, error)

Get gets information for a particular storage pool definition.

func (*StoragePoolDefinitionService) GetAll

func (s *StoragePoolDefinitionService) GetAll(ctx context.Context, opts ...*ListOpts) ([]StoragePoolDefinition, error)

GetAll gets information for all existing storage pool definitions.

func (*StoragePoolDefinitionService) GetPropsInfos

func (s *StoragePoolDefinitionService) GetPropsInfos(ctx context.Context, opts ...*ListOpts) ([]PropsInfo, error)

GetPropsInfos gets meta information about the properties that can be set on a storage pool definition.

func (*StoragePoolDefinitionService) Modify

func (s *StoragePoolDefinitionService) Modify(ctx context.Context, spdName string, props StoragePoolDefinitionModify) error

Modify modifies the given storage pool definition and sets/deletes the given properties.

type StorageResource

StorageResource is a struct which contains the storage-volumes for a storage-resource

type StorageResource struct {
    StorageVolumes []StorageVolume `json:"storage_volumes,omitempty"`
}

type StorageVolume

StorageVolume is a struct to store standard poperties of a Volume

type StorageVolume struct {
    VolumeNumber int32 `json:"volume_number,omitempty"`
    // block device path
    DevicePath       string `json:"device_path,omitempty"`
    AllocatedSizeKib int64  `json:"allocated_size_kib,omitempty"`
    UsableSizeKib    int64  `json:"usable_size_kib,omitempty"`
    // String describing current volume state
    DiskState string `json:"disk_state,omitempty"`
}

type TimeStampMs

type TimeStampMs struct {
    time.Time
}

func (TimeStampMs) EncodeValues

func (t TimeStampMs) EncodeValues(key string, v *url.Values) error

func (TimeStampMs) MarshalJSON

func (t TimeStampMs) MarshalJSON() ([]byte, error)

func (*TimeStampMs) UnmarshalJSON

func (t *TimeStampMs) UnmarshalJSON(s []byte) (err error)

type ToggleDiskDiskfulProps

type ToggleDiskDiskfulProps struct {
    LayerList []devicelayerkind.DeviceLayerKind `json:"layer_list,omitempty"`
}

type VendorProvider

type VendorProvider interface {
    // GetExosDefaults lists default settings for all EXOS enclosures
    GetExosDefaults(ctx context.Context) (ExosDefaults, error)
    // ModifyExosDefaults sets or modifies default username / password for EXOS enclosures
    ModifyExosDefaults(ctx context.Context, defaults ExosDefaultsModify) error
    // GetExosEnclosures lists EXOS enclosures including controller IP and health status
    GetExosEnclosures(ctx context.Context, noCache bool) ([]ExosEnclosure, error)
    // CreateExosEnclosure creates a new enclosure unless it already exists
    CreateExosEnclosure(ctx context.Context, enclosure ExosEnclosure) error
    // ModifyExosEnclosure modifies an existing enclosure
    ModifyExosEnclosure(ctx context.Context, name string, enclosure ExosEnclosure) error
    // DeleteExosEnclosure deletes an existing enclosure
    DeleteExosEnclosure(ctx context.Context, name string) error
    // GetExosEvents lists the most current "count" events
    GetExosEvents(ctx context.Context, name string, count int32) ([]ExosEnclosureEvent, error)
    // GetExosConnectionMap lists the connection-mesh of EXOS Ports to LINSTOR Nodes
    GetExosConnectionMap(ctx context.Context) (ExosConnectionMap, error)
}

type VendorService

type VendorService struct {
    // contains filtered or unexported fields
}

func (*VendorService) CreateExosEnclosure

func (s *VendorService) CreateExosEnclosure(ctx context.Context, enclosure ExosEnclosure) error

CreateExosEnclosure creates a new enclosure unless it already exists

func (*VendorService) DeleteExosEnclosure

func (s *VendorService) DeleteExosEnclosure(ctx context.Context, name string) error

DeleteExosEnclosure deletes an existing enclosure

func (*VendorService) GetExosConnectionMap

func (s *VendorService) GetExosConnectionMap(ctx context.Context) (ExosConnectionMap, error)

GetExosConnectionMap lists the connection-mesh of EXOS Ports to LINSTOR Nodes

func (*VendorService) GetExosDefaults

func (s *VendorService) GetExosDefaults(ctx context.Context) (ExosDefaults, error)

GetExosDefaults lists default settings for all EXOS enclosures

func (*VendorService) GetExosEnclosures

func (s *VendorService) GetExosEnclosures(ctx context.Context, noCache bool) ([]ExosEnclosure, error)

GetExosEnclosures lists EXOS enclosures including controller IP and health status

func (*VendorService) GetExosEvents

func (s *VendorService) GetExosEvents(ctx context.Context, name string, count int32) ([]ExosEnclosureEvent, error)

GetExosEvents lists the most current "count" events

func (*VendorService) ModifyExosDefaults

func (s *VendorService) ModifyExosDefaults(ctx context.Context, defaults ExosDefaultsModify) error

ModifyExosDefaults sets or modifies default username / password for EXOS enclosures

func (*VendorService) ModifyExosEnclosure

func (s *VendorService) ModifyExosEnclosure(ctx context.Context, name string, enclosure ExosEnclosure) error

ModifyExosEnclosure modifies an existing enclosure

type Volume

Volume is a struct which holds the information about a linstor-volume

type Volume struct {
    VolumeNumber     int32        `json:"volume_number,omitempty"`
    StoragePoolName  string       `json:"storage_pool_name,omitempty"`
    ProviderKind     ProviderKind `json:"provider_kind,omitempty"`
    DevicePath       string       `json:"device_path,omitempty"`
    AllocatedSizeKib int64        `json:"allocated_size_kib,omitempty"`
    UsableSizeKib    int64        `json:"usable_size_kib,omitempty"`
    // A string to string property map.
    Props         map[string]string `json:"props,omitempty"`
    Flags         []string          `json:"flags,omitempty"`
    State         VolumeState       `json:"state,omitempty"`
    LayerDataList []VolumeLayer     `json:"layer_data_list,omitempty"`
    // unique object id
    Uuid    string      `json:"uuid,omitempty"`
    Reports []ApiCallRc `json:"reports,omitempty"`
}

type VolumeDefinition

VolumeDefinition is a struct which is used to store volume-definition properties

type VolumeDefinition struct {
    VolumeNumber *int32 `json:"volume_number,omitempty"`
    // Size of the volume in Kibi.
    SizeKib uint64 `json:"size_kib"`
    // A string to string property map.
    Props     map[string]string       `json:"props,omitempty"`
    Flags     []string                `json:"flags,omitempty"`
    LayerData []VolumeDefinitionLayer `json:"layer_data,omitempty"`
    // unique object id
    Uuid string `json:"uuid,omitempty"`
}

type VolumeDefinitionCreate

VolumeDefinitionCreate is a struct used for creating volume-definitions

type VolumeDefinitionCreate struct {
    VolumeDefinition VolumeDefinition `json:"volume_definition"`
    DrbdMinorNumber  int32            `json:"drbd_minor_number,omitempty"`
}

type VolumeDefinitionLayer

VolumeDefinitionLayer is a struct for the layer-type of a volume-definition

type VolumeDefinitionLayer struct {
    Type devicelayerkind.DeviceLayerKind `json:"type"`
    Data OneOfDrbdVolumeDefinition       `json:"data,omitempty"`
}

func (*VolumeDefinitionLayer) UnmarshalJSON

func (vd *VolumeDefinitionLayer) UnmarshalJSON(b []byte) error

UnmarshalJSON is needed for the unmarshal interface for VolumeDefinitionLayer types

type VolumeDefinitionModify

type VolumeDefinitionModify struct {
    SizeKib uint64 `json:"size_kib,omitempty"`
    GenericPropsModify
    // To add a flag just specify the flag name, to remove a flag prepend it with a '-'.  Flags:   * GROSS_SIZE
    Flags []string `json:"flags,omitempty"`
}

type VolumeGroup

type VolumeGroup struct {
    VolumeNumber int32 `json:"volume_number,omitempty"`
    // A string to string property map.
    Props map[string]string `json:"props,omitempty"`
    // unique object id
    Uuid  string   `json:"uuid,omitempty"`
    Flags []string `json:"flags,omitempty"`
}

type VolumeGroupModify

type VolumeGroupModify struct {
    // A string to string property map.
    OverrideProps map[string]string `json:"override_props,omitempty"`
    // To add a flag just specify the flag name, to remove a flag prepend it with a '-'.  Flags:   * GROSS_SIZE
    Flags            []string `json:"flags,omitempty"`
    DeleteProps      []string `json:"delete_props,omitempty"`
    DeleteNamespaces []string `json:"delete_namespaces,omitempty"`
}

type VolumeLayer

VolumeLayer is a struct for storing the layer-properties of a linstor-volume

type VolumeLayer struct {
    Type devicelayerkind.DeviceLayerKind                                                         `json:"type,omitempty"`
    Data OneOfDrbdVolumeLuksVolumeStorageVolumeNvmeVolumeWritecacheVolumeCacheVolumeBCacheVolume `json:"data,omitempty"`
}

func (*VolumeLayer) UnmarshalJSON

func (v *VolumeLayer) UnmarshalJSON(b []byte) error

UnmarshalJSON fulfills the unmarshal interface for the VolumeLayer type

type VolumeState

VolumeState is a struct which contains the disk-state for volume

type VolumeState struct {
    DiskState string `json:"disk_state,omitempty"`
}

type WritecacheResource

type WritecacheResource struct {
    WritecacheVolumes []WritecacheVolume `json:"writecache_volumes,omitempty"`
}

type WritecacheVolume

type WritecacheVolume struct {
    VolumeNumber int32 `json:"volume_number,omitempty"`
    // block device path
    DevicePath string `json:"device_path,omitempty"`
    // block device path used as cache device
    DevicePathCache  string `json:"device_path_cache,omitempty"`
    AllocatedSizeKib int64  `json:"allocated_size_kib,omitempty"`
    UsableSizeKib    int64  `json:"usable_size_kib,omitempty"`
    // String describing current volume state
    DiskState string `json:"disk_state,omitempty"`
}