Module client
source code
Ganeti confd client
Clients can use the confd client library to send requests to a group
of master candidates running confd. The expected usage is through the
asyncore framework, by sending queries, and asynchronously receiving
replies through a callback.
This way the client library doesn't ever need to "wait" on a
particular answer, and can proceed even if some udp packets are lost.
It's up to the user to reschedule queries if they haven't received
responses and they need them.
Example usage:
client = ConfdClient(...) # includes callback specification
req = confd_client.ConfdClientRequest(type=constants.CONFD_REQ_PING)
client.SendRequest(req)
# then make sure your client calls asyncore.loop() or daemon.Mainloop.Run()
# ... wait ...
# And your callback will be called by asyncore, when your query gets a
# response, or when it expires.
You can use the provided ConfdFilterCallback to act as a filter, only
passing "newer" answer to your callback, and filtering out
outdated ones, or ones confirming what you already got.
|
UPCALL_REPLY = 1
|
|
UPCALL_EXPIRE = 2
|
|
CONFD_UPCALL_TYPES = compat.UniqueFrozenset([UPCALL_REPLY, UPC...
|
Imports:
time,
random,
utils,
constants,
objects,
serializer,
daemon,
errors,
confd,
ssconf,
compat,
netutils,
pathutils
Return a client configured using the given callback.
This is handy to abstract the MC list and HMAC key reading.
Attention:
This should only be called on nodes which are part of a cluster,
since it depends on a valid (ganeti) data directory; for code
running outside of a cluster, you need to create the client
manually
|
CONFD_UPCALL_TYPES
- Value:
compat.UniqueFrozenset([UPCALL_REPLY, UPCALL_EXPIRE,])
|
|