resdiskdrbd

package
v3.0.0-beta14 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MaxNodes = 32
)

Functions

func New

func New() resource.Driver

Types

type DRBDDriver

type DRBDDriver interface {
	Adjust(context.Context) error
	Attach(context.Context) error
	ConfigurePeerMultiPrimary(ctx context.Context, peer string, enabled bool) error
	Connect(context.Context, string) error
	ConnStates(context.Context) (drbd.CStateM, error)
	ConnState(context.Context, string) (string, error)
	CreateMD(context.Context, int) error
	DetachForce(context.Context) error
	Disconnect(context.Context) error
	DiskStates(context.Context) ([]string, error)
	Down(context.Context) error
	HasMD(context.Context) (bool, error)
	IsDefined(context.Context) (bool, error)
	Primary(context.Context) error
	PrimaryForce(context.Context) error
	Role(context.Context) (string, error)
	Secondary(context.Context) error
	Up(context.Context) error
	WipeMD(context.Context) error
	WaitCState(ctx context.Context, nodeID string, timeout time.Duration, candidates ...string) (string, error)
	WaitConnectingOrConnected(ctx context.Context, nodeID string) (string, error)
	StartConnections(context.Context, ...string) error
	Show(ctx context.Context) (drbd.DrbdShow, error)
}

type NodeTemplateData

type NodeTemplateData struct {
	Name   string
	Addr   string
	Device string
	Disk   string
	NodeId int
}

NodeTemplateData represents a structure to hold template data for individual nodes, including their name, address, device, and disk information. It is exported (public) to help template designers to use it.

type ResTemplateData

type ResTemplateData struct {
	Name  string
	Nodes []NodeTemplateData
}

ResTemplateData represents template data for a resource configuration, it is exported (public) to help template designers to use it.

It defines the available fields that template designers can use. Example usage in a template:

 resource {{.Name}} {
    {{range $node := .Nodes}}
    on {{$node.Name}} {
        device    {{$node.Device}};
        disk      {{$node.Disk}};
        meta-disk internal;
        address   {{$node.Addr}};
        node-id   {{$node.NodeId}};
    }
    {{end}}
    connection-mesh {
        hosts{{range $node := .Nodes}} {{$node.Name}}{{end}};
    }
    net {
        rr-conflict retry-connect;
    }
}

type T

type T struct {
	resdisk.T
	Path     naming.Path `json:"path"`
	Nodes    []string    `json:"nodes"`
	Res      string      `json:"res"`
	Disk     string      `json:"disk"`
	MaxPeers int         `json:"max_peers"`
	Addr     string      `json:"addr"`
	Port     int         `json:"port"`
	Network  string      `json:"network"`
	Template string      `json:"template"`
}

func (*T) ClaimedDevices

func (t *T) ClaimedDevices(ctx context.Context) device.L

func (*T) Connect

func (t *T) Connect(ctx context.Context, nodeID string) error

func (*T) CreateMD

func (t *T) CreateMD(ctx context.Context) error

func (*T) Down

func (t *T) Down(ctx context.Context) error

func (*T) DownForce

func (t *T) DownForce(ctx context.Context) error

DownForce is called by the unprovisioner. Dataloss is not an issue there, so forced detach can be tried.

func (*T) ExposedDevices

func (t *T) ExposedDevices(ctx context.Context) device.L

func (*T) GoSecondary

func (t *T) GoSecondary(ctx context.Context) error

func (*T) Info

func (t *T) Info(_ context.Context) (resource.InfoKeys, error)

func (*T) Label

func (t *T) Label(_ context.Context) string

Label implements Label from resource.Driver interface, it returns a formatted short description of the Resource

func (*T) Manifest

func (t *T) Manifest() *manifest.T

Manifest exposes to the core the input expected by the driver.

func (*T) Name

func (t *T) Name() string

func (*T) PostMove

func (t *T) PostMove(ctx context.Context, peer string) error

PostMove moves the local res to secondary and disables the multiple primaries on the peer connection name.

func (*T) PreMove

func (t *T) PreMove(ctx context.Context, peer string) error

PreMove prepares the peer connection and promotes it to primary for multi-primary mode during resource operations.

func (*T) PreMoveRollback

func (t *T) PreMoveRollback(ctx context.Context, peer string) error

PreMoveRollback ensures a rollback of a pre-move operation, promoting peer as secondary and disabling multi-primary mode to the peer connection.

func (*T) ProvisionAsFollower

func (t *T) ProvisionAsFollower(ctx context.Context) error

func (*T) ProvisionAsLeader

func (t *T) ProvisionAsLeader(ctx context.Context) error

func (*T) ProvisionStart

func (t *T) ProvisionStart(_ context.Context) error

ProvisionStart is a noop to avoid calling the normal Start after provision

func (*T) Provisioned

func (t *T) Provisioned(ctx context.Context) (provisioned.T, error)

func (*T) ReservableDevices

func (t *T) ReservableDevices(ctx context.Context) device.L

func (*T) Shutdown

func (t *T) Shutdown(ctx context.Context) error

func (*T) Start

func (t *T) Start(ctx context.Context) error

func (*T) StartStandby

func (t *T) StartStandby(ctx context.Context) error

func (*T) Status

func (t *T) Status(ctx context.Context) status.T

func (*T) StatusInfo

func (t *T) StatusInfo(context.Context) map[string]any

func (*T) Stop

func (t *T) Stop(ctx context.Context) error

func (*T) StopStandby

func (t *T) StopStandby(ctx context.Context) error

func (*T) SubDevices

func (t *T) SubDevices(ctx context.Context) device.L

func (*T) UnprovisionAsFollower

func (t *T) UnprovisionAsFollower(ctx context.Context) error

func (*T) UnprovisionAsLeader

func (t *T) UnprovisionAsLeader(ctx context.Context) error

func (*T) UnprovisionStop

func (t *T) UnprovisionStop(_ context.Context) error

UnprovisionStop is a noop to avoid calling the normal Stop before unprovision

func (*T) Up

func (t *T) Up(ctx context.Context) error

Up function brings up the DRBD device and waits until its state is stable and not in a diskless configuration.

func (*T) WipeMD

func (t *T) WipeMD(ctx context.Context) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL