在创建端口之前,需要更新端口信息。在这种情况下,如图片所示,将报告错误。
中子的cmd是“中子端口创建net-id”
在对日志进行故障排除时,我发现代码逻辑是在创建之前进行更新,就像其他人一样。
if port.get('fixed_ips') and sg_ids:
addresses = ovn_acl.acl_port_ips(port)
# NOTE(rtheis): Fail port creation if the address set doesn't
# exist. This prevents ports from being created on any security
# groups out-of-sync between neutron and OVN.
for sg_id in sg_ids:
for ip_version in addresses:
if addresses[ip_version]:
txn.add(self._nb_idl.update_address_set(
name=utils.ovn_addrset_name(sg_id,
ip_version),
addrs_add=addresses[ip_version],
addrs_remove=None,
if_exists=False))
代码路径为/usr/lib/python2.7/site-packages/networking_ovn/common/ovn_clinet.py
当我将'if_exists'的值更改为True时,一切都会好起来的。
像这样的错误
File "/usr/lib/python2.7/site-packages/ovsdbapp/backend/ovs_idl/connection.py", line 97, in run
txn.results.put(txn.do_commit())
File "/usr/lib/python2.7/site-packages/ovsdbapp/backend/ovs_idl/transaction.py", line 86, in do_commit
command.run_idl(txn)
File "/usr/lib/python2.7/site-packages/networking_ovn/ovsdb/commands.py", line 725, in run_idl
raise RuntimeError(msg)
RuntimeError: Address set as_ip4_b5dbdfe6_bcd3_4e39_b43a_0c37c66ccb54 does not exist. Can't update addresses