format: Support partition capabilities in computer definition file
This goes with !584 (merged)
Feature
This allows partition capabilities to be specified in the computer definition file (conventionally slapformat-definition.cfg
), like this:
[partition_0]
...
capability_list =
fast-network
more_disk_space
yet another capability
...
Capabilities are line-separated and may otherwise contain whitespace. Whitespace at the beginning and end of each line is stripped.
Usage
As of current slapformat implementation, the computer definition file must exhaustively define the computer: this means it must have a section for the computer
and a section for each partition_X
, with required fields such as address
and user
. The ability to manually specify some things and automatically fill-in the rest is on the wishlist for a better slapformat :)
A practical usage is therefore to generate slapformat-definition.cfg
automatically and then edit it manually:
- Edit
slapos.cfg
to generateslapformat-definition.cfg
[slapformat] output_definition_file = path/to/slapformat-definition.cfg
- Run
slapos node format --now
to generateslapformat-definition.cfg
- Edit generated
slapformat-definition.cfg
to add capabilities - Edit
slapos.cfg
to useslapformat-definition.cfg
[slapformat] input_definition_file = path/to/slapformat-definition.cfg
-
slapos node format --now
to send the capabilities to master
Fixes
The netiface
module sometimes returns netmask values like ffff:ffff:ffff:ffff:ffff:ffff::/96
. This was already caught and fixed on the fly in some cases, but not all, causing the generate-edit-use slapformat-definition.cfg
pattern above to fail. To avoid this, all usages of netiface.ifaddresses
are replaced with a function that normalizes netmasks.