-
Notifications
You must be signed in to change notification settings - Fork 176
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
Add RootDevices selector #264
Add RootDevices selector #264
Conversation
/cc @ahalim-intel @martinkennelly @adrianchiris |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Just wondering if we can log error as well as sending them to stdout.
// in selector pool | ||
fields := strings.Split(selector, "#") | ||
if len(fields) != 2 { | ||
fmt.Printf("Failed to parse %s PF (name|address) selector, probably incorrect separator character usage\n", selector) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we start logging too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic was previously located at L#109 and was moved here so logic may be shared between selectors.
i think moving Printf()
calls to glog.<logging-call>()
is a welcomed addition, but should be in a separate PR IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will submit another PR to use glog.
@zshi-redhat is this work intended to support the VF use case? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting the patch @zshi-redhat , a couple of comments
pkg/netdevice/vhostNet.go
Outdated
@@ -8,7 +8,7 @@ import ( | |||
|
|||
// VhostNetDeviceExist returns true if /dev/vhost-net exists | |||
func VhostNetDeviceExist() bool { | |||
_, err := os.Stat("/dev/vhost-net"); | |||
_, err := os.Stat("/dev/vhost-net") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: unrelated change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change was merged in #263, I will rebase this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
// in selector pool | ||
fields := strings.Split(selector, "#") | ||
if len(fields) != 2 { | ||
fmt.Printf("Failed to parse %s PF (name|address) selector, probably incorrect separator character usage\n", selector) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic was previously located at L#109 and was moved here so logic may be shared between selectors.
i think moving Printf()
calls to glog.<logging-call>()
is a welcomed addition, but should be in a separate PR IMO
pkg/netdevice/pciNetDevice.go
Outdated
@@ -75,6 +80,7 @@ func NewPciNetDevice(dev *ghw.PCIDevice, rFactory types.ResourceFactory, rc *typ | |||
PciDevice: pciDev, | |||
ifName: ifName, | |||
pfName: pfName, | |||
pfAddr: pfAddr, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why was the attribute moved from types.PciDevice
?
pfAddr seems like a common attribute of an SR-IOV pci device and not limited to net device
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pfAddr
was in types.PciDevice
, but it was not populated or used by any other functions. I moved the pfAddr
to pciNetDevice
where pfName
is included.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pfName - represents the PF netdevice name so it makes sense for it to be in pciNetDevice
pfAddr - represents the device's PF PCI address if present (e.g for SR-IOV device) its a general PCI device attribute so it should really be part of PciDevice in my opinion regardless if its usage today.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adrianchiris do you have an example where we have a pfAddr, but not pfName?
I can move the pfAddr to pciDevice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general any PCI device that is not a network device has a PCI address but does not have a net device,
or even a PCI network device that is not bound to a network driver.
i understand that pfAddr
was not used outside the context of PciNetDevice
but having it in PciDevice
is in my opinion a better representation of the system.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ack, pfAddr
was moved to PciDevice
.
I wasn't intend to support VF use case as we already have the pciAddresses selector. |
3554d84
to
53e1ffc
Compare
Apologies - typo from me! I mean the VM use case. |
@killianmuldoon this is not intended to support VM case as rootDevices shall be used to specify PF PCI addresses, instead of VF PCI addresses. |
@@ -27,7 +27,7 @@ var _ = Describe("PoolStub", func() { | |||
fs = &utils.FakeFilesystem{ | |||
Dirs: []string{ | |||
"sys/bus/pci/devices/0000:00:00.1/net/enp2s0f1", | |||
"sys/bus/pci/devices/0000:00:00.1/physfn/net/enp2s0f0", | |||
"sys/bus/pci/devices/0000:01:00.0/net/enp2s0f0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: doesnt really affect the test, but should this point to a different netdev than the one on L#31 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! updated the pf/vf names.
Overall im LGTM :) |
764e0ef
to
66e5996
Compare
/LGTM - Thanks Zenghui. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
* Add rootDevices selector for netDevice * Add rootDevice unit tests * Update README for rootDevices selector * Move pfAddr in pciDevice
* Add rootDevices selector for netDevice * Add rootDevice unit tests * Update README for rootDevices selector * Move pfAddr in pciDevice
No description provided.