Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Commit

Permalink
network: Wait for network device in UpdateInterface
Browse files Browse the repository at this point in the history
A new field PciAddr has been added to grpc.Interface.
This is the PCI identifier of the network device.

In order to support network hotplug, we need to wait for the
device to be online first based on the PCI address of the device
inside the VM before updating its configuration.

Fixes #305

Signed-off-by: Archana Shinde <[email protected]>
  • Loading branch information
amshinde committed Aug 28, 2018
1 parent 218ce89 commit 5e36bfc
Show file tree
Hide file tree
Showing 3 changed files with 213 additions and 147 deletions.
11 changes: 11 additions & 0 deletions network.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,19 @@ func (s *sandbox) updateInterface(netHandle *netlink.Handle, iface *pb.Interface
fieldLogger := agentLog.WithFields(logrus.Fields{
"mac-address": iface.HwAddr,
"interface-name": iface.Device,
"pci-address": iface.PciAddr,
})

// If the PCI address of the network device is provided, wait/check for the device
// to be available first
if iface.PciAddr != "" {
// iface.PciAddr is in the format bridgeAddr/deviceAddr eg. 05/06
_, err := getPCIDeviceName(s, iface.PciAddr)
if err != nil {
return nil, err
}
}

var link netlink.Link
if iface.HwAddr != "" {
fieldLogger.Info("Getting interface from MAC address")
Expand Down
Loading

0 comments on commit 5e36bfc

Please sign in to comment.