Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

host-device: add pciBusID property #300

Merged

Conversation

zshi-redhat
Copy link
Contributor

Fixes #253

@zshi-redhat zshi-redhat force-pushed the host-device-pci-parameter branch from 56f972c to acde1c6 Compare April 18, 2019 06:04
* `device`: The device name, e.g. `eth0`, `can0`
* `hwaddr`: A MAC address
* `kernelpath`: The kernel device kobj, e.g. `/sys/devices/pci0000:00/0000:00:1f.6`
* `deviceID`: A PCI address of network device, e.g `0000:00:1f.6`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • how about PCIBusID instead of deviceID?
  • you also mention that the parameter is optional, not required one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@s1061123 I didn't mark the deviceID as optional because it's similar to other existing options, such as hwaddr, device and kernelpath; at least one of these four options need to be provided.
Re the name of deviceID, I give a second thought on it and maybe it should not be changed as that's the name used by device plugin framework which in some cases might be referred with a different meaning other than PCI.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In above example, deviceID in k8s sometimes uses other than PCI address. So user may confuse if we name 'PCIBusID' as 'deviceID'. This plugin, host-local plugin is for host local device, not only for PCI also USB (i.e. USB network adapter) as well as other bus, so we should give appropriate name for that.

Copy link
Contributor Author

@zshi-redhat zshi-redhat Apr 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, fair enough, updated a new version with pciBusID. Thanks @s1061123

@@ -38,12 +39,17 @@ import (
bv "github.com/containernetworking/plugins/pkg/utils/buildversion"
)

const (
sysBusPci = "/sys/bus/pci/devices"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

if err != nil {
return nil, fmt.Errorf("failed to read net directory %s: %q", netDir, err)
}
return netlink.LinkByName(fInfo[0].Name())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no check if this list has at least single entry. I'm not sure if this directory can be empty, but if it's possible - code will panic there. If you are sure that it has to have at least a single entry - just leave a comment about that there in code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added check for fInfo and return netlink by name when fInfo list larger than 0.

@zshi-redhat zshi-redhat force-pushed the host-device-pci-parameter branch from acde1c6 to 90b44d9 Compare April 25, 2019 02:23
@zshi-redhat
Copy link
Contributor Author

@squeed @dcbw PTAL?

@zshi-redhat zshi-redhat force-pushed the host-device-pci-parameter branch from 90b44d9 to 79b1c40 Compare April 25, 2019 04:18
Copy link
Contributor

@s1061123 s1061123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks!

zshi-redhat added a commit to zshi-redhat/multus-cni that referenced this pull request Apr 25, 2019
This allows host-device plugin to recognize
Device PCI address passed from Multus.
It is related to the change in host-device which
enables use of device pci address as a config option:
containernetworking/plugins#300
Copy link
Member

@jellonek jellonek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@zshi-redhat zshi-redhat changed the title host-device: add deviceID property host-device: add pciBusID property Apr 25, 2019
@squeed squeed added this to the v0.8.x milestone May 15, 2019
dougbtv pushed a commit to k8snetworkplumbingwg/multus-cni that referenced this pull request May 16, 2019
This allows host-device plugin to recognize
Device PCI address passed from Multus.
It is related to the change in host-device which
enables use of device pci address as a config option:
containernetworking/plugins#300
Copy link
Member

@dcbw dcbw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@dcbw dcbw merged commit e308211 into containernetworking:master May 29, 2019
dougbtv pushed a commit to k8snetworkplumbingwg/multus-cni that referenced this pull request May 31, 2019
This allows host-device plugin to recognize
Device PCI address passed from Multus.
It is related to the change in host-device which
enables use of device pci address as a config option:
containernetworking/plugins#300
dougbtv pushed a commit to dougbtv/multus-cni-1 that referenced this pull request May 31, 2019
This allows host-device plugin to recognize
Device PCI address passed from Multus.
It is related to the change in host-device which
enables use of device pci address as a config option:
containernetworking/plugins#300
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

host-device: specify device with pci address
5 participants