Changeset 26292 for trunk/Nebulous-Server/bin
- Timestamp:
- Nov 30, 2009, 1:54:49 PM (17 years ago)
- Location:
- trunk/Nebulous-Server/bin
- Files:
-
- 1 added
- 2 edited
-
neb-cabadd (added)
-
neb-voladm (modified) (9 diffs)
-
nebdiskd (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/bin/neb-voladm
r24842 r26292 23 23 $allocate, 24 24 $available, 25 $mounted, 25 26 $db, 26 27 $dbhost, … … 31 32 $vname, 32 33 $xattr, 34 $cab_id, 33 35 ); 34 36 … … 41 43 'allocate=i' => \$allocate, 42 44 'available=i' => \$available, 45 'mounted' => \$mounted, 43 46 'db|d=s' => \$db, 44 47 'debug' => \$debug, … … 48 51 'vhost=s' => \$vhost, 49 52 'vname|n=s' => \$vname, 53 'cab_id|c=i' => \$cab_id, 50 54 'xattr=i' => \$xattr, 51 55 ) || pod2usage( 2 ); … … 56 60 57 61 # are we listing the volumes or updating? 58 if (defined $allocate or defined $available or defined $xattr ) {59 pod2usage( -msg => "Options: --allocate, --available, and --xattrRequire options --vhost or --vname", -exitval => 2 )62 if (defined $allocate or defined $available or defined $xattr or defined $cab_id) { 63 pod2usage( -msg => "Options: --allocate, --available, --xattr, and --cab_id Require options --vhost or --vname", -exitval => 2 ) 60 64 unless defined $vhost or defined $vname; 61 65 pod2usage( -msg => "Options: --allocate, --available, and --xattr Must be 0 or 1", -exitval => 2) … … 84 88 $set{'v.available'} = $available if defined $available; 85 89 $set{'v.xattr'} = $xattr if defined $xattr; 90 $set{'v.cab_id'} = $cab_id if defined $cab_id; 86 91 87 92 if (%set) { … … 97 102 die $@; 98 103 } 104 if ($mounted) { 105 eval { 106 my ($q, @bind) = sql_interp("UPDATE mountedvol AS v SET", \%set, "WHERE", \%constraint); 107 warn "$q\n" if $debug; 108 my $query = $dbh->prepare($q); 109 $query->execute(@bind); 110 $dbh->commit; 111 }; 112 if ($@) { 113 $dbh->rollback; 114 die $@; 115 } 116 } 99 117 } 100 118 … … 132 150 neb-voladm [--vname <volume name>] [--vhost <volume host>] 133 151 [--allocate <0|1>] [--available <0|1>] [--xattr <0|1>] 152 [--cab_id <cab_id>] 134 153 [--host <database host> ] [--db <database name>] 135 154 [--user <database username>] [--pass <database password>] … … 164 183 165 184 Enables/Disables these flags on the storage volume. 185 186 Requires either the C<--vname> or c<--vhost> options. 187 188 =item * --cab_id <cab_id> 189 190 Sets the cabinet id for this storage volume. 166 191 167 192 Requires either the C<--vname> or c<--vhost> options. -
trunk/Nebulous-Server/bin/nebdiskd
r24617 r26292 177 177 178 178 eval { 179 my $r_query = $dbh->prepare_cached("REPLACE INTO mountedvol SELECT *, ?, ? FROM volume WHERE mountpoint = ?"); 179 my $r_query = $dbh->prepare_cached("REPLACE INTO mountedvol SELECT vol_id,name,host,path,allocate,available,xattr,mountpoint, ?, ? FROM volume WHERE mountpoint = ?"); 180 # my $d_query = $dbh->prepare_cached("UPDATE mountedvol SET allocate = ?, available = ? WHERE mountpoint = ?"); 180 181 my $d_query = $dbh->prepare_cached("DELETE FROM mountedvol WHERE mountpoint = ?"); 181 182 … … 185 186 # there may be multiple vol_ids per mountpoint but we only need to 186 187 # check each mointpont once 187 my $query = $dbh->prepare_cached("SELECT DISTINCT mountpoint FROM volume WHERE available = 1");188 my $query = $dbh->prepare_cached("SELECT DISTINCT mountpoint FROM volume"); 188 189 $query->execute; 189 190 while (my $row = $query->fetchrow_hashref) { … … 200 201 # automounter and it fails to mount 201 202 my $tries = 0; 203 my $valid_mountpoint = 1; 202 204 TEST: eval { 203 205 $tries++; 204 206 unless (is_mountpoint($mountpoint)) { 205 $log->warn("$mnt is not a valid mountpoint"); 207 $log->warn("$mountpoint is not a valid mountpoint ($tries)"); 208 $valid_mountpoint = 0; 206 209 } 207 210 }; 208 if ( $@) {211 if (!$valid_mountpoint) { 209 212 # try is_mountpoint() again if $retry > 1 210 213 if ($tries < $retry) { … … 212 215 goto TEST; 213 216 } 214 $log->warn($@); 217 $log->warn("Removing $mountpoint from the mountedvol table ($tries > $retry)"); 218 # $log->warn($@); 219 215 220 $d_query->execute($mountpoint); 216 221 next;
Note:
See TracChangeset
for help on using the changeset viewer.
