Documentation
¶
Index ¶
- Variables
- func New() resource.Driver
- type DRBDDriver
- type DRBDDriverResizer
- type NodeTemplateData
- type ResTemplateData
- type T
- func (t *T) ClaimedDevices(ctx context.Context) device.L
- func (t *T) Connect(ctx context.Context, nodeID string) error
- func (t *T) CreateMD(ctx context.Context) error
- func (t *T) CurrentSize(ctx context.Context) (int64, error)
- func (t *T) Down(ctx context.Context) error
- func (t *T) DownForce(ctx context.Context) error
- func (t *T) DriverID() driver.ID
- func (t *T) ExposedDevices(ctx context.Context) device.L
- func (t *T) GoSecondary(ctx context.Context) error
- func (t *T) Info(_ context.Context) (resource.InfoKeys, error)
- func (t *T) Label(_ context.Context) string
- func (t *T) Manifest() *manifest.T
- func (t *T) Name() string
- func (t *T) PostMove(ctx context.Context, peer string) error
- func (t *T) PreMove(ctx context.Context, peer string) error
- func (t *T) PreMoveRollback(ctx context.Context, peer string) error
- func (t *T) ProvisionAsFollower(ctx context.Context) error
- func (t *T) ProvisionAsLeader(ctx context.Context) error
- func (t *T) ProvisionStart(_ context.Context) error
- func (t *T) Provisioned(ctx context.Context) (provisioned.T, error)
- func (t *T) ReservableDevices(ctx context.Context) device.L
- func (t *T) Resize(ctx context.Context, _ int64) error
- func (t *T) ResizeIsReplicated() bool
- func (t *T) ResizePlan(ctx context.Context, to int64) (int64, error)
- func (t *T) ResizeSpansBelow() bool
- func (t *T) Shutdown(ctx context.Context) error
- func (t *T) Start(ctx context.Context) error
- func (t *T) StartStandby(ctx context.Context) error
- func (t *T) Status(ctx context.Context) status.T
- func (t *T) StatusDependsOnPeers() bool
- func (t *T) StatusInfo(context.Context) map[string]any
- func (t *T) Stop(ctx context.Context) error
- func (t *T) StopStandby(ctx context.Context) error
- func (t *T) SubDevices(ctx context.Context) device.L
- func (t *T) UnprovisionAsFollower(ctx context.Context) error
- func (t *T) UnprovisionAsLeader(ctx context.Context) error
- func (t *T) UnprovisionStop(ctx context.Context, leader bool) error
- func (t *T) Up(ctx context.Context) error
- func (t *T) WipeMD(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
var (
MaxNodes = 32
)
Functions ¶
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
WaitIsDefined(ctx context.Context, timeout time.Duration, target bool) 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 DRBDDriverResizer ¶
type NodeTemplateData ¶
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) CurrentSize ¶
CurrentSize implements resource.Sizer.
It is the size of the replicated device, which is less than the device behind it: drbd keeps its metadata there.
func (*T) DownForce ¶
DownForce is called by the unprovisioner. Dataloss is not an issue there, so forced detach can be tried.
func (*T) Label ¶
Label implements Label from resource.Driver interface, it returns a formatted short description of the Resource
func (*T) PostMove ¶
PostMove moves the local res to secondary and disables the multiple primaries on the peer connection name.
func (*T) PreMove ¶
PreMove prepares the peer connection and promotes it to primary for multi-primary mode during resource operations.
func (*T) PreMoveRollback ¶
PreMoveRollback ensures a rollback of a pre-move operation, promoting peer as secondary and disabling multi-primary mode to the peer connection.
func (*T) ProvisionStart ¶
ProvisionStart is a noop to avoid calling the normal Start after provision
func (*T) Provisioned ¶
func (*T) Resize ¶
Resize implements resource.Resizer.
The device behind drbd has to have been grown on every node first: a replica can only offer what the smallest of them holds.
func (*T) ResizeIsReplicated ¶
ResizeIsReplicated implements resource.ResizeIsReplicated.
A drbd resource offers what its smallest replica holds, so it can only be grown once every node has grown the device behind it.
func (*T) ResizePlan ¶
ResizePlan implements resource.Resizer.
What drbd asks of the device below is the size wanted plus room for its metadata: a dirty bitmap holding one bit per 4k of data for each peer it was given room for, and a superblock and an activity log on top of that.
It is computed from the size asked for rather than measured as the gap between the device below and the replicated device. That gap is not the metadata while a resize is in flight: every node grows the device below first, and only then is the replicated device grown to match, so measuring then reads the growth itself as metadata and asks for it a second time. Asking for a little too much costs nothing. Asking for too little leaves the filesystem above short of what it was promised.
func (*T) ResizeSpansBelow ¶
ResizeSpansBelow implements resource.ResizeSpansBelow.
A drbd resource takes up the device it was given, keeping a cut of it for its metadata: it is not told a size, it is told to look again.
func (*T) StatusDependsOnPeers ¶
StatusDependsOnPeers says the status of a drbd resource reads the disk states of its peers, which change when a peer instance takes its drbd resource down or up, as a shutdown and a start of the standby resources do.
func (*T) UnprovisionStop ¶
UnprovisionStop is a noop to avoid calling the normal Stop before unprovision