broadcast accessibility contraints (topology) for zfs-local
Signed-off-by: Travis Glenn Hansen <travisghansen@yahoo.com>
This commit is contained in:
parent
5426f1ec12
commit
f50e297d33
|
|
@ -1,3 +1,4 @@
|
|||
const _ = require("lodash");
|
||||
const { ControllerZfsBaseDriver } = require("../controller-zfs");
|
||||
const { GrpcError, grpc } = require("../../utils/grpc");
|
||||
const LocalCliExecClient = require("./exec").LocalCliClient;
|
||||
|
|
@ -8,6 +9,26 @@ const ZFS_ASSET_NAME_PROPERTY_NAME = "zfs_asset_name";
|
|||
const NODE_TOPOLOGY_KEY_NAME = "org.democratic-csi.topology/node";
|
||||
|
||||
class ControllerZfsLocalDriver extends ControllerZfsBaseDriver {
|
||||
constructor(ctx, options) {
|
||||
const i_caps = _.get(
|
||||
options,
|
||||
"service.identity.capabilities.service",
|
||||
false
|
||||
);
|
||||
super(...arguments);
|
||||
|
||||
|
||||
if (!i_caps) {
|
||||
this.ctx.logger.debug("setting zfs-local identity service caps");
|
||||
|
||||
options.service.identity.capabilities.service = [
|
||||
//"UNKNOWN",
|
||||
"CONTROLLER_SERVICE",
|
||||
"VOLUME_ACCESSIBILITY_CONSTRAINTS"
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
getExecClient() {
|
||||
return new LocalCliExecClient({
|
||||
logger: this.ctx.logger,
|
||||
|
|
|
|||
|
|
@ -3123,7 +3123,6 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
|||
}
|
||||
entries = this.ctx.cache.get(`ListVolumes:result:${uuid}`);
|
||||
if (entries) {
|
||||
entries = JSON.parse(JSON.stringify(entries));
|
||||
entries_length = entries.length;
|
||||
entries = entries.slice(start_position, end_position);
|
||||
if (max_entries > 0 && end_position > entries_length) {
|
||||
|
|
@ -3219,10 +3218,7 @@ class FreeNASApiDriver extends CsiBaseDriver {
|
|||
|
||||
if (max_entries && entries.length > max_entries) {
|
||||
uuid = uuidv4();
|
||||
this.ctx.cache.set(
|
||||
`ListVolumes:result:${uuid}`,
|
||||
JSON.parse(JSON.stringify(entries))
|
||||
);
|
||||
this.ctx.cache.set(`ListVolumes:result:${uuid}`, entries);
|
||||
next_token = `${uuid}:${max_entries}`;
|
||||
entries = entries.slice(0, max_entries);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ class NodeManualDriver extends CsiBaseDriver {
|
|||
let message = null;
|
||||
let driverResourceType;
|
||||
let fs_types = [];
|
||||
let access_modes = [];
|
||||
//[{"access_mode":{"mode":"SINGLE_NODE_WRITER"},"mount":{"mount_flags":["noatime","_netdev"],"fs_type":"nfs"},"access_type":"mount"}]
|
||||
switch (node_attach_driver) {
|
||||
case "nfs":
|
||||
|
|
@ -124,6 +125,16 @@ class NodeManualDriver extends CsiBaseDriver {
|
|||
driverResourceType = "volume";
|
||||
fs_types = ["ext3", "ext4", "ext4dev", "xfs"];
|
||||
break;
|
||||
case "zfs-local":
|
||||
driverResourceType = "volume";
|
||||
fs_types = ["ext3", "ext4", "ext4dev", "xfs", "zfs"];
|
||||
access_modes = [
|
||||
"UNKNOWN",
|
||||
"SINGLE_NODE_WRITER",
|
||||
"SINGLE_NODE_SINGLE_WRITER", // added in v1.5.0
|
||||
"SINGLE_NODE_MULTI_WRITER", // added in v1.5.0
|
||||
"SINGLE_NODE_READER_ONLY",
|
||||
];
|
||||
default:
|
||||
return {
|
||||
valid: false,
|
||||
|
|
@ -134,6 +145,18 @@ class NodeManualDriver extends CsiBaseDriver {
|
|||
const valid = capabilities.every((capability) => {
|
||||
switch (driverResourceType) {
|
||||
case "filesystem":
|
||||
if (access_modes.length == 0) {
|
||||
access_modes = [
|
||||
"UNKNOWN",
|
||||
"SINGLE_NODE_WRITER",
|
||||
"SINGLE_NODE_SINGLE_WRITER", // added in v1.5.0
|
||||
"SINGLE_NODE_MULTI_WRITER", // added in v1.5.0
|
||||
"SINGLE_NODE_READER_ONLY",
|
||||
"MULTI_NODE_READER_ONLY",
|
||||
"MULTI_NODE_SINGLE_WRITER",
|
||||
"MULTI_NODE_MULTI_WRITER",
|
||||
];
|
||||
}
|
||||
if (capability.access_type != "mount") {
|
||||
message = `invalid access_type ${capability.access_type}`;
|
||||
return false;
|
||||
|
|
@ -147,8 +170,15 @@ class NodeManualDriver extends CsiBaseDriver {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
![
|
||||
if (!access_modes.includes(capability.access_mode.mode)) {
|
||||
message = `invalid access_mode, ${capability.access_mode.mode}`;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
case "volume":
|
||||
if (access_modes.length == 0) {
|
||||
access_modes = [
|
||||
"UNKNOWN",
|
||||
"SINGLE_NODE_WRITER",
|
||||
"SINGLE_NODE_SINGLE_WRITER", // added in v1.5.0
|
||||
|
|
@ -156,15 +186,8 @@ class NodeManualDriver extends CsiBaseDriver {
|
|||
"SINGLE_NODE_READER_ONLY",
|
||||
"MULTI_NODE_READER_ONLY",
|
||||
"MULTI_NODE_SINGLE_WRITER",
|
||||
"MULTI_NODE_MULTI_WRITER",
|
||||
].includes(capability.access_mode.mode)
|
||||
) {
|
||||
message = `invalid access_mode, ${capability.access_mode.mode}`;
|
||||
return false;
|
||||
];
|
||||
}
|
||||
|
||||
return true;
|
||||
case "volume":
|
||||
if (capability.access_type == "mount") {
|
||||
if (
|
||||
capability.mount.fs_type &&
|
||||
|
|
@ -175,17 +198,7 @@ class NodeManualDriver extends CsiBaseDriver {
|
|||
}
|
||||
}
|
||||
|
||||
if (
|
||||
![
|
||||
"UNKNOWN",
|
||||
"SINGLE_NODE_WRITER",
|
||||
"SINGLE_NODE_SINGLE_WRITER", // added in v1.5.0
|
||||
"SINGLE_NODE_MULTI_WRITER", // added in v1.5.0
|
||||
"SINGLE_NODE_READER_ONLY",
|
||||
"MULTI_NODE_READER_ONLY",
|
||||
"MULTI_NODE_SINGLE_WRITER",
|
||||
].includes(capability.access_mode.mode)
|
||||
) {
|
||||
if (!access_modes.includes(capability.access_mode.mode)) {
|
||||
message = `invalid access_mode, ${capability.access_mode.mode}`;
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue