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

Add support for running in a virtual machine -- Remove PF dependency #369

Merged
merged 2 commits into from
Nov 25, 2020

Conversation

atyronesmith
Copy link
Contributor

This PR adds support for running (initially) in an OpenShift on OpenStack environment. In a VM environment, only VFs are attached (no PF) and the VFs represent an underlying OpenStack network. This PR removes the necessity of accessing a PF and uses additional information passed into the VM by the OpenStack metadata service to include underlying network mappings in the sriovnetworknodestate. In addition, the exposed underlying network information can be used to select networks for a policy.

This PR is in conjunction with a PR in k8snetworkplumbingwg/sriov-network-device-plugin repository.

This PR is to allow a review of the concept.

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.

Thanks Aaron for working on the patches, added few comments inline.
I think the overall design looks good to me:

  1. A virtual plugin for VM use case
  2. Auto detect platform type and invoke the virtual plugin

pkg/utils/utils_virtual.go Outdated Show resolved Hide resolved
iface.TotalVfs = 1
iface.NumVfs = 1

vf := sriovnetworkv1.VirtualFunction{
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we consider the VM VF as a individual device (just like a regular PF device in the host) and not populate the vf fields?

Copy link
Contributor

Choose a reason for hiding this comment

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

We could modify current numVfs range to allow 0 numVfs be 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.

I think it would be good to treat VFs as individual devices. The problem is that the current code seems to be keyed to TotalVFs/NumVfs and I took the approach of setting to 1 to reduce the number code changes. I can take a look at your suggestion.

pkg/utils/utils.go Outdated Show resolved Hide resolved
@atyronesmith atyronesmith changed the title WIP -- Add support for running in a virtual machine -- Remove PF dependency Add support for running in a virtual machine -- Remove PF dependency Nov 6, 2020
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 6, 2020
@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 12, 2020
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 12, 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.

Looks generally good to me.
I think we might want to do two things in a follow-up PRs:

  1. enable use of numVfs=0 so that virtual-plugin doesn't need to populate InterfaceExt.VFs
  2. move platform specific code into a separate file.

controllers/sriovnetworknodepolicy_controller.go Outdated Show resolved Hide resolved
pkg/daemon/daemon.go Outdated Show resolved Hide resolved
pkg/daemon/daemon.go Show resolved Hide resolved
@zshi-redhat
Copy link
Contributor

/cc @pliurh

@atyronesmith
Copy link
Contributor Author

/retest

pkg/daemon/plugin.go Outdated Show resolved Hide resolved
var err error

if platformType == Virtual {
iface, err = utils.DiscoverSriovDevicesVirtual()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use one function to discover devices for both baremetal and virtual nodes? We can pass the platformType to DiscoverSriovDevices so that the VFs can be treated differently on a virtual node.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to completely separate the virtual path from the baremetal path. I didn't think it was clean to include a bunch of checks in the discover function. I can change if you feel strongly about it...

pkg/plugins/virtual/virtual_plugin.go Outdated Show resolved Hide resolved
pkg/utils/utils_virtual.go Outdated Show resolved Hide resolved
Copy link
Contributor Author

@atyronesmith atyronesmith left a comment

Choose a reason for hiding this comment

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

Completed

pkg/daemon/daemon.go Show resolved Hide resolved
pkg/plugins/virtual/virtual_plugin.go Show resolved Hide resolved
var err error

if platformType == Virtual {
iface, err = utils.DiscoverSriovDevicesVirtual()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wanted to completely separate the virtual path from the baremetal path. I didn't think it was clean to include a bunch of checks in the discover function. I can change if you feel strongly about it...

pkg/plugins/virtual/virtual_plugin.go Outdated Show resolved Hide resolved
pkg/utils/utils_virtual.go Outdated Show resolved Hide resolved
@pliurh
Copy link
Contributor

pliurh commented Nov 25, 2020

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 25, 2020
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: atyronesmith, pliurh

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 25, 2020
@openshift-merge-robot openshift-merge-robot merged commit b6967d0 into openshift:master Nov 25, 2020
jerpeter1 pushed a commit to jerpeter1/sriov-network-operator that referenced this pull request Mar 7, 2023
config-daemon: fix NM udev path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants