Adding memory to a virtual machine: Difference between revisions

From DISI
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
Use "virsh", either locally:
Use "virsh", either locally:
  root@rocky$ virsh (COMMANDS HERE)
  root@your_hypervisor$ virsh (COMMANDS HERE)
or remotely:
or remotely:
  teague@spinaltap$ virsh --connect qemu:///rocky.cluster.uoft.bkslab.org/system (COMMANDS HERE)
  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.
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 list  # Show all VMs
  virsh dumpxml pan.slot-31.rack-1.donnelly.cluster.uoft.bkslab.org > ~/pan.xml.tmp  # Extract pan configuration for local modification
  virsh dumpxml your_vm > ~/pan.xml.tmp  # Extract pan configuration for local modification
  vim ~/pan.xml.tmp
  vim ~/your_vm.xml.tmp
  These lines
  These lines
   <memory unit='KiB'>4194304</memory>
   <memory unit='KiB'>4194304</memory>
Line 17: Line 17:
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
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 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 shutdown your_vm
  virsh start pan.slot-31.rack-1.donnelly.cluster.uoft.bkslab.org
  virsh start your_vm


To remove jobs:
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
  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
  qstat -u '*' | tail -n+3 | cut -f2 -d\ | xargs -L 250 qdel -f  # -L 250 means send chunks of 250 job ids to qdel




[[Category:Internal]]
[[Category:Internal]]

Revision as of 20:16, 22 January 2014

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 > ~/pan.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 ~/pan.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