Changeset 26874
- Timestamp:
- Feb 10, 2010, 4:16:41 PM (16 years ago)
- Location:
- branches/eam_branches/20091201/Nebulous
- Files:
-
- 3 edited
-
bin/neb-df (modified) (3 diffs)
-
bin/neb-rm (modified) (4 diffs)
-
lib/Nebulous/Client.pm (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/20091201/Nebulous/bin/neb-df
r17547 r26874 44 44 my $total_total = 0; 45 45 my $total_used = 0; 46 my $allocated_total = 0; 47 my $allocated_used = 0; 46 48 foreach my $row (@$stats) { 47 49 my %vol; 48 @vol{qw(mountpoint total used vol_id name path allocate available xattr)}50 @vol{qw(mountpoint total used vol_id name host path allocate available xattr)} 49 51 = @$row; 50 51 my $path = $vol{path}; 52 my $path = $vol{host}; 52 53 my $total = $vol{total}; 53 54 $total_total += $total; … … 58 59 my $mountpoint = $vol{mountpoint}; 59 60 61 if ($vol{allocate} == 1) { 62 $allocated_total += $total; 63 $allocated_used += $used; 64 } 60 65 # indicated the part of the nebulous volume name that matches up with a 61 66 # local volume (mountpoint) … … 101 106 ); 102 107 108 my $allocated_available = $allocated_total - $allocated_used; 109 my $allocated_usedper = ($allocated_used / $allocated_total) * 100; 110 111 # summary 112 printf ("%s\n%20s", "/summmary_of_allocated_volumes", ""); 113 printf(" %*s %*s %*s %*.0f%% %s\n", 114 9, 115 $allocated_total, 116 9, 117 $allocated_used, 118 9, 119 $allocated_available, 120 3, 121 $allocated_usedper, 122 "/allocated", 123 ); 124 103 125 __END__ 104 126 -
branches/eam_branches/20091201/Nebulous/bin/neb-rm
r24864 r26874 19 19 $force, 20 20 $move, 21 $invalid, 21 22 $server, 22 23 ); … … 27 28 'force|f' => \$force, 28 29 'move|m' => \$move, 30 'invalid|i' => \$invalid, 29 31 'server|s=s' => \$server, 30 32 ) || pod2usage( 2 ); … … 42 44 foreach my $key (@ARGV) { 43 45 unless (defined $move) { 44 $neb->delete($key, $force ) or warn "failed to delete key: $key";46 $neb->delete($key, $force,$invalid) or warn "failed to delete key: $key"; 45 47 } else { 46 48 $neb->move($key, "${key}.rm") or warn "failed to move key: $key"; … … 80 82 When set, this flag causes C<<key>> to be renamed to C<<key>.rm> instead of 81 83 being deleted. 84 85 Optional. 86 87 =item * --invalid|-i 88 89 When set, unavailable instances of C<<key>> will be removed from the nebulous database. 82 90 83 91 Optional. -
branches/eam_branches/20091201/Nebulous/lib/Nebulous/Client.pm
r26292 r26874 755 755 optional => 1, 756 756 }, 757 { 758 #find_invalid 759 type => SCALAR|UNDEF, 760 optional => 1, 761 }, 757 762 ); 758 763 … … 951 956 my $self = shift; 952 957 953 my ($key, $force ) = validate_pos( @_,958 my ($key, $force, $invalid) = validate_pos( @_, 954 959 { 955 960 type => SCALAR, … … 965 970 }, 966 971 }, 967 ); 968 969 $log->debug( "entered - @_" ); 970 971 my $locations = $self->find_instances( $key, 'any' ); 972 { 973 type => BOOLEAN, 974 optional => 1, 975 default => undef, 976 callbacks => { 977 'is boolean' => sub { 978 $_[0] == 0 or $_[0] == 1 or $_[0] == undef; 979 }, 980 }, 981 }, 982 ); 983 984 $log->debug( "entered - @_" ); 985 986 987 my $locations; 988 if ($invalid) { 989 $locations = $self->find_instances( $key, 'any', 'find them all'); 990 } 991 else { 992 $locations = $self->find_instances( $key, 'any' ); 993 } 972 994 973 995 return undef unless $locations;
Note:
See TracChangeset
for help on using the changeset viewer.
