# Slurmctld Generic Plugin Programmer Guide

## Overview

This document describes slurmctld daemon's generic plugins and the API that defines them. It is intended as a resource to programmers wishing to write their own slurmctld generic plugins. This is version 100 of the API.

The slurmctld generic plugin must conform to the Slurm Plugin API with the following specifications:

const char plugin_name[]="full text name"

A free-formatted ASCII text string that identifies the plugin.

const char plugin_type[]="major/minor"

The major type must be "slurmctld_plugstack." The minor type can be any suitable name for the type of slurmctld package. Slurm can be configured to use multiple slurmctld_plugstack plugins if desired.

const uint32_t plugin_version
If specified, identifies the version of Slurm used to build this plugin and any attempt to load the plugin from a different version of Slurm will result in an error. If not specified, then the plugin may be loaded by Slurm commands and daemons from any version, however this may result in difficult to diagnose failures due to changes in the arguments to plugin functions or changes in other Slurm functions used by the plugin.

## API Functions

int init (void)

Description:
Called when the plugin is loaded, before any other functions are called. Put global initialization here.

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

void fini (void)

Description:
Called when the plugin is removed. Clear any allocated storage here.

Returns: None.

List slurmctld_plugstack_p_get_config (void)

Description:
Called when there's a REQUEST_BUILD_INFO RPC call. It must fill a List with config_key_pair_t elements that represents the configurable parameters of the plugin. Normally used when for scontrol and sview to dump the configuration.

Returns:
List of keyword - value pairs.

Note: These init and fini functions are not the same as those described in the dlopen (3) system library. The C run-time system co-opts those symbols for its own initialization. The system _init() is called before the Slurm init(), and the Slurm fini() is called before the system's _fini().

The init function will be called when the slurmctld daemon begins accepting RPCs. The fini function will be called when the slurmctld daemon stops accepting RPCs. Other functions can be called at any time. In the case of the backup slurmctld daemon, the init and fini functions may be called multiple times (when it assumes control functions and then when it reliquishes them to the primary slurmctld daemon).

Last modified 24 January 2018