Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ncm-metaconfig/ganesha: Cleanup pan templates #1806

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ prefix "/metaconfig/contents/main/test";
"Enable_RQUOTA" = true;
"MNT_Port" = 0;
"MNT_Program" = 100005;
"Manage_Gids_Expiration" = 30*60;
"Manage_Gids_Expiration" = 30 * 60;
"MaxRPCRecvBufferSize" = 1048576;
"MaxRPCSendBufferSize" = 1048576;
"NFS_Port" = 2049;
Expand Down
5 changes: 2 additions & 3 deletions ncm-metaconfig/src/main/metaconfig/ganesha/pan/config_v1.pan
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
unique template metaconfig/ganesha/config_v1;

variable GANESHA_FSAL ?= undef;
variable GANESHA_SERVICE ?= format('nfs-ganesha-%s',GANESHA_FSAL);
variable GANESHA_SERVICE ?= format('nfs-ganesha-%s', GANESHA_FSAL);
variable GANESHA_MANAGES_GANESHA ?= true;

include 'metaconfig/ganesha/schema';

bind "/software/components/metaconfig/services/{/etc/ganesha/ganesha.nfsd.conf}/contents" = ganesha_config;

prefix "/software/components/metaconfig/services/{/etc/ganesha/ganesha.nfsd.conf}";
"daemons" = {if(GANESHA_MANAGES_GANESHA) {dict(GANESHA_SERVICE, "restart")} else {null};};
"daemons" = if(GANESHA_MANAGES_GANESHA) dict(GANESHA_SERVICE, "restart") else null;
"module" = "ganesha/1.5/main";

prefix "/software/components/metaconfig/services/{/etc/ganesha/ganesha.nfsd.conf}/contents/main";
'SNMP_ADM/snmp_adm_log' = '/var/log/ganesha_snmp_adm.log';

3 changes: 1 addition & 2 deletions ncm-metaconfig/src/main/metaconfig/ganesha/pan/config_v2.pan
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ include 'metaconfig/ganesha/schema_v2';
bind "/software/components/metaconfig/services/{/etc/ganesha/ganesha.conf}/contents" = ganesha_v2_config;

prefix "/software/components/metaconfig/services/{/etc/ganesha/ganesha.conf}";
"daemons" = {if(GANESHA_MANAGES_GANESHA) {dict(GANESHA_SERVICE, "restart")} else {null};};
"daemons" = if(GANESHA_MANAGES_GANESHA) dict(GANESHA_SERVICE, "restart") else null;
"module" = "ganesha/2.2/main";

7 changes: 3 additions & 4 deletions ncm-metaconfig/src/main/metaconfig/ganesha/pan/fsal/gpfs.pan
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,19 @@ prefix "/software/components/metaconfig/services/{/etc/ganesha/ganesha.nfsd.conf
"CacheInode/Symlink_Expiration_Time" = 120;
"CacheInode/Directory_Expiration_Time" = 120;

"CacheInode_GC_Policy/Entries_HWMark" = 1500*256*GANESHA_GPFS_MULTIPLIER;
"CacheInode_GC_Policy/Entries_LWMark" = 1000*256*GANESHA_GPFS_MULTIPLIER;
"CacheInode_GC_Policy/Entries_HWMark" = 1500 * 256 * GANESHA_GPFS_MULTIPLIER;
"CacheInode_GC_Policy/Entries_LWMark" = 1000 * 256 * GANESHA_GPFS_MULTIPLIER;
"CacheInode_GC_Policy/LRU_Run_Interval" = 90;
"CacheInode_GC_Policy/FD_HWMark_Percent" = 60;
"CacheInode_GC_Policy/FD_LWMark_Percent" = 20;
"CacheInode_GC_Policy/FD_Limit_Percent" = 90;
"CacheInode_GC_Policy/Reaper_Work" = 15000;

"NFS_Core_Param/Nb_Worker" = 128*GANESHA_GPFS_MULTIPLIER;
"NFS_Core_Param/Nb_Worker" = 128 * GANESHA_GPFS_MULTIPLIER;
"NFS_Core_Param/MNT_Port" = 32767;
"NFS_Core_Param/NLM_Port" = 32769;
"NFS_Core_Param/RQOTA_Port" = null; # no rqouta on gpfs
"NFS_Core_Param/Nb_Max_Fd" = -1;
"NFS_Core_Param/Clustered" = true;

"SNMP_ADM/export_cache_inode_calls_detail" = null; # not for gpfs

10 changes: 5 additions & 5 deletions ncm-metaconfig/src/main/metaconfig/ganesha/pan/schema.pan
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ declaration template metaconfig/ganesha/schema;

# the defaults are based on the GPFS FSAL

type ganesha_nfs_protocol = long with SELF == 2 || SELF == 3 || SELF == 4;
type ganesha_transport_protocol = string with SELF == 'TCP' || SELF == 'UDP';
type ganesha_sec_type = string with SELF == 'sys' || SELF == 'krb5' || SELF == 'krb5i' || SELF == 'krb5p';
type ganesha_nfs_protocol = long(2..4);
type ganesha_transport_protocol = choice('TCP', 'UDP');
type ganesha_sec_type = choice('sys', 'krb5', 'krb5i', 'krb5p');

