IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17079


Ignore:
Timestamp:
Mar 20, 2008, 3:36:59 PM (18 years ago)
Author:
jhoblitt
Message:

modify neb-df to use Nebulous::Client::mounts()

Location:
trunk/Nebulous
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Nebulous/Build.PL

    r17073 r17079  
    9191        'Getopt::Long'          => 0,
    9292        'Pod::Usage'            => 0,
    93 # below are for ./bin only any need to go away
    94         'DBD::mysql'            => '3.0007',
    95         'DBI'                   => '1.53',
    96         'Nebulous::Server::SQL' => 0,
    9793    },
    9894    recommends          => {
  • trunk/Nebulous/Changes

    r17073 r17079  
    22
    330.07
     4    - modify neb-df to use Nebulous::Client::mounts()
    45    - server/client split into Nebulous::Server and Nebulous::Client packages
    56    - add support for storing instances in multi-tier 'hashed' directories
  • trunk/Nebulous/bin/neb-df

    r13074 r17079  
    33# Copyright (C) 2007  Joshua Hoblitt
    44#
    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 $
    66
    77use strict;
     
    1111$VERSION = '0.01';
    1212
    13 use DBI;
    14 use Nebulous::Server::SQL;
    15 use URI;
     13use Nebulous::Client;
    1614
    1715use Getopt::Long qw( GetOptions :config auto_help auto_version );
    1816use Pod::Usage qw( pod2usage );
    1917
    20 my ($db, $dbuser, $dbpass, $name, $uri);
     18my ($db, $dbuser, $dbpass);
    2119
    2220$db     = $ENV{'NEB_DB'} unless $db;
     
    3432    unless $db && $dbuser && $dbpass;
    3533
    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     },
     34my $neb = Nebulous::Client->new(
     35    proxy => "$server",
    4536);
    4637
    47 my $sql = Nebulous::Server::SQL->new();
     38die "can't connected to Nebulous Server: $server"
     39    unless defined $neb;
    4840
    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 }
     41my $stats = $neb->mounts();
    6042
    6143# output a summary of the information in a vaguely POSIX df like format
    6244print "Filesystem           1K-blocks      Used Available Use% Mounted on\n";
    6345
    64 foreach my $vol (@stats) {
     46foreach my $row (@$stats) {
     47    my %vol;
     48    @vol{qw(mountpoint total used vol_id name path allocate available xattr)}
     49        = @$row;
     50
    6551    my $path        = $vol->{path};
    6652    my $total       = $vol->{total};
Note: See TracChangeset for help on using the changeset viewer.