osmo-lpmgd/doc/server-power-mgmt-daemon.txt

82 lines
2.2 KiB
Plaintext

h3. resources
A "resource" is a power-switched resource such as a given server. It can be
switched on an off using a "switcher"
A resource has the following data:
* name
* description
* status (UNKNOWN, OFF, POWERED, AVAILABLE)
* reference to switcher
* switcher configuration (depends on switcher)
* optional: upstream resource dependency
* optional: current power consumption
* expected availability time (last time from OFF->POWERED to POWERED->AVAILABLE)
h3. switcher
A "switcher" is something that can turn on/off the power to a given "resource".
An abstract base class defines the interface, with derived classes providing implementations for
* intellinet PDU
* sispmctl
* tasmota
* soft-power-off + wake-on-lan
* supermicro [open]ipmi ?
Each of the derived classes will have specific parameters describing the address/id of the switcher,
such as the IP address + port number on an intellinet PDU
h3. availability_checker
An "availability_checker" is something that can check whether or not a given "resource" is available for use
or not. A typical example would be to ping the host after it booted, or to check whether the SSHd is
accepting inbound connections.
The availability_checker is called internally
* on 75% of expected_avail_time expiration (after OFF->POWERED), afterwards
* every 1s/5s, as long as we remain in POWERED state
h3. usage token
Every user of a resource has to obtain a usage token before using a service. The daemon will internally keep a use counter, one for each concurrently active token for a give resource. Once the counter drops to zero, the device will be powered off
usage tokens have the following information:
* reference of the related resource (resolved by name from client API request)
* duration of the token (specified during API call to get the token)
* name of the related user
* description of the user / usage
h2. REST API calls
h3. GET api/v1/power_resource/<name>
* name
* description
* status
* switcher
** type
** channel
h3. POST api/v1/power_resource/<name>/usage_token_get
Request:
* user
* duration
Response:
* token
* user
* duration
* resource
* expected_availability_time (0 in case already available)
h3. PUT api/v1/power_resource/<name>/usage_token/<token>