Adding memory to a virtual machine
Jump to navigation
Jump to search
Use "virsh", either locally:
root@your_hypervisor$ virsh (COMMANDS HERE)
or remotely:
root@foreman_machine$ virsh --connect qemu:///your_hypervisor/system (COMMANDS HERE)
We want to change the configuration for a running VM. Doing this requires dumping the current configuration to a text (XML) file, editing it, and pushing the changes to the hypervisor. I will show this with the local version for brevity.
virsh list # Show all VMs virsh dumpxml your_vm > ~/your_vm.xml.tmp # Extract pan configuration for local modification vim ~/your_vm.xml.tmp These lines <memory unit='KiB'>4194304</memory> <currentMemory unit='KiB'>4194304</currentMemory> to this <memory unit='KiB'>16777216</memory> <currentMemory unit='KiB'>8388608</currentMemory>
This changes the currently used memory from 4GB to 8GB and raises the max memory that can be allocated w/o rebotting from 4GB to 16GB
virsh define ~/your_vm.xml.tmp # Upload the new configuration to the hypervisor (overwrites pan.slot-31....) virsh shutdown your_vm virsh start your_vm
To remove jobs:
qconf -as your_vm qstat -u '*' | tail -n+3 | cut -f2 -d\ | xargs -L 250 qdel -f # -L 250 means send chunks of 250 job ids to qdel