def update_crushmap():
try:
encoded_text = action_get("map")
json_map = base64.b64decode(encoded_text)
try:
# This needs json_map passed to it from stdin
crushtool = Popen(
["crushtool", "-o", "compiled_crushmap", "-m", "compile"],
stdin=PIPE)
crushtool_stdout, crushtool_stderr = crushtool.communicate(
input=json_map)
if crushtool_stderr is not None:
action_fail(
"Failed to compile json: {}".format(crushtool_stderr))
check_output(
["ceph", "osd", "setcrushmap", "-i", "compiled_crushmap"])
except (CalledProcessError, OSError) as err2:
action_fail("Crush compile or load failed with error: {}".format(
err2.output))
except TypeError as err:
action_fail(
"Unable to base64 decode: {}. Error: {}".format(encoded_text, err))
评论列表
文章目录