Commit 03b5e6a4 authored by Leigh B Stoller's avatar Leigh B Stoller
Browse files

Wrap the other call to iptables in a loop, to deal with stupid

resource locking issue that iptables should deal with, not me!
parent d2a1ee62
......@@ -394,9 +394,16 @@ if (safeLibOp($vnodeid,'vnodeConfigDevices',1,1,$vnodeid,$vmid)) {
if (exists($vnconfig{'SSHDPORT'}) && $vnconfig{'SSHDPORT'} ne "") {
my $sshdport = $vnconfig{'SSHDPORT'};
my $ctrlip = $vnconfig{'CTRLIP'};
system("$IPTABLES -v -t nat -A PREROUTING -p tcp -d $ext_ctrlip ".
"--dport $sshdport -j DNAT --to-destination $ctrlip:$sshdport");
# Retry a few times cause of iptables locking stupidity.
for (my $i = 0; $i < 5; $i++) {
system("$IPTABLES -v -t nat -A PREROUTING -p tcp -d $ext_ctrlip ".
"--dport $sshdport -j DNAT ".
"--to-destination $ctrlip:$sshdport");
last
if ($? == 0);
sleep(2);
}
}
#
......@@ -546,7 +553,7 @@ sub Cleanup()
my $ctrlip = $vnconfig{'CTRLIP'};
# Retry a few times cause of iptables locking stupidity.
for (my $i = 0; $i < 3; $i++) {
for (my $i = 0; $i < 5; $i++) {
system("$IPTABLES -v -t nat -D PREROUTING -p tcp -d $ext_ctrlip ".
"--dport $sshdport -j DNAT ".
"--to-destination $ctrlip:$sshdport");
......
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