2019-08-28 23:13:02 +05:00
|
|
|
import logging
|
|
|
|
|
|
|
|
from etcd3_wrapper import Etcd3Wrapper
|
|
|
|
from ucloud_common.vm import VmPool
|
|
|
|
from ucloud_common.host import HostPool
|
|
|
|
from ucloud_common.request import RequestPool
|
2019-08-28 23:28:19 +05:00
|
|
|
from decouple import config
|
|
|
|
|
2019-08-28 23:13:02 +05:00
|
|
|
|
|
|
|
logging.basicConfig(
|
|
|
|
level=logging.DEBUG,
|
|
|
|
filename="log.txt",
|
|
|
|
filemode="a",
|
|
|
|
format="%(asctime)s: %(levelname)s - %(message)s",
|
|
|
|
datefmt="%d-%b-%y %H:%M:%S",
|
|
|
|
)
|
|
|
|
|
2019-08-30 23:41:14 +05:00
|
|
|
# TODO: Remove timeout, use certificate authentication
|
|
|
|
etcd_client = Etcd3Wrapper(host=config("ETCD_URL"), user="root",
|
|
|
|
password=config("ETCD_PASSWORD"),
|
|
|
|
timeout=2629746)
|
2019-08-28 23:13:02 +05:00
|
|
|
|
|
|
|
host_pool = HostPool(etcd_client, "/v1/host")
|
|
|
|
vm_pool = VmPool(etcd_client, "/v1/vm")
|
|
|
|
request_pool = RequestPool(etcd_client, "/v1/request")
|
|
|
|
|
|
|
|
running_vms = []
|