Configuration/Setting module added

This commit is contained in:
ahmadbilalkhalid 2019-12-21 14:36:55 +05:00
commit bc58a6ed9c
11 changed files with 217 additions and 106 deletions

View file

@ -8,17 +8,16 @@ from ucloud.common.etcd_wrapper import Etcd3Wrapper
from ucloud.common.request import RequestEntry, RequestType
from ucloud.config import (vm_pool, request_pool,
etcd_client, running_vms,
etcd_wrapper_args, etcd_wrapper_kwargs,
HostPool, config)
from .helper import find_free_port
from . import virtualmachine
from ucloud.host import logger
from . import virtualmachine, logger
def update_heartbeat(hostname):
"""Update Last HeartBeat Time for :param hostname: in etcd"""
client = Etcd3Wrapper(*etcd_wrapper_args, **etcd_wrapper_kwargs)
client = config.get_etcd_client()
host_pool = HostPool(client, config['etcd']['host_prefix'])
this_host = next(filter(lambda h: h.hostname == hostname, host_pool.hosts), None)
@ -73,7 +72,7 @@ def maintenance(host):
running_vms.remove(_vm)
def check():
if config['storage']['backend'] == 'filesystem' and \
if config['storage']['storage_backend'] == 'filesystem' and \
not isdir(config['storage']['vm_dir']):
print("You have set STORAGE_BACKEND to filesystem. So, the vm directory mentioned"
@ -81,7 +80,6 @@ def check():
sys.exit(1)
def main(hostname):
check()