cockpit-project / cockpit-machines

Cockpit UI for virtual machines
GNU Lesser General Public License v2.1
274 stars 71 forks source link

Enable Hyper-V Enlightenments #1002

Open jdgregson opened 1 year ago

jdgregson commented 1 year ago

Following the steps in this blog post, I'd like Windows guests to be able to run Hyper-V-based features, such as HVCI. I've confirmed that nested virtualization is enabled on the guest but cannot enable the desired features as the guest is detecting another hypervisor and disabling Hyper-V support.

Per the blog post, the following flags, called Hyper-V Enlightenments, should fix the issue:

–cpu Skylake-Client-v3,hv_stimer,hv_synic,hv_relaxed,hv_reenlightenment,hv_spinlocks=0xfff,hv_vpindex,hv_vapic,hv_time,hv_frequencies,hv_runtime,+kvm_pv_unhalt,+vmx

However, it is not clear to me if and how these can be enabled on VMs managed through cockpit-machines. How would I enable these features?

skobyda commented 1 year ago

Just to confirm, you have a setup of Windows guests running under QEMU-KVM, just like in the blog you linked, right?

Anyway, currently, cockpit doesn't support configuring any CPU enlightenments nor hypervisor features in our UI. But it's a valid functionality that we can add.

Libvirt supports adding enlightenments as "Hypervisor features" thru XML configuration: https://libvirt.org/formatdomain.html#hypervisor-features

Patternfly has multi-select component, so my first idea is to have something like this: Screenshot from 2023-04-03 02-24-43

In the CPU configuration dialog? Screenshot from 2023-04-03 02-28-28

jdgregson commented 1 year ago

Just to confirm, you have a setup of Windows guests running under QEMU-KVM, just like in the blog you linked, right?

Yes, correct.

my first idea is to have something like this ... In the CPU configuration dialog

That's a good idea, the UI would work pretty well there.

Another option would be to add the ability to create custom CPU configurations. For instance, I could clone the "Skylake-Client" CPU config to "Skylake-HyperV" and add the enlightenments to that CPU. Then I'd just need to select the custom CPU for all VMs needing that capability rather than adding the enlightenments to each VM individually.

I tried to manually add such a custom CPU configuration, but couldn't figure out all of the details I'd need to get that working.