Commit 642d15f8 authored by David Johnson's avatar David Johnson

Fix nasty bugs in failed docker rootPreConfigNetwork error dealloc.

parent 533e1714
...@@ -2735,10 +2735,13 @@ sub rootPreConfigNetwork($$$$) ...@@ -2735,10 +2735,13 @@ sub rootPreConfigNetwork($$$$)
# of any other macvlan devices). # of any other macvlan devices).
if (exists($private->{'vlandevs'})) { if (exists($private->{'vlandevs'})) {
foreach my $brname (keys(%{ $private->{'vlandevs'} })) { foreach my $brname (keys(%{ $private->{'vlandevs'} })) {
my $brv = getBridgeForIface($private->{'dummys'}->{$brname}); my $viface = $private->{'vlandevs'}->{$brname};
my @mvs = getMacvlanIfaces($private->{'dummys'}->{$brname}); next
if (!defined($viface));
my $brv = getBridgeForIface($viface);
my @mvs = getMacvlanIfaces($viface);
if (!defined($brv) && @mvs == 0) { if (!defined($brv) && @mvs == 0) {
mysystem2("$IP link del dev $brname"); mysystem2("$IP link del dev $viface");
delete($private->{'vlandevs'}->{$brname}) delete($private->{'vlandevs'}->{$brname})
if ($?); if ($?);
} }
...@@ -4213,10 +4216,13 @@ sub vnodeDestroy($$$$) ...@@ -4213,10 +4216,13 @@ sub vnodeDestroy($$$$)
# of any other macvlan devices). # of any other macvlan devices).
if (exists($private->{'vlandevs'})) { if (exists($private->{'vlandevs'})) {
foreach my $brname (keys(%{ $private->{'vlandevs'} })) { foreach my $brname (keys(%{ $private->{'vlandevs'} })) {
my $brv = getBridgeForIface($private->{'dummys'}->{$brname}); my $viface = $private->{'vlandevs'}->{$brname};
my @mvs = getMacvlanIfaces($private->{'dummys'}->{$brname}); next
if (!defined($viface));
my $brv = getBridgeForIface($viface);
my @mvs = getMacvlanIfaces($viface);
if (!defined($brv) && @mvs == 0) { if (!defined($brv) && @mvs == 0) {
mysystem2("$IP link del dev $brname"); mysystem2("$IP link del dev $viface");
delete($private->{'vlandevs'}->{$brname}) delete($private->{'vlandevs'}->{$brname})
if ($?); if ($?);
} }
......
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