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

design-proposal: VM video device type configuration #371

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dasionov
Copy link

@dasionov dasionov commented Dec 26, 2024

What this PR does / why we need it:
This PR introduces a design proposal to discuss about the optimal implementation for introducing a dedicated field for a video device to be used.

We want to allow VM-owners to explicitly set the video device type when needed.

Fixes #

Special notes for your reviewer:

Checklist

This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.

Release note:

None

@kubevirt-bot kubevirt-bot added the dco-signoff: yes Indicates the PR's author has DCO signed all their commits. label Dec 26, 2024
@kubevirt-bot kubevirt-bot requested a review from dhiller December 26, 2024 16:59
@dasionov dasionov changed the title design-proposal: toggle_vga_video_device design-proposal: toggle default vga video device Dec 26, 2024
@dasionov
Copy link
Author

/cc @enp0s3

@kubevirt-bot kubevirt-bot requested a review from enp0s3 December 26, 2024 16:59
Copy link
Contributor

@iholder101 iholder101 left a comment

Choose a reason for hiding this comment

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

Thanks @dasionov!

design-proposals/toggle_vga_video_device.md Outdated Show resolved Hide resolved
design-proposals/toggle_vga_video_device.md Outdated Show resolved Hide resolved
Comment on lines 33 to 39
### Option 1: Annotation-Based Toggle
**Description:** Introduce an annotation on the KubeVirt CR to specify the default video device type. The annotation kubevirt.io/default-video-device: vga can be used to default all VMs to VGA unless overridden in individual VMIs.

**Pros:**

- Minimal changes to the API schema.
- Easy to implement and maintain.
Copy link
Contributor

Choose a reason for hiding this comment

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

TBH I don't understand these pros.

Such an annotation would demand backward compatibility anyhow, and it's not much easier to implement AFAICT. To me it's equivalent to adding a non-visible field.

The proposed changes have no anticipated impact on scalability capabilities of the KubeVirt framework

## Update/Rollback Compatibility
cluster admins and vm-owners that have old vms that supports only vga video device.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can VMs change video type between reboots / live-migrations? Will it break the guest?

Copy link
Author

Choose a reason for hiding this comment

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

AFAIK as long as the domain capabilities supports virtio as video type, switching between vga to virtio should not break the guest at all, (e.g in upgrade scenario)
unless of course the launcher image doesn't have the qemu-kvm-device-display-virtio-gpu (which provide support for virtio) installed, in that case the guest will break immediately at the first sync.

@dasionov dasionov force-pushed the toggle_vga_video_device_design_proposal branch from 8e566ba to 0ce94dd Compare December 29, 2024 16:16
@dasionov dasionov force-pushed the toggle_vga_video_device_design_proposal branch from 0ce94dd to 7928683 Compare December 30, 2024 14:08
@dasionov dasionov changed the title design-proposal: toggle default vga video device design-proposal: VM video device type configuration Dec 30, 2024
@dasionov dasionov force-pushed the toggle_vga_video_device_design_proposal branch 3 times, most recently from 0596398 to f51aee9 Compare January 2, 2025 16:37
@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Jan 2, 2025
Copy link
Contributor

@iholder101 iholder101 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 @dasionov! Looks good in general

A bit off topic, but I think this PR raises an interesting question around defaults. Do we want to generally default to the most-compatible option, or the most optimized one? In any case, I think that in some point in the future we'd need to consider defaulting to virtio as I think it makes sense to do so when supported on vast majority of guests.

design-proposals/vm_video_device_type_field.md Outdated Show resolved Hide resolved

**Cons:**
- API Complexity: Requires schema changes to the VM template API, introducing additional fields that need maintenance and testing.
- Administrative Effort: Per-VM configuration may lead to higher administrative overhead if many VMs require toggling.
Copy link
Contributor

Choose a reason for hiding this comment

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

BTW, perhaps this con can be addressed with instance types & preferences
FYI @lyarwood

Comment on lines 56 to 73
video:
type: virtio
Copy link
Contributor

Choose a reason for hiding this comment

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

Libvirt supports multiple video devices [1]:

<devices>
  <video>
    <model type='vga'/>
  </video>
  <video>
    <model type='virtio'/>
  </video>
