patroni.watchdog.linux module

patroni.watchdog.linux.IOC(dir_: int, type_: str, nr: int, size: int) → int
patroni.watchdog.linux.IOR(type_: str, nr: int, size: int) → int
patroni.watchdog.linux.IOW(type_: str, nr: int, size: int) → int
patroni.watchdog.linux.IOWR(type_: str, nr: int, size: int) → int
class patroni.watchdog.linux.LinuxWatchdogDevice(device: str)

Bases: patroni.watchdog.base.WatchdogBase

DEFAULT_DEVICE = '/dev/watchdog'
can_be_disabled

Returns True when watchdog will be disabled by calling close(). Some watchdog devices will keep running no matter what once activated. May raise WatchdogError if called without calling open() first.

close() → None

Gracefully close watchdog device.

describe() → str

Human readable name for this device

classmethod from_config(config: Dict[str, Any]) → patroni.watchdog.linux.LinuxWatchdogDevice
get_support() → patroni.watchdog.linux.WatchdogInfo
get_timeout() → int

Returns the current keepalive timeout in effect.

has_set_timeout() → bool

Returns True if setting a timeout is supported.

is_healthy

Returns False when calling open() is known to fail.

is_running

Returns True when watchdog is activated and capable of performing it’s task.

keepalive() → None

Resets the watchdog timer.

Watchdog must be open when keepalive is called.

open() → None

Open watchdog device.

When watchdog is opened keepalive must be called. Returns nothing on success or raises WatchdogError if the device could not be opened.

set_timeout(timeout: int) → None

Set the watchdog timer timeout.

Parameters:timeout – watchdog timeout in seconds
class patroni.watchdog.linux.TestingWatchdogDevice(device: str)

Bases: patroni.watchdog.linux.LinuxWatchdogDevice

Converts timeout ioctls to regular writes that can be intercepted from a named pipe.

get_support() → patroni.watchdog.linux.WatchdogInfo
get_timeout() → int

Returns the current keepalive timeout in effect.

set_timeout(timeout: int) → None

Set the watchdog timer timeout.

Parameters:timeout – watchdog timeout in seconds
timeout = 60
class patroni.watchdog.linux.WatchdogInfo

Bases: tuple

Watchdog descriptor from the kernel

identity

Alias for field number 2

options

Alias for field number 0

version

Alias for field number 1

class patroni.watchdog.linux.watchdog_info

Bases: _ctypes.Structure

firmware_version

Structure/Union member

identity

Structure/Union member

options

Structure/Union member