Migrate sanity_check.py into the respective daemons

This commit is contained in:
Nico Schottelius 2019-12-07 14:25:21 +01:00
commit 9517e73233
4 changed files with 22 additions and 35 deletions

View file

@ -18,6 +18,19 @@ def qemu_img_type(path):
qemu_img_info = json.loads(qemu_img_info.decode("utf-8"))
return qemu_img_info["format"]
def check():
""" check whether settings are sane, refuse to start if they aren't """
if env_vars.get('STORAGE_BACKEND') == 'filesystem' and not isdir(env_vars.get('IMAGE_DIR')):
print("You have set STORAGE_BACKEND to filesystem, but "
"{} does not exist. Refusing to start".format(env_vars.get('IMAGE_DIR')))
sys.exit(1)
try:
subprocess.check_output(['which', 'qemu-img'])
except Exception:
print("qemu-img missing")
sys.exit(1)
def main():
# We want to get images entries that requests images to be created