line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#!/bin/false |
2
|
|
|
|
|
|
|
# PODNAME: Net::Proxmox::VE::Pools |
3
|
|
|
|
|
|
|
# ABSTRACT: Presents a pool object |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
36
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
59
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Net::Proxmox::VE::Pools; |
9
|
|
|
|
|
|
|
$Net::Proxmox::VE::Pools::VERSION = '0.36'; |
10
|
1
|
|
|
1
|
|
5
|
use parent 'Exporter'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our @EXPORT = qw( pools get_pool create_pool delete_pool update_pool ); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $base = '/pools'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub pools { |
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_pool { |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
30
|
|
|
|
|
|
|
|
31
|
0
|
0
|
|
|
|
|
my $a = shift or die 'No poolid for get_pool()'; |
32
|
0
|
0
|
|
|
|
|
die 'poolid must be a scalar for get_pool()' if ref $a; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return $self->get( $base, $a ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub create_pool { |
40
|
|
|
|
|
|
|
|
41
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
42
|
0
|
|
|
|
|
|
my @p = @_; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
die 'No arguments for create_pool()' unless @p; |
45
|
0
|
|
|
|
|
|
my %args; |
46
|
|
|
|
|
|
|
|
47
|
0
|
0
|
|
|
|
|
if ( @p == 1 ) { |
48
|
0
|
0
|
|
|
|
|
die 'Single argument not a hash for create_pool()' |
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_pool()' |
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_pool { |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
66
|
0
|
0
|
|
|
|
|
my $a = shift or die 'No argument given for delete_pool()'; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
return $self->delete( $base, $a ); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub update_pool { |
74
|
|
|
|
|
|
|
|
75
|
0
|
0
|
|
0
|
1
|
|
my $self = shift or return; |
76
|
0
|
0
|
|
|
|
|
my $poolid = shift or die 'No poolid provided for update_pool()'; |
77
|
0
|
0
|
|
|
|
|
die 'poolid must be a scalar for update_pool()' if ref $poolid; |
78
|
0
|
|
|
|
|
|
my @p = @_; |
79
|
|
|
|
|
|
|
|
80
|
0
|
0
|
|
|
|
|
die 'No arguments for update_pool()' unless @p; |
81
|
0
|
|
|
|
|
|
my %args; |
82
|
|
|
|
|
|
|
|
83
|
0
|
0
|
|
|
|
|
if ( @p == 1 ) { |
84
|
0
|
0
|
|
|
|
|
die 'Single argument not a hash for update_pool()' |
85
|
|
|
|
|
|
|
unless ref $p[0] eq 'HASH'; |
86
|
0
|
|
|
|
|
|
%args = %{ $p[0] }; |
|
0
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
else { |
89
|
0
|
0
|
|
|
|
|
die 'Odd number of arguments for update_pool()' |
90
|
|
|
|
|
|
|
if ( scalar @p % 2 != 0 ); |
91
|
0
|
|
|
|
|
|
%args = @p; |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
return $self->put( $base, $poolid, \%args ) |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
1; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=pod |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=encoding UTF-8 |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=head1 NAME |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
Net::Proxmox::VE::Pools - Presents a pool object |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 VERSION |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
version 0.36 |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 SYNOPSIS |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
@pools = $obj->pools(); |
116
|
|
|
|
|
|
|
$pool = $obj->get_pool('poolid'); |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
$ok = $obj->create_pool(%args); |
119
|
|
|
|
|
|
|
$ok = $obj->create_pool(\%args); |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
$ok = $obj->delete_pool('poolid'); |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
$ok = $obj->update_pool('poolid', %args); |
124
|
|
|
|
|
|
|
$ok = $obj->update_pool('poolid', \%args); |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 DESCRIPTION |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
This module implements the 'pools' 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 pools |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Gets a list of pools (aka the a Pool Index) |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
@pools = $obj->pools(); |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 get_pool |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Gets a single pool's configuration details |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
$pool = $obj->get_pool('poolid'); |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
poolid is a string in pve-poolid format |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 create_pool |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Creates a new pool |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
$ok = $obj->create_pool( %args ); |
162
|
|
|
|
|
|
|
$ok = $obj->create_pool( \%args ); |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
I<%args> may items contain from the following list |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=over 4 |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item poolid |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
String. The id of the pool you wish to access, in pve-poolid format. This is required. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item comment |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
String. This is a comment associated with the new pool, this is optional |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=back |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head2 delete_pool |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Deletes a single pool |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
$ok = $obj->delete_pool('poolid') |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
poolid is a string in pve-poolid format |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head2 update_pool |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Updates (sets) a pool's data |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
$ok = $obj->update_pool( 'poolid', %args ); |
191
|
|
|
|
|
|
|
$ok = $obj->update_pool( 'poolid', \%args ); |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
poolid is a string in pve-poolid format |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
I<%args> may items contain from the following list |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=over 4 |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=item comment |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
String. This is a comment associated with the new pool, this is optional |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
=item delete |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
Boolean. Removes the vms/storage rather than adding it. |
206
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=item storage |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
String. List of storage ids (in pve-storage-id-list format) |
210
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=item vms |
212
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
String. List of virtual machines in pve-vmid-list format. |
214
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=back |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=head1 SEE ALSO |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
L |
220
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=head1 AUTHOR |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
Brendan Beveridge , Dean Hamstead |
224
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
This software is Copyright (c) 2022 by Dean Hamstad. |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
This is free software, licensed under: |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
The MIT (X11) License |
232
|
|
|
|
|
|
|
|
233
|
|
|
|
|
|
|
=cut |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
__END__ |