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

SRIOV migration based hotplug #10185

Merged
merged 6 commits into from Aug 6, 2023
Merged

Conversation

AlonaKaplan
Copy link
Member

What this PR does / why we need it:
This PR adds support for migration based SRIOV hotplug.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Release note:

Add support to migration based SRIOV hotplug.

@kubevirt-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kubevirt-bot kubevirt-bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. sig/network size/XXL labels Jul 27, 2023
@AlonaKaplan
Copy link
Member Author

/test pull-kubevirt-e2e-k8s-1.26-sig-network-multus-v4
/test pull-kubevirt-e2e-k8s-1.26-sig-network
/test pull-kubevirt-build
/test pull-kubevirt-build-arm64
/test pull-kubevirt-generate
/test pull-kubevirt-manifests
/test pull-kubevirt-unit-test

@AlonaKaplan AlonaKaplan force-pushed the sriov_hotplug branch 2 times, most recently from 22d2de4 to e227d20 Compare July 27, 2023 18:09
@AlonaKaplan
Copy link
Member Author

/test pull-kubevirt-e2e-k8s-1.26-sig-network-multus-v4
/test pull-kubevirt-e2e-k8s-1.26-sig-network
/test pull-kubevirt-build
/test pull-kubevirt-build-arm64
/test pull-kubevirt-generate
/test pull-kubevirt-manifests
/test pull-kubevirt-unit-test

@AlonaKaplan
Copy link
Member Author

/test pull-kubevirt-e2e-k8s-1.26-sig-network-multus-v4
/test pull-kubevirt-e2e-k8s-1.26-sig-network
/test pull-kubevirt-build
/test pull-kubevirt-build-arm64
/test pull-kubevirt-generate
/test pull-kubevirt-manifests
/test pull-kubevirt-unit-test
/test pull-kubevirt-e2e-kind-1.27-sriov

@AlonaKaplan
Copy link
Member Author

/retest

1 similar comment
@AlonaKaplan
Copy link
Member Author

/retest

@AlonaKaplan
Copy link
Member Author

/test pull-kubevirt-e2e-kind-1.27-sriov

@AlonaKaplan
Copy link
Member Author

/test pull-kubevirt-e2e-k8s-1.26-sig-network-multus-v4
/test pull-kubevirt-e2e-k8s-1.26-sig-network
/test pull-kubevirt-build
/test pull-kubevirt-build-arm64
/test pull-kubevirt-generate
/test pull-kubevirt-manifests
/test pull-kubevirt-unit-test
/test pull-kubevirt-e2e-kind-1.27-sriov

@AlonaKaplan
Copy link
Member Author

/test pull-kubevirt-e2e-k8s-1.26-sig-network-multus-v4
/test pull-kubevirt-e2e-k8s-1.26-sig-network
/test pull-kubevirt-e2e-kind-1.27-sriov

@AlonaKaplan
Copy link
Member Author

/test pull-kubevirt-e2e-k8s-1.26-sig-network-multus-v4
/test pull-kubevirt-e2e-k8s-1.26-sig-network
/test pull-kubevirt-build
/test pull-kubevirt-build-arm64
/test pull-kubevirt-generate
/test pull-kubevirt-manifests
/test pull-kubevirt-unit-test
/test pull-kubevirt-e2e-kind-1.27-sriov

@AlonaKaplan
Copy link
Member Author

/test pull-kubevirt-e2e-k8s-1.26-sig-network-multus-v4
/test pull-kubevirt-e2e-k8s-1.26-sig-network
/test pull-kubevirt-build
/test pull-kubevirt-build-arm64
/test pull-kubevirt-generate
/test pull-kubevirt-manifests
/test pull-kubevirt-unit-test
/test pull-kubevirt-e2e-kind-1.27-sriov

@AlonaKaplan AlonaKaplan marked this pull request as ready for review July 28, 2023 15:15
Copy link
Member

@EdDev EdDev left a comment

Choose a reason for hiding this comment

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

Thank you!

I think we are still missing a test (see inline) and the commit messages still need fixing (subject line is too long).
But I will not block the change on those, feel free to remove the hold.

/hold

nil,
nil,
expectNoChange,
),
Copy link
Member

Choose a reason for hiding this comment

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

I was looking for "expectToChange" + new SR-IOV not added.
I do not think we have it.

vmi.Namespace, vmi.Spec.Domain.Devices.Interfaces, vmi.Spec.Networks, pod)).To(HaveOccurred())
})
})

