Skip to content

Commit

Permalink
vCenter: Fix ContrailVM interface names
Browse files Browse the repository at this point in the history
- Fix involves - not executing /firstboot at ContrailVM creation,
  this will result in the following names for the ContrailVM

                mgmt      ctrl-data    vmware_physical_intf

single-intf     ens160    --           ens192

multi-intf      ens160    ens192       ens224
(ctrl-data)

multi-intf      ens160    ens192       ens224
(pci/sriov)

  This change is done and saved in the ContrailVM vmdk.

- When finding vmware_physical_interface, exclude PCI/SRIOV
  interfaces (driver_type should be vmxnet3)

Change-Id: Iffed0cd9125cd98e5b232ce30428f3ece6a19986
Closes-Bug: #1781121
  • Loading branch information
Amudha committed Aug 10, 2018
1 parent 49e3600 commit 22259f0
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions containers/vrouter/base/agent-functions.sh
Expand Up @@ -181,9 +181,10 @@ function get_physical_nic_and_mac()
}

# Find the overlay interface on a ContrailVM
# ContrailVM is spawned with nic ens160, which is the primary interface
# ContrailVM is spawned with nic ens160, which is the primary/mgmt interface
# Secondary nics (like ens192, ens224) are added during provisioning
# The overlay interface will have name ens* and not have inet* configured
# The overlay interface will have name ens*, be of type vmxnet3
# and not have inet address configured
# This function uses this logic to find the overlay interface and
# return as vmware_physical_interface.
function get_vmware_physical_iface() {
Expand All @@ -192,11 +193,16 @@ function get_vmware_physical_iface() {
local iface_list=`ip -o link show | awk -F': ' '{print $2}'`
iface_list=`echo "$iface_list" | grep ens`
for iface in $iface_list; do
ip addr show dev $iface | grep 'inet ' > /dev/null 2>&1
if [[ $? == 0 ]]; then
continue;
local intf_type=`ethtool -i $iface | grep driver | cut -f 2 -d ' '`
if [[ $intf_type != "vmxnet3" ]]; then
continue;
else
vmware_int=$iface
ip addr show dev $iface | grep 'inet ' > /dev/null 2>&1
if [[ $? == 0 ]]; then
continue;
else
vmware_int=$iface
fi
fi
done
if [[ "$vmware_int" == '' ]]; then
Expand Down

0 comments on commit 22259f0

Please sign in to comment.