[1940] in Moira Commits

home help back first fref pref prev next nref lref last post

/svn/moira r4079 - trunk/moira/incremental/afs

daemon@ATHENA.MIT.EDU (Jonathon Weiss)
Wed May 23 18:42:26 2012

Date: Wed, 23 May 2012 18:42:25 -0400
From: Jonathon Weiss <jweiss@MIT.EDU>
Message-Id: <201205232242.q4NMgPUq026646@drugstore.mit.edu>
To: moira-commits@MIT.EDU
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Author: jweiss
Date: 2012-05-23 18:42:25 -0400 (Wed, 23 May 2012)
New Revision: 4079

Modified:
   trunk/moira/incremental/afs/afs.c
   trunk/moira/incremental/afs/afs_create.pl
   trunk/moira/incremental/afs/afs_utils.pl
Log:
Support new AFS locker type 'SITE' for the DAAS/sites project.
Filesystems will be named foo.site in moira, but the '.site' needs to
be omitted form the volume name.


Modified: trunk/moira/incremental/afs/afs.c
===================================================================
--- trunk/moira/incremental/afs/afs.c	2012-05-14 03:23:06 UTC (rev 4078)
+++ trunk/moira/incremental/afs/afs.c	2012-05-23 22:42:25 UTC (rev 4079)
@@ -426,7 +426,8 @@
 void do_filesys(char **before, int beforec, char **after, int afterc)
 {
   char cmd[1024];
-  int acreate, atype, bcreate, btype;
+  int acreate, atype, bcreate, btype, fsltypelen, fsnamelen;
+  char *tmp;
 
   if (afterc < FS_CREATE)
     atype = acreate = 0;
@@ -434,6 +435,14 @@
     {
       atype = !strcmp(after[FS_TYPE], "AFS");
       acreate = atoi(after[FS_CREATE]);
+      /* If the lockername ends in ".lockertype" strip that.
+       * eg.  the SITE locker "foo.site" becomes just "foo"
+       */
+      fsltypelen = strlen(after[FS_L_TYPE]);
+      fsnamelen = strlen(after[FS_NAME]);
+      tmp = (after[FS_NAME] + fsnamelen - fsltypelen);
+      if (!strcasecmp(tmp, after[FS_L_TYPE]) && *(tmp-1) == '.')
+	*(tmp-1) = '\0';
     }
 
   if (beforec < FS_CREATE)
@@ -449,6 +458,17 @@
       run_cmd(cmd);
       return;
     }
+  else
+    {
+      /* If the lockername ends in ".lockertype" strip that.
+       * eg.  the SITE locker "foo.site" becomes just "foo"
+       */
+      fsltypelen = strlen(before[FS_L_TYPE]);
+      fsnamelen = strlen(before[FS_NAME]);
+      tmp = (before[FS_NAME] + fsnamelen - fsltypelen);
+      if (!strcasecmp(tmp, before[FS_L_TYPE]) && *(tmp-1) == '.')
+	*(tmp-1) = '\0';
+    }
 
   btype = !strcmp(before[FS_TYPE], "AFS");
   bcreate = atoi(before[FS_CREATE]);

Modified: trunk/moira/incremental/afs/afs_create.pl
===================================================================
--- trunk/moira/incremental/afs/afs_create.pl	2012-05-14 03:23:06 UTC (rev 4078)
+++ trunk/moira/incremental/afs/afs_create.pl	2012-05-23 22:42:25 UTC (rev 4079)
@@ -107,6 +107,7 @@
     # ORG	<user> all <group> all system:cwisfac all system:anyuser rl
     # PROJECT   <user> all <group> all
     # REF       <user> all system:anyuser rl
+    # SITE	system:sites-admin all system:sites-servers write
     # SW        <user> all system:swmaint all system:authuser rl
     # SYSTEM    system:administrators all system:anyuser rl
     # UROP	<user> all <group> all system:facdev all system:authuser rl
@@ -115,6 +116,8 @@
     # 1. All directories also have "system:expunge ld".
 
     @acl=("system:expunge ld");
+    push(@acl,"system:sites-admin all") if ($type =~ /^(SITE)/);
+    push(@acl,"system:sites-servers write") if ($type =~ /^(SITE)/);
     push(@acl,"system:facdev all") if ($type =~ /^(COURSE|UROP)/);
     push(@acl,"system:swmaint all") if ($type =~ /^(SW)/);
     push(@acl,"system:cwisfac all") if ($type =~ /^(ORG)/);
@@ -131,8 +134,10 @@
 
     if ($type !~ /^(AREF|ORG|SYSTEM)/) {
 	system("$vos backup $vname >/dev/null");
-	system("$fs mkm $path/OldFiles $vname.backup");
-	warn "$locker: Unable to create OldFiles mountpoint\n" if ($?);
+	if ($type !~ /^(SITE)/) {
+	    system("$fs mkm $path/OldFiles $vname.backup");
+	    warn "$locker: Unable to create OldFiles mountpoint\n" if ($?);
+	}
     }
 
     if ($type =~ /ACTIVITY|APROJ|PROJECT/) {

Modified: trunk/moira/incremental/afs/afs_utils.pl
===================================================================
--- trunk/moira/incremental/afs/afs_utils.pl	2012-05-14 03:23:06 UTC (rev 4078)
+++ trunk/moira/incremental/afs/afs_utils.pl	2012-05-23 22:42:25 UTC (rev 4079)
@@ -28,6 +28,7 @@
      "ORG", "org",
      "PROJECT", "project",
      "REF", "ref",
+     "SITE", "site",
      "SW", "sw",
      "SYSTEM", "system",
      "UROP", "urop",


home help back first fref pref prev next nref lref last post