]>
Commit | Line | Data |
---|---|---|
1dc01b9f DM |
1 | package PVE::Storage::DirPlugin; |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | use File::Path; | |
6 | use PVE::Storage::Plugin; | |
7 | use PVE::JSONSchema qw(get_standard_option); | |
8 | ||
9 | use base qw(PVE::Storage::Plugin); | |
10 | ||
11 | # Configuration | |
12 | ||
13 | sub type { | |
14 | return 'dir'; | |
15 | } | |
16 | ||
17 | sub plugindata { | |
18 | return { | |
19 | content => [ { images => 1, rootdir => 1, vztmpl => 1, iso => 1, backup => 1, none => 1 }, | |
20 | { images => 1, rootdir => 1 }], | |
21 | format => [ { raw => 1, qcow2 => 1, vmdk => 1 } , 'raw' ], | |
22 | }; | |
23 | } | |
24 | ||
25 | sub properties { | |
26 | return { | |
27 | path => { | |
28 | description => "File system path.", | |
29 | type => 'string', format => 'pve-storage-path', | |
30 | }, | |
31 | }; | |
32 | } | |
33 | ||
34 | sub options { | |
35 | return { | |
36 | path => { fixed => 1 }, | |
37 | nodes => { optional => 1 }, | |
38 | shared => { optional => 1 }, | |
39 | disable => { optional => 1 }, | |
40 | maxfiles => { optional => 1 }, | |
41 | content => { optional => 1 }, | |
42 | format => { optional => 1 }, | |
43 | }; | |
44 | } | |
45 | ||
46 | # Storage implementation | |
47 | ||
48 | sub activate_storage { | |
49 | my ($class, $storeid, $scfg, $cache) = @_; | |
50 | ||
51 | my $path = $scfg->{path}; | |
52 | mkpath $path; | |
53 | ||
54 | $class->SUPER::activate_storage($storeid, $scfg, $cache); | |
55 | } | |
56 | ||
57 | ||
58 | 1; |