[libvirt-users] Dynamically setting permanent memory libvirt-lxc

I'm trying to permanently change memory allocation for a libvirt-lxc domain. So far I tried changing memory in memory.limit_in_bytes under /cgroup/memory/libvirt/lxc/<container>/. This didn't help. It appears that libvirt is not reading changes in cgroup. My requirements are 1) Be able to dynamically change memory of a LXC domain without reboot 2) The memory change must survive LXC domain reboot. Any help would be greatly appreciated

On 01/30/2014 10:11 AM, mallu mallu wrote:
I'm trying to permanently change memory allocation for a libvirt-lxc domain. So far I tried changing memory in memory.limit_in_bytes under /cgroup/memory/libvirt/lxc/<container>/. This didn't help. It appears that libvirt is not reading changes in cgroup.
My requirements are
1) Be able to dynamically change memory of a LXC domain without reboot 2) The memory change must survive LXC domain reboot.
virsh memtune, virsh setmaxmem, and virsh setmem are the appropriate tools to use. Changing things directly in cgroups goes behind libvirt's back, while changing it through the libvirt API allows you to hot-plug the changes as well as control whether the next boot will have the same new limits. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

Eric, thank you for your response. Virsh memtune, setmaxmem and setmem won't survive a reboot. I'm hoping to find a solution that can survive reboot. On Thursday, January 30, 2014 11:36 AM, Eric Blake <eblake@redhat.com> wrote: On 01/30/2014 10:11 AM, mallu mallu wrote:
I'm trying to permanently change memory allocation for a libvirt-lxc domain. So far I tried changing memory in memory.limit_in_bytes under /cgroup/memory/libvirt/lxc/<container>/. This didn't help. It appears that libvirt is not reading changes in cgroup.
My requirements are
1) Be able to dynamically change memory of a LXC domain without reboot 2) The memory change must survive LXC domain reboot.
virsh memtune, virsh setmaxmem, and virsh setmem are the appropriate tools to use. Changing things directly in cgroups goes behind libvirt's back, while changing it through the libvirt API allows you to hot-plug the changes as well as control whether the next boot will have the same new limits. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

On 01/30/2014 01:26 PM, mallu mallu wrote: [please don't top-post on technical lists; also, it would be nice if you could convince your mailer to wrap long lines)
Eric, thank you for your response. Virsh memtune, setmaxmem and setmem won't survive a reboot.
Ah, but they DO survive reboots, if you use the right options. 'virsh memtune --live --config' affects both the running guest and the next boot. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org

[please don't top-post on technical lists; also, it would be nice if you could convince your mailer to wrap long lines)
Eric, thank you for your response. Virsh memtune, setmaxmem and setmem won't survive a reboot.
Ah, but they DO survive reboots, if you use the right options. 'virsh memtune --live --config' affects both the running guest and the next boot. ------- Appologize for top-posting. I'm getting error when specifying --live or --config. Am I doing something wrong? # virsh memtune test --hard-limit 786432 --config --live error: Unable to change memory parameters error: unsupported flags (0x3) in function lxcDomainSetMemoryParameters # libvirtd -v 2014-01-31 00:17:00.511+0000: 3313: info : libvirt version: 0.10.2, package: 18.el6_4.15

On 01/30/2014 05:25 PM, mallu mallu wrote:
I'm getting error when specifying --live or --config. Am I doing something wrong?
Your version of libvirt is too old.
# libvirtd -v 2014-01-31 00:17:00.511+0000: 3313: info : libvirt version: 0.10.2, package: 18.el6_4.15
RHEL 6 offered LXC support in libvirt only as a tech preview - it is missing a large number of features (including this one). You would be much better off retrying with the RHEL 7 beta, where LXC is finally a first-class citizen when it comes to Red Hat support, and/or building upstream libvirt yourself. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
participants (2)
-
Eric Blake
-
mallu mallu