Adding memory to a virtual machine

From DISI
Revision as of 18:39, 22 January 2014 by Therese (talk | contribs)
Jump to navigation Jump to search

Use "virsh", either locally:

root@rocky$ virsh (COMMANDS HERE)

or remotely:

teague@spinaltap$ virsh --connect qemu:///rocky.cluster.uoft.bkslab.org/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
  1. Extract pan (sgemaster) configuration for local modification
virsh dumpxml pan.slot-31.rack-1.donnelly.cluster.uoft.bkslab.org > ~/pan.xml.tmp  
vim ~/pan.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 ~/pan.xml.tmp  # Upload the new configuration to the hypervisor (overwrites pan.slot-31....)
virsh shutdown pan.slot-31.rack-1.donnelly.cluster.uoft.bkslab.org
virsh start pan.slot-31.rack-1.donnelly.cluster.uoft.bkslab.org

To remove jobs:

qconf -as pan.slot-27.rack-1.pharmacy.cluster.uoft.bkslab.org  # I forgot to make pan a submit node, needed for deleting
qstat -u '*' | tail -n+3 | cut -f2 -d\ | xargs -L 250 qdel -f   # -L 250 means send chunks of 250 job ids to qdel