From 498277408a9613d70617869367415494af2aee90 Mon Sep 17 00:00:00 2001 From: Travis Glenn Hansen Date: Thu, 24 Jun 2021 17:04:38 -0600 Subject: [PATCH] lustre-client support Signed-off-by: Travis Glenn Hansen --- examples/lustre-client.yaml | 10 +++++++ src/driver/controller-lustre-client/index.js | 31 ++++++++++++++++++++ src/driver/factory.js | 3 ++ src/driver/index.js | 2 ++ src/driver/node-manual/index.js | 3 ++ 5 files changed, 49 insertions(+) create mode 100644 examples/lustre-client.yaml create mode 100644 src/driver/controller-lustre-client/index.js diff --git a/examples/lustre-client.yaml b/examples/lustre-client.yaml new file mode 100644 index 0000000..7a331b4 --- /dev/null +++ b/examples/lustre-client.yaml @@ -0,0 +1,10 @@ +driver: lustre-client +instance_id: +lustre: + shareHost: server address + shareBasePath: "/some/path" + # shareHost:shareBasePath should be mounted at this location in the controller container + controllerBasePath: "/storage" + dirPermissionsMode: "0777" + dirPermissionsUser: root + dirPermissionsGroup: wheel diff --git a/src/driver/controller-lustre-client/index.js b/src/driver/controller-lustre-client/index.js new file mode 100644 index 0000000..18914a8 --- /dev/null +++ b/src/driver/controller-lustre-client/index.js @@ -0,0 +1,31 @@ +const { ControllerClientCommonDriver } = require("../controller-client-common"); + +/** + * Crude lustre-client driver which simply creates directories to be mounted + * and uses rsync for cloning/snapshots + */ +class ControllerLustreClientDriver extends ControllerClientCommonDriver { + constructor(ctx, options) { + super(...arguments); + } + + getConfigKey() { + return "lustre"; + } + + getVolumeContext(name) { + const driver = this; + const config_key = driver.getConfigKey(); + return { + node_attach_driver: "lustre", + server: this.options[config_key].shareHost, + share: driver.getShareVolumePath(name), + }; + } + + getFsTypes() { + return ["lustre"]; + } +} + +module.exports.ControllerLustreClientDriver = ControllerLustreClientDriver; diff --git a/src/driver/factory.js b/src/driver/factory.js index f10f9b5..413c2df 100644 --- a/src/driver/factory.js +++ b/src/driver/factory.js @@ -7,6 +7,7 @@ const { const { ControllerNfsClientDriver } = require("./controller-nfs-client"); const { ControllerSmbClientDriver } = require("./controller-smb-client"); +const { ControllerLustreClientDriver } = require("./controller-lustre-client"); const { ControllerSynologyDriver } = require("./controller-synology"); const { NodeManualDriver } = require("./node-manual"); @@ -36,6 +37,8 @@ function factory(ctx, options) { return new ControllerSmbClientDriver(ctx, options); case "nfs-client": return new ControllerNfsClientDriver(ctx, options); + case "lustre-client": + return new ControllerLustreClientDriver(ctx, options); case "node-manual": return new NodeManualDriver(ctx, options); default: diff --git a/src/driver/index.js b/src/driver/index.js index 74852c4..89c9df9 100644 --- a/src/driver/index.js +++ b/src/driver/index.js @@ -316,6 +316,7 @@ class CsiBaseDriver { switch (node_attach_driver) { case "nfs": + case "lustre": device = `${volume_context.server}:${volume_context.share}`; break; case "smb": @@ -814,6 +815,7 @@ class CsiBaseDriver { switch (node_attach_driver) { case "nfs": case "smb": + case "lustre": case "iscsi": // ensure appropriate directories/files switch (access_type) { diff --git a/src/driver/node-manual/index.js b/src/driver/node-manual/index.js index 60920a2..d2de424 100644 --- a/src/driver/node-manual/index.js +++ b/src/driver/node-manual/index.js @@ -87,6 +87,9 @@ class NodeManualDriver extends CsiBaseDriver { case "smb": driverResourceType = "filesystem"; fs_types = ["cifs"]; + case "lustre": + driverResourceType = "filesystem"; + fs_types = ["lustre"]; break; case "iscsi": driverResourceType = "volume";