| 1 | package Linux::LVM2::LV; | ||||||||||
| 2 | { | ||||||||||
| 3 | 3 | $Linux::LVM2::LV::VERSION = '0.14'; | |||||||||
| 4 | } | ||||||||||
| 5 | 3 | ▶ | BEGIN { | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 3 | $Linux::LVM2::LV::AUTHORITY = 'cpan:TEX'; | |||||||||
| 7 | } | ||||||||||
| 8 | # ABSTRACT: a class representing a LV in a Linux LVM2 | ||||||||||
| 9 | |||||||||||
| 10 | 3 | ▶ | use 5.010_000; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 3 | ▶ | use mro 'c3'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 3 | ▶ | use feature ':5.10'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 3 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 3 | ▶ | use namespace::autoclean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | # use IO::Handle; | ||||||||||
| 18 | # use autodie; | ||||||||||
| 19 | # use MooseX::Params::Validate; | ||||||||||
| 20 | |||||||||||
| 21 | 3 | has 'name' => ( | |||||||||
| 22 | 'is' => 'ro', | ||||||||||
| 23 | 'isa' => 'Str', | ||||||||||
| 24 | 'required' => 1, | ||||||||||
| 25 | ); | ||||||||||
| 26 | |||||||||||
| 27 | 3 | has 'vg' => ( | |||||||||
| 28 | 'is' => 'ro', | ||||||||||
| 29 | 'isa' => 'Linux::LVM2::VG', | ||||||||||
| 30 | 'required' => 1, | ||||||||||
| 31 | 'weak_ref' => 1, | ||||||||||
| 32 | ); | ||||||||||
| 33 | |||||||||||
| 34 | 3 | has 'access' => ( | |||||||||
| 35 | 'is' => 'rw', | ||||||||||
| 36 | 'isa' => 'Int', | ||||||||||
| 37 | 'required' => 1, | ||||||||||
| 38 | ); | ||||||||||
| 39 | |||||||||||
| 40 | 3 | has 'status' => ( | |||||||||
| 41 | 'is' => 'rw', | ||||||||||
| 42 | 'isa' => 'Int', | ||||||||||
| 43 | 'required' => 1, | ||||||||||
| 44 | ); | ||||||||||
| 45 | |||||||||||
| 46 | 3 | has 'intlvnum' => ( | |||||||||
| 47 | 'is' => 'rw', | ||||||||||
| 48 | 'isa' => 'Int', | ||||||||||
| 49 | 'required' => 1, | ||||||||||
| 50 | ); | ||||||||||
| 51 | |||||||||||
| 52 | 3 | has 'opencount' => ( | |||||||||
| 53 | 'is' => 'rw', | ||||||||||
| 54 | 'isa' => 'Int', | ||||||||||
| 55 | 'required' => 1, | ||||||||||
| 56 | ); | ||||||||||
| 57 | |||||||||||
| 58 | 3 | has 'lvsize' => ( | |||||||||
| 59 | 'is' => 'rw', | ||||||||||
| 60 | 'isa' => 'Int', | ||||||||||
| 61 | 'required' => 1, | ||||||||||
| 62 | ); | ||||||||||
| 63 | |||||||||||
| 64 | 3 | has 'leassoc' => ( | |||||||||
| 65 | 'is' => 'rw', | ||||||||||
| 66 | 'isa' => 'Int', | ||||||||||
| 67 | 'required' => 1, | ||||||||||
| 68 | ); | ||||||||||
| 69 | |||||||||||
| 70 | 3 | has 'lealloc' => ( | |||||||||
| 71 | 'is' => 'rw', | ||||||||||
| 72 | 'isa' => 'Int', | ||||||||||
| 73 | 'required' => 1, | ||||||||||
| 74 | ); | ||||||||||
| 75 | |||||||||||
| 76 | 3 | has 'allocpol' => ( | |||||||||
| 77 | 'is' => 'rw', | ||||||||||
| 78 | 'isa' => 'Int', | ||||||||||
| 79 | 'required' => 1, | ||||||||||
| 80 | ); | ||||||||||
| 81 | |||||||||||
| 82 | 3 | has 'rasect' => ( | |||||||||
| 83 | 'is' => 'rw', | ||||||||||
| 84 | 'isa' => 'Int', | ||||||||||
| 85 | 'required' => 1, | ||||||||||
| 86 | ); | ||||||||||
| 87 | |||||||||||
| 88 | 3 | has 'majornum' => ( | |||||||||
| 89 | 'is' => 'rw', | ||||||||||
| 90 | 'isa' => 'Int', | ||||||||||
| 91 | 'required' => 1, | ||||||||||
| 92 | ); | ||||||||||
| 93 | |||||||||||
| 94 | 3 | has 'minornum' => ( | |||||||||
| 95 | 'is' => 'rw', | ||||||||||
| 96 | 'isa' => 'Int', | ||||||||||
| 97 | 'required' => 1, | ||||||||||
| 98 | ); | ||||||||||
| 99 | |||||||||||
| 100 | 3 | has 'origin' => ( | |||||||||
| 101 | 'is' => 'rw', | ||||||||||
| 102 | 'isa' => 'Linux::LVM2::LV', | ||||||||||
| 103 | ); | ||||||||||
| 104 | |||||||||||
| 105 | 3 | has 'snap_pc' => ( | |||||||||
| 106 | 'is' => 'rw', | ||||||||||
| 107 | 'isa' => 'Int', | ||||||||||
| 108 | ); | ||||||||||
| 109 | |||||||||||
| 110 | 3 | has 'move' => ( | |||||||||
| 111 | 'is' => 'rw', | ||||||||||
| 112 | 'isa' => 'Str', # ??? | ||||||||||
| 113 | ); | ||||||||||
| 114 | |||||||||||
| 115 | 3 | has 'log' => ( | |||||||||
| 116 | 'is' => 'rw', | ||||||||||
| 117 | 'isa' => 'Str', # ??? | ||||||||||
| 118 | ); | ||||||||||
| 119 | |||||||||||
| 120 | 3 | has 'copy_pc' => ( | |||||||||
| 121 | 'is' => 'rw', | ||||||||||
| 122 | 'isa' => 'Int', | ||||||||||
| 123 | ); | ||||||||||
| 124 | |||||||||||
| 125 | 3 | has 'convert' => ( | |||||||||
| 126 | 'is' => 'rw', | ||||||||||
| 127 | 'isa' => 'Str', # ??? | ||||||||||
| 128 | ); | ||||||||||
| 129 | |||||||||||
| 130 | 3 | has 'mount_point' => ( | |||||||||
| 131 | 'is' => 'rw', | ||||||||||
| 132 | 'isa' => 'Str', | ||||||||||
| 133 | 'default' => q{}, | ||||||||||
| 134 | ); | ||||||||||
| 135 | |||||||||||
| 136 | 3 | has 'fs_type' => ( | |||||||||
| 137 | 'is' => 'rw', | ||||||||||
| 138 | 'isa' => 'Str', | ||||||||||
| 139 | ); | ||||||||||
| 140 | |||||||||||
| 141 | 3 | has 'fs_options' => ( | |||||||||
| 142 | 'is' => 'rw', | ||||||||||
| 143 | 'isa' => 'Str', | ||||||||||
| 144 | ); | ||||||||||
| 145 | |||||||||||
| 146 | 0 | ▶ | sub BUILD { | ||||||||
|
Subroutine
BUILD: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 147 | 0 | my $self = shift; | |||||||||
| 148 | |||||||||||
| 149 | 0 | $self->vg()->lvs()->{ $self->name() } = $self; | |||||||||
| 150 | |||||||||||
| 151 | 0 | return 1; | |||||||||
| 152 | } | ||||||||||
| 153 | |||||||||||
| 154 | 0 | ▶ | sub full_path { | ||||||||
|
Subroutine
full_path: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 155 | 0 | my $self = shift; | |||||||||
| 156 | |||||||||||
| 157 | 0 | return '/dev/' . $self->vg()->name() . '/' . $self->name(); | |||||||||
| 158 | } | ||||||||||
| 159 | |||||||||||
| 160 | 0 | ▶ | sub mapper_path { | ||||||||
|
Subroutine
mapper_path: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 161 | 0 | my $self = shift; | |||||||||
| 162 | |||||||||||
| 163 | 0 | my $vg = $self->vg()->name(); | |||||||||
| 164 | 0 | $vg =~ s/(?<!-)-(?!-)/--/; | |||||||||
| 165 | 0 | my $lv = $self->name(); | |||||||||
| 166 | 0 | $lv =~ s/(?<!-)-(?!-)/--/; | |||||||||
| 167 | 0 | return '/dev/mapper/' . $vg . '-' . $lv; | |||||||||
| 168 | } | ||||||||||
| 169 | |||||||||||
| 170 | 0 | ▶ | sub valid { | ||||||||
|
Subroutine
valid: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 171 | 0 | my $self = shift; | |||||||||
| 172 | 0 | $self->vg()->update(); | |||||||||
| 173 | 0 | ▶ | if ( $self->snap_pc() < 100 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 174 | 0 | return 1; | |||||||||
| 175 | } | ||||||||||
| 176 | else { | ||||||||||
| 177 | 0 | return; | |||||||||
| 178 | } | ||||||||||
| 179 | } | ||||||||||
| 180 | |||||||||||
| 181 | 3 | ▶ | no Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 182 | 3 | __PACKAGE__->meta->make_immutable; | |||||||||
| 183 | |||||||||||
| 184 | 3 | 1; | |||||||||
| 185 | |||||||||||
| 186 | __END__ | ||||||||||