From 14db633f4f1318f651f2cf3791198eb21ea084b2 Mon Sep 17 00:00:00 2001 From: Magnus Ahltorp Date: Fri, 31 Jul 2015 08:20:26 +0200 Subject: Set verifiedsize after merge backup is verified --- tools/compileconfig.py | 1 + tools/merge.py | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tools/compileconfig.py b/tools/compileconfig.py index 0e4a839..1e1fa41 100755 --- a/tools/compileconfig.py +++ b/tools/compileconfig.py @@ -128,6 +128,7 @@ def allowed_clients_mergesecondary(primarymergenode): ("/catlfish/merge/sendlog", [primarymergenode]), ("/catlfish/merge/verifyroot", [primarymergenode]), ("/catlfish/merge/verifiedsize", [primarymergenode]), + ("/catlfish/merge/setverifiedsize", [primarymergenode]), ("/catlfish/merge/missingentries", [primarymergenode]), ] diff --git a/tools/merge.py b/tools/merge.py index 34d1697..7453fa4 100755 --- a/tools/merge.py +++ b/tools/merge.py @@ -241,6 +241,23 @@ def verifyroot(node, baseurl, treesize): sys.stderr.flush() raise e +def setverifiedsize(node, baseurl, treesize): + try: + result = http_request(baseurl + "catlfish/merge/setverifiedsize", + json.dumps({"size":treesize}), key=own_key, verifynode=node, publickeydir=paths["publickeys"]) + return json.loads(result) + except urllib2.HTTPError, e: + print >>sys.stderr, "ERROR: setverifiedsize", e.read() + sys.exit(1) + except ValueError, e: + print >>sys.stderr, "==== FAILED REQUEST ====" + print >>sys.stderr, submission + print >>sys.stderr, "======= RESPONSE =======" + print >>sys.stderr, result + print >>sys.stderr, "========================" + sys.stderr.flush() + raise e + def get_missingentries(node, baseurl): try: result = http_request(baseurl + "ct/frontend/missingentries", key=own_key, verifynode=node, publickeydir=paths["publickeys"]) @@ -404,7 +421,7 @@ for secondary in secondaries: print >>sys.stderr, " expected", hexencode(root_hash) sys.exit(1) timing_point(timing, "verifyroot") - # XXX: set verifiedsize + setverifiedsize(nodename, nodeaddress, tree_size) if args.timing: print >>sys.stderr, timing["deltatimes"] sys.stderr.flush() -- cgit v1.1