logging.error("Key 'entries' not in dump-journal output")
errors += 1
elif len(jsondict['entries']) == 0:
- logging.warning("No entries in journal found, probably a problem")
- errors += 1
+ logging.info("No entries in journal found")
else:
errors += check_journal_entries(jsondict['entries'])
return errors
return errors
+def test_dump_journal(CFSD_PREFIX, osds):
+ ERRORS = 0
+ pid = os.getpid()
+ TMPFILE = r"/tmp/tmp.{pid}".format(pid=pid)
+
+ for osd in osds:
+ # Test --op dump-journal by loading json
+ cmd = (CFSD_PREFIX + "--op dump-journal --format json").format(osd=osd)
+ logging.debug(cmd)
+ tmpfd = open(TMPFILE, "w")
+ ret = call(cmd, shell=True, stdout=tmpfd)
+ if ret != 0:
+ logging.error("Bad exit status {ret} from {cmd}".format(ret=ret, cmd=cmd))
+ ERRORS += 1
+ continue
+ tmpfd.close()
+ tmpfd = open(TMPFILE, "r")
+ jsondict = json.load(tmpfd)
+ tmpfd.close()
+ os.unlink(TMPFILE)
+
+ journal_errors = check_journal(jsondict)
+ if journal_errors is not 0:
+ logging.error(jsondict)
+ ERRORS += journal_errors
+
+ return ERRORS
+
+
CEPH_DIR = "ceph_objectstore_tool_dir"
CEPH_CONF = os.path.join(CEPH_DIR, 'ceph.conf')
OSDS = get_osds(ALLPGS[0], OSDDIR)
osd = OSDS[0]
- # Test --op dump-journal by loading json
- print "Test --op dump-journal"
- cmd = (CFSD_PREFIX + "--op dump-journal --format json").format(osd=osd)
- logging.debug(cmd)
- tmpfd = open(TMPFILE, "w")
- ret = call(cmd, shell=True, stdout=tmpfd)
- if ret != 0:
- logging.error("Bad exit status {ret} from {cmd}".format(ret=ret, cmd=cmd))
- ERRORS += 1
- tmpfd.close()
- tmpfd = open(TMPFILE, "r")
- jsondict = json.load(tmpfd)
- tmpfd.close()
- os.unlink(TMPFILE)
-
- journal_errors = check_journal(jsondict)
- if journal_errors is not 0:
- logging.error(jsondict)
- ERRORS += journal_errors
+ print "Test all --op dump-journal"
+ ALLOSDS = [f for f in os.listdir(OSDDIR) if os.path.isdir(os.path.join(OSDDIR, f)) and string.find(f, "osd") == 0]
+ ERRORS += test_dump_journal(CFSD_PREFIX, ALLOSDS)
# Test --op list and generate json for all objects
print "Test --op list variants"
else:
logging.warning("SKIPPING CHECKING IMPORT DATA DUE TO PREVIOUS FAILURES")
+ print "Test all --op dump-journal again"
+ ALLOSDS = [f for f in os.listdir(OSDDIR) if os.path.isdir(os.path.join(OSDDIR, f)) and string.find(f, "osd") == 0]
+ ERRORS += test_dump_journal(CFSD_PREFIX, ALLOSDS)
+
vstart(new=False)
wait_for_health()