Commit c7fbae28 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

kvm: use 'ip' command instead of 'ifconfig' which is deprecated

parent 8aaf82a9
...@@ -19,7 +19,7 @@ md5sum = 028b6a6456d744c11b1bb2c51ecd51b2 ...@@ -19,7 +19,7 @@ md5sum = 028b6a6456d744c11b1bb2c51ecd51b2
[template-kvm] [template-kvm]
filename = instance-kvm.cfg.jinja2 filename = instance-kvm.cfg.jinja2
md5sum = c79448a49b1b3dc6e757b90f497c7be1 md5sum = 12a99227828e834d97ee0c68246c467c
[template-kvm-cluster] [template-kvm-cluster]
filename = instance-kvm-cluster.cfg.jinja2.in filename = instance-kvm-cluster.cfg.jinja2.in
......
...@@ -498,16 +498,15 @@ ipv6-network-info = ...@@ -498,16 +498,15 @@ ipv6-network-info =
recipe = plone.recipe.command recipe = plone.recipe.command
filename = netconfig.sh filename = netconfig.sh
path = ${directory:public}/${:filename} path = ${directory:public}/${:filename}
ifconfig = ifconfig \$IFACE {{ slap_configuration.get('tap-ipv4-addr') }} netmask {{ slap_configuration.get('tap-ipv4-netmask') }} ipv4-add-address = ip -4 address add {{ slap_configuration.get('tap-ipv4-addr') }}/{{ slap_configuration.get('tap-ipv4-netmask') }} dev \$IFACE
route-iface = route add {{ slap_configuration.get('tap-ipv4-gateway') }} dev \$IFACE
route-network = route add -net {{ slap_configuration.get('tap-ipv4-network') }} netmask {{ slap_configuration.get('tap-ipv4-netmask') }} gw {{ slap_configuration.get('tap-ipv4-gateway') }}
{% if nat_restrict == 'true' -%} {% if nat_restrict == 'true' -%}
route-default = route add default gw {{ slap_configuration.get('tap-ipv4-gateway') }} dev \$IFACE ipv4-add-default-route = ip route add default via {{ slap_configuration.get('tap-ipv4-gateway') }} dev \$IFACE
{% elif global_ipv4_prefix -%} {% elif global_ipv4_prefix -%}
route-default = ip route add {{ global_ipv4_prefix }} via {{ slap_configuration.get('tap-ipv4-gateway') }} dev \$IFACE src {{ slap_configuration.get('tap-ipv4-addr') }} ipv4-add-default-route = ip route add {{ global_ipv4_prefix }} via {{ slap_configuration.get('tap-ipv4-gateway') }} dev \$IFACE src {{ slap_configuration.get('tap-ipv4-addr') }}
{% else -%} {% else -%}
route-default = ipv4-add-default-route =
{% endif -%} {% endif -%}
ipv4-set-link-up = ip link set dev \$IFACE up
command = command =
cat > ${:path} << EOF cat > ${:path} << EOF
#!/bin/sh #!/bin/sh
...@@ -515,10 +514,9 @@ command = ...@@ -515,10 +514,9 @@ command =
#try to be compatible with OS with old names #try to be compatible with OS with old names
ip a | grep eth0: && [ \$IFACE = ens3 ] && IFACE=eth0 ip a | grep eth0: && [ \$IFACE = ens3 ] && IFACE=eth0
ip a | grep eth1: && [ \$IFACE = ens4 ] && IFACE=eth1 ip a | grep eth1: && [ \$IFACE = ens4 ] && IFACE=eth1
${:ifconfig} ${:ipv4-add-address}
${:route-iface} ${:ipv4-add-default-route}
${:route-network} ${:ipv4-set-link-up}
${:route-default}
EOF EOF
update-command = ${:command} update-command = ${:command}
{% endif -%} {% endif -%}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment