IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 28492


Ignore:
Timestamp:
Jun 24, 2010, 3:56:40 PM (16 years ago)
Author:
watersc1
Message:

Add note to nebulous volume and mountedvol tables

Location:
trunk/Nebulous-Server
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous-Server/bin/neb-host

    r27114 r28492  
    1616use Pod::Usage qw( pod2usage );
    1717
    18 my ($host, $state,
     18my ($host, $state, $note,
    1919    $db, $dbhost, $dbpass, $dbuser,
    2020    $allocate, $available, $debug);
     
    5151    'host=s'         => \$host,
    5252    'state=s'        => \$state,
    53    
     53    'note=s'         => \$note,
    5454    'db=s'           => \$db,
    5555    'dbhost=s'       => \$dbhost,
    5656    'dbuser=s'       => \$dbuser,
    5757    'dbpass=s'       => \$dbpass,
     58
    5859   
    5960    ) || pod2usage( 2 );
     
    101102    $set{'v.allocate'} = $allocate if defined $allocate;
    102103    $set{'v.available'} = $available if defined $available;
    103    
     104    $set{'v.note'} = $note if defined $note;
     105
    104106    eval {
    105107        my ($q, @bind) = sql_interp("UPDATE volume AS v SET", \%set, "WHERE", \%constraint);
     
    134136$dbh->commit;
    135137
    136 my $format  = "%-15s %-15s %-10s %-10s %-10s %-10s\n";
    137 my @columns = qw(host name mounted allocate available xattr);
     138my $format  = "%-15s %-15s %-7s %-8s %-9s %-5s %s\n";
     139my @columns = qw(host name mounted allocate available xattr note);
    138140printf($format, @columns);
    139141
    140142while (my $row = $query->fetchrow_hashref) {
     143    unless ((exists($$row{ 'note' })) && (defined($$row{ 'note' }))) {
     144        $$row{ 'note' } = '-';
     145    }
     146
    141147    printf($format, @$row{@columns});
    142148}
  • trunk/Nebulous-Server/bin/neb-voladd

    r24545 r28492  
    1919use Pod::Usage qw( pod2usage );
    2020
    21 my ($db, $dbhost, $dbuser, $dbpass, $mountpoint, $vname, $vhost, $uri);
     21my ($db, $dbhost, $dbuser, $dbpass, $mountpoint, $vname, $vhost, $uri, $note);
    2222
    2323$db     = $ENV{'NEB_DB'} unless $db;
     
    3535    'vhost=s'           => \$vhost,
    3636    'vname|n=s'         => \$vname,
     37    'note=s'            => \$note,
    3738) || pod2usage( 2 );
    3839
     
    6970
    7071my $query = $dbh->prepare( $sql->new_volume );
    71 $query->execute( $vname, $vhost, $path, $mountpoint);
     72$query->execute( $vname, $vhost, $path, $mountpoint, $note);
    7273
    7374print " OK\n";
     
    131132
    132133Optional.  Defaults to C<localhost>.
     134
     135=item * --note <note>
     136
     137Add a note for this volume.
    133138
    134139=item * --mountpoint <path>
  • trunk/Nebulous-Server/bin/neb-voladm

    r26292 r28492  
    3333    $xattr,
    3434    $cab_id,
     35    $note,
    3536);
    3637
     
    5354    'cab_id|c=i'        => \$cab_id,
    5455    'xattr=i'           => \$xattr,
     56    'note=s'            => \$note,
    5557) || pod2usage( 2 );
    5658
     
    8991$set{'v.xattr'} = $xattr if defined $xattr;
    9092$set{'v.cab_id'} = $cab_id if defined $cab_id;
     93$set{'v.note'} = $note if defined $note;
    9194
    9295if (%set) {
     
    150153    neb-voladm [--vname <volume name>] [--vhost <volume host>]
    151154    [--allocate <0|1>] [--available <0|1>] [--xattr <0|1>]
    152     [--cab_id <cab_id>]
     155    [--cab_id <cab_id>] [--note <note>]
    153156    [--host <database host> ] [--db <database name>]
    154157    [--user <database username>] [--pass <database password>]
     
    189192
    190193Sets the cabinet id for this storage volume.
     194
     195Requires either the C<--vname> or c<--vhost> options.
     196
     197=item * --note <note>
     198
     199Set a note for this volume.
    191200
    192201Requires either the C<--vname> or c<--vhost> options.
  • trunk/Nebulous-Server/bin/nebdiskd

    r28446 r28492  
    187187
    188188    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 = ?");
    190190#       my $d_query = $dbh->prepare_cached("UPDATE mountedvol SET allocate = ?, available = ? WHERE mountpoint = ?");
    191191        my $d_query = $dbh->prepare_cached("DELETE FROM mountedvol WHERE mountpoint = ?");
  • trunk/Nebulous-Server/lib/Nebulous/Server/SQL.pm

    r28446 r28492  
    367367    },
    368368    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, ?)
    371371    },
    372372    get_volume_by_name => qq{
     
    385385            v.xattr,
    386386            mountedvol.vol_id IS NOT NULL as mounted,
    387             v.cab_id
     387            v.cab_id,
     388            v.note
    388389        FROM volume AS v
    389390        LEFT JOIN mountedvol
     
    689690    mountpoint VARCHAR(255) NOT NULL,
    690691    cab_id INT,
     692    note VARCHAR(255),
    691693    PRIMARY KEY(vol_id),
    692694    UNIQUE KEY(name),
     
    715717    total BIGINT NOT NULL,
    716718    used BIGINT NOT NULL,
     719    note VARCHAR(255),
    717720    PRIMARY KEY(vol_id),
    718721    KEY(name),
Note: See TracChangeset for help on using the changeset viewer.