Provide a way to disable swap files added by default to all deployed machines
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MAAS |
Triaged
|
Medium
|
Unassigned | ||
3.4 |
Won't Fix
|
Medium
|
Unassigned | ||
3.5 |
Won't Fix
|
Medium
|
Unassigned | ||
3.6 |
Triaged
|
Medium
|
Unassigned | ||
maas-ui |
Triaged
|
Medium
|
Unassigned |
Bug Description
Currently all ubuntu installations have swap enabled by default even if there was no swap partition configured in the node storage configuration. For bionic this is somewhat consistent with [1] and [2], however, MAAS uses curtin to perform the installation and not d-i or subiquity.
It would make sense to have a UI option and a way to disable swap via API for individual nodes, by tag or completely for all deployed nodes.
This is relevant, for example, on hypervisor nodes where guest (QEMU process) pages can be otherwise swapped out by the host or storage nodes where certain designs prohibit swap usage completely making a compromise between trashing vs OOM killer behavior. There are other applications where this can be relevant as well.
The curtin logic is pretty straightforward: setup a swap file if swap size is not provided (None) and it is set to 'None' if there is no swap config. And the default curtin config generated by MAAS (see the attachment) does not contain a swap section.
https:/
def setup_swapfile(
if size is None:
size = suggested_
if size == 0:
return
if swapfile is None:
swapfile = "/swap.img"
https:/
def add_swap(cfg, target, fstab):
if 'swap' in cfg and not cfg.get('swap'):
return
swapcfg = cfg.get('swap', {})
fname = swapcfg.
size = swapcfg.get('size', None)
maxsize = swapcfg.
# ...
swap.
https:/
def builtin_
# ...
with events.
https:/
"size: <Size string> Configure the exact size of the swapfile. Setting size to 0 will disable swap."
maas-vhost1/
maas-vhost1/
maas-vhost1/
maas-vhost1/
# swap is on, whether you need it or not
free -m
total used free shared buff/cache available
Mem: 1993 90 1677 0 225 1756
Swap: 2047 0 2047
One could set vm.swappiness=0 [3], however, this is not ideal because it does not entirely disable swap [3]:
"A value of 0 instructs the kernel not to initiate swap until the amount of free and file-backed pages is less than the high water mark in a zone."
The default value for vm.swappiness is 60 [4] and has to be changed explicitly as well.
[1] https:/
[2] http://
Starting from 17.04 Zesty Zapus release, instead of creating swap partitions, swapfiles will be used by default for non-lvm based installations.
[3] https:/
[4] http://
Changed in maas: | |
assignee: | nobody → MAAS UI team (maas-ui-team) |
status: | New → Triaged |
importance: | Undecided → Medium |
tags: | added: ui |
Changed in maas-ui: | |
importance: | Undecided → Unknown |
summary: |
- [ui] provide a way to disable swap files added by default to all - deployed machines + Provide a way to disable swap files added by default to all deployed + machines |
Changed in maas-ui: | |
status: | New → Triaged |
milestone: | none → 3.4.0 |
Changed in maas: | |
milestone: | 3.4.0 → 3.4.x |
tags: | removed: ui |
Changed in maas: | |
milestone: | 3.4.x → 3.5.x |
Changed in maas-ui: | |
milestone: | 3.4.x → 3.5.x |
Changed in maas-ui: | |
milestone: | 3.5.x → 3.6.x |
importance: | Unknown → Medium |
Have you tried:
maas {session} machine update {system_id} swap_size=0