OpenMediaVault-Plugin-Developers / openmediavault-kvm

openmediavault plugin for kvm
25 stars 7 forks source link

KVM: Cannot change vcpu #19

Closed edgd1er closed 8 months ago

edgd1er commented 9 months ago

I have a ryzen 5600g (12 cpu) on which i set up a 2 cpu windows 11 vm. That was ok until i tried to add 2 cpu to the vm.

I got this error:

Unable to change topolgy cores for VM - Requested operation is not valid: cannot undefine domain with nvram

OMV\Exception: Unable to change topolgy cores for VM - Requested operation is not valid: cannot undefine domain with 
nvram in /usr/share/openmediavault/engined/rpc/kvm.inc:2517
Stack trace:
#0 [internal function]: OMVRpcServiceKvm->doChangeCpuMemory()
#1 /usr/share/php/openmediavault/rpc/serviceabstract.inc(122): call_user_func_array()
#2 /usr/share/php/openmediavault/rpc/rpc.inc(86): OMV\Rpc\ServiceAbstract->callMethod()
#3 /usr/sbin/omv-engined(535): OMV\Rpc\Rpc::call()
#4 {main}

I suppose the plugin try to dele the vm to recreate it. I tried to change through command lines without any success:

~# virsh setvcpus W11KVM --count 5 --config --maximum
error: invalid argument: requested vcpus is greater than max allowable vcpus for the persistent domain: 5 > 4

when trying to edit the xml, I managed to set vcpu, changing these two values vcpu placement and cores:

~# virsh edit W11KVM
.....
<vcpu placement='static'>6</vcpu>
....
<topology sockets='1' dies='1' cores='3' threads='2'/>

I set librvirt-manager with ssh+qemu to have access to all settings. I hope that the manager won't set feature that the plugin won't be able to handle.

I'm new to kvm and this plugin, I don't know if it's a known limitation, a bug or a feature to be developped.

ryecoaaron commented 9 months ago

Any VM still using nvram is problematic when using virsh or libvirt commands. I will look to see if I can make it work but it seems like libvirt/virsh support for nvram is not good. Do you still have the issue when the VM is powered off?

edgd1er commented 9 months ago

all commands were ran when vm was shutdown as --live arg with the same commands were not giving more results. is the plugin deleting the vm before recreating the same when editing memory or vcpu ?

the link gave me information: https://earlruby.org/2014/05/increase-a-vms-vcpu-count-with-virsh/

ryecoaaron commented 9 months ago

all commands were ran when vm was shutdown as --live arg with the same commands were not giving more results.

Does that mean you used menus in the plugin while it was shutdown and things still didn't work?

is the plugin deleting the vm before recreating the same when editing memory or vcpu ?

No. The plugin runs libvirt or virsh commands. Those commands may redefine the xml behind the scenes.

edgd1er commented 9 months ago

all commands were ran when vm was shutdown as --live arg with the same commands were not giving more results.

Does that mean you used menus in the plugin while it was shutdown and things still didn't work?

yes, here is what I tried:

ryecoaaron commented 9 months ago

Can you post the xml for the VM causing issues?

edgd1er commented 9 months ago

error when upgrading from 2 to 4 cpu. image

W11KVM.zip

ryecoaaron commented 9 months ago

So, it doesn't work because you have something other than one for threads. The plugin is only changing cores and vcpu must match sockets cores threads, You have 2 threads which means the plugin is setting vcpu to half of what it should. If I change the plugin to force one for threads, sockets, and dies, it works fine.

ryecoaaron commented 8 months ago

This is fixed now by forcing the dies, sockets, and threads to 1.

edgd1er commented 8 months ago

thanks for the fix.