Multi-Category Security (MCS) Plugin Programmer Guide

Overview

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

Slurm MCS plugins must conform to the Slurm Plugin API with the following specifications:
Slurm MCSプラグインは、次の仕様のSlurmプラグイン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.
メジャータイプは「mcs」である必要があります。マイナータイプは、MCSに適した任意の名前にすることができます。
We recommend, for example :
たとえば、次のことをお勧めします。

  • account — Use user account as the category to associate jobs to.
    アカウント—ジョブを関連付けるカテゴリとしてユーザーアカウントを使用します。
  • none — Default.
    none —デフォルト。
    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.
注:これらのinitおよびfini関数は、dlopen(3)システムライブラリで説明されているものと同じではありません。
The C run-time system co-opts those symbols for its own initialization.
Cランタイムシステムは、独自の初期化のためにこれらのシンボルを採用します。
The system _init() is called before the Slurm init(), and the Slurm fini() is called before the system's _fini().
システム_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.
ジョブのmcs_labelを取得するために_job_createによって呼び出されます。

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

label (input) pointer to requested label or NULL if not specified.
label(入力)要求されたラベルへのポインター。指定されていない場合は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.
コマンドsqueue / scontrolの場合、オプションprivateの場合はノードを表示します。
Check the compatibility between MCS_label of user and MCS_label of jobs/nodes.
ユーザーの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