hackety hack

This commit is contained in:
Paul Collins
2012-10-02 23:52:44 +13:00
parent d1940639ef
commit 0a563bb818
8 changed files with 200 additions and 18 deletions

26
hooks/ceph.py Normal file
View File

@@ -0,0 +1,26 @@
#
# Copyright 2012 Canonical Ltd.
#
# Authors:
# James Page <james.page@canonical.com>
#
import subprocess
import json
import os
QUORUM = [ 'leader', 'peon' ]
def is_quorum():
cmd = [
"ceph",
"--admin-daemon",
"/var/run/ceph/ceph-mon.%s.asok" % os.uname()[1],
"mon_status"
]
result = json.loads(subprocess.check_output(cmd))
if result['state'] in QUORUM:
return True
else:
return False