本文整理汇总了Python中neutron.common.utils.get_other_dvr_serviced_device_owners函数的典型用法代码示例。如果您正苦于以下问题:Python get_other_dvr_serviced_device_owners函数的具体用法?Python get_other_dvr_serviced_device_owners怎么用?Python get_other_dvr_serviced_device_owners使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_other_dvr_serviced_device_owners函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: get_ports_on_host_by_subnet
def get_ports_on_host_by_subnet(self, context, host, subnet):
"""Returns DVR serviced ports on a given subnet in the input host
This method returns ports that need to be serviced by DVR.
:param context: rpc request context
:param host: host id to match and extract ports of interest
:param subnet: subnet id to match and extract ports of interest
:returns list -- Ports on the given subnet in the input host
"""
filters = {'fixed_ips': {'subnet_id': [subnet]},
portbindings.HOST_ID: [host]}
ports_query = self.plugin._get_ports_query(context, filters=filters)
owner_filter = or_(
models_v2.Port.device_owner.startswith(
constants.DEVICE_OWNER_COMPUTE_PREFIX),
models_v2.Port.device_owner.in_(
utils.get_other_dvr_serviced_device_owners()))
ports_query = ports_query.filter(owner_filter)
ports = [
self.plugin._make_port_dict(port, process_extensions=False)
for port in ports_query.all()
]
LOG.debug("Returning list of dvr serviced ports on host %(host)s"
" for subnet %(subnet)s ports %(ports)s",
{'host': host, 'subnet': subnet,
'ports': ports})
return ports
开发者ID:21atlas,项目名称:neutron,代码行数:27,代码来源:dvr_mac_db.py
示例2: _check_dvr_serviceable_ports_on_host
def _check_dvr_serviceable_ports_on_host(self, context, host, subnet_ids):
"""Check for existence of dvr serviceable ports on host
:param context: request context
:param host: host to look ports on
:param subnet_ids: IDs of subnets to look ports on
:return: return True if dvr serviceable port exists on host,
otherwise return False
"""
# db query will return ports for all subnets if subnet_ids is empty,
# so need to check first
if not subnet_ids:
return False
core_plugin = manager.NeutronManager.get_plugin()
filters = {'fixed_ips': {'subnet_id': subnet_ids},
portbindings.HOST_ID: [host]}
ports_query = core_plugin._get_ports_query(context, filters=filters)
owner_filter = or_(
models_v2.Port.device_owner.startswith(
n_const.DEVICE_OWNER_COMPUTE_PREFIX),
models_v2.Port.device_owner.in_(
n_utils.get_other_dvr_serviced_device_owners()))
ports_query = ports_query.filter(owner_filter)
return ports_query.first() is not None
开发者ID:FedericoRessi,项目名称:neutron,代码行数:25,代码来源:l3_dvrscheduler_db.py
示例3: check_dvr_serviceable_ports_on_host
def check_dvr_serviceable_ports_on_host(
self, context, host, subnet_ids, except_port=None):
"""Check for existence of dvr serviceable ports on host
:param context: request context
:param host: host to look ports on
:param subnet_ids: IDs of subnets to look ports on
:param except_port: ID of the port to ignore (used when checking if
DVR router should be removed from host before actual port remove)
:return: return True if dvr serviceable port exists on host,
otherwise return False
"""
# db query will return ports for all subnets if subnet_ids is empty,
# so need to check first
if not subnet_ids:
return False
core_plugin = manager.NeutronManager.get_plugin()
filters = {'fixed_ips': {'subnet_id': subnet_ids},
portbindings.HOST_ID: [host]}
ports_query = core_plugin._get_ports_query(context, filters=filters)
owner_filter = or_(
models_v2.Port.device_owner.startswith(
constants.DEVICE_OWNER_COMPUTE_PREFIX),
models_v2.Port.device_owner.in_(
n_utils.get_other_dvr_serviced_device_owners()))
if except_port:
ports_query = ports_query.filter(models_v2.Port.id != except_port)
ports_query = ports_query.filter(owner_filter)
return ports_query.first() is not None
开发者ID:manjeetbhatia,项目名称:test_l3,代码行数:30,代码来源:l3_agentschedulers_db.py
示例4: _get_dvr_subnet_ids_on_host_query
def _get_dvr_subnet_ids_on_host_query(self, context, host):
query = context.session.query(
models_v2.IPAllocation.subnet_id).distinct()
query = query.join(models_v2.IPAllocation.port)
query = query.join(models_v2.Port.port_bindings)
query = query.filter(ml2_models.PortBinding.host == host)
owner_filter = or_(
models_v2.Port.device_owner.startswith(
n_const.DEVICE_OWNER_COMPUTE_PREFIX),
models_v2.Port.device_owner.in_(
n_utils.get_other_dvr_serviced_device_owners()))
query = query.filter(owner_filter)
return query
开发者ID:cubeek,项目名称:neutron,代码行数:13,代码来源:l3_dvrscheduler_db.py
示例5: _get_dvr_hosts_for_subnets
def _get_dvr_hosts_for_subnets(self, context, subnet_ids):
"""Get a list of hosts with DVR servicable ports on subnet_ids."""
Binding = ml2_models.PortBinding
Port = models_v2.Port
IPAllocation = models_v2.IPAllocation
query = context.session.query(Binding.host).distinct()
query = query.join(Binding.port)
query = query.join(Port.fixed_ips)
query = query.filter(IPAllocation.subnet_id.in_(subnet_ids))
owner_filter = or_(
Port.device_owner.startswith(n_const.DEVICE_OWNER_COMPUTE_PREFIX),
Port.device_owner.in_(
n_utils.get_other_dvr_serviced_device_owners()))
query = query.filter(owner_filter)
hosts = [item[0] for item in query]
return hosts
开发者ID:cubeek,项目名称:neutron,代码行数:17,代码来源:l3_dvrscheduler_db.py
示例6: _check_dvr_serviceable_ports_on_host
def _check_dvr_serviceable_ports_on_host(self, context, host, subnet_ids):
"""Check for existence of dvr serviceable ports on host
:param context: request context
:param host: host to look ports on
:param subnet_ids: IDs of subnets to look ports on
:return: return True if dvr serviceable port exists on host,
otherwise return False
"""
# db query will return ports for all subnets if subnet_ids is empty,
# so need to check first
if not subnet_ids:
return False
# The port binding profile filter for host performs a "contains"
# operation. This produces a LIKE expression targeting a sub-string
# match: column LIKE '%' || <host> || '%'.
# Add quotes to force an exact match of the host name in the port
# binding profile dictionary.
profile_host = "\"%s\"" % host
Binding = ml2_models.PortBinding
IPAllocation = models_v2.IPAllocation
Port = models_v2.Port
query = context.session.query(Binding)
query = query.join(Binding.port)
query = query.join(Port.fixed_ips)
query = query.filter(
IPAllocation.subnet_id.in_(subnet_ids))
query = query.filter(
ml2_models.PortBinding.status == n_const.ACTIVE)
device_filter = or_(
models_v2.Port.device_owner.startswith(
n_const.DEVICE_OWNER_COMPUTE_PREFIX),
models_v2.Port.device_owner.in_(
n_utils.get_other_dvr_serviced_device_owners()))
query = query.filter(device_filter)
host_filter = or_(
ml2_models.PortBinding.host == host,
ml2_models.PortBinding.profile.contains(profile_host))
query = query.filter(host_filter)
return query.first() is not None
开发者ID:openstack,项目名称:neutron,代码行数:43,代码来源:l3_dvrscheduler_db.py
示例7: check_ports_exist_on_l3agent
def check_ports_exist_on_l3agent(self, context, l3_agent, subnet_ids):
"""
This function checks for existence of dvr serviceable
ports on the host, running the input l3agent.
"""
# db query will return ports for all subnets if subnet_ids is empty,
# so need to check first
if not subnet_ids:
return False
core_plugin = manager.NeutronManager.get_plugin()
filters = {'fixed_ips': {'subnet_id': subnet_ids},
portbindings.HOST_ID: [l3_agent['host']]}
ports_query = core_plugin._get_ports_query(context, filters=filters)
owner_filter = or_(
models_v2.Port.device_owner.startswith(
constants.DEVICE_OWNER_COMPUTE_PREFIX),
models_v2.Port.device_owner.in_(
n_utils.get_other_dvr_serviced_device_owners()))
ports_query = ports_query.filter(owner_filter)
return ports_query.first() is not None
开发者ID:osic-neutron,项目名称:neutron,代码行数:21,代码来源:l3_agentschedulers_db.py
示例8: _get_dvr_hosts_for_router
def _get_dvr_hosts_for_router(self, context, router_id):
"""Get a list of hosts where specified DVR router should be hosted
It will first get IDs of all subnets connected to the router and then
get a set of hosts where all dvr serviceable ports on those subnets
are bound
"""
subnet_ids = self.get_subnet_ids_on_router(context, router_id)
Binding = ml2_models.PortBinding
Port = models_v2.Port
IPAllocation = models_v2.IPAllocation
query = context.session.query(Binding.host).distinct()
query = query.join(Binding.port)
query = query.join(Port.fixed_ips)
query = query.filter(IPAllocation.subnet_id.in_(subnet_ids))
owner_filter = or_(
Port.device_owner.startswith(n_const.DEVICE_OWNER_COMPUTE_PREFIX),
Port.device_owner.in_(
n_utils.get_other_dvr_serviced_device_owners()))
query = query.filter(owner_filter)
hosts = [item[0] for item in query]
LOG.debug('Hosts for router %s: %s', router_id, hosts)
return hosts
开发者ID:RustShen,项目名称:neutron,代码行数:24,代码来源:l3_dvrscheduler_db.py
注:本文中的neutron.common.utils.get_other_dvr_serviced_device_owners函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论