Multi-Category Security (MCS) Plugin Programmer Guide

Overview

This document describes Slurm's MCS plugins and the API that defines them. It is intended as a resource to programmers wishing to write their own Slurm MCS plugins.
このドキュメントでは、SlurmのMCSプラグインとそれらを定義するAPIについて説明します。独自のSlurm MCSプラグインを作成したいプログラマへのリソースとして意図されています。

Slurm MCS plugins must conform to the Slurm Plugin API with the following specifications:
Slurm MCSプラグインは、次の仕様のSlurm Plugin APIに準拠している必要があります。

const char plugin_name[]="full text name"

A free-formatted ASCII text string that identifies the plugin.
プラグインを識別する自由形式のASCIIテキスト文字列。

const char plugin_type[]="major/minor"

The major type must be "mcs." The minor type can be any suitable name for the MCS. We recommend, for example :
主なタイプは「mcs」である必要があります。マイナータイプには、MCSの適切な名前を指定できます。たとえば、次のことをお勧めします。

  • account — Use user account as the category to associate jobs to.
    アカウント—ジョブを関連付けるカテゴリとしてユーザーアカウントを使用します。
  • none — Default. No category associated to jobs.
    なし—デフォルト。ジョブに関連付けられているカテゴリはありません。
  • user — Use user name as the category to associate jobs to.
    user —ジョブを関連付けるカテゴリとしてユーザー名を使用します。
  • group — Use a user group as the category to associate jobs to.
    group —ジョブを関連付けるカテゴリとしてユーザーグループを使用します。

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.
指定した場合、このプラグインのビルドに使用されたSlurmのバージョンを識別し、異なるバージョンのSlurmからプラグインをロードしようとすると、エラーが発生します。
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.
指定されていない場合、プラグインはSlurmコマンドとデーモンによって任意のバージョンから読み込まれる可能性がありますが、プラグイン関数の引数の変更やプラグインで使用される他のSlurm関数の変更が原因で、障害の診断が困難になる可能性があります。

The programmer is urged to study src/plugins/mcs/group and src/common/slurm_mcs.c for an example implementation of a Slurm MCS plugin.
プログラマーは、Slurm MCSプラグインの実装例について、src / plugins / mcs / groupおよびsrc / common / slurm_mcs.cを調べることをお勧めします。

API Functions

All of the following functions are required. Functions which are not implemented must be stubbed.
以下の機能がすべて必要です。実装されていない関数はスタブする必要があります。

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.

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().
注:これらのinitおよびfini関数は、dlopen(3)システムライブラリで説明されているものと同じではありません。Cランタイムシステムは、これらのシンボルを独自の初期化用にco-optします。システムの_init()はSlurm init()の前に呼び出され、Slurm fini()はシステムの_fini()の前に呼び出されます。

int mcs_p_set_mcs_label(job_record_t *job_ptr, char *label)

Description:
Verify and set or calculate MCS_label for a job.
ジョブのMCS_labelを確認および設定または計算します。

Called by _job_create to get the mcs_label for a job.
_job_createによって呼び出され、ジョブのmcs_labelを取得します。

Arguments:
job_ptr (input/output) pointer to the slurmctld job structure. This can be used to get user_id and group_id. Assign MCS_label if possible.
job_ptr(入力/出力)slurmctldジョブ構造へのポインター。これは、user_idおよびgroup_idを取得するために使用できます。可能であればMCS_labelを割り当てます。

label (input) pointer to requested label or NULL if not specified.
要求されたラベルへのラベル(入力)ポインター。指定されていない場合はNULL。

Returns:
SLURM_SUCCESS on success, or SLURM_ERROR on failure.

int mcs_p_check_mcs_label(uint32_t user_id, char *mcs_label)

Description:
For command squeue/scontrol show nodes in case of option private. Check the compatibility between MCS_label of user and MCS_label of jobs/nodes.
コマンドsqueue / scontrolの場合、オプションがprivateの場合はノードを表示します。ユーザーのMCS_labelとジョブ/ノードのMCS_labelの互換性を確認してください。

Arguments:
user_id, mcs_label (input).

Returns:
SLURM_SUCCESS on success, or SLURM_ERROR on failure.

Parameters

These parameters can be used in the slurm.conf to configure the plugin.
これらのパラメーターをslurm.confで使用して、プラグインを構成できます。

MCSPlugin
Specifies which plugin should be used.
使用するプラグインを指定します。
MCSParameters
If MCSPlugin!=mcs/none, specifies options
MCSPlugin!= mcs / noneの場合、オプションを指定します

Last modified 23 October 2019