Changing the default CPU capabilities of KVM VM deployments

Hi,

When deploying a KVM VM, the CPU capabilities are very limited and set to QEMU/KVM CPU. I’d like to use host-passthrough as a default but I’m not sure where to find how MAAS communicates with Virsh or any config files.

Appreciate the help!

@ryan1336, you can connect to libvirtd or the Virtual Machine Manager to change the defaults or the values. have you tried that? also, you can use virsh-edit from the command line to change some virsh parameters.

maybe you can give some more details?

I’m not very familiar with libvirtd.

If MAAS is not responsible for the CPU options when creating domains, where abouts in libvirtd can I modify so that when MAAS deploys a new KVM virtual machine, it will have the correct options.

Not sure what you mean by “CPU options” – which ones?

@ryan1336: see if this post helps: https://ubuntu.com/blog/quick-add-kvms-for-maas

I’d like the virtual machines that MAAS creates to have host-passthrough as the CPU arch instead of the current CPU arch which is very basic.

For example, creating a VM with MAAS will produce a virtual machine that can’t even run Docker because the VCPU doesn’t have SSE4 capabilities.

  <cpu mode='host-passthrough' check='none'/>

I’d like to be automatically inserted into each new domain that is created by MAAS

@ryan1336, i see. this might actually be a bug; we have that on architectures other than x86_64. can you file a bug and we’ll look into it?

https://bugs.launchpad.net/maas/+filebug

Just to confirm, we’re not talking about the CPU architecture as in x86_64 but the feature flags and processor name/details retrieved from /proc/cpuinfo. I’d like them to have the host flags and details as via host-passthrough.

You’re saying that MAAS should be creating VMs with host-passthrough CPU flags and that it’s a bug that it isn’t?

Hello,

Still looking for an update on this.

@ryan1336, I’ve filed a bug on your behalf. I’ll let you know as it progresses through the system.

https://bugs.launchpad.net/maas/+bug/1876365

I’m having an issue caused by what OP is requesting here.

Don’t know the reason but when a machine gets created it asks for SVM flag which belongs to AMD not Intel causing this message at the KVM host.

qemu-system-x86_64: warning: host doesn’t support requested feature: CPUID.80000001H:ECX.svm

I had to edit the VM so it uses ‘minimum’ mode at CPU key instead of ‘exact’ which was the one used.

I am coming a bit later, but I found this issue too, and that is “probably” a bug on virsh.py

you can see that the host-passthrough parameter has been “omitted / forgotten” for AMD64 -> https://github.com/maas/maas/blob/3.2/src/provisioningserver/drivers/pod/virsh.py#L100
while on ARM64 and PCC is present see: https://github.com/maas/maas/blob/3.2/src/provisioningserver/drivers/pod/virsh.py#L151
https://github.com/maas/maas/blob/3.2/src/provisioningserver/drivers/pod/virsh.py#L192

This parameter should be a default and present for any KVM deployment as it is already default on many systems including openstack since quite a while. I will post on the related bug asking to re-open as well.

On your case, to fix your issue now, on your maas deployment edit the file:

/usr/lib/python3/dist-packages/provisioningserver/drivers/pod/virsh.py

and add <cpu mode='host-passthrough'/> under the AMD64 section.

Then restart maas-rackd for change the default for each of your POD creation.

@billwear if someone can re-open https://bugs.launchpad.net/maas/+bug/1876365 would be appreciated

so the bug in question is Fix Committed for MAAS 3.4, release imminent.