Skip to content

Instantly share code, notes, and snippets.

@oBuTr471b
Created January 9, 2021 19:09
Show Gist options
  • Save oBuTr471b/13a517d8d507130c228c740c7e4509ef to your computer and use it in GitHub Desktop.
Save oBuTr471b/13a517d8d507130c228c740c7e4509ef to your computer and use it in GitHub Desktop.
# In The Name Of Allah .
# -- --- ---- -- ----- -
# Thu Nov 19 14:20:52 2020
# Written By : zer0err0r .
# ======= == = ========= =
# 21, Changing VMs Basic Parameters .
# To change vCPUs :
$ virsh shutdown centos1
$ virsh edit centos1
<vcpu>2</vcpu>
$ virsh create /etc/libvirt/qemu/centos1.xml
# To change RAM :
# Reducing [1GB to 512MB] :
$ virsh dominfo centos1 | grep memory
Max memory: 1048576kb # 1GB .
Used memory: 1048576kb # 1GB .
$ virsh setmem centos1 524288 # [512mb x 1024 = 524288kb] .
# Increasing [512MB to 1GB] :
$ virsh shutdown centos1
$ virsh edit centos1
<memory>1048576</memory> # Leave the <CurrentMemory> as it is .
$ virsh start centos1
$ virsh dominfo centos1 | grep memory
Max memory: 1048576kb # 1GB .
Used memory: 524288kb # 512MB .
$ virsh setmem centos1 1048576
# As you see :
= Because of we needed to modify the VM [.xml] file, We shutted the VM down .
= Unlike when we reduced the VM RAM size, We did it dynamically without shutting it down .
# ===== == ==== ======== =
# Peace Be Up0n Muhammed .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment