1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-21 14:50:08 +03:00

M #-: nodeport post needs deactivate (#1237)

When resuming a VM powered-off from guest OS (and it is monitored as
powered-off by the OpenNebula monitor), it fails because 'ip route add'
fails when an already existing route is configured. If 'ip route add' is
changed by 'ip route replace' (idempotent) the problem is solved;
however, duplicated iptables rules are added. Therefore, to have this
working for all scenarios a deactivate is called on driver to clean the
VM route and the all the iptables rules previos to the call to activate.

Signed-off-by: Ricardo Diaz <rdiaz@opennebula.io>
(cherry picked from commit cc2ae9ef7bb54b30a9480dd4f56cd7d59286af03)
This commit is contained in:
Ricardo Diaz 2021-05-20 12:21:34 +02:00 committed by Ruben S. Montero
parent 6a5eaaaa3e
commit 0c170ea135
No known key found for this signature in database
GPG Key ID: A0CEA6FA880A1D87
2 changed files with 5 additions and 2 deletions

View File

@ -100,9 +100,9 @@ class NodePortDriver < VNMMAD::VNMDriver
"#{nic[:bridge]} | true"
cmds.add :iptables, '-t nat -D PREROUTING -p tcp --dport ' \
"#{nic[:external_port_range]} -j DNAT --to " \
"#{nic[:ip]}:#{nic[:internal_port_range]}"
"#{nic[:ip]}:#{nic[:internal_port_range]} | true"
cmds.add :iptables, '-t nat -D POSTROUTING -j MASQUERADE ' \
"-s #{nic[:ip]}"
"-s #{nic[:ip]} | true"
end
if rc != false

View File

@ -31,6 +31,9 @@ begin
xpath_filter,
deploy_id,
false)
drv.deactivate
filter_driver.activate(true) if drv.activate == 0
rescue Exception => e
OpenNebula.log_error(e.message)