24 lines
811 B
Python
24 lines
811 B
Python
import time
|
|
import threading
|
|
import Pyro4
|
|
import logging as log
|
|
|
|
DEFAULT_REFRESH_INTERVAL=(5 * 60)
|
|
|
|
class ZFSSMDaemonRefresh(object):
|
|
## TODO Docstrings
|
|
def __init__(self, interval=DEFAULT_REFRESH_INTERVAL):
|
|
self.interval = interval
|
|
|
|
thread = threading.Thread(target=self.run, args=())
|
|
thread.daemon = True
|
|
thread.start()
|
|
|
|
def run(self):
|
|
while True:
|
|
## FIXME Rework it as root process cursor if it's even possible to avoid RPC. For now it's not bad.
|
|
uri = "PYRO:058b7dde9ec53de9235cfc57a07ce17a9eabfce3@./u:/run/zfssmd.sock"
|
|
zfssmd_connection = Pyro4.Proxy(uri)
|
|
last_ref = zfssmd_connection.call_zfs_list_snapshots()
|
|
log.debug("Refreshed list " + str(last_ref))
|
|
time.sleep(self.interval) |