</devices>

They also have the "primary" field to indicate which is the primary volume.
Since that's the case, I think we want to turn the video field to a slice, and perhaps add the primary field. In libvirt, if the primary field is not supplied, than the first video device is set as the primary, perhaps we can follow this approach.

@dasionov dasionov force-pushed the toggle_vga_video_device_design_proposal branch from f51aee9 to 452d86c Compare January 5, 2025 12:51
@kubevirt-bot
Copy link

New changes are detected. LGTM label has been removed.

@kubevirt-bot kubevirt-bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 5, 2025
@kubevirt-bot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from jean-edouard. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

Copy link
Member

@xpivarc xpivarc left a comment

Choose a reason for hiding this comment

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

Kubevirt doesn't strive to provide any/every option available (be it by qemu/libvirt...) and rather we have sidecars that allows you to do what we don't make explicitly available. I am not convinced we should support this unless good use cases are provided and available alternative (sidecars) shows major negatives compare to have this in core.

VM-owners who require specific configurations for VMIs in their environments.

## User Stories
- As a VM owner, I want to be able to set a better video device like `virtio` instead of the standard `vga`.
Copy link
Member

Choose a reason for hiding this comment

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

This is not really an use case imho. There should be why one needs virtio or anything other than vga/bosh(partial compatibility of vga)

design-proposals/vm_video_device_type_field.md Outdated Show resolved Hide resolved
```

## Scalability
The proposed changes have no anticipated impact on the scalability capabilities of the KubeVirt framework.
Copy link
Member

Choose a reason for hiding this comment

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

Overhead of the virt-launcher(or rather qemu I should say) may be impacted.

Copy link
Contributor

Choose a reason for hiding this comment

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

FWIW I would guess the using virtio would demand less memory if anything. But this is just an educated guess :)

design-proposals/vm_video_device_type_field.md Outdated Show resolved Hide resolved
@iholder101
Copy link
Contributor

Kubevirt doesn't strive to provide any/every option available (be it by qemu/libvirt...) and rather we have sidecars that allows you to do what we don't make explicitly available. I am not convinced we should support this unless good use cases are provided and available alternative (sidecars) shows major negatives compare to have this in core.

Sidecars are problematic in many ways. They're alpha, not really supported, hard to use and do not fit production use-cases. As most virtio drivers, I'd guess that also in this case the virtio driver would be faster, consume less memory and would fit better to virtualized workloads in most cases.

On the other hand, I agree this proposal lacks the use-cases and research necessary to back up these assumptions.
@dasionov can you please try to find more use-cases or data that shows if and how virtio is better? I vaguely remember you mentioned something about being able to achieve better video resolutions with virtio, this sounds like a good start to me.

@dasionov dasionov force-pushed the toggle_vga_video_device_design_proposal branch from 452d86c to ba747c0 Compare January 8, 2025 11:51
@xpivarc
Copy link
Member

xpivarc commented Jan 10, 2025

Kubevirt doesn't strive to provide any/every option available (be it by qemu/libvirt...) and rather we have sidecars that allows you to do what we don't make explicitly available. I am not convinced we should support this unless good use cases are provided and available alternative (sidecars) shows major negatives compare to have this in core.

Sidecars are problematic in many ways. They're alpha, not really supported, hard to use and do not fit production use-cases. As most virtio drivers, I'd guess that also in this case the virtio driver would be faster, consume less memory and would fit better to virtualized workloads in most cases.

About the side-cars, I would you say you just point out that we should work towards graduation of it and improving it. For the virtio, well it is The virtualization "hw" so it better be better than emulating whatever ;)

On the other hand, I agree this proposal lacks the use-cases and research necessary to back up these assumptions. @dasionov can you please try to find more use-cases or data that shows if and how virtio is better? I vaguely remember you mentioned something about being able to achieve better video resolutions with virtio, this sounds like a good start to me.

We want to allow VM-owners to explicitly set the video device type when
needed.

Signed-off-by: Daniel Sionov <[email protected]>
@dasionov dasionov force-pushed the toggle_vga_video_device_design_proposal branch from ba747c0 to f5bcbcd Compare January 12, 2025 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has DCO signed all their commits. size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants