hsci: fix failed to delete an HSCI connected with VLAN

Deleting an HSCI interface, the connected HiperSockets interface's name
and the connected Ethernet interface's name are extracted from "ip link
show". Currently the extracted names are directly used in "bridge -d link
show dev ifname" for further checking. If "iflink" and "ifindex" of an
interface are not matched, ip commands will print @ifXX appended to the
real interface's name. Thus, it will be failed if the interface's name
with the ending @ifXX is used in "bridge -d link show dev ifname" for
further checking.

To solve the problem, the ending @ifXX must be removed before the
interface name is used further.

Signed-off-by: Wenjia Zhang <wenjia@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Wenjia Zhang
2021-01-22 08:57:35 +01:00
committed by Jan Höppner
parent 522252d18a
commit faf26220a7

View File

@@ -303,10 +303,14 @@ function del_hsci {
bports="$(ip link show | grep "master $hsci" | awk '{print $2}')"
for bport in $bports; do
bport=${bport%:}
if [[ $bport == *@* ]]; then
bport=${bport%@*}
fi
if [ $(bridge -d link show dev $bport | grep "learning_sync on" | wc -l) -ne 0 ]; then
hsdev=${bport%:}
hsdev=$bport
else
ndev=${bport%:}
ndev=$bport
fi
done
if [ "$hsdev" == "" ]; then