Documentation ¶
Index ¶
- Variables
- func Dump() ([]byte, error)
- func IsCapable() bool
- func ResConfigFile(res string) string
- func Version() (string, error)
- func WithLogger(log *plog.Logger) funcopt.O
- type Config
- type ConfigAddress
- type ConfigCommon
- type ConfigConnection
- type ConfigConnectionHost
- type ConfigDevice
- type ConfigHost
- type ConfigResource
- type ConfigVolume
- type Digest
- type T
- func (t T) Adjust() error
- func (t T) Attach() error
- func (t T) ConnState() (string, error)
- func (t T) Connect() error
- func (t *T) Create(disk string, addr string, port int) error
- func (t T) CreateMD(maxPeers int) error
- func (t T) DetachForce() error
- func (t T) Disconnect() error
- func (t T) DiskStates() ([]string, error)
- func (t T) Down() error
- func (t T) HasMD() (bool, error)
- func (t T) IsDefined() (bool, error)
- func (t T) IsUp() (bool, string, error)
- func (t T) ModProbe() error
- func (t T) Primary() error
- func (t T) PrimaryForce() error
- func (t T) Remove() error
- func (t T) Role() (string, error)
- func (t T) Secondary() error
- func (t T) Up() error
- func (t T) WipeMD() error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( KeyResource = "resource " KeyConnectionMesh = "connection-mesh " KeyHosts = "hosts " KeyOn = "on " KeyNodeID = "node-id " KeyDevice = "device " KeyDisk = "disk " KeyMetaDisk = "meta-disk " KeyAddress = "address " KeyVolume = "volume " KeyResourceLen = len(KeyResource) KeyConnectionMeshLen = len(KeyConnectionMesh) KeyHostsLen = len(KeyHosts) KeyOnLen = len(KeyOn) KeyNodeIDLen = len(KeyNodeID) KeyDeviceLen = len(KeyDevice) KeyDiskLen = len(KeyDisk) KeyMetaDiskLen = len(KeyMetaDisk) KeyAddressLen = len(KeyAddress) KeyVolumeLen = len(KeyVolume) RetryDelay = time.Second * 1 RetryTimeout = time.Second * 10 ExitCodeDeviceInUse = 11 MaxDRBD = 512 MinPort = 7289 MaxPort = 7489 )
Functions ¶
func ResConfigFile ¶
Types ¶
type Config ¶
type Config struct { XMLName xml.Name `xml:"config"` File string `xml:"config,attr"` Common ConfigCommon `xml:"common"` Resources []ConfigResource `xml:"resource"` }
func ParseConfig ¶
func (Config) GetResource ¶
func (t Config) GetResource(name string) (ConfigResource, bool)
type ConfigAddress ¶
type ConfigCommon ¶
type ConfigConnection ¶
type ConfigConnection struct { XMLName xml.Name `xml:"connection"` Hosts []ConfigConnectionHost `xml:"host"` }
type ConfigConnectionHost ¶
type ConfigConnectionHost struct { XMLName xml.Name `xml:"host"` Name string `xml:"name,attr"` Address ConfigAddress `xml:"address"` }
type ConfigDevice ¶
type ConfigHost ¶
type ConfigHost struct { Name string `xml:"name,attr"` Volumes []ConfigVolume `xml:"volume"` Address ConfigAddress `xml:"address"` }
func (ConfigHost) GetVolume ¶
func (t ConfigHost) GetVolume(name string) (ConfigVolume, bool)
type ConfigResource ¶
type ConfigResource struct { XMLName xml.Name `xml:"resource"` Name string `xml:"name,attr"` FileLine string `xml:"conf-file-line"` Hosts []ConfigHost `xml:"host"` Connection ConfigConnection `xml:"connection"` }
func (ConfigResource) GetHost ¶
func (t ConfigResource) GetHost(name string) (ConfigHost, bool)
type ConfigVolume ¶
type ConfigVolume struct { Name string `xml:"vnr,attr"` Device ConfigDevice `xml:"device"` Disk string `xml:"disk"` MetaDisk string `xml:"meta-disk"` }
type Digest ¶
func ParseDigest ¶
type T ¶
type T struct {
// contains filtered or unexported fields
}
func (T) DetachForce ¶
func (T) Disconnect ¶
func (T) DiskStates ¶
func (T) PrimaryForce ¶
func (T) WipeMD ¶
WipeMD executes the `wipe-md` drbd command.
Ignore the exit code `20`:
Returned when the sub dev is not found. No need to fail, as the sub dev is surely flagged for unprovision too, which will wipe metadata. This situation happens on unprovision on a stopped instance, when drbd is stacked over another (stopped) disk resource.
Click to show internal directories.
Click to hide internal directories.