| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
#!/bin/false |
|
2
|
|
|
|
|
|
|
# PODNAME: Net::Proxmox::VE::Storage |
|
3
|
|
|
|
|
|
|
# ABSTRACT: Store object |
|
4
|
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
27
|
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
36
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Net::Proxmox::VE::Storage; |
|
9
|
|
|
|
|
|
|
$Net::Proxmox::VE::Storage::VERSION = '0.36'; |
|
10
|
1
|
|
|
1
|
|
4
|
use parent 'Exporter'; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
5
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @EXPORT = qw( storages ); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $base = '/storages'; |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub storage { |
|
19
|
|
|
|
|
|
|
|
|
20
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
|
21
|
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
return $self->get($base); |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub get_storage { |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
|
30
|
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
my $a = shift or die 'No storageid for get_storage()'; |
|
32
|
0
|
0
|
|
|
|
|
die 'storageid must be a scalar for get_storage()' if ref $a; |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return $self->get( $base, $a ); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub create_storage { |
|
40
|
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
|
42
|
0
|
|
|
|
|
|
my @p = @_; |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
die 'No arguments for create_storage()' unless @p; |
|
45
|
0
|
|
|
|
|
|
my %args; |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
if ( @p == 1 ) { |
|
48
|
0
|
0
|
|
|
|
|
die 'Single argument not a hash for create_storage()' |
|
49
|
|
|
|
|
|
|
unless ref $a eq 'HASH'; |
|
50
|
0
|
|
|
|
|
|
%args = %{ $p[0] }; |
|
|
0
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
else { |
|
53
|
0
|
0
|
|
|
|
|
die 'Odd number of arguments for create_storage()' |
|
54
|
|
|
|
|
|
|
if ( scalar @p % 2 != 0 ); |
|
55
|
0
|
|
|
|
|
|
%args = @p; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
return $self->post( $base, \%args ) |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub delete_storage { |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
|
66
|
0
|
0
|
|
|
|
|
my $a = shift or die 'No argument given for delete_storage()'; |
|
67
|
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return $self->delete( $base, $a ); |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub update_storage { |
|
74
|
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
|
76
|
0
|
0
|
|
|
|
|
my $storageid = shift or die 'No storageid provided for update_storage()'; |
|
77
|
0
|
0
|
|
|
|
|
die 'storageid must be a scalar for update_storage()' if ref $storageid; |
|
78
|
0
|
|
|
|
|
|
my @p = @_; |
|
79
|
|
|
|
|
|
|
|
|
80
|
0
|
0
|
|
|
|
|
die 'No arguments for update_storage()' unless @p; |
|
81
|
0
|
|
|
|
|
|
my %args; |
|
82
|
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
|
if ( @p == 1 ) { |
|
84
|
0
|
0
|
|
|
|
|
die 'Single argument not a hash for update_storage()' |
|
85
|
|
|
|
|
|
|
unless ref $a eq 'HASH'; |
|
86
|
0
|
|
|
|
|
|
%args = %{ $p[0] }; |
|
|
0
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
else { |
|
89
|
0
|
0
|
|
|
|
|
die 'Odd number of arguments for update_storage()' |
|
90
|
|
|
|
|
|
|
if ( scalar @p % 2 != 0 ); |
|
91
|
0
|
|
|
|
|
|
%args = @p; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
return $self->put( $base, $storageid, \%args ); |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
} |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=pod |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=encoding UTF-8 |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 NAME |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Net::Proxmox::VE::Storage - Store object |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 VERSION |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
version 0.36 |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
@storage = $obj->storage(); |
|
116
|
|
|
|
|
|
|
$storage = $obj->get_storage('storageid'); |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
$ok = $obj->create_storage(%args); |
|
119
|
|
|
|
|
|
|
$ok = $obj->create_storage(\%args); |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
$ok = $obj->delete_storage('storageid'); |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
$ok = $obj->update_storage('storageid', %args); |
|
124
|
|
|
|
|
|
|
$ok = $obj->update_storage('storageid', \%args); |
|
125
|
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This module implements the 'storages' section of the Proxmox API for L, |
|
129
|
|
|
|
|
|
|
you should use the API via that module. This documentation is for detailed reference. |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
To be clear, this module isn't useful as a stand alone piece of software. |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=head1 NOTE |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
String formats that are mentioned herein are done so for convenience and |
|
136
|
|
|
|
|
|
|
are defined in detail in the Proxmox API documents on the Proxmox project website. |
|
137
|
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
This module doesnt enforce them, it will send whatever garbage you provide |
|
139
|
|
|
|
|
|
|
straight to the server API. So garbage-in, garbage-out! |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 METHODS |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head2 storages |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Gets a list of storages (aka the a Storage Index) |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
@storage = $obj->storage(); |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 get_storage |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Gets a single storage's configuration details |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
$storage = $obj->get_storage('storageid'); |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
storageid is a string in pve-storageid format |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 create_storage |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Creates a new storage |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
$ok = $obj->create_storage( %args ); |
|
162
|
|
|
|
|
|
|
$ok = $obj->create_storage( \%args ); |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
I<%args> may items contain from the following list |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=over 4 |
|
167
|
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item storage |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
String. The id of the storage you wish to access in pve-storageid format. Required. |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item type |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Emum. This is the type of storage, options are dir, nfs, lvm, isci. Required. |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item base |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
String. A pve-volume-id, see the PVE documentation. Optional. |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item content |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
String. A pve-storage-content-list. Optional. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=item disable |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Boolean. See the PVE documetnation. Optional. |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item export |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
String. A pve-storage-path. Optional. |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=item format |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
String. A pve-format-path. Optional. |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=item maxfiles |
|
197
|
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
Integer. See the PVE documentation. Optional. |
|
199
|
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=item nodes |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
String. A pve-node-list. Optional. |
|
203
|
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=item options |
|
205
|
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
String. A pve-storage-options. Optional. |
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
=item path |
|
209
|
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
String. A pve-storage-path. Optional. |
|
211
|
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
=item portal |
|
213
|
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
String. A pve-storage-portal-dns. Optional. |
|
215
|
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
=item server |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
String. A pve-storage-server. Optional. |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
=item shared |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
Boolean. See the PVE documentation. Optional. |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=back |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head2 delete_storage |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
Deletes a single storage |
|
229
|
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
$ok = $obj->delete_storage('storage') |
|
231
|
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
storage is a string in pve-storage-id format |
|
233
|
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
=head2 update_storage |
|
235
|
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
Updates (sets) a storage's data |
|
237
|
|
|
|
|
|
|
|
|
238
|
|
|
|
|
|
|
$ok = $obj->update_storage( 'storage', %args ); |
|
239
|
|
|
|
|
|
|
$ok = $obj->update_storage( 'storage', \%args ); |
|
240
|
|
|
|
|
|
|
|
|
241
|
|
|
|
|
|
|
storage is a string in pve-storage-id format |
|
242
|
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
I<%args> may items contain from the following list |
|
244
|
|
|
|
|
|
|
|
|
245
|
|
|
|
|
|
|
=over 4 |
|
246
|
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
=item content |
|
248
|
|
|
|
|
|
|
|
|
249
|
|
|
|
|
|
|
String. Storage content list. Optional. |
|
250
|
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
=item digest |
|
252
|
|
|
|
|
|
|
|
|
253
|
|
|
|
|
|
|
String. Prevent changes if current configuration file has a different SHA1 digest. This can be used to prevent concurrent modifications. Optional. |
|
254
|
|
|
|
|
|
|
|
|
255
|
|
|
|
|
|
|
=item disable |
|
256
|
|
|
|
|
|
|
|
|
257
|
|
|
|
|
|
|
Boolean. Disables the storage. Optional. |
|
258
|
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
=item format |
|
260
|
|
|
|
|
|
|
|
|
261
|
|
|
|
|
|
|
String. Storage format in pve-storage-format format (see the PVE documentation). Optional. |
|
262
|
|
|
|
|
|
|
|
|
263
|
|
|
|
|
|
|
=item maxfiles |
|
264
|
|
|
|
|
|
|
|
|
265
|
|
|
|
|
|
|
Integer. See PVE documentation. Optional. |
|
266
|
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
=item nodes |
|
268
|
|
|
|
|
|
|
|
|
269
|
|
|
|
|
|
|
String. List of cluster node names. Optional. |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
=item options |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
String. Storage options in pve-storage-options format. Optional. |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
=item shared |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
Boolean. See PVE documentation. Optional. |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=back |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
L |
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=head1 AUTHOR |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
Brendan Beveridge , Dean Hamstead |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
This software is Copyright (c) 2022 by Dean Hamstad. |
|
292
|
|
|
|
|
|
|
|
|
293
|
|
|
|
|
|
|
This is free software, licensed under: |
|
294
|
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
The MIT (X11) License |
|
296
|
|
|
|
|
|
|
|
|
297
|
|
|
|
|
|
|
=cut |
|
298
|
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
__END__ |