Changeset 17079
- Timestamp:
- Mar 20, 2008, 3:36:59 PM (18 years ago)
- Location:
- trunk/Nebulous
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous/Build.PL
r17073 r17079 91 91 'Getopt::Long' => 0, 92 92 'Pod::Usage' => 0, 93 # below are for ./bin only any need to go away94 'DBD::mysql' => '3.0007',95 'DBI' => '1.53',96 'Nebulous::Server::SQL' => 0,97 93 }, 98 94 recommends => { -
trunk/Nebulous/Changes
r17073 r17079 2 2 3 3 0.07 4 - modify neb-df to use Nebulous::Client::mounts() 4 5 - server/client split into Nebulous::Server and Nebulous::Client packages 5 6 - add support for storing instances in multi-tier 'hashed' directories -
trunk/Nebulous/bin/neb-df
r13074 r17079 3 3 # Copyright (C) 2007 Joshua Hoblitt 4 4 # 5 # $Id: neb-df,v 1. 3 2007-04-28 01:19:59 jhoblitt Exp $5 # $Id: neb-df,v 1.4 2008-03-21 01:36:59 jhoblitt Exp $ 6 6 7 7 use strict; … … 11 11 $VERSION = '0.01'; 12 12 13 use DBI; 14 use Nebulous::Server::SQL; 15 use URI; 13 use Nebulous::Client; 16 14 17 15 use Getopt::Long qw( GetOptions :config auto_help auto_version ); 18 16 use Pod::Usage qw( pod2usage ); 19 17 20 my ($db, $dbuser, $dbpass , $name, $uri);18 my ($db, $dbuser, $dbpass); 21 19 22 20 $db = $ENV{'NEB_DB'} unless $db; … … 34 32 unless $db && $dbuser && $dbpass; 35 33 36 my $dbh = DBI->connect( 37 "DBI:mysql:database=$db:host=localhost", 38 $dbuser, 39 $dbpass, 40 { 41 RaiseError => 1, 42 PrintError => 0, 43 AutoCommit => 1, 44 }, 34 my $neb = Nebulous::Client->new( 35 proxy => "$server", 45 36 ); 46 37 47 my $sql = Nebulous::Server::SQL->new(); 38 die "can't connected to Nebulous Server: $server" 39 unless defined $neb; 48 40 49 # ask the db to generate the table of mounted Nebulous volume 50 $dbh->do("call getmountedvol()"); 51 52 # suck that table into an AoH 53 my $query = $dbh->prepare("SELECT * FROM mountedvol"); 54 $query->execute(); 55 56 my @stats; 57 while (my $mountedvol = $query->fetchrow_hashref) { 58 push @stats, $mountedvol; 59 } 41 my $stats = $neb->mounts(); 60 42 61 43 # output a summary of the information in a vaguely POSIX df like format 62 44 print "Filesystem 1K-blocks Used Available Use% Mounted on\n"; 63 45 64 foreach my $vol (@stats) { 46 foreach my $row (@$stats) { 47 my %vol; 48 @vol{qw(mountpoint total used vol_id name path allocate available xattr)} 49 = @$row; 50 65 51 my $path = $vol->{path}; 66 52 my $total = $vol->{total};
Note:
See TracChangeset
for help on using the changeset viewer.
