]> andersk Git - moira.git/commitdiff
richard's changes
authormar <mar>
Wed, 30 Dec 1992 17:42:20 +0000 (17:42 +0000)
committermar <mar>
Wed, 30 Dec 1992 17:42:20 +0000 (17:42 +0000)
incremental/afs_create.pl
incremental/afs_nightly.pl
incremental/afs_utils.pl

index 0330d2182099f7bb13c033f7a8b3de7dbb32f7fc..e5a33f851c740d7b3bbccbf227ffec335471ec51 100644 (file)
@@ -16,8 +16,10 @@ die "Usage: $0 locker type cell path user group\n" if (@ARGV != 6);
 
 # Lookup volume type
 ($c = $cell) =~ s/\./_/g;
-$vname = &afs_vname($locker, $type, $cell);
-die "Cannot create $type volumes in $cell\n" unless $vname;
+$vtype = eval "\$vtypes_$c{$type}";
+die "Cannot create $type volumes in $cell\n" unless $vtype;
+$vname = $vtype . "." . $locker;
+$vname =~ s/[^-A-Za-z0-9_.]//g;                # strip out illegal characters
 
 # Find free space
 ($asrv,$apart) = &afs_find($cell,$type,$quota);
index 68a00211d377082bb362f2e69c9edadfe98001a9..d717ad2f9452cb5563825d44fac0367e59e0b61f 100644 (file)
@@ -33,9 +33,14 @@ for (@new_data) {
        print SRV $_ unless ($c eq $c2 && $as eq $as2 && $ap eq $ap2);
     }
     &afs_unlock;
-
-    ($total, $used) = &afs_partinfo($as, $ap, $c);
+    
+    open(VOS,"$vos partinfo $as $ap -cell $c -noauth|");
+    chop(@vos = <VOS>);
+    close(VOS);
     next if ($?);
+    @vos = split(/\s+/,$vos[0]);
+    $total = pop(@vos);
+    $used = $total-$vos[5];
     $alloc = 0;
     
     open(VOS,"$vos listvol $as $ap -cell $c -long -noauth|");
index 0e1399e145aa525f966339e771824ef17751f92d..1c97ecd173a0863e45d64ebe5468d603dffe2691 100644 (file)
@@ -23,21 +23,6 @@ $LOCK_UN=8;
      "UROP", "urop",
      );
 
-# Function: afs_vname
-# Returns the canonical volume name for (locker,type,cell)
-sub afs_vname
-{
-    local($name,$type,$cell) = @_;
-
-    $vtype = eval "\$vtypes_$cell{$type}";
-    return "" unless $vtype;
-
-    $vname = $vtype . "." . $name;
-    $vname =~ s/[^-A-Za-z0-9_.]//g;            # strip out illegal characters
-    return $vname;
-}
-
-
 # File format:
 #    cell server partition total used alloc
 
@@ -72,8 +57,7 @@ sub afs_unlock
     close(SRV);
 }
 
-# Function: afs_find
-# Finds server/partition for allocation.
+# Find server/partition for allocation.
 #
 # Best fit algorithm used:
 #    max[ (2*free space) - (unused quota) ]
@@ -81,36 +65,31 @@ sub afs_unlock
 #
 # Note: This routine does not actually adjust the quota; the caller
 # should use afs_quota_adj();
+
 sub afs_find
 {
     local($cell,$type,$quota) = @_;
-    local($i, $j, $vos, $a);
+    local($j);
     local(@max) = '';
 
     &afs_lock;
     chop(@afs_data);
 
-    for $i ($[ .. $#afs_data) {
-       ($a, $asrv, $apart, $t, $total, $used, $alloc) =
-           split(/\s+/, $afs_data[$i]);
+    for (@afs_data) {
+       local ($a, $asrv, $apart, $t, $total, $used, $alloc) = split(/\s+/,$_);
        next if ($a ne $cell || !$total || $type !~ /$t/);
        $alloc = $used if ($alloc < $used);
        $j = 2*$total - $used - $alloc;
-       if (! @max || $j > $max[2]) {
-           ($total, $used) = &afs_partinfo($asrv, $apart, $cell);
-           next if ($?);
-           $afs_data[$i]=join(' ',$cell,$asrv,$apart,$t,$total,$used,$alloc);
-           @max = ($asrv,$apart,$j);
-       }
+       @max = ($asrv,$apart,$j) if (! @max || $j > $max[2]);
     }
 
     &afs_unlock;
     return(@max);
 }
 
-
-# Function: afs_quota_adj
-# Adjusts the quota allocation for a given server/partition
+#
+# Quota adjustments
+#
 sub afs_quota_adj
 {
     local($cell,$asrv,$apart,$adj) = @_;
@@ -131,20 +110,3 @@ sub afs_quota_adj
     &afs_unlock;
     return($found);
 }
-
-
-sub afs_partinfo
-{
-    local($as, $ap, $c) = @_;
-    local(@vos, $total, $used);
-
-    open(VOS,"$vos partinfo $as $ap -cell $c -noauth|");
-    chop(@vos = <VOS>);
-    close(VOS);
-    return "" if ($?);
-
-    @vos = split(/\s+/,$vos[0]);
-    $total = pop(@vos);
-    $used = $total-$vos[5];
-    return ($total,$used);
-}
This page took 0.044201 seconds and 5 git commands to generate.