How to change cpu mode on KVM managed instance. Feature request?

Hi

It looks like MaaS provisioned instances on top of Virsh enabled machines are configured by default with libvirt cpu mode qemu64. This mode lacks cpu extensions like avx, avx2 which are required to run modern apps, like MongoDB 5+.
As a workaround, I managed to edit the libvirt domain, setting cpu to host-passthrough then restart the VM.
Is there a setting in MaaS than would configure the libvirt cpu to host-passthrough, or a setting to add cpu features like avx, avx2?

Cheers

Hi @jeanfabrice

Unfortunately there is no such setting that would allow you configuring Virsh host this way.

Configuration comes from predefined XMLs available at src/provisioningserver/drivers/pod/virsh.py

But you can adopt that configuration to your needs and then build your own MAAS
HACKING.rst might help you to start hacking.

1 Like

Thanks for the suggestion!

Quick question regarding src/provisioningserver/drivers/pod/virsh.py:
Any idea why DOM_TEMPLATE_ARM64 and others would define <cpu mode='host-passthrough'/> but DOM_TEMPLATE_AMD64 not? then fallbacks to qemu64 IIUC

Unfortunately I don’t know any reasons why AMD64 was defined in a different way.

Do you think this can be fixed somehow?

Everything is possible :slight_smile:
Have you had a chance to modify virsh.py and try if it works?

Gave it a shot. Unfortunately, I’m using a snap. virsh.py is mounted readonly

Hi @jeanfabrice

I’ve just discovered that it was a known bug. This is something that will be fixed!

Regarding a read-only snap filesystem: you can either build your own snap or unpack, modify and pack back. Here is a post for the reference.

Thanks for sharing the bug link, and thanks for the fix!
Thanks as well for the post link. That will definitely help in the future

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.