File Coverage

blib/lib/Lustre/Info/MDT.pm
Criterion Covered Total %
statement 6 25 24.0
branch 0 4 0.0
condition n/a
subroutine 2 11 18.1
pod 6 8 75.0
total 14 48 29.1


line stmt bran cond sub pod time code
1             #
2             # Lustre OST/OSS subclass
3             #
4             # (C) 2010 Adrian Ulrich -
5             #
6             # This program is free software; you can redistribute it and/or
7             # modify it under the same terms as Perl itself.
8             #
9             package Lustre::Info::MDT;
10              
11 1     1   5 use strict;
  1         2  
  1         49  
12 1     1   5 use constant PROCFS_MDS => "/proc/fs/lustre/mds";
  1         1  
  1         351  
13              
14             ##########################################################################
15             # Creates a new MDT Object
16             sub new {
17 0     0 0   my($classname, %args) = @_;
18 0           my $self = { super=>$args{super}, mdtname=>$args{mdtname}, procpath=>PROCFS_MDS."/$args{mdtname}" };
19 0           bless($self,$classname);
20 0 0         return ( -d $self->{procpath} ? $self : undef );
21             }
22              
23             ##########################################################################
24             # Return name of MDT
25             sub get_name {
26 0     0 1   my($self) = @_;
27 0           return $self->{mdtname};
28             }
29              
30             ##########################################################################
31             # Return the size of this MDT
32 0     0 1   sub get_kbytes_total { return $_[0]->_rint('kbytestotal'); }
33              
34             ##########################################################################
35             # Return how much space is free
36 0     0 1   sub get_kbytes_free { return $_[0]->_rint('kbytesfree'); }
37              
38             ##########################################################################
39             # # of pre-allocated inodes (at mkfs.lustre runtime)
40 0     0 1   sub get_files_total { return $_[0]->_rint('filestotal'); }
41              
42             ##########################################################################
43             # How many files/inodes are free
44 0     0 1   sub get_files_free { return $_[0]->_rint('filesfree'); }
45              
46             ##########################################################################
47             # Returns the name of the hosting blockdevice
48 0     0 0   sub get_blockdevice { return $_[0]->_rint('mntdev'); }
49              
50             ##########################################################################
51             # Parse and return information about the last recovery procedure
52             sub get_recovery_info {
53 0     0 1   my($self) = @_;
54 0           return $self->{super}->_parse_generic_file($self->{procpath}."/recovery_status");
55             }
56              
57              
58             ##########################################################################
59             # Return an integer
60             sub _rint {
61 0     0     my($self,$procfile) = @_;
62 0 0         open(PF, $self->{procpath}."/$procfile") or return -1;
63 0           my $num = ; chomp($num);
  0            
64 0           close(PF);
65 0           return $num;
66             }
67              
68              
69             1;
70             __END__