type ganesha_export_client = {
"Root_Access" ? string[] # Grant root access to thoses nodes, networks and @netgroups. A hostname can contain wildcards (*?).
Expand Down Expand Up @@ -86,7 +86,7 @@ type ganesha_filesystem = {
} = dict();

type ganesha_GPFS = {
# no GPFS specific options
# no GPFS specific options
} = dict();

type ganesha_cacheinode_hash = {
Expand Down Expand Up @@ -197,7 +197,7 @@ type ganesha_nfs_core_param = {

"MaxRPCSendBufferSize" ? long(0..) = 32768 # The size of each RPC send buffer in bytes and effectively the maximum send size.
"MaxRPCRecvBufferSize" ? long(0..) = 32768 # The size of each RPC receive buffer in bytes and effectively the maximum receive size.
"NFS_Protocols" ? ganesha_nfs_protocol[] = list(3,4) # List of NFS Protocol Versions that should be supported
"NFS_Protocols" ? ganesha_nfs_protocol[] = list(3, 4) # List of NFS Protocol Versions that should be supported
} = dict();

type ganesha_nfs_dupreq_hash = {
Expand Down
87 changes: 63 additions & 24 deletions ncm-metaconfig/src/main/metaconfig/ganesha/pan/schema_v2.pan
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ declaration template metaconfig/ganesha/schema_v2;
include 'pan/types';

final variable GANESHA_V2_LOG_COMPONENTS = list(
'ALL', 'LOG', 'LOG_EMERG', 'MEMLEAKS', 'FSAL', 'NFSPROTO',
'NFS_V4', 'EXPORT', 'FILEHANDLE', 'DISPATCH', 'CACHE_INODE',
'CACHE_INODE_LRU', 'HASHTABLE', 'HASHTABLE_CACHE', 'DUPREQ',
'INIT', 'MAIN', 'IDMAPPER', 'NFS_READDIR', 'NFS_V4_LOCK',
'CONFIG', 'CLIENTID', 'SESSIONS', 'PNFS', 'RW_LOCK', 'NLM',
'RPC', 'NFS_CB', 'THREAD', 'NFS_V4_ACL', 'STATE', '9P',
'9P_DISPATCH', 'FSAL_UP', 'DBUS'
'ALL', 'LOG', 'LOG_EMERG', 'MEMLEAKS', 'FSAL', 'NFSPROTO',
'NFS_V4', 'EXPORT', 'FILEHANDLE', 'DISPATCH', 'CACHE_INODE',
'CACHE_INODE_LRU', 'HASHTABLE', 'HASHTABLE_CACHE', 'DUPREQ',
'INIT', 'MAIN', 'IDMAPPER', 'NFS_READDIR', 'NFS_V4_LOCK',
'CONFIG', 'CLIENTID', 'SESSIONS', 'PNFS', 'RW_LOCK', 'NLM',
'RPC', 'NFS_CB', 'THREAD', 'NFS_V4_ACL', 'STATE', '9P',
'9P_DISPATCH', 'FSAL_UP', 'DBUS',
);

@{ Ganesha 9p protocol section @}
Expand Down Expand Up @@ -57,7 +57,7 @@ type ganesha_v2_export_FSAL = {
#"FSAL" ? ganesha_v2_export_FSAL
#FSAL_VFS
"pnfs" ? boolean = false
"fsid_type" ? string with match(SELF, '^(None|One64|Major64|Two64|uuid|Two32|Dev|Device)$')
"fsid_type" ? choice('None', 'One64', 'Major64', 'Two64', 'uuid', 'Two32', 'Dev', 'Device')
#FSAL_GLUSTER
"glfs_log" ? string = "/tmp/gfapi.log"
"hostname" ? string # Mandatory
Expand All @@ -71,25 +71,40 @@ type ganesha_v2_export_FSAL = {
"PNFS" ? ganesha_v2_export_FSAL_PNFS
};

type ganesha_v2_protocol = string with match(SELF, '^((NFS)?[vV]?[34]|9P)$');
type ganesha_v2_SecType = string with match(SELF, '^(none|sys|krb5[ip]?)$');
type ganesha_v2_Transports = string with match(SELF, '^(UDP|TCP)$');
type ganesha_v2_protocol = choice('3', '4', 'NFS3', 'NFS4', 'V3', 'V4', 'NFSv3', 'NFSv4', '9P');
type ganesha_v2_SecType = choice('none', 'sys', 'krb5', 'krb5i', 'krb5p');
type ganesha_v2_Transports = choice('UDP', 'TCP');
type ganesha_v2_delegations = choice('None', 'read', 'write', 'readwrite', 'r', 'w', 'rw');

@{ Ganesha Export Permissions for EXPORT_DEFAULLTS, EXPORT and CLIENT sections @}
type ganesha_v2_export_permissions = {
"Access_Type" ? string = 'None' with match(SELF, '^(None|RW|RO|MDONLY|MDONLY_RO)$')
"Access_Type" ? choice('None', 'RW', 'RO', 'MDONLY', 'MDONLY_RO') = 'None'
"Anonymous_gid" ? long = -2
"Anonymous_uid" ? long = -2
"Delegations" ? string with match(SELF, '^(None|read|write|readwrite|r|w|rw)$')
"Delegations" ? ganesha_v2_delegations
"Disable_ACL" ? boolean = false
"DisableReaddirPlus" ? boolean = false
"Manage_Gids" ? boolean = false
"NFS_Commit" ? boolean = false
"PrivilegedPort" ? boolean = false
"Protocols" ? ganesha_v2_protocol[] = list('3', '4', '9P')
"SecType" ? ganesha_v2_SecType[] = list('none', 'sys')
"Squash" ? string = "root_squash" with match(SELF,
'^((root|all)(_?squash)?|no_root_squash|none|noidsquash)$')
"Squash" ? choice(
'root',
'root_squash',
'rootsquash',
'rootid',
'root_id_squash',
'rootidsquash',
'all',
'all_squash',
'allsquash',
'all_anomnymous',
'allanonymous',
'no_root_squash',
'none',
'noidsquash'
) = "root_squash"
"Transports" ? ganesha_v2_Transports[] = list('UDP', 'TCP')
"Trust_Readdir_Negative_Cache" ? boolean = false
};
Expand Down Expand Up @@ -129,23 +144,47 @@ type ganesha_v2_exports = {
"UseCookieVerifier" ? boolean = true
};

type ganesha_v2_log_level = string with match(SELF,
'^(NULL|FATAL|MAJ|CRIT|WARN|EVENT|INFO|DEBUG|MID_DEBUG|M_DBG|FULL_DEBUG|F_DBG)$');
type ganesha_v2_log_level = choice(
'NULL',
'FATAL',
'MAJ',
'CRIT',
'WARN',
'EVENT',
'INFO',
'DEBUG',
'MID_DEBUG',
'M_DBG',
'FULL_DEBUG',
'F_DBG'
);

@{ Check for valid Ganesha Log Component names @}
function is_ganesha_v2_log_Components = {
components = ARGV[0];
foreach(cmp; logl; components) {
if(index(cmp, GANESHA_V2_LOG_COMPONENTS) == -1) {
error(format("%s is not a valid Ganesha Log Component !", cmp));
error("%s is not a valid Ganesha Log Component !", cmp);
return(false);
};
};
};
type ganesha_v2_log_Components = ganesha_v2_log_level{} with is_ganesha_v2_log_Components(SELF);

type ganesha_v2_log_time_format = string with match(SELF,
'^(ganesha|true|local|8601|ISO-8601|ISO 8601|ISO|syslog|syslog_usec|false|none|user_defined)$');
type ganesha_v2_log_time_format = choice(
'ganesha',
'true',
'local',
'8601',
'ISO-8601',
'ISO 8601',
'ISO',
'syslog',
'syslog_usec',
'false',
'none',
'user_defined'
);

@{ Ganesha Log Format subsection @}
type ganesha_v2_log_Format = {
Expand All @@ -170,8 +209,8 @@ type ganesha_v2_log_Format = {
@{ Ganesha Log Facility subsection @}
type ganesha_v2_log_Facility = {
"destination" : string
"enable" ? string = 'idle' with match(SELF, '^(idle|active|default)$')
"headers" ? string = 'all' with match(SELF, '^(none|component|all)$')
"enable" ? choice('idle', 'active', 'default') = 'idle'
"headers" ? choice('none', 'component', 'all') = 'all'
"max_level" ? ganesha_v2_log_level = 'FULL_DEBUG'
"name" ? string
};
Expand Down Expand Up @@ -280,7 +319,7 @@ type ganesha_v2_proxy_remote_server = {
"RPC_Client_Timeout" ? long(0..) = 60
"Remote_PrincipalName" ? string
"Retry_SleepTime" ? long(0..) = 10
"Sec_Type" ? string = 'krb5' with match(SELF, '^krb5[ip]?$')
"Sec_Type" ? choice('none', 'krb5', 'krb5i', 'krb5p') = 'krb5'
"Srv_Addr" ? type_ip = "127.0.0.1"
"Use_Privileged_Client_Port" ? boolean = false
};
Expand Down Expand Up @@ -311,7 +350,7 @@ type ganesha_v2_proxy = {
@{ Ganesha GPFS section @}
type ganesha_v2_GPFS = {
include ganesha_v2_fsalsettings_all
"Delegations" ? string with match(SELF, '^(None|read|write|readwrite|r|w|rw)$')
"Delegations" ? ganesha_v2_delegations
"fsal_grace" ? boolean = false
"fsal_trace" ? boolean = true
"pnfs_file" ? boolean = false
Expand Down
Loading