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