Skip to content

Comments

Implement device-info-spec in app-netutil#24

Merged
zshi-redhat merged 6 commits intoopenshift:masterfrom
Billy99:billy99-device-info-spec
Nov 24, 2020
Merged

Implement device-info-spec in app-netutil#24
zshi-redhat merged 6 commits intoopenshift:masterfrom
Billy99:billy99-device-info-spec

Conversation

@Billy99
Copy link
Contributor

@Billy99 Billy99 commented Nov 16, 2020

Add support to app-netutil to implement the device-info-spec. Primarily, it consists of pull additional data from the DeviceInfo field in the NetworkStatus.

As part of supporting the device-info-spec, migrate app-netutil to use network-attachment-definition-client data structs. app-netutil redefined some of the data structs from Multus and Userspace CNI. Since network-attachment-definition-client is now the location for these data structs, migrate to app-netutil to use these instead of defining it's own.

@Billy99
Copy link
Contributor Author

Billy99 commented Nov 16, 2020

/hold

Need to get k8snetworkplumbingwg/network-attachment-definition-client#30 merged first.

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 16, 2020
@Billy99 Billy99 force-pushed the billy99-device-info-spec branch from 6360b08 to 6fd56fa Compare November 17, 2020 19:30
@Billy99
Copy link
Contributor Author

Billy99 commented Nov 18, 2020

/hold cancel

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 18, 2020
Copy link
Contributor

@zshi-redhat zshi-redhat left a comment

Choose a reason for hiding this comment

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

Billy, I added a few comments to see if I understand the logic correctly.

glog.Infof("%s is the \"default\" interface, mark as \"%s\"",
ifaceData.NetworkStatus.Interface, ifaceData.DeviceType)
} else if pciIndex < len(pciAddressSlice) {
if ifaceData.NetworkStatus.DeviceInfo == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

If it's a device set in PCIDEVICE_ env var, but DeviceInfo doesn't exist, mark it as SR-IOV type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, because I think only SR-IOV is using that env var. This would be the case where a newer app-netutil is running with older SR-IOV DP and older Multus.

ifaceData.NetworkStatus.Interface, ifaceData.DeviceType)
} else {
glog.Warningf("More SR-IOV interfaces detected than PCI addresses - %s", interfaceData.IfName)
glog.Warningf("%s was \"unknown\", but DeviceInfo exists with type \"%s\"",
Copy link
Contributor

Choose a reason for hiding this comment

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

If it's a device set in PCIDEVICE_ env var, but doesn't match with DeviceInfo PCI address, leave the device type as unknown.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This should not happen. It's really the case where the type is "unknown", but DeviceInfo struct was created. This is for debugging to catch invalid config or errors in the code where the NetworkStatus annotation was parsed.

ifaceData.NetworkStatus.Interface, ifaceData.NetworkStatus.DeviceInfo.Type)
}
} else {
ifaceData.DeviceType = types.INTERFACE_TYPE_HOST
Copy link
Contributor

Choose a reason for hiding this comment

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

If device doesn't exist in PCIDEVICE_ && device doesn't have a deviceInfo, mark it as a HOST type device.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. We don't know what it is. I guess we could leave as unknown and let the consumer of the API decide?


// PCI Address found that did not match an existing interface in the
// NetworkStatus annotation so add to list.
if pciIndex < len(pciAddressSlice) {
Copy link
Contributor

Choose a reason for hiding this comment

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

If a device set in PCIDEVICE_ env var, but still has unknown type, mark it as SR-IOV type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are PCI Addresses in the PCIDEVICE_ env var but no associated NetworkStatus annotation. The only time I hit this was working a POC that wasn't using Multus.

glog.Infof("RESPONSE:")
for _, interfaceData := range response.Interface {
glog.Infof("%v", interfaceData)
for _, ifaceData := range response.Interface {
Copy link
Contributor

@zshi-redhat zshi-redhat Nov 19, 2020

Choose a reason for hiding this comment

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

I think there might still be devices that have empty type at this point, right? it would be the device that has a deviceInfo but DeviceInfo.Type is not configured.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, what should I do with those? Invalid config.

Copy link
Contributor

Choose a reason for hiding this comment

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

nothing need to change, I just make sure understand it correctly.

@zshi-redhat
Copy link
Contributor

btw, is there any device plugin patch required to make this work?

@Billy99
Copy link
Contributor Author

Billy99 commented Nov 19, 2020

btw, is there any device plugin patch required to make this work?

k8snetworkplumbingwg/sriov-network-device-plugin#287

Move repository to point to the latest network-attachment-definition-client.
This required an update to userspace-cni-network-plugin, so also move
to latest version of that repository as well.

Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
The multusplugin pkg was used to pull in the NetworkStatus map from the multus-cni
code base and parse the NetworkStatus annotation. Turns out that map was outdated
and the map that was being pushed in annotations was from the
network-attachment-definition-client library. So moved to pull from there and
remove references to Multus.

Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
Multus deprecated networks-status annotation in favor of network-status.

Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
To support SR-IOV Device Plugin, volume mount for directory DPDeviceInfoFile
is created in needs to be added to the pod.spec for SR-IOV DP.

Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
Add support to app-netutil to implement the device-info-spec. Primarily, it consists
of pull additional data fron the DeviceInfo field in the NetworkStatus.

As part of supporting the device-info-spec, migrate app-netutil to use
network-attachment-definition-client data structs. app-netutil redefined some of
the data structs from Multus and Userspace CNI. Since
network-attachment-definition-client is now the location for these data structs,
migrate to app-netutil to use these instead of defining it's own.

Since app-netutil is not GA yet, the data structure returned by GetInterfaces()
changed. Once this package is moved to GA, the API will need to be backwards
compatible.

Signed-off-by: Billy McFall <22157057+Billy99@users.noreply.github.com>
@Billy99 Billy99 force-pushed the billy99-device-info-spec branch from 6fd56fa to 72333ff Compare November 19, 2020 23:03
@Billy99
Copy link
Contributor Author

Billy99 commented Nov 23, 2020

@zshi-redhat Sorry, had some comments "pending" that I thought I submitted early last week. Let me know if you have any more comments. I pushed a small change up last week to count the number of "unknown" interfaces and take that into consideration when applying the PCIDEVICE_ interfaces.

@zshi-redhat
Copy link
Contributor

@zshi-redhat Sorry, had some comments "pending" that I thought I submitted early last week. Let me know if you have any more comments. I pushed a small change up last week to count the number of "unknown" interfaces and take that into consideration when applying the PCIDEVICE_ interfaces.

@Billy99, I don't have further comments, shall I merge it now or wait until DP/Multus PRs be merged?

@Billy99
Copy link
Contributor Author

Billy99 commented Nov 24, 2020

@zshi-redhat Sorry, had some comments "pending" that I thought I submitted early last week. Let me know if you have any more comments. I pushed a small change up last week to count the number of "unknown" interfaces and take that into consideration when applying the PCIDEVICE_ interfaces.

@Billy99, I don't have further comments, shall I merge it now or wait until DP/Multus PRs be merged?

Yes. I have other changes coming for exposing hugepages via DownwardAPI. So let's get this in and build on it.

@zshi-redhat zshi-redhat merged commit b734995 into openshift:master Nov 24, 2020
@Billy99 Billy99 deleted the billy99-device-info-spec branch December 4, 2020 19:12
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.

3 participants