Skip to contentSkip to conversation

hotplug/Linux: Add --wait to iptables calls.

RFC PATCH In review Anthony PERARD 4 participants 6 messages Jun 1, 2015

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 hotplug/Linux: Add --wait to iptables calls.

This help to avoid guest creation error when a downstream project is also updating the iptables at guest creation time.

The error seen is this one:
libxl: error: libxl_exec.c:118:libxl_report_child_exitstatus:
/etc/xen/scripts/vif-bridge online [-1] exited with error status 4

Apparently, exit status 4 could be a try again error.

---

This error is seen while using OpenStack with nova-network service running (instead of Neutron). OpenStack is updating the iptables with iptables-save and iptables-restore.

The status 4 error also happend at guest shutdown time (with vif-bridge offline ...) and it appear to happen more often, but that not an issue since the guest is been destroy.

Host: Ubuntu 14.04 (which have Xen 4.4)

---
 tools/hotplug/Linux/vif-common.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/hotplug/Linux/vif-common.sh +2 -2
index fa0a18e..5780343 100644
@@ -130,9 +130,9 @@ frob_iptable()
     local c="-D"
   fi
 
-  iptables "$c" FORWARD -m physdev --physdev-is-bridged --physdev-in "$dev" \
+  iptables --wait "$c" FORWARD -m physdev --physdev-is-bridged --physdev-in "$dev" \
     "$@" -j ACCEPT 2>/dev/null &&
-  iptables "$c" FORWARD -m physdev --physdev-is-bridged --physdev-out "$dev" \
+  iptables --wait "$c" FORWARD -m physdev --physdev-is-bridged --physdev-out "$dev" \
     -j ACCEPT 2>/dev/null
 
   if [ \( "$command" == "online" -o "$command" == "add" \) -a $? -ne 0 ]
Signature · 1 line
Anthony PERARD
#1 lore raw
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 01.06.15 at 16:59, <[email protected]> wrote:
tools/hotplug/Linux/vif-common.sh +0 -0
@@ -130,9 +130,9 @@ frob_iptable()
     local c="-D"

tools/hotplug/Linux/vif-common.sh frob_iptable() · line 138

Quoted 10 lines
tools/hotplug/Linux/vif-common.sh +2 -2
   fi
 
-  iptables "$c" FORWARD -m physdev --physdev-is-bridged --physdev-in "$dev" \
+  iptables --wait "$c" FORWARD -m physdev --physdev-is-bridged --physdev-in "$dev" \
     "$@" -j ACCEPT 2>/dev/null &&
-  iptables "$c" FORWARD -m physdev --physdev-is-bridged --physdev-out "$dev" \
+  iptables --wait "$c" FORWARD -m physdev --physdev-is-bridged --physdev-out "$dev" \
     -j ACCEPT 2>/dev/null
 
   if [ \( "$command" == "online" -o "$command" == "add" \) -a $? -ne 0 ]

Looking at my oldest system's "iptables --help" I can't spot such an option (which doesn't necessarily mean it's not supported). Did you make sure all (older) distros we care about actually support this?

Jan

#2 lore raw
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 01.06.15 at 16:59, <[email protected]> wrote:
tools/hotplug/Linux/vif-common.sh +2 -2
@@ -130,9 +130,9 @@ frob_iptable()
     local c="-D"
   fi
 
-  iptables "$c" FORWARD -m physdev --physdev-is-bridged --physdev-in "$dev" \
+  iptables --wait "$c" FORWARD -m physdev --physdev-is-bridged --physdev-in "$dev" \
     "$@" -j ACCEPT 2>/dev/null &&
-  iptables "$c" FORWARD -m physdev --physdev-is-bridged --physdev-out "$dev" \
+  iptables --wait "$c" FORWARD -m physdev --physdev-is-bridged --physdev-out "$dev" \
     -j ACCEPT 2>/dev/null
 
Quoted 5 lines

tools/hotplug/Linux/vif-common.sh frob_iptable() · line 138

Quoted 1 line
tools/hotplug/Linux/vif-common.sh +0 -0
   if [ \( "$command" == "online" -o "$command" == "add" \) -a $? -ne 0 ]

Looking at my oldest system's "iptables --help" I can't spot such an option (which doesn't necessarily mean it's not supported). Did you make sure all (older) distros we care about actually support this?

It's not really clear if/why --wait is the solution to the problem of another party using iptables-{save,restore} to do their own network management in the first place.

If OpenStack is doing save/modify/restore then what stops us rewriting things in the middle and then getting those changes clobbered on restore? Surely iptables-save can't exit holding the lock...

And if nova-network is managing networking do we really need to do it too?

Ian.

#3 lore raw
Quoted 15 lines · Ian Campbell
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 01.06.15 at 16:59, <[email protected]> wrote:
tools/hotplug/Linux/vif-common.sh +2 -2
@@ -130,9 +130,9 @@ frob_iptable()
     local c="-D"
   fi
 
-  iptables "$c" FORWARD -m physdev --physdev-is-bridged --physdev-in "$dev" \
+  iptables --wait "$c" FORWARD -m physdev --physdev-is-bridged --physdev-in "$dev" \
     "$@" -j ACCEPT 2>/dev/null &&
-  iptables "$c" FORWARD -m physdev --physdev-is-bridged --physdev-out "$dev" \
+  iptables --wait "$c" FORWARD -m physdev --physdev-is-bridged --physdev-out "$dev" \
     -j ACCEPT 2>/dev/null
 
