Commit 78f44650 authored by Iustin Pop's avatar Iustin Pop
Browse files

watcher: write the instance status to a file



This patch modifies the watcher to keep on-disk a file with the instance
status; this can be used from outside of ganeti to react to instances
being down (when the watcher cannot restart them).
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent d392fa34
......@@ -244,10 +244,17 @@ def GetClusterData():
all_results = cli.PollJob(job_id, cl=client, feedback_fn=logging.debug)
logging.debug("Got data from cluster, writing instance status file")
result = all_results[0]
smap = {}
instances = {}
# write the upfile
up_data = "".join(["%s %s\n" % (fields[0], fields[1]) for fields in result])
utils.WriteFile(file_name=constants.INSTANCE_UPFILE, data=up_data)
for fields in result:
(name, status, autostart, snodes) = fields
......
......@@ -96,6 +96,7 @@ CLUSTER_CONF_FILE = DATA_DIR + "/config.data"
SSL_CERT_FILE = DATA_DIR + "/server.pem"
RAPI_CERT_FILE = DATA_DIR + "/rapi.pem"
WATCHER_STATEFILE = DATA_DIR + "/watcher.data"
INSTANCE_UPFILE = RUN_GANETI_DIR + "/instance-status"
SSH_KNOWN_HOSTS_FILE = DATA_DIR + "/known_hosts"
RAPI_USERS_FILE = DATA_DIR + "/rapi_users"
QUEUE_DIR = DATA_DIR + "/queue"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment