You can set the vCPU and memory while the VM is running with --current instead of --config, but the new numbers has to be within the maximum values already set. You can not set these maximum numbers while the VM is running. You will have to shutdown the VM with virsh shutdown <vm_name>, use the above command and start back the VM with virsh start <vm_name>.
To increase the maximum amount of memory that can be allocated to the VM you have to increase the maximum memory limit, power off the VM, increase the memory allocated, the start the VM. There's a step-by-step guide here:
For offline configuration:
To increase the number of CPUs:
If you get an error that you exceeded the maximum number, first do:
Then repeat the above:
To increase the memory size:
For online configuration:
You can set the vCPU and memory while the VM is running with
--current
instead of--config
, but the new numbers has to be within the maximum values already set. You can not set these maximum numbers while the VM is running. You will have to shutdown the VM withvirsh shutdown <vm_name>
, use the above command and start back the VM withvirsh start <vm_name>
.You can edit its
XML
from command-line with:Then, you only have to search the
<memory>
tag and modify itKeep in mind that the memory allocation is in kilobytes, so to allocate 512MB of memory, use 512 * 1024, or 524288.
You can edit the VM settings in
virt-manager
or in cli by changing the XML invirsh edit VMNAME
To increase the maximum amount of memory that can be allocated to the VM you have to increase the maximum memory limit, power off the VM, increase the memory allocated, the start the VM. There's a step-by-step guide here:
http://earlruby.org/2014/05/increase-a-vms-available-memory-with-virsh/
To get more VCPUs you have to edit the virsh XML file and restart the VM. There's a step-by-step guide to do this here:
http://earlruby.org/2014/05/increase-a-vms-vcpu-count-with-virsh/