kolla-ansible 部署,网络使用 bond 子接口时,配置 rp_filter 错误
版本:
kolla-ansible:9.1.1.dev91
OpenStack:Train
整理后的错误信息
TASK [nova-cell : Setting sysctl values]
failed: [nicloud-compute22] (item={u'name': u'net.ipv4.conf.default.rp_filter', u'value': 0}) =>
{"ansible_loop_var": "item", "changed": false, "item":
{"name": "net.ipv4.conf.default.rp_filter", "value": 0},
"msg": "Failed to reload sysctl:
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.neigh.default.gc_thresh1 = 4096
net.ipv4.neigh.default.gc_thresh2 = 6144
net.ipv4.neigh.default.gc_thresh3 = 8192
net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.bond0.rp_filter = 0
net.ipv4.conf.bond1.rp_filter = 0
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.conf.default.rp_filter = 0
sysctl: cannot stat /proc/sys/net/ipv4/conf/bond0/601/rp_filter: No such file or directory
sysctl: cannot stat /proc/sys/net/ipv4/conf/bond0/602/rp_filter: No such file or directory
sysctl: cannot stat /proc/sys/net/ipv4/conf/bond0/605/rp_filter: No such file or directory
sysctl: cannot stat /proc/sys/net/ipv4/conf/bond1/603/rp_filter: No such file or directory
sysctl: cannot stat /proc/sys/net/ipv4/conf/bond1/604/rp_filter: No such file or directory"}
出现原因:Linux sysctl 命令对子接口进行配置时,会将 .
识别为 /
,导致配置失败。
解决办法:子接口相关配置手动执行,然后忽略该错误。
忽略方法:在kolla-ansible安装目录/usr/share/kolla-ansible/ansible/roles/nova-cell/tasks/config.yml
中为 - name: Setting sysctl values
任务添加 ignore_errors: yes
。
- name: Setting sysctl values
become: true
sysctl: name={{ item.name }} value={{ item.value }} sysctl_set=yes
with_items:
- { name: "net.bridge.bridge-nf-call-iptables", value: 1}
- { name: "net.bridge.bridge-nf-call-ip6tables", value: 1}
- { name: "net.ipv4.conf.all.rp_filter", value: "{{ nova_compute_host_rp_filter_mode }}"}
- { name: "net.ipv4.conf.default.rp_filter", value: "{{ nova_compute_host_rp_filter_mode }}"}
when:
- set_sysctl | bool
- inventory_hostname in groups[nova_cell_compute_group]
ignore_errors: yes