Skip to content

Set Kubevirt live-migrations multi-chassis options for all VM nics#6241

Merged
oilbeater merged 3 commits intokubeovn:masterfrom
jskrill:add-chassis-options-all-kubevirt-nics
Feb 2, 2026
Merged

Set Kubevirt live-migrations multi-chassis options for all VM nics#6241
oilbeater merged 3 commits intokubeovn:masterfrom
jskrill:add-chassis-options-all-kubevirt-nics

Conversation

@jskrill
Copy link
Copy Markdown
Contributor

@jskrill jskrill commented Jan 31, 2026

Pull Request

What type of this PR

  • Features

Currently the Kubevirt live migration optimizations only are applied to the primary interface lsp. This PR extends that logic to apply to all attached networks that are managed by Kube-OVN.

Without this change, VMs with multiple NICs can fail live migration (this seemed to happen sporadically in my test env) and near-zero downtime migrations are not possible in those configurations.

Which issue(s) this PR fixes

N/A

Signed-off-by: Jules Skrill <julesskrill@gmail.com>
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. feature New network feature labels Jan 31, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @jskrill, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the robustness of Kubevirt live migrations by extending network optimizations to all Kube-OVN managed network interfaces attached to a Virtual Machine Instance. Previously, these optimizations were limited to the primary interface, which could lead to sporadic migration failures and prevent near-zero downtime for VMs utilizing multiple network cards. The changes ensure that all relevant network ports are correctly configured during migration, thereby improving the reliability and efficiency of live migrations for complex VM network setups.

Highlights

  • Extended Live Migration Optimizations: Kubevirt live migration optimizations now cover all Kube-OVN managed network interfaces for Virtual Machine Instances (VMIs), not just the primary interface.
  • Improved Multi-NIC VM Migration Reliability: This change addresses potential live migration failures and enables near-zero downtime for VMs configured with multiple network interfaces.
  • Comprehensive Port Identification: New logic has been implemented to identify and apply migration options to all relevant logical switch ports associated with a VMI, including default and additional Multus networks.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request extends the Kubevirt live migration optimization to support all Kube-OVN managed NICs on a Virtual Machine, not just the primary one. This is a valuable feature that improves the reliability of live migrations for multi-homed VMs. The implementation correctly identifies all relevant logical switch ports associated with a VMI by inspecting the VMI spec and annotations. The changes to apply migration options to all collected ports are also correct. I have one suggestion to improve the code's robustness by handling potential duplicate port names.

Signed-off-by: Jules Skrill <julesskrill@gmail.com>
@jskrill jskrill force-pushed the add-chassis-options-all-kubevirt-nics branch from 31f2266 to 95d4d26 Compare January 31, 2026 22:10
@jskrill
Copy link
Copy Markdown
Contributor Author

jskrill commented Jan 31, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request extends the Kubevirt live migration optimization to support multiple network interfaces for a single Virtual Machine. However, it introduces a critical security vulnerability by failing to verify port ownership. The controller collects port names based on user-controlled annotations and specs and applies migration options to any matching port found in the OVN database, without checking if the port belongs to the VMI being migrated. This could allow an attacker to disrupt the network connectivity of other users' VMIs. Additionally, the current approach for collecting VMI's logical switch ports is inefficient and can be optimized by using a more targeted query.

Signed-off-by: Jules Skrill <julesskrill@gmail.com>
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Jan 31, 2026
@jskrill
Copy link
Copy Markdown
Contributor Author

jskrill commented Jan 31, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly extends the Kubevirt live migration optimization to support all VM NICs, not just the primary one. This is achieved by fetching all logical switch ports associated with a Virtual Machine Instance and applying the migration options to each. The implementation is sound and addresses the issue of migration failures for multi-NIC VMs. I have one suggestion to refactor a small piece of duplicated code to improve maintainability.

@jskrill
Copy link
Copy Markdown
Contributor Author

jskrill commented Jan 31, 2026

Gemini issues resolved (or not in scope), this should be good to review.

@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 21552442512

Details

  • 0 of 32 (0.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.005%) to 22.928%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controller/kubevirt.go 0 32 0.0%
Totals Coverage Status
Change from base Build 21538844522: -0.005%
Covered Lines: 12330
Relevant Lines: 53778

💛 - Coveralls

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Feb 1, 2026
@oilbeater oilbeater merged commit 9d4330e into kubeovn:master Feb 2, 2026
75 of 77 checks passed
@oilbeater
Copy link
Copy Markdown
Collaborator

Thanks! @jskrill

oilbeater pushed a commit that referenced this pull request Mar 30, 2026
…6241)

* feat: Set multi-chassis options for all VM nics

Signed-off-by: Jules Skrill <julesskrill@gmail.com>

* fix: Use set to collect port names

Signed-off-by: Jules Skrill <julesskrill@gmail.com>

* fix: Simplify logic to discovery all lsp ports

Signed-off-by: Jules Skrill <julesskrill@gmail.com>

---------

Signed-off-by: Jules Skrill <julesskrill@gmail.com>
zbb88888 pushed a commit to qiniu/kube-ovn that referenced this pull request Apr 8, 2026
…ubeovn#6241)

* feat: Set multi-chassis options for all VM nics

Signed-off-by: Jules Skrill <julesskrill@gmail.com>

* fix: Use set to collect port names

Signed-off-by: Jules Skrill <julesskrill@gmail.com>

* fix: Simplify logic to discovery all lsp ports

Signed-off-by: Jules Skrill <julesskrill@gmail.com>

---------

Signed-off-by: Jules Skrill <julesskrill@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New network feature lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants