本文整理匯總了Python中oslo_messaging.Target方法的典型用法代碼示例。如果您正苦於以下問題:Python oslo_messaging.Target方法的具體用法?Python oslo_messaging.Target怎麽用?Python oslo_messaging.Target使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類oslo_messaging
的用法示例。
在下文中一共展示了oslo_messaging.Target方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_zone_transfer_request
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def get_zone_transfer_request(self, context, zone_transfer_request_id):
elevated_context = context.elevated(all_tenants=True)
# Get zone transfer request
zone_transfer_request = self.storage.get_zone_transfer_request(
elevated_context, zone_transfer_request_id)
LOG.info('Target Tenant ID found - using scoped policy')
target = {
'target_tenant_id': zone_transfer_request.target_tenant_id,
'tenant_id': zone_transfer_request.tenant_id,
}
policy.check('get_zone_transfer_request', context, target)
return zone_transfer_request
示例2: __init__
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def __init__(self, topic, context, env, group, host):
"""Initialize LBaaSv2PluginRPC."""
super(LBaaSv2PluginRPC, self).__init__()
if topic:
self.topic = topic
else:
self.topic = constants.TOPIC_PROCESS_ON_HOST_V2
self.target = messaging.Target(topic=self.topic,
version=constants.RPC_API_VERSION)
self._client = rpc.get_client(self.target, version_cap=None)
self.context = context
self.env = env
self.group = group
self.host = host
示例3: main
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def main():
if len(sys.argv) < 2:
print("Supply an exchange")
sys.exit(0)
exchange = sys.argv[1]
pool = sys.argv[2] if len(sys.argv) > 2 else None
transport = oslo_messaging.get_notification_transport(
cfg.CONF,
url='rabbit://%s:%s@%s' % (username, password, host))
targets = [oslo_messaging.Target(topic=topic, exchange=exchange)]
endpoints = [EP()]
oslo_listener = oslo_messaging.get_notification_listener(
transport, targets, endpoints, pool=pool, executor='threading')
try:
print("Started")
oslo_listener.start()
while True:
time.sleep(1)
except KeyboardInterrupt:
print("Stopping")
oslo_listener.stop()
oslo_listener.wait()
示例4: start
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def start(self):
super(ListenerService, self).start()
transport = oslo_messaging.get_notification_transport(CONF)
targets = [
oslo_messaging.Target(topic=pl_topic, exchange=pl_exchange)
for pl_topic, pl_exchange in self.topics_exchanges_set
]
endpoints = [
NotificationEndpoint(self.plugins, PipelineManager(self.plugins))
]
listener = oslo_messaging.get_notification_listener(
transport,
targets,
endpoints,
executor='threading',
pool=CONF.listener.notifications_pool)
listener.start()
self.listeners.append(listener)
示例5: _init_instance
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def _init_instance(self):
notifier = messaging.VitrageNotifier("vitrage.api",
[EVALUATOR_TOPIC])
db = storage.get_connection_from_config()
transport = messaging.get_rpc_transport()
target = oslo_messaging.Target(topic=CONF.rpc_topic,
server=uuidutils.generate_uuid())
self.api_lock = threading.RLock()
endpoints = [
TopologyApis(self._entity_graph, self.api_lock),
AlarmApis(self._entity_graph, self.api_lock, db),
RcaApis(self._entity_graph, self.api_lock, db),
ResourceApis(self._entity_graph, self.api_lock),
TemplateApis(notifier, db),
EventApis(),
WebhookApis(db),
OperationalApis(self._entity_graph),
]
server = vitrage_rpc.get_server(target, endpoints, transport)
server.start()
示例6: start
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def start(self):
super(ConductorService, self).start()
self.service_id = uuidutils.generate_uuid()
target = oslo_messaging.Target(version=consts.RPC_API_VERSION,
server=self.host,
topic=self.topic)
serializer = obj_base.VersionedObjectSerializer()
self.server = rpc_messaging.get_rpc_server(
target, self, serializer=serializer)
self.server.start()
# create service record
ctx = senlin_context.get_admin_context()
service_obj.Service.create(ctx, self.service_id, self.host,
self.service_name, self.topic)
# we may want to make the clean-up attempts configurable.
self.cleanup_timer = self.tg.add_timer(2 * CONF.periodic_interval,
self.service_manage_cleanup)
self.tg.add_timer(CONF.periodic_interval, self.service_manage_report)
示例7: start
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def start(self):
"""Start the engine.
Note that the engine is an internal server, we are not using
versioned object for parameter passing.
"""
super(EngineService, self).start()
self.service_id = uuidutils.generate_uuid()
self.target = oslo_messaging.Target(server=self.service_id,
topic=self.topic,
version=self.version)
self.server = messaging.get_rpc_server(self.target, self)
self.server.start()
# create service record
ctx = senlin_context.get_admin_context()
service_obj.Service.create(ctx, self.service_id, self.host,
self.service_name, self.topic)
self.tg.add_timer(CONF.periodic_interval, self.service_manage_report)
示例8: start
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def start(self):
super(HealthManagerService, self).start()
self.service_id = uuidutils.generate_uuid()
self.health_registry = health_manager.RuntimeHealthRegistry(
ctx=self.ctx, engine_id=self.service_id,
thread_group=self.tg
)
# create service record
ctx = senlin_context.get_admin_context()
service_obj.Service.create(ctx, self.service_id, self.host,
self.service_name,
self.topic)
self.tg.add_timer(CONF.periodic_interval, self.service_manage_report)
self.target = messaging.Target(server=self.service_id,
topic=self.topic,
version=self.version)
self.server = rpc.get_rpc_server(self.target, self)
self.server.start()
self.tg.add_dynamic_timer(self.task, None, cfg.CONF.periodic_interval)
示例9: start
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def start(self):
super(RPCService, self).start()
target = messaging.Target(topic=self.topic, server=self.host)
endpoints = [self.manager]
serializer = objects_base.CyborgObjectSerializer()
self.rpcserver = rpc.get_server(target, endpoints, serializer)
self.rpcserver.start()
admin_context = context.get_admin_context()
self.tg.add_dynamic_timer(
self.manager.periodic_tasks,
periodic_interval_max=CONF.periodic_interval,
context=admin_context)
LOG.info('Created RPC server for service %(service)s on host '
'%(host)s.',
{'service': self.topic, 'host': self.host})
示例10: __init__
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def __init__(self, topic, server, endpoints, binary):
super(Service, self).__init__()
serializer = _init_serializer()
transport = messaging.get_rpc_transport(CONF)
access_policy = dispatcher.DefaultRPCAccessPolicy
# TODO(asalkeld) add support for version='x.y'
target = messaging.Target(topic=topic, server=server)
self.endpoints = endpoints
self._server = messaging.get_rpc_server(transport, target, endpoints,
executor='eventlet',
serializer=serializer,
access_policy=access_policy)
self.binary = binary
profiler.setup(binary, CONF.host)
示例11: __init__
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def __init__(self, driver):
self.target = oslo_messaging.Target(version='1.0')
self.driver = driver
示例12: __init__
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def __init__(self, topic, host):
self.host = host
self.target = oslo_messaging.Target(topic=topic, version='1.0')
self.client = n_rpc.get_client(self.target)
示例13: __init__
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def __init__(self):
super(AmphoraProviderDriver, self).__init__()
topic = cfg.CONF.oslo_messaging.topic
self.target = messaging.Target(
namespace=consts.RPC_NAMESPACE_CONTROLLER_AGENT,
topic=topic, version="1.0", fanout=False)
self.client = rpc.get_client(self.target)
self.repositories = repositories.Repositories()
示例14: __init__
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def __init__(self):
super(AmphoraProviderDriver, self).__init__()
self.target = messaging.Target(
namespace=consts.RPC_NAMESPACE_CONTROLLER_AGENT,
topic=consts.TOPIC_AMPHORA_V2, version="2.0", fanout=False)
self.client = rpc.get_client(self.target)
self.repositories = repositories.Repositories()
key = utils.get_compatible_server_certs_key_passphrase()
self.fernet = fernet.Fernet(key)
示例15: __init__
# 需要導入模塊: import oslo_messaging [as 別名]
# 或者: from oslo_messaging import Target [as 別名]
def __init__(self, amp_id):
super(FailoverController, self).__init__()
if CONF.api_settings.default_provider_driver == constants.AMPHORAV2:
topic = constants.TOPIC_AMPHORA_V2
version = "2.0"
else:
topic = cfg.CONF.oslo_messaging.topic
version = "1.0"
self.target = messaging.Target(
namespace=constants.RPC_NAMESPACE_CONTROLLER_AGENT,
topic=topic, version=version, fanout=False)
self.client = rpc.get_client(self.target)
self.amp_id = amp_id