Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

References

A reference is a marker in the value of a configuration keyword, replaced during evaluation.

A reference is formatted as {<expression>}.

References can be used to:

  • Abstract changing parts of a configuration, so this configuration can be used as a template Example: The object name, object id, the devices that hosts the data

  • Factorize information, so changing it is easier and safer Example: A project name used to format the name of different resources (volume group, filesystem path, …)

  • Contextualize part of a configuration with information known to the agent Example: The cluster nodes, cluster dns ip addresses, …

Intra-Configuration References

The reference format is {[<section>.]<option>}, where

  • <section> is a configuration file section name
  • <option> is the option name in the pointed section.

If <section> is omitted, the referencing keyword’s section is implicitly used if the reference can be found locally, or the DEFAULT section is implicitly used.

Intra-Section References

These references can be used inside a configuration section, and their evaluated value depends on the section.

ReferenceDescriptionNode Configuration FileService Configuration File
{rid}The name of the section the reference is underNoYes
{rindex}The part after the dash of the name of the section the reference is underNoYes
{<keyword>}Reference to another keyword’s value inside the same sectionYesYes

Hard Coded References

ReferenceDescriptionNode Configuration FileService Configuration File
{nodename}The running node fqdnYesYes
{short_nodename}The running node base name (without domain)YesYes
{#nodes}Number of nodesNoYes
{namespace}The name of the hosting namespaceNoYes
{kind}The object kind, ie “svc”, “vol”, “sec”, “cfg”, “ccfg”NoYes
{name}The object nameNoYes
{path}The object path, ie <namespace>/<kind>/<name>NoYes
{short_name}The object base name (name with domain suffix stripped)NoYes
{fqdn}The object fully qualified name, as registered in the cluster DNS, ie <name>.<namespace>.<kind>.<clustername>NoYes
{scaler_name}The scaler name (because {name} resolves to the slice name)NoYes
{scaler_short_name}The scaler base name (name with domain suffix stripped)NoYes
{id}The object idNoYes
{safe://<id>}Substitute the reference with the content of the safe file identified by <id>. Usually passwords or private keys. The content is cached locally so the collector dependency is loose.YesYes
{clustername}The cluster.name node keyword valueYesYes
{clusterid}The cluster.id node keyword valueYesYes
{clusternodes}The cluster.nodes node keyword valueYesYes
{clusterdrpnodes}The cluster.drpnodes node keyword valueYesYes
{dns}The cluster.dns node keyword value (ip adressses)YesYes
{dnsnodes}The cluster.dns node keyword value (resolved names)YesYes
{dnsuxsock}The path to the dns thread unix socketYesYes
{dnsuxsockd}The path to the directory hosting the dns thread unix socketYesYes
{collector_api}The uri of the collector Rest APIYesYes
{nodemgr}The full path the the om node executable}YesYes
{svcmgr}The full path the the svcmgr executableYesYes
{etc}The agent etc/ directory path: /etc/opensvc/ for agents installed through the packages, /opt/opensvc/etc/ for an agent installed via git pull in /optYesYes
{var}The agent var/ directory path /var/lib/opensvc/ for agents installed through the packages, /opt/opensvc/var/ for an agent installed via git pull in /optYesYes
{initd}The object init directory path. ex: /etc/opensvc/etc/<name>.dYesYes
{private_var}The object private directory under {var}YesYes
{<rid>.exposed_devs}The whitespace-separated list of devpaths exposed by <rid>NoYes
{<rid>.exposed_devs[<n>]}The -th element of the list of devpaths exposed by <rid>NoYes
{<rid>.exposed_devs[#]}The length of the list of devpaths exposed by <rid>NoYes

Deprecated references:

ReferenceDescriptionNode Configuration FileService Configuration File
{svcname}Deprecated by {name}NoYes
{svcpath}Deprecated by {path}NoYes
{short_svcname}Deprecated by {short_name}NoYes

References and env Section

The env section can be used to store arbitrary factorized information to make available as references in other parts of the configuration.

Example:

[disk#0]
name = {id}
pvs = {env.devs}

[env]
devs = /dev/vdb

These values can be overridden when creating a new object from this configuration file or template.

om <path> create --config <template> --env devs=/dev/vdc