本文整理汇总了Python中neutron.common.utils.compare_elements函数的典型用法代码示例。如果您正苦于以下问题:Python compare_elements函数的具体用法?Python compare_elements怎么用?Python compare_elements使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了compare_elements函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: update_security_group_on_port
def update_security_group_on_port(self, context, id, port,
original_port, updated_port):
"""Update security groups on port.
This method returns a flag which indicates request notification
is required and does not perform notification itself.
It is because another changes for the port may require notification.
"""
need_notify = False
port_updates = port['port']
if (ext_sg.SECURITYGROUPS in port_updates and
not utils.compare_elements(
original_port.get(ext_sg.SECURITYGROUPS),
port_updates[ext_sg.SECURITYGROUPS])):
# delete the port binding and read it with the new rules
port_updates[ext_sg.SECURITYGROUPS] = (
self._get_security_groups_on_port(context, port))
self._delete_port_security_group_bindings(context, id)
self._process_port_create_security_group(
context,
updated_port,
port_updates[ext_sg.SECURITYGROUPS])
need_notify = True
else:
updated_port[ext_sg.SECURITYGROUPS] = (
original_port[ext_sg.SECURITYGROUPS])
return need_notify
开发者ID:Lily913,项目名称:neutron,代码行数:27,代码来源:securitygroups_db.py
示例2: update_port
def update_port(self, context, port_id, port):
original_port = self.get_port(context, port_id)
session = context.session
port_updated = False
with session.begin(subtransactions=True):
# delete the port binding and read it with the new rules
if ext_sg.SECURITYGROUPS in port['port']:
port['port'][ext_sg.SECURITYGROUPS] = (
self._get_security_groups_on_port(context, port))
self._delete_port_security_group_bindings(context, port_id)
# process_port_create_security_group also needs port id
port['port']['id'] = port_id
self._process_port_create_security_group(
context,
port['port'],
port['port'][ext_sg.SECURITYGROUPS])
port_updated = True
port = super(BrocadePluginV2, self).update_port(
context, port_id, port)
if original_port['admin_state_up'] != port['admin_state_up']:
port_updated = True
if (original_port['fixed_ips'] != port['fixed_ips'] or
not utils.compare_elements(
original_port.get(ext_sg.SECURITYGROUPS),
port.get(ext_sg.SECURITYGROUPS))):
self.notifier.security_groups_member_updated(
context, port.get(ext_sg.SECURITYGROUPS))
if port_updated:
self._notify_port_updated(context, port)
return self._extend_port_dict_binding(context, port)
开发者ID:Brocade-OpenSource,项目名称:OpenStack-DNRM-Neutron,代码行数:35,代码来源:NeutronPlugin.py
示例3: check_and_notify_security_group_member_changed
def check_and_notify_security_group_member_changed(self, context, original_port, updated_port):
sg_change = not utils.compare_elements(
original_port.get(ext_sg.SECURITYGROUPS), updated_port.get(ext_sg.SECURITYGROUPS)
)
if sg_change:
self.notify_security_groups_member_updated_bulk(context, [original_port, updated_port])
elif original_port["fixed_ips"] != updated_port["fixed_ips"]:
self.notify_security_groups_member_updated(context, updated_port)
开发者ID:FedericoRessi,项目名称:neutron,代码行数:8,代码来源:securitygroups_rpc_base.py
示例4: is_security_group_member_updated
def is_security_group_member_updated(self, context, original_port, updated_port):
"""Check security group member updated or not.
This method returns a flag which indicates request notification
is required and does not perform notification itself.
It is because another changes for the port may require notification.
"""
need_notify = False
if original_port["fixed_ips"] != updated_port["fixed_ips"] or not utils.compare_elements(
original_port.get(ext_sg.SECURITYGROUPS), updated_port.get(ext_sg.SECURITYGROUPS)
):
need_notify = True
return need_notify
开发者ID:kongseokhwan,项目名称:kulcloud-neutron,代码行数:13,代码来源:securitygroups_rpc_base.py
示例5: is_address_pairs_attribute_updated
def is_address_pairs_attribute_updated(self, port, update_attrs):
"""Check if the address pairs attribute is being updated.
This method returns a flag which indicates whether there is an update
and therefore a port update notification should be sent to agents or
third party controllers.
"""
new_pairs = update_attrs.get(addr_pair.ADDRESS_PAIRS)
if new_pairs and not utils.compare_elements(
port.get(addr_pair.ADDRESS_PAIRS), new_pairs):
return True
# Missing or unchanged address pairs in attributes mean no update
return False
开发者ID:ChengZuo,项目名称:neutron,代码行数:13,代码来源:allowedaddresspairs_db.py
注:本文中的neutron.common.utils.compare_elements函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论