Changeset 28492
- Timestamp:
- Jun 24, 2010, 3:56:40 PM (16 years ago)
- Location:
- trunk/Nebulous-Server
- Files:
-
- 1 added
- 5 edited
-
bin/neb-host (modified) (4 diffs)
-
bin/neb-voladd (modified) (4 diffs)
-
bin/neb-voladm (modified) (5 diffs)
-
bin/nebdiskd (modified) (1 diff)
-
docs/changes.txt (added)
-
lib/Nebulous/Server/SQL.pm (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/bin/neb-host
r27114 r28492 16 16 use Pod::Usage qw( pod2usage ); 17 17 18 my ($host, $state, 18 my ($host, $state, $note, 19 19 $db, $dbhost, $dbpass, $dbuser, 20 20 $allocate, $available, $debug); … … 51 51 'host=s' => \$host, 52 52 'state=s' => \$state, 53 53 'note=s' => \$note, 54 54 'db=s' => \$db, 55 55 'dbhost=s' => \$dbhost, 56 56 'dbuser=s' => \$dbuser, 57 57 'dbpass=s' => \$dbpass, 58 58 59 59 60 ) || pod2usage( 2 ); … … 101 102 $set{'v.allocate'} = $allocate if defined $allocate; 102 103 $set{'v.available'} = $available if defined $available; 103 104 $set{'v.note'} = $note if defined $note; 105 104 106 eval { 105 107 my ($q, @bind) = sql_interp("UPDATE volume AS v SET", \%set, "WHERE", \%constraint); … … 134 136 $dbh->commit; 135 137 136 my $format = "%-15s %-15s %- 10s %-10s %-10s %-10s\n";137 my @columns = qw(host name mounted allocate available xattr );138 my $format = "%-15s %-15s %-7s %-8s %-9s %-5s %s\n"; 139 my @columns = qw(host name mounted allocate available xattr note); 138 140 printf($format, @columns); 139 141 140 142 while (my $row = $query->fetchrow_hashref) { 143 unless ((exists($$row{ 'note' })) && (defined($$row{ 'note' }))) { 144 $$row{ 'note' } = '-'; 145 } 146 141 147 printf($format, @$row{@columns}); 142 148 } -
trunk/Nebulous-Server/bin/neb-voladd
r24545 r28492 19 19 use Pod::Usage qw( pod2usage ); 20 20 21 my ($db, $dbhost, $dbuser, $dbpass, $mountpoint, $vname, $vhost, $uri );21 my ($db, $dbhost, $dbuser, $dbpass, $mountpoint, $vname, $vhost, $uri, $note); 22 22 23 23 $db = $ENV{'NEB_DB'} unless $db; … … 35 35 'vhost=s' => \$vhost, 36 36 'vname|n=s' => \$vname, 37 'note=s' => \$note, 37 38 ) || pod2usage( 2 ); 38 39 … … 69 70 70 71 my $query = $dbh->prepare( $sql->new_volume ); 71 $query->execute( $vname, $vhost, $path, $mountpoint );72 $query->execute( $vname, $vhost, $path, $mountpoint, $note); 72 73 73 74 print " OK\n"; … … 131 132 132 133 Optional. Defaults to C<localhost>. 134 135 =item * --note <note> 136 137 Add a note for this volume. 133 138 134 139 =item * --mountpoint <path> -
trunk/Nebulous-Server/bin/neb-voladm
r26292 r28492 33 33 $xattr, 34 34 $cab_id, 35 $note, 35 36 ); 36 37 … … 53 54 'cab_id|c=i' => \$cab_id, 54 55 'xattr=i' => \$xattr, 56 'note=s' => \$note, 55 57 ) || pod2usage( 2 ); 56 58 … … 89 91 $set{'v.xattr'} = $xattr if defined $xattr; 90 92 $set{'v.cab_id'} = $cab_id if defined $cab_id; 93 $set{'v.note'} = $note if defined $note; 91 94 92 95 if (%set) { … … 150 153 neb-voladm [--vname <volume name>] [--vhost <volume host>] 151 154 [--allocate <0|1>] [--available <0|1>] [--xattr <0|1>] 152 [--cab_id <cab_id>] 155 [--cab_id <cab_id>] [--note <note>] 153 156 [--host <database host> ] [--db <database name>] 154 157 [--user <database username>] [--pass <database password>] … … 189 192 190 193 Sets the cabinet id for this storage volume. 194 195 Requires either the C<--vname> or c<--vhost> options. 196 197 =item * --note <note> 198 199 Set a note for this volume. 191 200 192 201 Requires either the C<--vname> or c<--vhost> options. -
trunk/Nebulous-Server/bin/nebdiskd
r28446 r28492 187 187 188 188 eval { 189 my $r_query = $dbh->prepare_cached("REPLACE INTO mountedvol SELECT vol_id,name,host,path,allocate,available,xattr,mountpoint, ?, ? FROM volume WHERE mountpoint = ?");189 my $r_query = $dbh->prepare_cached("REPLACE INTO mountedvol SELECT vol_id,name,host,path,allocate,available,xattr,mountpoint, ?, ?,note FROM volume WHERE mountpoint = ?"); 190 190 # my $d_query = $dbh->prepare_cached("UPDATE mountedvol SET allocate = ?, available = ? WHERE mountpoint = ?"); 191 191 my $d_query = $dbh->prepare_cached("DELETE FROM mountedvol WHERE mountpoint = ?"); -
trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm
r28446 r28492 367 367 }, 368 368 new_volume => qq{ 369 INSERT INTO volume (name, host, path, allocate, available, xattr, mountpoint, cab_id )370 VALUES (?, ?, ?, TRUE, TRUE, FALSE, ?, NULL )369 INSERT INTO volume (name, host, path, allocate, available, xattr, mountpoint, cab_id, note) 370 VALUES (?, ?, ?, TRUE, TRUE, FALSE, ?, NULL, ?) 371 371 }, 372 372 get_volume_by_name => qq{ … … 385 385 v.xattr, 386 386 mountedvol.vol_id IS NOT NULL as mounted, 387 v.cab_id 387 v.cab_id, 388 v.note 388 389 FROM volume AS v 389 390 LEFT JOIN mountedvol … … 689 690 mountpoint VARCHAR(255) NOT NULL, 690 691 cab_id INT, 692 note VARCHAR(255), 691 693 PRIMARY KEY(vol_id), 692 694 UNIQUE KEY(name), … … 715 717 total BIGINT NOT NULL, 716 718 used BIGINT NOT NULL, 719 note VARCHAR(255), 717 720 PRIMARY KEY(vol_id), 718 721 KEY(name),
Note:
See TracChangeset
for help on using the changeset viewer.