Context("hotplug operation", func() {
Context("pod status update", func() {
const mac1 = "abc"
Copy link
Member

Choose a reason for hiding this comment

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

Not really sure how it is related to the code changes done here, but I will not dig into it further.

@kubevirt-bot kubevirt-bot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Aug 2, 2023
If an SRIOV interface is added to the spec of a running VM, don't update
the pod multus annotation with this interface.
To configure SRIOV on the pod, device plugin has to be invovled.
Kubelet invokes the device plugin of pod startup only.
Therefore, there is no point in adding the SRIOV interface to the multus
annotation at this point. It should be added only on migration to the
new target pod multus annotation.

Signed-off-by: Alona Paz <alkaplan@redhat.com>
The vmi network and interfaces spec may contain interface that are not
plugged to the pod yet and therefore not reported in the multus
status annotation.
Those interfaces should be ignored when building the
"kubevirt.io/network-pci-map" annotation.

Signed-off-by: Alona Paz <alkaplan@redhat.com>
If there are SRIOV interfaces in the spec that are not in the domain
(plug pending)->
SRIOV hotplug is invoked.
This commit changes the code to invoke the SRIOV hotplug only if those
plug pending interfaces are reported in the multus annotation.

If they are not reported by the multus annotation it means the pod cannot
use the VF yet.

Signed-off-by: Alona Paz <alkaplan@redhat.com>
A preparation step for hotplug_sriov test file to be added.

Signed-off-by: Alona Paz <alkaplan@redhat.com>
@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 2, 2023
Signed-off-by: Alona Paz <alkaplan@redhat.com>
@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2023
Comment on lines +139 to +141
mac, err := GenerateRandomMac()
if err != nil {
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Since addSRIOVInterface used only in one place, also MAC address has no actual affect on the hotplug logic isn't it?

Comment on lines +36 to +37
sriovIfaceNotPlugged := iface.SRIOV != nil && !ifaceInStatus
return !sriovIfaceNotPlugged
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO the intermediate variable doesn't help understanding what will be the result, the reader still need to interpret what !sriovIfaceNotPlugged means.
How about using the direct condition with better descriptive name?

nonSriovDesiredIfaces := iface.SRIOV == nil || ifaceInStatus
return nonSriovDesiredIfaces

We can address it later though.

@@ -24,23 +24,29 @@ import (
"kubevirt.io/kubevirt/pkg/network/vmispec"
)

func calculateDynamicInterfaces(vmi *v1.VirtualMachineInstance) ([]v1.Interface, []v1.Network, bool) {
vmiSpecIfaces := vmispec.FilterInterfacesSpec(vmi.Spec.Domain.Devices.Interfaces, func(iface v1.Interface) bool {
func calculateInterfacesAndNetworksForMultusAnnotation(vmi *v1.VirtualMachineInstance) ([]v1.Interface, []v1.Network, bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

So its basicly set the desired interfaces in the VMI hence in the pod.
I would call it somthing like calcuclateDesiredInterfaces or calcuclateDesiredPodInterfaces.

We can address this later and improve the naming around that area.

@AlonaKaplan
Copy link
Member Author

/approve

Increasing 2 lgtms to approve.

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AlonaKaplan

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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 3, 2023
@EdDev
Copy link
Member

EdDev commented Aug 6, 2023

/unhold

@kubevirt-bot kubevirt-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Aug 6, 2023
@EdDev
Copy link
Member

EdDev commented Aug 6, 2023

/retest

@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

1 similar comment
@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@kubevirt-bot kubevirt-bot merged commit ca740d9 into kubevirt:main Aug 6, 2023
36 checks passed
orelmisan added a commit to orelmisan/kubevirt that referenced this pull request Aug 16, 2023
PR kubevirt#10185 introduced the SR-IOV migration-based hotplug
with an E2E test that fails [1] in case the `HotplugNICs`
feature gate is disabled.

The CI system of kubevirt/kubevirtci, has an SR-IOV lane
that deploys a cluster and runs the conformance test mechanism
with a focus on SR-IOV tests[2] without enabling the `HotplugNICs`
feature gate.

This causes the pre-submit jobs in kubevirt/kubevirtci to fail[3],
and requires a maintainer override in order to merge PRs.

As an immediate fix, skip the SR-IOV migration based hotplug tests
if the `HotplugNICs` feature gate is disabled.

The kubevirt/kubevirt tests will not be affected by this change.
A more permanent fix will follow.

[1] https://github.com/kubevirt/kubevirt/blob/cb29e9f87d41deae0d9e1efa6b0cde53ecd8c28a/tests/network/hotplug_sriov.go#L52
[2] https://github.com/kubevirt/project-infra/blob/88e8dbd315a7bc908f637ebe3168f1fe7da97839/github/ci/prow-deploy/files/jobs/kubevirt/kubevirtci/kubevirtci-presubmits.yaml#L53
[3] https://prow.ci.kubevirt.io/view/gs/kubevirt-prow/pr-logs/pull/kubevirt_kubevirtci/1070/check-up-kind-1.27-sriov/1691706923780411392

Signed-off-by: Orel Misan <omisan@redhat.com>
orelmisan added a commit to orelmisan/kubevirt that referenced this pull request Aug 16, 2023
PR kubevirt#10185 introduced the SR-IOV migration-based hotplug
with an E2E test that fails [1] in case the `HotplugNICs`
feature gate is disabled.

The CI system of kubevirt/kubevirtci, has an SR-IOV lane
that deploys a cluster and runs the conformance test mechanism
with a focus on SR-IOV tests[2] without enabling the `HotplugNICs`
feature gate.

This causes the pre-submit jobs in kubevirt/kubevirtci to fail[3],
and requires a maintainer override in order to merge PRs.

As an immediate fix, skip the SR-IOV migration based hotplug tests
if the `HotplugNICs` feature gate is disabled.

The kubevirt/kubevirt tests will not be affected by this change.
A more permanent fix will follow.

[1] https://github.com/kubevirt/kubevirt/blob/cb29e9f87d41deae0d9e1efa6b0cde53ecd8c28a/tests/network/hotplug_sriov.go#L52
[2] https://github.com/kubevirt/project-infra/blob/88e8dbd315a7bc908f637ebe3168f1fe7da97839/github/ci/prow-deploy/files/jobs/kubevirt/kubevirtci/kubevirtci-presubmits.yaml#L53
[3] https://prow.ci.kubevirt.io/view/gs/kubevirt-prow/pr-logs/pull/kubevirt_kubevirtci/1070/check-up-kind-1.27-sriov/1691706923780411392

Signed-off-by: Orel Misan <omisan@redhat.com>
orelmisan added a commit to orelmisan/kubevirt that referenced this pull request Aug 16, 2023
PR kubevirt#10185 introduced the SR-IOV migration-based hotplug
with an E2E test that fails [1] in case the `HotplugNICs`
feature gate is disabled.

The CI system of kubevirt/kubevirtci, has an SR-IOV lane
that deploys a cluster and runs the conformance test mechanism
with a focus on SR-IOV tests[2] without enabling the `HotplugNICs`
feature gate.

This causes the pre-submit jobs in kubevirt/kubevirtci to fail[3],
and requires a maintainer override in order to merge PRs.

As an immediate fix, skip the SR-IOV migration based hotplug tests
if the `HotplugNICs` feature gate is disabled.

The kubevirt/kubevirt tests will not be affected by this change.
A more permanent fix will follow.

[1] https://github.com/kubevirt/kubevirt/blob/cb29e9f87d41deae0d9e1efa6b0cde53ecd8c28a/tests/network/hotplug_sriov.go#L52
[2] https://github.com/kubevirt/project-infra/blob/88e8dbd315a7bc908f637ebe3168f1fe7da97839/github/ci/prow-deploy/files/jobs/kubevirt/kubevirtci/kubevirtci-presubmits.yaml#L53
[3] https://prow.ci.kubevirt.io/view/gs/kubevirt-prow/pr-logs/pull/kubevirt_kubevirtci/1070/check-up-kind-1.27-sriov/1691706923780411392

Signed-off-by: Orel Misan <omisan@redhat.com>
VirrageS pushed a commit to VirrageS/kubevirt that referenced this pull request Nov 17, 2023
PR kubevirt#10185 introduced the SR-IOV migration-based hotplug
with an E2E test that fails [1] in case the `HotplugNICs`
feature gate is disabled.

The CI system of kubevirt/kubevirtci, has an SR-IOV lane
that deploys a cluster and runs the conformance test mechanism
with a focus on SR-IOV tests[2] without enabling the `HotplugNICs`
feature gate.

This causes the pre-submit jobs in kubevirt/kubevirtci to fail[3],
and requires a maintainer override in order to merge PRs.

As an immediate fix, skip the SR-IOV migration based hotplug tests
if the `HotplugNICs` feature gate is disabled.

The kubevirt/kubevirt tests will not be affected by this change.
A more permanent fix will follow.

[1] https://github.com/kubevirt/kubevirt/blob/cb29e9f87d41deae0d9e1efa6b0cde53ecd8c28a/tests/network/hotplug_sriov.go#L52
[2] https://github.com/kubevirt/project-infra/blob/88e8dbd315a7bc908f637ebe3168f1fe7da97839/github/ci/prow-deploy/files/jobs/kubevirt/kubevirtci/kubevirtci-presubmits.yaml#L53
[3] https://prow.ci.kubevirt.io/view/gs/kubevirt-prow/pr-logs/pull/kubevirt_kubevirtci/1070/check-up-kind-1.27-sriov/1691706923780411392

Signed-off-by: Orel Misan <omisan@redhat.com>
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. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/network size/XXL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants