[one-users] How-to set RAM on Running KVM VM in CentOS 6.2x86 +    openNebula v3.6

cloud.b.lab cloud.b.lab at zoho.com
Wed Aug 22 00:17:48 PDT 2012


Junix,

There is an indirect method, but I do not recommend that as it will send wrong and incorrect signals to OpenNebula Monitoring program and if you do not have fast hands, your VM will end up in "unkn" state.


Again I am saying I it is not a  recommend practice and you don't try  it in a non test environment.  




If you would like to try it for information purpose , do the following:


1. Create a test vm and login.
   e.g.   153 oneadmin oneadmin centos63  runn   10   1024M onehost      0d 00h12


2. Verify the total memory using "free" command


3. Go to the machine running libvirt [means your OpenNebula Node]


4. Get the doamin ID using                     virsh list


5. Get a xmldump of running domain         virsh dumpxml <Domain-ID>  <file-name>          
    e.g.  virsh dumpxml 7 > /var/lib/one/template/one-149


6. Open the XML and change the memory values, Save. Assume currently it is 1048576.
  <memory>2095104</memory>
  <currentMemory>2095104</currentMemory>


7. Destroy the running domain                 virsh destroy 6


8. List all doamins in Shut-off state          virsh list --all


9. If it is there in shut-off state, undefine it          virsh undefine <DOAMIn-NAME>           
      e.g. virsh undefine one-149


10. Recreate the doamin using the XML       
      e.g. virsh create /var/lib/one/template/one-149


11. Connect through VNC , login as root and check with "free". You will see a higher MEM value 


11. Give onevm top ,Wait for some time: OpenNebula reports the following.


153 oneadmin oneadmin  centos63   runn    5      2G onehost      0d 00h24





 Thanks and regards,
Anil Kumar






---- On Tue, 21 Aug 2012 22:38:39 -0700 cloud.b.lab<cloud.b.lab at zoho.com> wrote ---- 


As per my limited understanding:


The  RAM size you specify in the VM template using "MEMORY=xxxx" translates to "Maximum available memory" for an active domain.

Hence, while the domain being active , I think one cannot go beyond the available/max mem. 


If you edit the XML file through libvirt and force change the Maximum memory value to anything higher, you may end up in Kernel Panic situation.


If you would like to try it , do the following:
1. Create a test vm
2. Verify the total memory using "free" command
3. Go to the machine running libvirt
4. Get the doamin ID using                               virsh list
5. Save the current state of doamin using          virsh save <Doamin_ID>  <Filename-with-domain-name>
    (so that you have a copy of it)                      
6. Restore the doamin      using                        virsh  <Filename-with-domain-name>
5. Edit the doamin XML using                            virsh edit <DOMAIN_ID>
6. Try to change values for <memory> and <currentMemory> tags to a higher value divisible by 1024.
     Assume current <memory> is 1048576.
e.g. 
 <memory>2095104</memory>
  <currentMemory>2095104</currentMemory>

7. Try to reboot the doamin                              virsh reboot <DOAMIn-ID>
8. Check available memory using "free"
9. Try issue setmaxmem command to increase memory to 2095104   virsh setmaxmem <DOAMIn-ID> 2095104


oneadmin at onehost:~$ virsh setmaxmem 4 2095104
error: Unable to change MaxMemorySize
error: Requested operation is not valid: cannot resize the maximum memory on an active domain

10. Try to increase available memory
oneadmin at onehost:~$ virsh setmem 4 2095104
error: Requested memory size 2095104 kb is larger than maximum of 1048576 kb



Hope this helps.....


Regards,
Anil.





---- On Tue, 21 Aug 2012 10:42:41 -0700 Lawrence Chiong<junix88 at gmail.com> wrote ---- 


Hello,

Can anyone guide me a step-by-step guide on HOWTO change/update RAM on a fly / running VM (KVM). Because I tried changing my VM template (in sunstone)  its Memory (e.g. from 2048M to 4096M) and then reboot my KVM VM but changes made doesn't take effect. So I tried manually changed the .../deployment.0 file and update the Memory element and update also the vm_pool table on body field +Memory element to 4096M then I restarted "oned" + "sunstone" so with mysqld BUT still the memory being updated doesn't changed.
 
Any help is very much appreciated. 

Thank you.

Junix
 _______________________________________________ 
Users mailing list 
Users at lists.opennebula.org 
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org 



_______________________________________________ 
Users mailing list 
Users at lists.opennebula.org 
http://lists.opennebula.org/listinfo.cgi/users-opennebula.org 




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opennebula.org/pipermail/users-opennebula.org/attachments/20120822/f5ef3a96/attachment-0003.htm>


More information about the Users mailing list