[Pkg-libvirt-maintainers] Bug#908186: libvirt-clients: UNable to limit swap by editing guest xml configuration, but virsh memtune swap_hard_limit works

reusser reusser.mb at gmail.com
Fri Sep 7 08:43:49 BST 2018


Package: libvirt-clients
Version: 3.0.0-4+deb9u3
Severity: normal

Dear Maintainer,

I'm trying to limit swap usage of guest systems. Libvirt offers the
memory tuning option 'swap_hard_limit' [1]. To enable setting of the swap
hard limit, we need to enable swap control in the kernel by adding
swapaccounting to the grub commandline [2]. 

Now, I'm able to set a swap limit with virsh memtune:

> virsh --connect qemu:///system memtune demo --hard-limit 614400 
> virsh --connect qemu:///system memtune demo --swap-hard-limit 714400 

However, if I edit the guest xml configuration by adding

  <memtune>
      <swap_hard_limit unit='KiB'>614402</swap_hard_limit>
  </memtune>

The guest does not start. Instead, I get an error:
virsh --connect qemu:///system start demo
error: Failed to start domain demo error: Invalid value '629146624' for 'memory.memsw.limit_in_bytes': Das Argument ist ungültig 

I expect the guest to start with a limitation on swap usage.

[1] https://libvirt.org/formatdomain.html#elementsMemoryTuning
[2] https://askubuntu.com/questions/417215/how-does-kernel-support-swap-limit


-- System Information:
Debian Release: 9.5
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-8-amd64 (SMP w/8 CPU cores)
Locale: LANG=de_DE.utf8, LC_CTYPE=de_DE.utf8 (charmap=UTF-8) (ignored: LC_ALL set to de_DE.utf8), LANGUAGE=de_DE.utf8 (charmap=UTF-8) (ignored: LC_ALL set to de_DE.utf8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libvirt-clients depends on:
ii  libapparmor1        2.11.0-3+deb9u2
ii  libaudit1           1:2.6.7-2
ii  libavahi-client3    0.6.32-2
ii  libavahi-common3    0.6.32-2
ii  libc6               2.24-11+deb9u3
ii  libcap-ng0          0.7.7-3+b1
ii  libdbus-1-3         1.10.26-0+deb9u1
ii  libdevmapper1.02.1  2:1.02.137-2
ii  libgnutls30         3.5.8-5+deb9u3
ii  libnl-3-200         3.2.27-2
ii  libnl-route-3-200   3.2.27-2
ii  libnuma1            2.0.11-2.1
ii  libreadline7        7.0-3
ii  libsasl2-2          2.1.27~101-g0780600+dfsg-3
ii  libselinux1         2.6-3+b3
ii  libssh2-1           1.7.0-1
ii  libvirt0            3.0.0-4+deb9u3
ii  libxen-4.8          4.8.4+xsa273+shim4.10.1+xsa273-1+deb9u10
ii  libxml2             2.9.4+dfsg1-2.2+deb9u2
ii  libyajl2            2.1.0-2+b3

libvirt-clients recommends no packages.

Versions of packages libvirt-clients suggests:
ii  libvirt-daemon  3.0.0-4+deb9u3

-- no debconf information


More information about the Pkg-libvirt-maintainers mailing list