2019-12-31 10:30:02 +00:00
|
|
|
from uncloud.settings import settings
|
|
|
|
from uncloud.common.vm import VmPool
|
|
|
|
from uncloud.common.host import HostPool
|
|
|
|
from uncloud.common.request import RequestPool
|
|
|
|
from uncloud.common.storage_handlers import get_storage_handler
|
2019-12-22 07:26:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Shared:
|
|
|
|
@property
|
|
|
|
def etcd_client(self):
|
|
|
|
return settings.get_etcd_client()
|
|
|
|
|
|
|
|
@property
|
|
|
|
def host_pool(self):
|
2019-12-30 09:35:07 +00:00
|
|
|
return HostPool(
|
|
|
|
self.etcd_client, settings["etcd"]["host_prefix"]
|
|
|
|
)
|
2019-12-22 07:26:48 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def vm_pool(self):
|
2019-12-30 09:35:07 +00:00
|
|
|
return VmPool(self.etcd_client, settings["etcd"]["vm_prefix"])
|
2019-12-22 07:26:48 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def request_pool(self):
|
2019-12-30 09:35:07 +00:00
|
|
|
return RequestPool(
|
|
|
|
self.etcd_client, settings["etcd"]["request_prefix"]
|
|
|
|
)
|
2019-12-22 07:26:48 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def storage_handler(self):
|
|
|
|
return get_storage_handler()
|
|
|
|
|
|
|
|
|
|
|
|
shared = Shared()
|