本文整理汇总了Python中neutron.db.agentschedulers_db.services_available函数的典型用法代码示例。如果您正苦于以下问题:Python services_available函数的具体用法?Python services_available怎么用?Python services_available使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了services_available函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: validate_agent_router_combination
def validate_agent_router_combination(self, context, agent, router):
"""Validate if the router can be correctly assigned to the agent.
:raises: RouterL3AgentMismatch if attempting to assign DVR router
to legacy agent.
:raises: InvalidL3Agent if attempting to assign router to an
unsuitable agent (disabled, type != L3, incompatible configuration)
:raises: DVRL3CannotAssignToDvrAgent if attempting to assign a
router to an agent in 'dvr' mode.
"""
if agent['agent_type'] != constants.AGENT_TYPE_L3:
raise l3agentscheduler.InvalidL3Agent(id=agent['id'])
agent_mode = self._get_agent_mode(agent)
if agent_mode == constants.L3_AGENT_MODE_DVR:
raise l3agentscheduler.DVRL3CannotAssignToDvrAgent()
if (agent_mode == constants.L3_AGENT_MODE_LEGACY and
router.get('distributed')):
raise l3agentscheduler.RouterL3AgentMismatch(
router_id=router['id'], agent_id=agent['id'])
is_suitable_agent = (
agentschedulers_db.services_available(agent['admin_state_up']) and
self.get_l3_agent_candidates(context, router,
[agent],
ignore_admin_state=True))
if not is_suitable_agent:
raise l3agentscheduler.InvalidL3Agent(id=agent['id'])
开发者ID:HoratiusTang,项目名称:neutron,代码行数:30,代码来源:l3_agentschedulers_db.py
示例2: list_active_sync_routers_on_active_l3_agent
def list_active_sync_routers_on_active_l3_agent(self, context, host, router_ids):
agent = self._get_agent_by_type_and_host(context, constants.AGENT_TYPE_L3, host)
if not agentschedulers_db.services_available(agent.admin_state_up):
return []
router_ids = self._get_router_ids_for_agent(context, agent, router_ids)
if router_ids:
return self._get_active_l3_agent_routers_sync_data(context, host, agent, router_ids)
return []
开发者ID:qianqunyi,项目名称:neutron,代码行数:8,代码来源:l3_agentschedulers_db.py
示例3: list_router_ids_on_host
def list_router_ids_on_host(self, context, host, router_ids=None):
try:
agent = self._get_agent_by_type_and_host(
context, constants.AGENT_TYPE_L3, host)
except agent_exc.AgentNotFoundByTypeHost:
return []
if not agentschedulers_db.services_available(agent.admin_state_up):
return []
return self._get_router_ids_for_agent(context, agent, router_ids)
开发者ID:cubeek,项目名称:neutron,代码行数:9,代码来源:l3_agentschedulers_db.py
示例4: list_router_ids_on_host
def list_router_ids_on_host(self, context, host, router_ids=None):
agent = self._get_agent_by_type_and_host(context, constants.AGENT_TYPE_L3, host)
if not agentschedulers_db.services_available(agent.admin_state_up):
return []
query = context.session.query(RouterL3AgentBinding.router_id)
query = query.filter(RouterL3AgentBinding.l3_agent_id == agent.id)
if router_ids:
query = query.filter(RouterL3AgentBinding.router_id.in_(router_ids))
return [item[0] for item in query]
开发者ID:lizk1989,项目名称:neutron,代码行数:11,代码来源:l3_agentschedulers_db.py
示例5: list_active_sync_routers_on_active_l3_agent
def list_active_sync_routers_on_active_l3_agent(self, context, host, router_ids):
agent = self._get_agent_by_type_and_host(context, constants.AGENT_TYPE_L3, host)
if not agentschedulers_db.services_available(agent.admin_state_up):
LOG.debug("Agent has its services disabled. Returning " "no active routers. Agent: %s", agent)
return []
scheduled_router_ids = self._get_router_ids_for_agent(context, agent, router_ids)
diff = set(router_ids or []) - set(scheduled_router_ids or [])
if diff:
LOG.debug(
"Agent requested router IDs not scheduled to it. "
"Scheduled: %(sched)s. Unscheduled: %(diff)s. "
"Agent: %(agent)s.",
{"sched": scheduled_router_ids, "diff": diff, "agent": agent},
)
if scheduled_router_ids:
return self._get_active_l3_agent_routers_sync_data(context, host, agent, scheduled_router_ids)
return []
开发者ID:klmitch,项目名称:neutron,代码行数:17,代码来源:l3_agentschedulers_db.py
示例6: validate_agent_router_combination
def validate_agent_router_combination(self, context, agent, router):
"""Validate if the router can be correctly assigned to the agent.
:raises: RouterL3AgentMismatch if attempting to assign DVR router
to legacy agent, or centralized router to compute's L3 agents.
:raises: InvalidL3Agent if attempting to assign router to an
unsuitable agent (disabled, type != L3, incompatible configuration)
:raises: DVRL3CannotAssignToDvrAgent if attempting to assign DVR
router from one DVR Agent to another.
"""
if agent['agent_type'] != constants.AGENT_TYPE_L3:
raise l3agentscheduler.InvalidL3Agent(id=agent['id'])
is_distributed = router.get('distributed')
agent_mode = self._get_agent_mode(agent)
router_type = (
'distributed' if is_distributed else
'centralized')
is_agent_router_types_incompatible = (
agent_mode == constants.L3_AGENT_MODE_DVR and not is_distributed
or agent_mode == constants.L3_AGENT_MODE_LEGACY and is_distributed
)
if is_agent_router_types_incompatible:
raise l3agentscheduler.RouterL3AgentMismatch(
router_type=router_type, router_id=router['id'],
agent_mode=agent_mode, agent_id=agent['id'])
if agent_mode == constants.L3_AGENT_MODE_DVR and is_distributed:
raise l3agentscheduler.DVRL3CannotAssignToDvrAgent(
router_type=router_type, router_id=router['id'],
agent_id=agent['id'])
is_suitable_agent = (
agentschedulers_db.services_available(agent['admin_state_up']) and
(self.get_l3_agent_candidates(context, router,
[agent],
ignore_admin_state=True) or
self.get_snat_candidates(router, [agent]))
)
if not is_suitable_agent:
raise l3agentscheduler.InvalidL3Agent(id=agent['id'])
开发者ID:punithks,项目名称:neutron,代码行数:41,代码来源:l3_agentschedulers_db.py
示例7: validate_agent_router_combination
def validate_agent_router_combination(self, context, agent, router):
"""Validate if the router can be correctly assigned to the agent.
:raises: RouterL3AgentMismatch if attempting to assign DVR router
to legacy agent, or centralized router to compute's L3 agents.
:raises: InvalidL3Agent if attempting to assign router to an
unsuitable agent (disabled, type != L3, incompatible configuration)
:raises: DVRL3CannotAssignToDvrAgent if attempting to assign DVR
router from one DVR Agent to another.
"""
is_distributed = router.get("distributed")
agent_conf = self.get_configuration_dict(agent)
agent_mode = agent_conf.get(constants.L3_AGENT_MODE, constants.L3_AGENT_MODE_LEGACY)
router_type = "distributed" if is_distributed else "centralized"
is_agent_router_types_incompatible = (
agent_mode == constants.L3_AGENT_MODE_DVR
and not is_distributed
or agent_mode == constants.L3_AGENT_MODE_LEGACY
and is_distributed
)
if is_agent_router_types_incompatible:
raise l3agentscheduler.RouterL3AgentMismatch(
router_type=router_type, router_id=router["id"], agent_mode=agent_mode, agent_id=agent["id"]
)
if agent_mode == constants.L3_AGENT_MODE_DVR and is_distributed:
raise l3agentscheduler.DVRL3CannotAssignToDvrAgent(
router_type=router_type, router_id=router["id"], agent_id=agent["id"]
)
is_wrong_type_or_unsuitable_agent = (
agent["agent_type"] != constants.AGENT_TYPE_L3
or not agentschedulers_db.services_available(agent["admin_state_up"])
or not self.get_l3_agent_candidates(context, router, [agent], ignore_admin_state=True)
)
if is_wrong_type_or_unsuitable_agent:
raise l3agentscheduler.InvalidL3Agent(id=agent["id"])
开发者ID:cisco-openstack,项目名称:neutron,代码行数:37,代码来源:l3_agentschedulers_db.py
注:本文中的neutron.db.agentschedulers_db.services_available函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论