Documentation ¶
Index ¶
- func AttachConfig(ctx context.Context, cli *client.Client, cfg *PromoterConfig, path string) error
- func ConfigPath(id string) string
- func DeleteConfig(ctx context.Context, cli *client.Client, id string) error
- func DetachConfig(ctx context.Context, cli *client.Client, cfg *PromoterConfig, path string) error
- func EnsureConfig(ctx context.Context, cli *client.Client, cfg *PromoterConfig, id string) error
- type Config
- type PromoterConfig
- type PromoterMetadata
- type PromoterResourceConfig
- type ResourceAgent
- type StartEntry
- type SystemdService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AttachConfig ¶
AttachConfig ensures the promoter config is attached to all referenced resources.
func ConfigPath ¶
ConfigPath is the file system path of the promoter config with the given type and id once it is deployed.
func DeleteConfig ¶
DeleteConfig removes the promoter of the given id from LINSTOR.
In case the config did not exist, no error is returned.
func DetachConfig ¶
DetachConfig detaches the promoter config from all resources.
func EnsureConfig ¶
EnsureConfig ensures the given config is registered in LINSTOR and up-to-date.
Types ¶
type Config ¶
type Config struct {
Promoter []PromoterConfig `toml:"promoter,omitempty"`
}
Config is the root configuration for drbd-reactor.
Currently, only supports Promoter plugins.
type PromoterConfig ¶
type PromoterConfig struct { // Deprecated: ID is no longer required in drbd-reactor v1.2.0 and newer. ID string `toml:"id,omitempty"` Resources map[string]PromoterResourceConfig `toml:"resources,omitempty"` Metadata PromoterMetadata `toml:"metadata,omitempty"` }
PromoterConfig is the configuration for drbd-reactors "promoter" plugin.
func FindConfig ¶
func FindConfig(ctx context.Context, cli *client.Client, id string) (*PromoterConfig, string, error)
FindConfig fetches the promoter config with the given id. It returns the corresponding PromoterConfig as well as the path of the configuration file.
Returns nil and "" if no config exists.
func ListConfigs ¶
ListConfigs fetches all promoter configurations registered with LINSTOR. It returns a slice of PromoterConfigs as well as a slice of configuration file paths.
func (*PromoterConfig) DeployedResources ¶
func (p *PromoterConfig) DeployedResources(ctx context.Context, cli *client.Client) (*client.ResourceDefinition, *client.ResourceGroup, []client.VolumeDefinition, []client.ResourceWithVolumes, error)
DeployedResources fetches the current state of the resources referenced in the promoter config.
func (*PromoterConfig) FirstResource ¶ added in v1.4.0
func (p *PromoterConfig) FirstResource() (string, *PromoterResourceConfig)
type PromoterMetadata ¶ added in v1.4.0
type PromoterMetadata struct {
LinstorGatewaySchemaVersion int `toml:"linstor-gateway-schema-version"`
}
PromoterMetadata is a custom extension to the drbd-reactor config format. It stores fields specific to linstor-gateway.
type PromoterResourceConfig ¶
type PromoterResourceConfig struct { Start []StartEntry `toml:"start,omitempty"` Runner string `toml:"runner,omitempty"` OnDrbdDemoteFailure string `toml:"on-drbd-demote-failure,omitempty"` StopServicesOnExit bool `toml:"stop-services-on-exit,omitempty"` TargetAs string `toml:"target-as,omitempty"` }
PromoterResourceConfig is the configuration of a single promotable resource used by drbd-reactor's promoter.
func (*PromoterResourceConfig) UnmarshalTOML ¶
func (c *PromoterResourceConfig) UnmarshalTOML(data interface{}) error
type ResourceAgent ¶
ResourceAgent is an entry within a drbd-reactor config that describes an ocf resource agent. The structure of such an ocf resource definition is as follows:
ocf:$vendor:$agent $instance-id name=value ...
For details on how these, fields are decoded, see UnmarshalText.
func (ResourceAgent) MarshalText ¶
func (r ResourceAgent) MarshalText() (text []byte, err error)
func (*ResourceAgent) UnmarshalText ¶
func (r *ResourceAgent) UnmarshalText(text []byte) error
UnmarshalText parses a ResourceAgent from its string representation, as defined by the drbd-reactor configuration format. The structure of such an ocf resource definition is as follows:
ocf:$vendor:$agent $instance-id name=value ...
The first part, "ocf:$vendor:$agent" will be put into the "Type" field of the resulting ResourceAgent struct. $instance-id is the unique name of the resource agent instance, and will end up in the "Name" field of the ResourceAgent struct. After these fields follow an arbitrary number of optional key-value pairs. They will be parsed into the "Attributes" map of the ResourceAgent struct.
type StartEntry ¶
type StartEntry interface { encoding.TextMarshaler encoding.TextUnmarshaler }
type SystemdService ¶
type SystemdService struct {
Name string
}
SystemdService is an entry within a drbd-reactor config that describes a systemd service. It is very simple: the whole text is just the systemd service name.
func (*SystemdService) MarshalText ¶
func (s *SystemdService) MarshalText() (text []byte, err error)
func (*SystemdService) UnmarshalText ¶
func (s *SystemdService) UnmarshalText(text []byte) error