]>
Commit | Line | Data |
---|---|---|
5bb8e010 DM |
1 | package PVE::Storage::ZFSDirPlugin; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | use IO::File; | |
6 | use POSIX; | |
7 | use PVE::Tools qw(run_command); | |
8 | use PVE::Storage::Plugin; | |
9 | ||
10 | ||
11 | use base qw(PVE::Storage::Plugin); | |
12 | ||
13 | sub zfs_parse_size { | |
14 | my ($text) = @_; | |
15 | ||
16 | return 0 if !$text; | |
17 | ||
18 | if ($text =~ m/^(\d+(\.\d+)?)([TGMK])?$/) { | |
19 | my ($size, $reminder, $unit) = ($1, $2, $3); | |
20 | return $size if !$unit; | |
21 | if ($unit eq 'K') { | |
22 | $size *= 1024; | |
23 | } elsif ($unit eq 'M') { | |
24 | $size *= 1024*1024; | |
25 | } elsif ($unit eq 'G') { | |
26 | $size *= 1024*1024*1024; | |
27 | } elsif ($unit eq 'T') { | |
28 | $size *= 1024*1024*1024*1024; | |
29 | } | |
30 | ||
31 | if ($reminder) { | |
32 | $size = ceil($size); | |
33 | } | |
34 | return $size; | |
35 | } else { | |
36 | return 0; | |
37 | } | |
38 | } | |
39 | ||
40 | sub type { | |
41 | return 'zfsdir'; | |
42 | } | |
43 | ||
44 | sub plugindata { | |
45 | return { | |
46 | content => [ { images => 1, rootdir => 1, vztmpl => 1, iso => 1, backup => 1}, | |
47 | { images => 1 }], | |
48 | }; | |
49 | } | |
50 | ||
51 | sub options { | |
52 | return { | |
53 | path => { fixed => 1 }, | |
54 | nodes => { optional => 1 }, | |
55 | disable => { optional => 1 }, | |
56 | maxfiles => { optional => 1 }, | |
57 | content => { optional => 1 }, | |
58 | }; | |
59 | } | |
60 | ||
61 | # fixme: implement me | |
62 | ||
63 | 1; |