def _get_client(self, pod_name=None): if not pod_name: if t_constants.TOP not in self.clients: self.clients[t_constants.TOP] = client.Client() return self.clients[t_constants.TOP] if pod_name not in self.clients: self.clients[pod_name] = client.Client(pod_name) return self.clients[pod_name]
def _get_client(self, region_name=None): if not region_name: if t_constants.TOP not in self.clients: self.clients[t_constants.TOP] = client.Client() return self.clients[t_constants.TOP] if region_name not in self.clients: self.clients[region_name] = client.Client(region_name) return self.clients[region_name]
def setUp(self): core.initialize() core.ModelBase.metadata.create_all(core.get_engine()) # enforce foreign key constraint for sqlite core.get_engine().execute('pragma foreign_keys=on') self.context = context.Context() pod_dict = { 'pod_id': FAKE_SITE_ID, 'region_name': FAKE_SITE_NAME, 'az_name': FAKE_AZ } config_dict = { 'service_id': FAKE_SERVICE_ID, 'pod_id': FAKE_SITE_ID, 'service_type': FAKE_TYPE, 'service_url': FAKE_URL } api.create_pod(self.context, pod_dict) api.create_cached_endpoints(self.context, config_dict) global FAKE_RESOURCES FAKE_RESOURCES = [{'name': 'res1'}, {'name': 'res2'}] cfg.CONF.set_override(name='top_region_name', override=FAKE_SITE_NAME, group='client') self.client = client.Client() self.client.resource_service_map[FAKE_RESOURCE] = FAKE_TYPE self.client.operation_resources_map['list'].add(FAKE_RESOURCE) self.client.operation_resources_map['create'].add(FAKE_RESOURCE) self.client.operation_resources_map['delete'].add(FAKE_RESOURCE) self.client.operation_resources_map['action'].add(FAKE_RESOURCE) self.client.service_handle_map[FAKE_TYPE] = FakeResHandle(None)
def __init__(self, project_id, server_id): self.project_id = project_id self.server_id = server_id self.clients = {constants.TOP: t_client.Client()} self.handle_map = { 'os-start': self._handle_start, 'os-stop': self._handle_stop }
def get_pod_service_endpoint(context, region_name, st): pod = db_api.get_pod_by_name(context, region_name) if pod: c = client.Client() return c.get_endpoint(context, pod['pod_id'], st) return ''
def __init__(self, project_id, volume_id): self.project_id = project_id self.volume_id = volume_id self.clients = {constants.TOP: t_client.Client()} self.handle_map = { 'os-attach': self._attach, 'os-extend': self._extend, 'os-reset_status': self._reset_status, 'os-set_image_metadata': self._set_image_metadata, 'os-unset_image_metadata': self._unset_image_metadata, 'os-show_image_metadata': self._show_image_metadata }
def __init__(self, host=None, service_name='xjob'): LOG.debug(_('XManager initialization...')) if not host: host = CONF.host self.host = host self.service_name = service_name # self.notifier = rpc.get_notifier(self.service_name, self.host) self.additional_endpoints = [] self.clients = {constants.TOP: client.Client()} self.job_handles = { constants.JT_ROUTER: self.configure_extra_routes, constants.JT_ROUTER_SETUP: self.setup_bottom_router, constants.JT_PORT_DELETE: self.delete_server_port} self.helper = helper.NetworkHelper() self.xjob_handler = xrpcapi.XJobAPI() super(XManager, self).__init__()
def __init__(self): self.clients = {constants.TOP: client.Client()}
def _get_client(self, pod_name=constants.TOP): if pod_name not in self.clients: self.clients[pod_name] = t_client.Client(pod_name) return self.clients[pod_name]
def __init__(self, project_id): self.project_id = project_id self.clients = {constants.TOP: t_client.Client()} self.xjob_handler = xrpcapi.XJobAPI()
def _get_client(self, region_name): if region_name not in self.clients: self.clients[region_name] = t_client.Client(region_name) return self.clients[region_name]
def __init__(self, project_id): self.project_id = project_id self.client = t_client.Client()
def _get_client(self, pod_name='top'): if pod_name not in self.clients: self.clients[pod_name] = t_client.Client(pod_name) return self.clients[pod_name]
def __init__(self, project_id, server_id): self.project_id = project_id self.server_id = server_id self.clients = {'top': t_client.Client()}
def __init__(self): super(TricircleQosPlugin, self).__init__() self.clients = {'top': t_client.Client()}
def __init__(self): self.clients = {constants.TOP: client.Client()} self.helper = FakeNetworkHelper()