Quoted 5 lines
Quoted 5 lines

tools/hotplug/Linux/vif-common.sh frob_iptable() · line 138

Quoted 1 line
tools/hotplug/Linux/vif-common.sh +0 -0
   if [ \( "$command" == "online" -o "$command" == "add" \) -a $? -ne 0 ]

Looking at my oldest system's "iptables --help" I can't spot such an option (which doesn't necessarily mean it's not supported). Did you make sure all (older) distros we care about actually support this?

--wait does not appear work on a debian weezy (Debian 7.8).

Quoted 7 lines

It's not really clear if/why --wait is the solution to the problem of another party using iptables-{save,restore} to do their own network management in the first place.

If OpenStack is doing save/modify/restore then what stops us rewriting things in the middle and then getting those changes clobbered on restore? Surely iptables-save can't exit holding the lock...

That could be an issue.

Quoted 2 lines

And if nova-network is managing networking do we really need to do it too?

I will investigate in that, check what there are doing, and what we are doing. The solution might just be a script=none.

Signature · 1 line
Anthony PERARD
#4 lore raw
Quoted 32 lines · Anthony PERARD
Quoted 15 lines · Ian Campbell
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 01.06.15 at 16:59, <[email protected]> wrote:
tools/hotplug/Linux/vif-common.sh +2 -2
@@ -130,9 +130,9 @@ frob_iptable()
     local c="-D"
   fi
 
-  iptables "$c" FORWARD -m physdev --physdev-is-bridged --physdev-in "$dev" \
+  iptables --wait "$c" FORWARD -m physdev --physdev-is-bridged --physdev-in "$dev" \
     "$@" -j ACCEPT 2>/dev/null &&
-  iptables "$c" FORWARD -m physdev --physdev-is-bridged --physdev-out "$dev" \
+  iptables --wait "$c" FORWARD -m physdev --physdev-is-bridged --physdev-out "$dev" \
     -j ACCEPT 2>/dev/null
 
Quoted 5 lines
Quoted 5 lines

tools/hotplug/Linux/vif-common.sh frob_iptable() · line 138

Quoted 1 line
tools/hotplug/Linux/vif-common.sh +0 -0
   if [ \( "$command" == "online" -o "$command" == "add" \) -a $? -ne 0 ]

Looking at my oldest system's "iptables --help" I can't spot such an option (which doesn't necessarily mean it's not supported). Did you make sure all (older) distros we care about actually support this?

--wait does not appear work on a debian weezy (Debian 7.8).

Quoted 7 lines

It's not really clear if/why --wait is the solution to the problem of another party using iptables-{save,restore} to do their own network management in the first place.

If OpenStack is doing save/modify/restore then what stops us rewriting things in the middle and then getting those changes clobbered on restore? Surely iptables-save can't exit holding the lock...

Quoted 8 lines

That could be an issue.

Quoted 2 lines

And if nova-network is managing networking do we really need to do it too?

I will investigate in that, check what there are doing, and what we are doing. The solution might just be a script=none.

This makes sense. If OpenStack wants to be in charge of network topology libxl probably don't want to mess with that.

There is a field called script in libxl_device_nic, in case you're wondering how to pass that information to libxl.

Wei.

Quoted 2 lines
Signature · 1 line
Anthony PERARD
#5 lore raw
In reply to Anthony PERARD
Quoted 32 lines · Anthony PERARD
Quoted 15 lines · Ian Campbell
Quoted 14 lines · Jan Beulich
Quoted 14 lines
Quoted 1 line
Quoted 1 line · On 01.06.15 at 16:59, <[email protected]> wrote:
tools/hotplug/Linux/vif-common.sh +2 -2
@@ -130,9 +130,9 @@ frob_iptable()
     local c="-D"
   fi
 
-  iptables "$c" FORWARD -m physdev --physdev-is-bridged --physdev-in "$dev" \
+  iptables --wait "$c" FORWARD -m physdev --physdev-is-bridged --physdev-in "$dev" \
     "$@" -j ACCEPT 2>/dev/null &&
-  iptables "$c" FORWARD -m physdev --physdev-is-bridged --physdev-out "$dev" \
+  iptables --wait "$c" FORWARD -m physdev --physdev-is-bridged --physdev-out "$dev" \
     -j ACCEPT 2>/dev/null
 
Quoted 5 lines
Quoted 5 lines

tools/hotplug/Linux/vif-common.sh frob_iptable() · line 138

Quoted 1 line
tools/hotplug/Linux/vif-common.sh +0 -0
   if [ \( "$command" == "online" -o "$command" == "add" \) -a $? -ne 0 ]

Looking at my oldest system's "iptables --help" I can't spot such an option (which doesn't necessarily mean it's not supported). Did you make sure all (older) distros we care about actually support this?

--wait does not appear work on a debian weezy (Debian 7.8).

Quoted 7 lines

It's not really clear if/why --wait is the solution to the problem of another party using iptables-{save,restore} to do their own network management in the first place.

If OpenStack is doing save/modify/restore then what stops us rewriting things in the middle and then getting those changes clobbered on restore? Surely iptables-save can't exit holding the lock...

Quoted 7 lines

That could be an issue.

Quoted 2 lines

And if nova-network is managing networking do we really need to do it too?

I will investigate in that, check what there are doing, and what we are doing. The solution might just be a script=none.

Or script=nova-network even.

Ian.