line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VMware::API::LabManager; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Workaround for self-signed certs |
4
|
|
|
|
|
|
|
$ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS} = "Net::SSL"; |
5
|
|
|
|
|
|
|
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; |
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
19186
|
use Data::Dumper; |
|
2
|
|
|
|
|
24991
|
|
|
2
|
|
|
|
|
240
|
|
8
|
2
|
|
|
2
|
|
3880
|
use SOAP::Lite; # +trace => 'debug'; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
use warnings; |
10
|
|
|
|
|
|
|
use strict; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
$VMware::API::LabManager::VERSION = '2.10'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
### External methods |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
|
|
|
|
|
|
my $class = shift @_; |
18
|
|
|
|
|
|
|
my $self = {}; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
$self->{username} = shift @_; |
21
|
|
|
|
|
|
|
$self->{password} = shift @_; |
22
|
|
|
|
|
|
|
$self->{hostname} = shift @_; |
23
|
|
|
|
|
|
|
$self->{orgname} = shift @_; |
24
|
|
|
|
|
|
|
$self->{workspace} = shift @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
$self->{debug} = 0; # Defaults to no debug info |
27
|
|
|
|
|
|
|
$self->{die_on_fault} = 1; # Defaults to die'ing on an error |
28
|
|
|
|
|
|
|
$self->{ssl_timeout} = 3600; # Defaults to 1h |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
bless($self,$class); |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
my $old_debug = shift @_; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
if ( defined $old_debug ) { |
35
|
|
|
|
|
|
|
warn "Old method for setting 'debug' used. You should use config() for this."; |
36
|
|
|
|
|
|
|
$self->config('debug',$old_debug); |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
my $old_die_on_fault = shift @_; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
if ( defined $old_die_on_fault ) { |
42
|
|
|
|
|
|
|
warn "Old method for setting 'die_on_fault' used. You should use config() for this."; |
43
|
|
|
|
|
|
|
$self->config('die_on_fault',$old_die_on_fault); |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
$self->_regenerate(); |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
$self->_debug("Loaded VMware::API::LabManager v" . our $VERSION . "\n") if $self->{debug}; |
49
|
|
|
|
|
|
|
return $self; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub config { |
53
|
|
|
|
|
|
|
my $self = shift @_; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
my %input = @_; |
56
|
|
|
|
|
|
|
my @config_vals = qw/debug die_on_fault hostname orgname password ssl_timeout username workspace/; |
57
|
|
|
|
|
|
|
my %config_vals = map { $_,1; } @config_vals; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
for my $key ( keys %input ) { |
60
|
|
|
|
|
|
|
if ( $config_vals{$key} ) { |
61
|
|
|
|
|
|
|
$self->{$key} = $input{$key}; |
62
|
|
|
|
|
|
|
} else { |
63
|
|
|
|
|
|
|
warn 'Config key "$key" is being ignored. Only the following options may be configured: ' |
64
|
|
|
|
|
|
|
. join(", ", @config_vals ) . "\n"; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
$self->_regenerate(); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
my %out; |
71
|
|
|
|
|
|
|
map { $out{$_} = $self->{$_} } @config_vals; |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
return wantarray ? %out : \%out; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub getLastSOAPError { |
77
|
|
|
|
|
|
|
my $self = shift @_; |
78
|
|
|
|
|
|
|
my $error_summary; |
79
|
|
|
|
|
|
|
if ( $self->{LASTERROR} and $self->{LASTERROR}->{data} ) { |
80
|
|
|
|
|
|
|
$error_summary = "\n\nERROR: $self->{LASTERROR}->{text}\n"; |
81
|
|
|
|
|
|
|
$error_summary .= "\n\nSUBMITTED XML: $self->{LASTERROR}->{xml} \n" if $self->{LASTERROR}->{xml}; |
82
|
|
|
|
|
|
|
$error_summary .= "\n\nERROR DEBUG: " . Dumper($self->{LASTERROR}->{data}) if $self->{debug}; |
83
|
|
|
|
|
|
|
$self->{LASTERROR} = {}; |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
return $error_summary; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
### Internal methods |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub _debug { |
91
|
|
|
|
|
|
|
my $self = shift @_; |
92
|
|
|
|
|
|
|
while ( my $debug = shift @_ ) { |
93
|
|
|
|
|
|
|
chomp $debug; |
94
|
|
|
|
|
|
|
print STDERR "DEBUG: $debug\n"; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub _fault { |
99
|
|
|
|
|
|
|
my $self = shift @_; |
100
|
|
|
|
|
|
|
my $data = shift @_; |
101
|
|
|
|
|
|
|
my $soapobj; |
102
|
|
|
|
|
|
|
my $text; |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
if ( ref $data ) { |
105
|
|
|
|
|
|
|
$soapobj = $data; |
106
|
|
|
|
|
|
|
$data = $soapobj->fault; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
if ( ref $data and defined $data->{faultstring} ) { |
110
|
|
|
|
|
|
|
$text = $data->{faultstring}; |
111
|
|
|
|
|
|
|
} elsif ( ref $data and ref $data->{detail} and defined $data->{detail}->{message}->{format} ) { |
112
|
|
|
|
|
|
|
$text = $data->{detail}->{message}->{format}; |
113
|
|
|
|
|
|
|
} else { |
114
|
|
|
|
|
|
|
$text = $data; |
115
|
|
|
|
|
|
|
$data = ''; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
my $xml; |
119
|
|
|
|
|
|
|
$xml = $soapobj->{_context}->{_transport}->{_proxy}->{_http_response}->{_request}->{_content} |
120
|
|
|
|
|
|
|
if ref $soapobj; |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
warn "\n\nERROR DETAILS:\n" . Dumper($data) if $self->{debug}; |
123
|
|
|
|
|
|
|
warn "\n\nSUBMITTED XML:\n" . $xml if $xml; #if $self->{debug} and $xml; |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
if ( $self->{die_on_fault} ) { |
126
|
|
|
|
|
|
|
die "\n\nERROR: $text\n"; |
127
|
|
|
|
|
|
|
} else { |
128
|
|
|
|
|
|
|
$self->{LASTERROR}->{data} = $data; |
129
|
|
|
|
|
|
|
$self->{LASTERROR}->{text} = $text; |
130
|
|
|
|
|
|
|
$self->{LASTERROR}->{xml} = $xml; |
131
|
|
|
|
|
|
|
warn "\n\nERROR: $text\n"; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub _regenerate { |
136
|
|
|
|
|
|
|
my $self = shift @_; |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
$self->{soap} = SOAP::Lite |
139
|
|
|
|
|
|
|
-> on_action(sub { return "http://vmware.com/labmanager/" . $_[1]; } ) |
140
|
|
|
|
|
|
|
-> default_ns('http://vmware.com/labmanager') |
141
|
|
|
|
|
|
|
-> proxy('https://' . $self->{hostname} . '/LabManager/SOAP/LabManager.asmx', timeout => $self->{ssl_timeout} ); |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
$self->{soap_priv} = SOAP::Lite |
144
|
|
|
|
|
|
|
-> on_action(sub { return "http://vmware.com/labmanager/" . $_[1]; } ) |
145
|
|
|
|
|
|
|
-> default_ns('http://vmware.com/labmanager') |
146
|
|
|
|
|
|
|
-> proxy('https://' . $self->{hostname} . '/LabManager/SOAP/LabManagerInternal.asmx', timeout => $self->{ssl_timeout} ); |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
$self->{soap}->readable(1); |
149
|
|
|
|
|
|
|
$self->{soap_priv}->readable(1); |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
$self->{auth_header} = SOAP::Header->new( |
152
|
|
|
|
|
|
|
name => 'AuthenticationHeader', |
153
|
|
|
|
|
|
|
attr => { xmlns => "http://vmware.com/labmanager" }, |
154
|
|
|
|
|
|
|
value => { username => $self->{username}, password => $self->{password}, organizationname => $self->{orgname}, workspacename => $self->{workspace} }, |
155
|
|
|
|
|
|
|
); |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
### Public API methods |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
sub ConfigurationCapture { |
161
|
|
|
|
|
|
|
my $self = shift @_; |
162
|
|
|
|
|
|
|
my $configID = shift @_; |
163
|
|
|
|
|
|
|
my $newLibName = shift @_; |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
$self->{ConfigurationCapture} = |
166
|
|
|
|
|
|
|
$self->{soap}->ConfigurationCapture( |
167
|
|
|
|
|
|
|
$self->{auth_header}, |
168
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID )->type('s:int'), |
169
|
|
|
|
|
|
|
SOAP::Data->name('newLibraryName' => $newLibName )->type('s:string') |
170
|
|
|
|
|
|
|
); |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
if ( $self->{ConfigurationCapture}->fault ) { |
173
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationCapture} ); |
174
|
|
|
|
|
|
|
return $self->{ConfigurationCapture}->fault; |
175
|
|
|
|
|
|
|
} else { |
176
|
|
|
|
|
|
|
return $self->{ConfigurationCapture}->result; |
177
|
|
|
|
|
|
|
} |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
sub ConfigurationCheckout { |
181
|
|
|
|
|
|
|
my $self = shift @_; |
182
|
|
|
|
|
|
|
my $configID = shift @_; |
183
|
|
|
|
|
|
|
my $configName = shift @_; |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
$self->{ConfigurationCheckout} = |
186
|
|
|
|
|
|
|
$self->{soap}->ConfigurationCheckout( |
187
|
|
|
|
|
|
|
$self->{auth_header}, |
188
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID )->type('s:int'), # Config to check out |
189
|
|
|
|
|
|
|
SOAP::Data->name('workspaceName' => $configName )->type('s:string') # New name it shall be |
190
|
|
|
|
|
|
|
); |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
if ( $self->{ConfigurationCheckout}->fault ) { |
193
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationCheckout} ); |
194
|
|
|
|
|
|
|
return $self->{ConfigurationCheckout}->fault; |
195
|
|
|
|
|
|
|
} else { |
196
|
|
|
|
|
|
|
return $self->{ConfigurationCheckout}->result; |
197
|
|
|
|
|
|
|
} |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
sub ConfigurationClone { |
201
|
|
|
|
|
|
|
my $self = shift @_; |
202
|
|
|
|
|
|
|
my $configID = shift @_; |
203
|
|
|
|
|
|
|
my $newWSName = shift @_; |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
$self->{ConfigurationClone} = |
206
|
|
|
|
|
|
|
$self->{soap}->ConfigurationClone($self->{auth_header}, |
207
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID )->type('s:int'), |
208
|
|
|
|
|
|
|
SOAP::Data->name('newWorkspaceName' => $newWSName )->type('s:string') ); |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
if ( $self->{ConfigurationClone}->fault ) { |
211
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationClone} ); |
212
|
|
|
|
|
|
|
return $self->{ConfigurationClone}->fault; |
213
|
|
|
|
|
|
|
} else { |
214
|
|
|
|
|
|
|
return $self->{ConfigurationClone}->result; |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
sub ConfigurationDelete { |
219
|
|
|
|
|
|
|
my $self = shift @_; |
220
|
|
|
|
|
|
|
my $configID = shift @_; |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
$self->{ConfigurationDelete} = |
223
|
|
|
|
|
|
|
$self->{soap}->ConfigurationDelete( $self->{auth_header}, |
224
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID)->type('s:int') |
225
|
|
|
|
|
|
|
); |
226
|
|
|
|
|
|
|
|
227
|
|
|
|
|
|
|
if ( $self->{ConfigurationDelete}->fault ) { |
228
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationDelete} ); |
229
|
|
|
|
|
|
|
return $self->{ConfigurationDelete}->fault; |
230
|
|
|
|
|
|
|
} else { |
231
|
|
|
|
|
|
|
return $self->{ConfigurationDelete}->result; |
232
|
|
|
|
|
|
|
} |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
sub ConfigurationDeploy { |
236
|
|
|
|
|
|
|
my $self = shift @_; |
237
|
|
|
|
|
|
|
my $configID = shift @_; |
238
|
|
|
|
|
|
|
my $fencemode = shift @_; # 1 = not fenced; 2 = block traffic in and out; 3 = allow out ; 4 allow in and out |
239
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
$self->{ConfigurationDeploy} = |
241
|
|
|
|
|
|
|
$self->{soap}->ConfigurationDeploy( $self->{auth_header}, |
242
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID )->type('s:int'), |
243
|
|
|
|
|
|
|
SOAP::Data->name('isCached' => "false")->type('s:boolean'), |
244
|
|
|
|
|
|
|
SOAP::Data->name('fenceMode' => $fencemode)->type('s:int') ); |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
if ( $self->{ConfigurationDeploy}->fault ) { |
247
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationDeploy} ); |
248
|
|
|
|
|
|
|
return $self->{ConfigurationDeploy}->fault; |
249
|
|
|
|
|
|
|
} else { |
250
|
|
|
|
|
|
|
return $self->{ConfigurationDeploy}->result; |
251
|
|
|
|
|
|
|
} |
252
|
|
|
|
|
|
|
} |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
sub ConfigurationPerformAction { |
255
|
|
|
|
|
|
|
my $self = shift @_; |
256
|
|
|
|
|
|
|
my $configID = shift @_; |
257
|
|
|
|
|
|
|
my $action = shift @_; # 1-Pwr On, 2-Pwr off, 3-Suspend, 4-Resume, 5-Reset, 6-Snapshot |
258
|
|
|
|
|
|
|
|
259
|
|
|
|
|
|
|
$self->{ConfigurationPerformAction} = |
260
|
|
|
|
|
|
|
$self->{soap}->ConfigurationPerformAction( $self->{auth_header}, |
261
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID )->type('s:int'), |
262
|
|
|
|
|
|
|
SOAP::Data->name('action' => $action )->type('s:int') ); |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
if ( $self->{ConfigurationPerformAction}->fault ) { |
265
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationPerformAction} ); |
266
|
|
|
|
|
|
|
return $self->{ConfigurationPerformAction}->fault; |
267
|
|
|
|
|
|
|
} else { |
268
|
|
|
|
|
|
|
return $self->{ConfigurationPerformAction}->result; |
269
|
|
|
|
|
|
|
} |
270
|
|
|
|
|
|
|
} |
271
|
|
|
|
|
|
|
|
272
|
|
|
|
|
|
|
sub ConfigurationSetPublicPrivate { |
273
|
|
|
|
|
|
|
my $self = shift @_; |
274
|
|
|
|
|
|
|
my $conf = shift @_; |
275
|
|
|
|
|
|
|
my $bool = shift @_; |
276
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
$self->{ConfigurationSetPublicPrivate} = |
278
|
|
|
|
|
|
|
$self->{soap}->ConfigurationSetPublicPrivate( $self->{auth_header}, |
279
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $conf )->type('s:int'), |
280
|
|
|
|
|
|
|
SOAP::Data->name('isPublic' => $bool )->type('s:boolean') |
281
|
|
|
|
|
|
|
); |
282
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
if ( $self->{ConfigurationSetPublicPrivate}->fault ) { |
284
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationSetPublicPrivate} ); |
285
|
|
|
|
|
|
|
return $self->{ConfigurationSetPublicPrivate}->fault; |
286
|
|
|
|
|
|
|
} else { |
287
|
|
|
|
|
|
|
return $self->{ConfigurationSetPublicPrivate}->result; |
288
|
|
|
|
|
|
|
} |
289
|
|
|
|
|
|
|
} |
290
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
sub ConfigurationUndeploy { |
292
|
|
|
|
|
|
|
my $self = shift @_; |
293
|
|
|
|
|
|
|
my $configID = shift @_; |
294
|
|
|
|
|
|
|
|
295
|
|
|
|
|
|
|
$self->{ConfigurationUndeploy} = |
296
|
|
|
|
|
|
|
$self->{soap}->ConfigurationUndeploy( $self->{auth_header}, |
297
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID )->type('s:int')); |
298
|
|
|
|
|
|
|
|
299
|
|
|
|
|
|
|
if ( $self->{ConfigurationUndeploy}->fault ) { |
300
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationUndeploy} ); |
301
|
|
|
|
|
|
|
return $self->{ConfigurationUndeploy}->fault; |
302
|
|
|
|
|
|
|
} else { |
303
|
|
|
|
|
|
|
return $self->{ConfigurationUndeploy}->result; |
304
|
|
|
|
|
|
|
} |
305
|
|
|
|
|
|
|
} |
306
|
|
|
|
|
|
|
|
307
|
|
|
|
|
|
|
sub GetConfiguration { |
308
|
|
|
|
|
|
|
my $self = shift @_; |
309
|
|
|
|
|
|
|
my $conf = shift @_; |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
$self->{GetConfiguration} = |
312
|
|
|
|
|
|
|
$self->{soap}->GetConfiguration( |
313
|
|
|
|
|
|
|
$self->{auth_header}, |
314
|
|
|
|
|
|
|
SOAP::Data->name('id' => $conf )->type('s:int') |
315
|
|
|
|
|
|
|
); |
316
|
|
|
|
|
|
|
|
317
|
|
|
|
|
|
|
if ( $self->{GetConfiguration}->fault ) { |
318
|
|
|
|
|
|
|
$self->_fault( $self->{GetConfiguration} ); |
319
|
|
|
|
|
|
|
return $self->{GetConfiguration}->fault; |
320
|
|
|
|
|
|
|
} else { |
321
|
|
|
|
|
|
|
return $self->{GetConfiguration}->result; |
322
|
|
|
|
|
|
|
} |
323
|
|
|
|
|
|
|
} |
324
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
sub GetConfigurationByName { |
326
|
|
|
|
|
|
|
my $self = shift @_; |
327
|
|
|
|
|
|
|
my $name = shift @_; |
328
|
|
|
|
|
|
|
|
329
|
|
|
|
|
|
|
$self->{GetConfigurationByName} = |
330
|
|
|
|
|
|
|
$self->{soap}->GetConfigurationByName( |
331
|
|
|
|
|
|
|
$self->{auth_header}, |
332
|
|
|
|
|
|
|
SOAP::Data->name( name => $name )->type('s:string') |
333
|
|
|
|
|
|
|
); |
334
|
|
|
|
|
|
|
|
335
|
|
|
|
|
|
|
if ( $self->{GetConfigurationByName}->fault ) { |
336
|
|
|
|
|
|
|
$self->_fault( $self->{GetConfigurationByName} ); |
337
|
|
|
|
|
|
|
return $self->{GetConfigurationByName}->fault; |
338
|
|
|
|
|
|
|
} |
339
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
my $ret = $self->{GetConfigurationByName}->result; |
341
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
my $array = $ret ? [ $ret ] : [ ]; |
343
|
|
|
|
|
|
|
$array = [ $ret->{Configuration} ] if ref $ret and ref $ret->{Configuration} eq 'HASH'; |
344
|
|
|
|
|
|
|
$array = $ret->{Configuration} if ref $ret and ref $ret->{Configuration} eq 'ARRAY'; |
345
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
return wantarray ? @$array : $array; |
347
|
|
|
|
|
|
|
} |
348
|
|
|
|
|
|
|
|
349
|
|
|
|
|
|
|
sub GetMachine { |
350
|
|
|
|
|
|
|
my $self = shift @_; |
351
|
|
|
|
|
|
|
my $id = shift @_; |
352
|
|
|
|
|
|
|
|
353
|
|
|
|
|
|
|
$self->{GetMachine} = |
354
|
|
|
|
|
|
|
$self->{soap}->GetMachine( |
355
|
|
|
|
|
|
|
$self->{auth_header}, |
356
|
|
|
|
|
|
|
SOAP::Data->name('machineId' => $id)->type('s:int') # mislabeled "machineID" by PUB API docs |
357
|
|
|
|
|
|
|
); |
358
|
|
|
|
|
|
|
|
359
|
|
|
|
|
|
|
if ( $self->{GetMachine}->fault ) { |
360
|
|
|
|
|
|
|
$self->_fault( $self->{GetMachine} ); |
361
|
|
|
|
|
|
|
return $self->{GetMachine}->fault; |
362
|
|
|
|
|
|
|
} else { |
363
|
|
|
|
|
|
|
return $self->{GetMachine}->result; |
364
|
|
|
|
|
|
|
} |
365
|
|
|
|
|
|
|
} |
366
|
|
|
|
|
|
|
|
367
|
|
|
|
|
|
|
sub GetMachineByName { |
368
|
|
|
|
|
|
|
my $self = shift @_; |
369
|
|
|
|
|
|
|
my $config = shift @_; |
370
|
|
|
|
|
|
|
my $name = shift @_; |
371
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
$self->{GetMachineByName} = |
373
|
|
|
|
|
|
|
$self->{soap}->GetMachineByName( $self->{auth_header}, |
374
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $config)->type('s:int'), |
375
|
|
|
|
|
|
|
SOAP::Data->name('name' => $name)->type('s:string')); |
376
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
if ( $self->{GetMachineByName}->fault ) { |
378
|
|
|
|
|
|
|
$self->_fault( $self->{GetMachineByName} ); |
379
|
|
|
|
|
|
|
return $self->{GetMachineByName}->fault; |
380
|
|
|
|
|
|
|
} else { |
381
|
|
|
|
|
|
|
return $self->{GetMachineByName}->result; |
382
|
|
|
|
|
|
|
} |
383
|
|
|
|
|
|
|
} |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
sub GetSingleConfigurationByName { |
386
|
|
|
|
|
|
|
my $self = shift @_; |
387
|
|
|
|
|
|
|
my $config = shift @_; |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
$self->{GetSingleConfigurationByName} = |
390
|
|
|
|
|
|
|
$self->{soap}->GetSingleConfigurationByName( $self->{auth_header}, |
391
|
|
|
|
|
|
|
SOAP::Data->name('name' => $config)->type('s:string')); |
392
|
|
|
|
|
|
|
|
393
|
|
|
|
|
|
|
if ( $self->{GetSingleConfigurationByName}->fault ) { |
394
|
|
|
|
|
|
|
$self->_fault( $self->{GetSingleConfigurationByName} ); |
395
|
|
|
|
|
|
|
return $self->{GetSingleConfigurationByName}->fault; |
396
|
|
|
|
|
|
|
} else { |
397
|
|
|
|
|
|
|
return $self->{GetSingleConfigurationByName}->result; |
398
|
|
|
|
|
|
|
} |
399
|
|
|
|
|
|
|
} |
400
|
|
|
|
|
|
|
|
401
|
|
|
|
|
|
|
sub ListConfigurations { |
402
|
|
|
|
|
|
|
my $self = shift @_; |
403
|
|
|
|
|
|
|
my $type = shift @_; #1 =WorkSpace, 2=Library |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
$self->_debug("LISTING CONFIGURATIONS") if $self->{debug}; |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
unless ($type == 1 || $type == 2 ) { |
408
|
|
|
|
|
|
|
$self->{LASTERROR} = "Configuration Type must be either 1 for Workspace or 2 for Library"; |
409
|
|
|
|
|
|
|
$self->_fault( $self->{LASTERROR} ); |
410
|
|
|
|
|
|
|
} |
411
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
$self->{ListConfigurations} = $self->{soap}->ListConfigurations( $self->{auth_header}, SOAP::Data->name('configurationType' => $type)->type('s:int')); |
413
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
if ( $self->{ListConfigurations}->fault ) { |
415
|
|
|
|
|
|
|
$self->_fault( $self->{ListConfigurations} ); |
416
|
|
|
|
|
|
|
return $self->{ListConfigurations}->fault; |
417
|
|
|
|
|
|
|
} |
418
|
|
|
|
|
|
|
|
419
|
|
|
|
|
|
|
my $ret = $self->{ListConfigurations}->result; |
420
|
|
|
|
|
|
|
|
421
|
|
|
|
|
|
|
my $array = $ret ? [ $ret ] : [ ]; |
422
|
|
|
|
|
|
|
$array = [ $ret->{Configuration} ] if ref $ret and ref $ret->{Configuration} eq 'HASH'; |
423
|
|
|
|
|
|
|
$array = $ret->{Configuration} if ref $ret and ref $ret->{Configuration} eq 'ARRAY'; |
424
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
return wantarray ? @$array : $array; |
426
|
|
|
|
|
|
|
} |
427
|
|
|
|
|
|
|
|
428
|
|
|
|
|
|
|
sub ListMachines { |
429
|
|
|
|
|
|
|
my $self = shift @_; |
430
|
|
|
|
|
|
|
my $config = shift @_; |
431
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
$self->{ListMachines} = |
433
|
|
|
|
|
|
|
$self->{soap}->ListMachines( $self->{auth_header}, |
434
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $config)->type('s:int')); |
435
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
if ( $self->{ListMachines}->fault ) { |
437
|
|
|
|
|
|
|
$self->_fault( $self->{ListMachines} ); |
438
|
|
|
|
|
|
|
return $self->{ListMachines}->fault; |
439
|
|
|
|
|
|
|
} |
440
|
|
|
|
|
|
|
|
441
|
|
|
|
|
|
|
my $ret = $self->{ListMachines}->result; |
442
|
|
|
|
|
|
|
|
443
|
|
|
|
|
|
|
my $array = []; |
444
|
|
|
|
|
|
|
$array = [ $ret->{Machine} ] if ref $ret and ref $ret->{Machine} eq 'HASH'; |
445
|
|
|
|
|
|
|
$array = $ret->{Machine} if ref $ret and ref $ret->{Machine} eq 'ARRAY'; |
446
|
|
|
|
|
|
|
|
447
|
|
|
|
|
|
|
return wantarray ? @$array : $array; |
448
|
|
|
|
|
|
|
} |
449
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
###### CHECK THIS |
451
|
|
|
|
|
|
|
# Not Supported, but works (I believe) |
452
|
|
|
|
|
|
|
sub GetConsoleAccessInfo { |
453
|
|
|
|
|
|
|
# Attribs: ServerAddress, ServerPort,VmxLocation,Ticket |
454
|
|
|
|
|
|
|
my($self) = shift @_; |
455
|
|
|
|
|
|
|
my($machineId) = shift @_; |
456
|
|
|
|
|
|
|
push(my(@attribs), @_); |
457
|
|
|
|
|
|
|
my @myattribs; |
458
|
|
|
|
|
|
|
|
459
|
|
|
|
|
|
|
$self->{GetConsoleAccessInfo} = |
460
|
|
|
|
|
|
|
$self->{soap}->GetConsoleAccessInfo( $self->{auth_header}, |
461
|
|
|
|
|
|
|
SOAP::Data->name('machineId' => $machineId)->type('s:int')); |
462
|
|
|
|
|
|
|
|
463
|
|
|
|
|
|
|
if ( $self->{GetConsoleAccessInfo}->fault ) { |
464
|
|
|
|
|
|
|
$self->_fault( $self->{GetConsoleAccessInfo} ); |
465
|
|
|
|
|
|
|
return $self->{GetConsoleAccessInfo}->fault; |
466
|
|
|
|
|
|
|
} else { |
467
|
|
|
|
|
|
|
return $self->{GetConsoleAccessInfo}->result; |
468
|
|
|
|
|
|
|
} |
469
|
|
|
|
|
|
|
} |
470
|
|
|
|
|
|
|
|
471
|
|
|
|
|
|
|
sub LiveLink { |
472
|
|
|
|
|
|
|
my $self = shift @_; |
473
|
|
|
|
|
|
|
my $configName = shift @_; |
474
|
|
|
|
|
|
|
|
475
|
|
|
|
|
|
|
$self->{LiveLink} = |
476
|
|
|
|
|
|
|
$self->{soap}->LiveLink( $self->{auth_header}, |
477
|
|
|
|
|
|
|
SOAP::Data->name('configName' => $configName)->type('s:string')); |
478
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
if ( $self->{LiveLink}->fault ) { |
480
|
|
|
|
|
|
|
$self->_fault( $self->{LiveLink} ); |
481
|
|
|
|
|
|
|
return $self->{LiveLink}->fault; |
482
|
|
|
|
|
|
|
} else { |
483
|
|
|
|
|
|
|
return $self->{LiveLink}->result; |
484
|
|
|
|
|
|
|
} |
485
|
|
|
|
|
|
|
} |
486
|
|
|
|
|
|
|
|
487
|
|
|
|
|
|
|
sub MachinePerformAction { |
488
|
|
|
|
|
|
|
my $self = shift @_; |
489
|
|
|
|
|
|
|
my $configID = shift @_; |
490
|
|
|
|
|
|
|
my $action = shift @_; # Actions: 1-Pwr On, 2-Pwr off, 3-Suspend, 4-Resume, 5-Reset, 6-Snapshot , 7-Revert, 8-Shutdown |
491
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
$self->{MachinePerformAction} = |
493
|
|
|
|
|
|
|
$self->{soap}->MachinePerformAction( $self->{auth_header}, |
494
|
|
|
|
|
|
|
SOAP::Data->name('machineId' => $configID )->type('s:int'), |
495
|
|
|
|
|
|
|
SOAP::Data->name('action' => $action )->type('s:int') ); |
496
|
|
|
|
|
|
|
|
497
|
|
|
|
|
|
|
if ( $self->{MachinePerformAction}->fault ) { |
498
|
|
|
|
|
|
|
$self->_fault( $self->{MachinePerformAction} ); |
499
|
|
|
|
|
|
|
return $self->{MachinePerformAction}->fault; |
500
|
|
|
|
|
|
|
} else { |
501
|
|
|
|
|
|
|
return $self->{MachinePerformAction}->result; |
502
|
|
|
|
|
|
|
} |
503
|
|
|
|
|
|
|
} |
504
|
|
|
|
|
|
|
|
505
|
|
|
|
|
|
|
### Internal API methods |
506
|
|
|
|
|
|
|
|
507
|
|
|
|
|
|
|
sub priv_ConfigurationAddMachineEx { |
508
|
|
|
|
|
|
|
my $self = shift @_; |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
my $ipaddress = '10.10.220.10'; |
511
|
|
|
|
|
|
|
my $macAddress = '00:50:DE:AD:BE:EF'; |
512
|
|
|
|
|
|
|
|
513
|
|
|
|
|
|
|
$_[4] = 0 unless $_[4]; |
514
|
|
|
|
|
|
|
$_[5] = 0 unless $_[5]; |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
my $eth0 = SOAP::Data->name('NetInfo' => \SOAP::Data->value( |
517
|
|
|
|
|
|
|
SOAP::Data->name('networkId' => 1 )->type('s:int'), |
518
|
|
|
|
|
|
|
SOAP::Data->name('nicId' => 0 )->type('s:int'), |
519
|
|
|
|
|
|
|
#SOAP::Data->name('vmxSlot' => 1 )->type('s:int'), |
520
|
|
|
|
|
|
|
SOAP::Data->name('macAddress' => $macAddress )->type('s:string'), |
521
|
|
|
|
|
|
|
SOAP::Data->name('resetMac' => 'true' )->type('s:boolean'), |
522
|
|
|
|
|
|
|
SOAP::Data->name('ipAddress' => $ipaddress )->type('s:string'), |
523
|
|
|
|
|
|
|
SOAP::Data->name('ipAddressingMode' => 'STATIC_MANUAL')->type('s:string'), |
524
|
|
|
|
|
|
|
SOAP::Data->name('netmask' => '255.255.255.0')->type('s:string'), |
525
|
|
|
|
|
|
|
SOAP::Data->name('gateway' => '10.10.220.1')->type('s:string'), |
526
|
|
|
|
|
|
|
SOAP::Data->name('dns1' => '4.2.2.1')->type('s:string'), |
527
|
|
|
|
|
|
|
SOAP::Data->name('dns2' => '4.2.2.2')->type('s:string'), |
528
|
|
|
|
|
|
|
SOAP::Data->name('isConnected' => 1 )->type('s:int'), |
529
|
|
|
|
|
|
|
)); |
530
|
|
|
|
|
|
|
|
531
|
|
|
|
|
|
|
$self->{ConfigurationAddMachineEx} = |
532
|
|
|
|
|
|
|
$self->{soap_priv}->ConfigurationAddMachineEx( |
533
|
|
|
|
|
|
|
$self->{auth_header}, |
534
|
|
|
|
|
|
|
SOAP::Data->name('id' =>$_[0])->type('s:int'), |
535
|
|
|
|
|
|
|
SOAP::Data->name('template_id'=>$_[1])->type('s:int'), |
536
|
|
|
|
|
|
|
SOAP::Data->name('name' =>$_[2])->type('s:string'), |
537
|
|
|
|
|
|
|
SOAP::Data->name('desc' =>$_[3])->type('s:string'), |
538
|
|
|
|
|
|
|
SOAP::Data->name('boot_seq' =>$_[4])->type('s:int'), |
539
|
|
|
|
|
|
|
SOAP::Data->name('boot_delay' =>$_[5])->type('s:int'), |
540
|
|
|
|
|
|
|
SOAP::Data->name('netInfo' => \SOAP::Data->value( |
541
|
|
|
|
|
|
|
#$eth0, |
542
|
|
|
|
|
|
|
) |
543
|
|
|
|
|
|
|
) |
544
|
|
|
|
|
|
|
); |
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
if ( $self->{ConfigurationAddMachineEx}->fault ) { |
547
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationAddMachineEx} ); |
548
|
|
|
|
|
|
|
return $self->{ConfigurationAddMachineEx}->fault; |
549
|
|
|
|
|
|
|
} else { |
550
|
|
|
|
|
|
|
return $self->{ConfigurationAddMachineEx}->result; |
551
|
|
|
|
|
|
|
} |
552
|
|
|
|
|
|
|
} |
553
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
sub priv_ConfigurationArchiveEx { |
555
|
|
|
|
|
|
|
my $self = shift @_; |
556
|
|
|
|
|
|
|
my $configurationId = shift @_; |
557
|
|
|
|
|
|
|
my $archiveName = shift @_; |
558
|
|
|
|
|
|
|
my $archiveDescription = shift @_; |
559
|
|
|
|
|
|
|
my $isFullClone = shift @_; |
560
|
|
|
|
|
|
|
my $storageName = shift @_; |
561
|
|
|
|
|
|
|
my $storageLeaseInMilliseconds = shift @_ || 0; |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
$isFullClone = 'false' unless $isFullClone =~ /^true$/i; |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
$self->{ConfigurationArchiveEx} = |
566
|
|
|
|
|
|
|
$self->{soap_priv}->ConfigurationArchiveEx( |
567
|
|
|
|
|
|
|
$self->{auth_header}, |
568
|
|
|
|
|
|
|
SOAP::Data->name('configurationID' => $configurationId )->type('s:int'), |
569
|
|
|
|
|
|
|
SOAP::Data->name('archiveName' => $archiveName )->type('s:string'), |
570
|
|
|
|
|
|
|
SOAP::Data->name('archiveDescription' => $archiveDescription )->type('s:string'), |
571
|
|
|
|
|
|
|
SOAP::Data->name('isFullClone' => $isFullClone )->type('s:boolean'), |
572
|
|
|
|
|
|
|
SOAP::Data->name('storageName' => $storageName )->type('s:string'), |
573
|
|
|
|
|
|
|
SOAP::Data->name('storageLeaseInMilliseconds' => $storageLeaseInMilliseconds )->type('s:long') |
574
|
|
|
|
|
|
|
); |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
if ( $self->{ConfigurationArchiveEx}->fault ) { |
577
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationArchiveEx} ); |
578
|
|
|
|
|
|
|
return $self->{ConfigurationArchiveEx}->fault; |
579
|
|
|
|
|
|
|
} else { |
580
|
|
|
|
|
|
|
return $self->{ConfigurationArchiveEx}->result; |
581
|
|
|
|
|
|
|
} |
582
|
|
|
|
|
|
|
} |
583
|
|
|
|
|
|
|
|
584
|
|
|
|
|
|
|
sub priv_ConfigurationCaptureEx { |
585
|
|
|
|
|
|
|
my $self = shift @_; |
586
|
|
|
|
|
|
|
my $configurationId = shift @_; |
587
|
|
|
|
|
|
|
my $newLibraryName = shift @_; |
588
|
|
|
|
|
|
|
my $libraryDescription = shift @_; |
589
|
|
|
|
|
|
|
my $isGoldMaster = shift @_; |
590
|
|
|
|
|
|
|
my $storageName = shift @_; |
591
|
|
|
|
|
|
|
my $storageLeaseInMilliseconds = shift @_ || 0; |
592
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
$isGoldMaster = 'false' unless $isGoldMaster =~ /^true$/i; |
594
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
$self->{ConfigurationCaptureEx} = |
596
|
|
|
|
|
|
|
$self->{soap_priv}->ConfigurationCaptureEx( |
597
|
|
|
|
|
|
|
$self->{auth_header}, |
598
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configurationId )->type('s:int'), |
599
|
|
|
|
|
|
|
SOAP::Data->name('newLibraryName' => $newLibraryName )->type('s:string'), |
600
|
|
|
|
|
|
|
SOAP::Data->name('libraryDescription' => $libraryDescription )->type('s:string'), |
601
|
|
|
|
|
|
|
SOAP::Data->name('isGoldMaster' => $isGoldMaster )->type('s:boolean'), |
602
|
|
|
|
|
|
|
SOAP::Data->name('storageName' => $storageName )->type('s:string'), |
603
|
|
|
|
|
|
|
SOAP::Data->name('storageLeaseInMilliseconds' => $storageLeaseInMilliseconds )->type('s:long') |
604
|
|
|
|
|
|
|
); |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
if ( $self->{ConfigurationCaptureEx}->fault ) { |
607
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationCaptureEx} ); |
608
|
|
|
|
|
|
|
return $self->{ConfigurationCaptureEx}->fault; |
609
|
|
|
|
|
|
|
} else { |
610
|
|
|
|
|
|
|
return $self->{ConfigurationCaptureEx}->result; |
611
|
|
|
|
|
|
|
} |
612
|
|
|
|
|
|
|
} |
613
|
|
|
|
|
|
|
|
614
|
|
|
|
|
|
|
sub priv_ConfigurationChangeOwner { |
615
|
|
|
|
|
|
|
my $self = shift @_; |
616
|
|
|
|
|
|
|
my $conf = shift @_; |
617
|
|
|
|
|
|
|
my $own = shift @_; |
618
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
$self->{ConfigurationChangeOwner} = |
620
|
|
|
|
|
|
|
$self->{soap_priv}->ConfigurationChangeOwner( |
621
|
|
|
|
|
|
|
$self->{auth_header}, |
622
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $conf )->type('s:int'), |
623
|
|
|
|
|
|
|
SOAP::Data->name('newOwnerId' => $own )->type('s:int'), |
624
|
|
|
|
|
|
|
); |
625
|
|
|
|
|
|
|
|
626
|
|
|
|
|
|
|
if ( $self->{ConfigurationChangeOwner}->fault ) { |
627
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationChangeOwner} ); |
628
|
|
|
|
|
|
|
return $self->{ConfigurationChangeOwner}->fault; |
629
|
|
|
|
|
|
|
} else { |
630
|
|
|
|
|
|
|
return $self->{ConfigurationChangeOwner}->result; |
631
|
|
|
|
|
|
|
} |
632
|
|
|
|
|
|
|
} |
633
|
|
|
|
|
|
|
|
634
|
|
|
|
|
|
|
sub priv_ConfigurationCopy { |
635
|
|
|
|
|
|
|
my $self = shift @_; |
636
|
|
|
|
|
|
|
my $sg_id = shift @_; |
637
|
|
|
|
|
|
|
my $name = shift @_; |
638
|
|
|
|
|
|
|
my $description = shift @_; |
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
my $machines = shift @_; |
641
|
|
|
|
|
|
|
my $storage = shift @_; |
642
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
my @machine_data; |
644
|
|
|
|
|
|
|
|
645
|
|
|
|
|
|
|
for my $machine (@$machines) { |
646
|
|
|
|
|
|
|
my @elements; |
647
|
|
|
|
|
|
|
for my $element ( keys %$machine ) { |
648
|
|
|
|
|
|
|
push @elements, SOAP::Data->name( $element, $machine->{$element} ); |
649
|
|
|
|
|
|
|
} |
650
|
|
|
|
|
|
|
push @machine_data, SOAP::Data->name('machine' => \SOAP::Data->value(@elements)); |
651
|
|
|
|
|
|
|
} |
652
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
$self->{ConfigurationCopy} = |
654
|
|
|
|
|
|
|
$self->{soap_priv}->ConfigurationCopy( |
655
|
|
|
|
|
|
|
$self->{auth_header}, |
656
|
|
|
|
|
|
|
SOAP::Data->name('sg_id' => $sg_id )->type('s:int'), |
657
|
|
|
|
|
|
|
SOAP::Data->name('name' => $name )->type('s:string'), |
658
|
|
|
|
|
|
|
SOAP::Data->name('description' => $description )->type('s:string'), |
659
|
|
|
|
|
|
|
SOAP::Data->name('configurationCopyData' => \SOAP::Data->value( |
660
|
|
|
|
|
|
|
SOAP::Data->name('VMCopyData' => \SOAP::Data->value( |
661
|
|
|
|
|
|
|
@machine_data, |
662
|
|
|
|
|
|
|
SOAP::Data->name('storageServerName' => $storage )->type('s:string') |
663
|
|
|
|
|
|
|
)) |
664
|
|
|
|
|
|
|
)) |
665
|
|
|
|
|
|
|
); |
666
|
|
|
|
|
|
|
|
667
|
|
|
|
|
|
|
if ( $self->{ConfigurationCopy}->fault ) { |
668
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationCopy} ); |
669
|
|
|
|
|
|
|
return $self->{ConfigurationCopy}->fault; |
670
|
|
|
|
|
|
|
} else { |
671
|
|
|
|
|
|
|
return $self->{ConfigurationCopy}->result; |
672
|
|
|
|
|
|
|
} |
673
|
|
|
|
|
|
|
} |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
sub priv_ConfigurationCloneToWorkspace { |
676
|
|
|
|
|
|
|
my $self = shift @_; |
677
|
|
|
|
|
|
|
my $destWorkspaceId = shift @_; |
678
|
|
|
|
|
|
|
my $isNewConfiguration = shift @_; |
679
|
|
|
|
|
|
|
my $newConfigName = shift @_; |
680
|
|
|
|
|
|
|
my $description = shift @_; |
681
|
|
|
|
|
|
|
|
682
|
|
|
|
|
|
|
my $machines = shift @_; |
683
|
|
|
|
|
|
|
my $storage = shift @_; |
684
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
my $existingConfigId = shift @_; |
686
|
|
|
|
|
|
|
my $isFullClone = shift @_; |
687
|
|
|
|
|
|
|
my $storageLeaseInMilliseconds = shift @_; |
688
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
$isNewConfiguration = 'false' unless $isNewConfiguration =~ /^true$/i; |
690
|
|
|
|
|
|
|
$isFullClone = 'false' unless $isFullClone =~ /^true$/i; |
691
|
|
|
|
|
|
|
|
692
|
|
|
|
|
|
|
my @machine_data; |
693
|
|
|
|
|
|
|
|
694
|
|
|
|
|
|
|
for my $machine (@$machines) { |
695
|
|
|
|
|
|
|
my @elements; |
696
|
|
|
|
|
|
|
for my $element ( keys %$machine ) { |
697
|
|
|
|
|
|
|
push @elements, SOAP::Data->name( $element, $machine->{$element} ); |
698
|
|
|
|
|
|
|
} |
699
|
|
|
|
|
|
|
push @machine_data, SOAP::Data->name('machine' => \SOAP::Data->value(@elements)); |
700
|
|
|
|
|
|
|
} |
701
|
|
|
|
|
|
|
|
702
|
|
|
|
|
|
|
$self->{ConfigurationCloneToWorkspace} = |
703
|
|
|
|
|
|
|
$self->{soap_priv}->ConfigurationCloneToWorkspace( |
704
|
|
|
|
|
|
|
$self->{auth_header}, |
705
|
|
|
|
|
|
|
SOAP::Data->name('destWorkspaceId' => $destWorkspaceId )->type('s:int'), |
706
|
|
|
|
|
|
|
SOAP::Data->name('isNewConfiguration' => $isNewConfiguration )->type('s:bool'), |
707
|
|
|
|
|
|
|
SOAP::Data->name('newConfigName' => $newConfigName )->type('s:string'), |
708
|
|
|
|
|
|
|
SOAP::Data->name('description' => $description )->type('s:string'), |
709
|
|
|
|
|
|
|
SOAP::Data->name('configurationCopyData' => \SOAP::Data->value( |
710
|
|
|
|
|
|
|
SOAP::Data->name('VMCopyData' => \SOAP::Data->value( |
711
|
|
|
|
|
|
|
@machine_data, |
712
|
|
|
|
|
|
|
SOAP::Data->name('storageServerName' => $storage )->type('s:string') |
713
|
|
|
|
|
|
|
)) |
714
|
|
|
|
|
|
|
)), |
715
|
|
|
|
|
|
|
SOAP::Data->name('isFullClone' => $newConfigName )->type('s:bool'), |
716
|
|
|
|
|
|
|
SOAP::Data->name('storageLeaseInMilliseconds' => $description )->type('s:long'), |
717
|
|
|
|
|
|
|
); |
718
|
|
|
|
|
|
|
|
719
|
|
|
|
|
|
|
if ( $self->{ConfigurationCloneToWorkspace}->fault ) { |
720
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationCloneToWorkspace} ); |
721
|
|
|
|
|
|
|
return $self->{ConfigurationCloneToWorkspace}->fault; |
722
|
|
|
|
|
|
|
} else { |
723
|
|
|
|
|
|
|
return $self->{ConfigurationCloneToWorkspace}->result; |
724
|
|
|
|
|
|
|
} |
725
|
|
|
|
|
|
|
} |
726
|
|
|
|
|
|
|
|
727
|
|
|
|
|
|
|
sub priv_ConfigurationCreateEx { |
728
|
|
|
|
|
|
|
my $self = shift @_; |
729
|
|
|
|
|
|
|
my $name = shift @_; |
730
|
|
|
|
|
|
|
my $desc = shift @_; |
731
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
$self->{ConfigurationCreateEx} = |
733
|
|
|
|
|
|
|
$self->{soap_priv}->ConfigurationCreateEx( |
734
|
|
|
|
|
|
|
$self->{auth_header}, |
735
|
|
|
|
|
|
|
SOAP::Data->name('name'=>$name)->type('s:string'), |
736
|
|
|
|
|
|
|
SOAP::Data->name('desc'=>$desc)->type('s:string') |
737
|
|
|
|
|
|
|
); |
738
|
|
|
|
|
|
|
|
739
|
|
|
|
|
|
|
if ( $self->{ConfigurationCreateEx}->fault ) { |
740
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationCreateEx} ); |
741
|
|
|
|
|
|
|
return $self->{ConfigurationCreateEx}->fault; |
742
|
|
|
|
|
|
|
} else { |
743
|
|
|
|
|
|
|
return $self->{ConfigurationCreateEx}->result; |
744
|
|
|
|
|
|
|
} |
745
|
|
|
|
|
|
|
} |
746
|
|
|
|
|
|
|
|
747
|
|
|
|
|
|
|
sub priv_ConfigurationDeployEx2 { |
748
|
|
|
|
|
|
|
my $self = shift @_; |
749
|
|
|
|
|
|
|
my $configID = shift @_; |
750
|
|
|
|
|
|
|
my $networkId = shift @_; |
751
|
|
|
|
|
|
|
my $fenceMode = 'FenceAllowInAndOut'; |
752
|
|
|
|
|
|
|
|
753
|
|
|
|
|
|
|
my $net_elem = SOAP::Data->name( 'FenceNetworkOption' => \SOAP::Data->value( |
754
|
|
|
|
|
|
|
SOAP::Data->name('configuredNetID' => $networkId)->type('s:int'), |
755
|
|
|
|
|
|
|
SOAP::Data->name('DeployFenceMode'=> $fenceMode)->type('tns:SOAPFenceMode') |
756
|
|
|
|
|
|
|
) |
757
|
|
|
|
|
|
|
); |
758
|
|
|
|
|
|
|
|
759
|
|
|
|
|
|
|
my $bridge_elem = SOAP::Data->name( 'BridgeNetworkOption' => \SOAP::Data->value( |
760
|
|
|
|
|
|
|
SOAP::Data->name('externalNetId' => $networkId)->type('s:int') |
761
|
|
|
|
|
|
|
) |
762
|
|
|
|
|
|
|
); |
763
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
my @net_array; |
765
|
|
|
|
|
|
|
my @bridge_array; |
766
|
|
|
|
|
|
|
push(@net_array,$net_elem); |
767
|
|
|
|
|
|
|
push(@bridge_array,$bridge_elem); |
768
|
|
|
|
|
|
|
|
769
|
|
|
|
|
|
|
$self->{ConfigurationDeployEx2} = |
770
|
|
|
|
|
|
|
$self->{soap_priv}->ConfigurationDeployEx2( $self->{auth_header}, |
771
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID )->type('s:int'), |
772
|
|
|
|
|
|
|
SOAP::Data->name('honorBootOrders' => 1)->type('s:boolean'), |
773
|
|
|
|
|
|
|
SOAP::Data->name('startAfterDeploy' => 1)->type('s:boolean'), |
774
|
|
|
|
|
|
|
SOAP::Data->name('fenceNetworkOptions' => \SOAP::Data->value( @net_array )->type('tns:ArrayOfFenceNetworkOption')), |
775
|
|
|
|
|
|
|
#Do not uncomment unless you know how to make it work: |
776
|
|
|
|
|
|
|
#SOAP::Data->name('bridgeNetworkOptions' =>\SOAP::Data->value( @bridge_array )->type('tns:ArrayOfBridgeNetworkOption')), |
777
|
|
|
|
|
|
|
SOAP::Data->name('isCrossHost' => 1)->type('s:boolean') |
778
|
|
|
|
|
|
|
); |
779
|
|
|
|
|
|
|
|
780
|
|
|
|
|
|
|
if ( $self->{ConfigurationDeployEx2}->fault ) { |
781
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationDeployEx2} ); |
782
|
|
|
|
|
|
|
return $self->{ConfigurationDeployEx2}->fault; |
783
|
|
|
|
|
|
|
} else { |
784
|
|
|
|
|
|
|
return $self->{ConfigurationDeployEx2}->result; |
785
|
|
|
|
|
|
|
} |
786
|
|
|
|
|
|
|
} |
787
|
|
|
|
|
|
|
|
788
|
|
|
|
|
|
|
sub priv_ConfigurationExport { |
789
|
|
|
|
|
|
|
my $self = shift @_; |
790
|
|
|
|
|
|
|
my $conf = shift @_; |
791
|
|
|
|
|
|
|
my $unc = shift @_; |
792
|
|
|
|
|
|
|
my $user = shift @_; |
793
|
|
|
|
|
|
|
my $pass = shift @_; |
794
|
|
|
|
|
|
|
|
795
|
|
|
|
|
|
|
$self->{ConfigurationExport} = |
796
|
|
|
|
|
|
|
$self->{soap_priv}->ConfigurationExport( |
797
|
|
|
|
|
|
|
$self->{auth_header}, |
798
|
|
|
|
|
|
|
SOAP::Data->name('configId' =>$conf)->type('s:int'), |
799
|
|
|
|
|
|
|
SOAP::Data->name('uncPath' =>$unc )->type('s:string'), |
800
|
|
|
|
|
|
|
SOAP::Data->name('username' =>$user)->type('s:string'), |
801
|
|
|
|
|
|
|
SOAP::Data->name('password' =>$pass)->type('s:string'), |
802
|
|
|
|
|
|
|
); |
803
|
|
|
|
|
|
|
|
804
|
|
|
|
|
|
|
if ( $self->{ConfigurationExport}->fault ) { |
805
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationExport} ); |
806
|
|
|
|
|
|
|
return $self->{ConfigurationExport}->fault; |
807
|
|
|
|
|
|
|
} else { |
808
|
|
|
|
|
|
|
return $self->{ConfigurationExport}->result; |
809
|
|
|
|
|
|
|
} |
810
|
|
|
|
|
|
|
} |
811
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
sub priv_ConfigurationGetNetworks { |
813
|
|
|
|
|
|
|
my $self = shift @_; |
814
|
|
|
|
|
|
|
my $conf = shift @_; |
815
|
|
|
|
|
|
|
my $phys = shift @_; |
816
|
|
|
|
|
|
|
|
817
|
|
|
|
|
|
|
$phys = 'false' unless $phys =~ /^true$/i; |
818
|
|
|
|
|
|
|
|
819
|
|
|
|
|
|
|
$self->{ConfigurationGetNetworks} = |
820
|
|
|
|
|
|
|
$self->{soap_priv}->ConfigurationGetNetworks( |
821
|
|
|
|
|
|
|
$self->{auth_header}, |
822
|
|
|
|
|
|
|
SOAP::Data->name('configID'=>$conf)->type('s:int'), |
823
|
|
|
|
|
|
|
SOAP::Data->name('physical'=>$phys)->type('s:boolean'), |
824
|
|
|
|
|
|
|
); |
825
|
|
|
|
|
|
|
|
826
|
|
|
|
|
|
|
if ( $self->{ConfigurationGetNetworks}->fault ) { |
827
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationGetNetworks} ); |
828
|
|
|
|
|
|
|
return $self->{ConfigurationGetNetworks}->fault; |
829
|
|
|
|
|
|
|
} |
830
|
|
|
|
|
|
|
|
831
|
|
|
|
|
|
|
my $ret = $self->{ConfigurationGetNetworks}->result; |
832
|
|
|
|
|
|
|
|
833
|
|
|
|
|
|
|
return $ret; |
834
|
|
|
|
|
|
|
|
835
|
|
|
|
|
|
|
#my $array = $ret ? [ $ret ] : [ ]; |
836
|
|
|
|
|
|
|
#$array = [ $ret->{Network} ] if ref $ret and ref $ret->{Network} eq 'HASH'; |
837
|
|
|
|
|
|
|
#$array = $ret->{Network} if ref $ret and ref $ret->{Network} eq 'ARRAY'; |
838
|
|
|
|
|
|
|
|
839
|
|
|
|
|
|
|
#return wantarray ? @$array : $array; |
840
|
|
|
|
|
|
|
} |
841
|
|
|
|
|
|
|
|
842
|
|
|
|
|
|
|
sub priv_ConfigurationImport { |
843
|
|
|
|
|
|
|
my $self = shift @_; |
844
|
|
|
|
|
|
|
my $unc = shift @_; |
845
|
|
|
|
|
|
|
my $user = shift @_; |
846
|
|
|
|
|
|
|
my $pass = shift @_; |
847
|
|
|
|
|
|
|
my $name = shift @_; |
848
|
|
|
|
|
|
|
my $desc = shift @_; |
849
|
|
|
|
|
|
|
my $stor = shift @_; |
850
|
|
|
|
|
|
|
|
851
|
|
|
|
|
|
|
$self->{ConfigurationImport} = |
852
|
|
|
|
|
|
|
$self->{soap_priv}->ConfigurationImport( |
853
|
|
|
|
|
|
|
$self->{auth_header}, |
854
|
|
|
|
|
|
|
SOAP::Data->name('UNCPath' =>$unc )->type('s:string'), |
855
|
|
|
|
|
|
|
SOAP::Data->name('dirUsername' =>$user)->type('s:string'), |
856
|
|
|
|
|
|
|
SOAP::Data->name('dirPassword' =>$pass)->type('s:string'), |
857
|
|
|
|
|
|
|
SOAP::Data->name('name' =>$name)->type('s:string'), |
858
|
|
|
|
|
|
|
SOAP::Data->name('description' =>$desc)->type('s:string'), |
859
|
|
|
|
|
|
|
SOAP::Data->name('storageName' =>$stor)->type('s:string'), |
860
|
|
|
|
|
|
|
); |
861
|
|
|
|
|
|
|
|
862
|
|
|
|
|
|
|
if ( $self->{ConfigurationImport}->fault ) { |
863
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationImport} ); |
864
|
|
|
|
|
|
|
return $self->{ConfigurationImport}->fault; |
865
|
|
|
|
|
|
|
} else { |
866
|
|
|
|
|
|
|
return $self->{ConfigurationImport}->result; |
867
|
|
|
|
|
|
|
} |
868
|
|
|
|
|
|
|
} |
869
|
|
|
|
|
|
|
|
870
|
|
|
|
|
|
|
sub priv_ConfigurationMove { |
871
|
|
|
|
|
|
|
my $self = shift @_; |
872
|
|
|
|
|
|
|
my $conf = shift @_; |
873
|
|
|
|
|
|
|
my $dest = shift @_; |
874
|
|
|
|
|
|
|
my $isnew = shift @_; |
875
|
|
|
|
|
|
|
my $name = shift @_; |
876
|
|
|
|
|
|
|
my $desc = shift @_; |
877
|
|
|
|
|
|
|
my $lease = shift @_; |
878
|
|
|
|
|
|
|
my $exist = shift @_; |
879
|
|
|
|
|
|
|
my $vmids = shift @_; |
880
|
|
|
|
|
|
|
my $del = shift @_; |
881
|
|
|
|
|
|
|
|
882
|
|
|
|
|
|
|
$isnew = 'false' unless $isnew =~ /^true$/i; |
883
|
|
|
|
|
|
|
$del = 'false' unless $del =~ /^true$/i; |
884
|
|
|
|
|
|
|
|
885
|
|
|
|
|
|
|
my $vmids_xml = SOAP::Data->name('vmIds'); |
886
|
|
|
|
|
|
|
$vmids_xml = SOAP::Data->name( vmIds => \SOAP::Data->name('int', @$vmids )) |
887
|
|
|
|
|
|
|
if ref $vmids; |
888
|
|
|
|
|
|
|
|
889
|
|
|
|
|
|
|
my @optional; |
890
|
|
|
|
|
|
|
push @optional, SOAP::Data->name('existingConfigId' =>$exist)->type('s:int') if $exist; |
891
|
|
|
|
|
|
|
push @optional, SOAP::Data->name('newConfigName' =>$name )->type('s:string') if $name; |
892
|
|
|
|
|
|
|
push @optional, SOAP::Data->name('newConfigDescription' =>$desc )->type('s:string') if $desc; |
893
|
|
|
|
|
|
|
push @optional, SOAP::Data->name('storageLeaseInMilliseconds' =>$lease)->type('s:long') if $lease; |
894
|
|
|
|
|
|
|
push @optional, SOAP::Data->name('deleteOriginalConfig' =>$del )->type('s:boolean') if $del; |
895
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
$self->{ConfigurationMove} = |
897
|
|
|
|
|
|
|
$self->{soap_priv}->ConfigurationMove( |
898
|
|
|
|
|
|
|
$self->{auth_header}, |
899
|
|
|
|
|
|
|
SOAP::Data->name('configIdToMove' =>$conf )->type('s:int'), |
900
|
|
|
|
|
|
|
SOAP::Data->name('destinationWorkspaceId' =>$dest )->type('s:int'), |
901
|
|
|
|
|
|
|
SOAP::Data->name('isNewConfiguration' =>$isnew)->type('s:boolean'), |
902
|
|
|
|
|
|
|
@optional, $vmids_xml |
903
|
|
|
|
|
|
|
); |
904
|
|
|
|
|
|
|
|
905
|
|
|
|
|
|
|
if ( $self->{ConfigurationMove}->fault ) { |
906
|
|
|
|
|
|
|
$self->_fault( $self->{ConfigurationMove} ); |
907
|
|
|
|
|
|
|
return $self->{ConfigurationMove}->fault; |
908
|
|
|
|
|
|
|
} else { |
909
|
|
|
|
|
|
|
return $self->{ConfigurationMove}->result; |
910
|
|
|
|
|
|
|
} |
911
|
|
|
|
|
|
|
} |
912
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
sub priv_GetAllWorkspaces { |
914
|
|
|
|
|
|
|
my $self = shift @_; |
915
|
|
|
|
|
|
|
$self->{GetAllWorkspaces} = $self->{soap_priv}->GetAllWorkspaces( $self->{auth_header} ); |
916
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
if ( $self->{GetAllWorkspaces}->fault ) { |
918
|
|
|
|
|
|
|
$self->_fault( $self->{GetAllWorkspaces} ); |
919
|
|
|
|
|
|
|
return $self->{GetAllWorkspaces}->fault; |
920
|
|
|
|
|
|
|
} |
921
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
my $ret = $self->{GetAllWorkspaces}->result; |
923
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
my $array = [ $ret ]; |
925
|
|
|
|
|
|
|
$array = [ $ret->{Workspace} ] if ref $ret and ref $ret->{Workspace} eq 'HASH'; |
926
|
|
|
|
|
|
|
$array = $ret->{Workspace} if ref $ret and ref $ret->{Workspace} eq 'ARRAY'; |
927
|
|
|
|
|
|
|
|
928
|
|
|
|
|
|
|
return wantarray ? @$array : $array; |
929
|
|
|
|
|
|
|
} |
930
|
|
|
|
|
|
|
|
931
|
|
|
|
|
|
|
sub priv_GetNetworkInfo { |
932
|
|
|
|
|
|
|
my $self = shift @_; |
933
|
|
|
|
|
|
|
my $vmid = shift @_; |
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
$self->{GetNetworkInfo} = |
936
|
|
|
|
|
|
|
$self->{soap_priv}->GetNetworkInfo( |
937
|
|
|
|
|
|
|
$self->{auth_header}, |
938
|
|
|
|
|
|
|
SOAP::Data->name('vmID'=>$vmid)->type('s:int') |
939
|
|
|
|
|
|
|
); |
940
|
|
|
|
|
|
|
|
941
|
|
|
|
|
|
|
if ( $self->{GetNetworkInfo}->fault ) { |
942
|
|
|
|
|
|
|
$self->_fault( $self->{GetNetworkInfo} ); |
943
|
|
|
|
|
|
|
return $self->{GetNetworkInfo}->fault; |
944
|
|
|
|
|
|
|
} |
945
|
|
|
|
|
|
|
|
946
|
|
|
|
|
|
|
my $ret = $self->{GetNetworkInfo}->result; |
947
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
my $array = []; |
949
|
|
|
|
|
|
|
$array = [ $ret->{NetInfo} ] if ref $ret and ref $ret->{NetInfo} eq 'HASH'; |
950
|
|
|
|
|
|
|
$array = $ret->{NetInfo} if ref $ret and ref $ret->{NetInfo} eq 'ARRAY'; |
951
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
return wantarray ? @$array : $array; |
953
|
|
|
|
|
|
|
} |
954
|
|
|
|
|
|
|
|
955
|
|
|
|
|
|
|
sub priv_GetObjectConditions { |
956
|
|
|
|
|
|
|
my $self = shift @_; |
957
|
|
|
|
|
|
|
my $objectType = shift @_; |
958
|
|
|
|
|
|
|
my $objectID = shift @_; |
959
|
|
|
|
|
|
|
|
960
|
|
|
|
|
|
|
$self->{GetObjectConditions} = |
961
|
|
|
|
|
|
|
$self->{soap_priv}->GetObjectConditions( |
962
|
|
|
|
|
|
|
$self->{auth_header}, |
963
|
|
|
|
|
|
|
SOAP::Data->name('objectType'=>$objectType)->type('s:int'), |
964
|
|
|
|
|
|
|
SOAP::Data->name('objectID'=>$objectID)->type('s:int'), |
965
|
|
|
|
|
|
|
); |
966
|
|
|
|
|
|
|
|
967
|
|
|
|
|
|
|
if ( $self->{GetObjectConditions}->fault ) { |
968
|
|
|
|
|
|
|
$self->_fault( $self->{GetObjectConditions} ); |
969
|
|
|
|
|
|
|
return $self->{GetObjectConditions}->fault; |
970
|
|
|
|
|
|
|
} else { |
971
|
|
|
|
|
|
|
return $self->{GetObjectConditions}->result; |
972
|
|
|
|
|
|
|
} |
973
|
|
|
|
|
|
|
} |
974
|
|
|
|
|
|
|
|
975
|
|
|
|
|
|
|
sub priv_GetOrganization { |
976
|
|
|
|
|
|
|
my $self = shift @_; |
977
|
|
|
|
|
|
|
my $oid = shift @_; |
978
|
|
|
|
|
|
|
|
979
|
|
|
|
|
|
|
$self->{GetOrganization} = |
980
|
|
|
|
|
|
|
$self->{soap_priv}->GetOrganization( |
981
|
|
|
|
|
|
|
$self->{auth_header}, |
982
|
|
|
|
|
|
|
SOAP::Data->name('organizationId'=>$oid)->type('s:int') |
983
|
|
|
|
|
|
|
); |
984
|
|
|
|
|
|
|
|
985
|
|
|
|
|
|
|
if ( $self->{GetOrganization}->fault ) { |
986
|
|
|
|
|
|
|
$self->_fault( $self->{GetOrganization} ); |
987
|
|
|
|
|
|
|
return $self->{GetOrganization}->fault; |
988
|
|
|
|
|
|
|
} else { |
989
|
|
|
|
|
|
|
return $self->{GetOrganization}->result; |
990
|
|
|
|
|
|
|
} |
991
|
|
|
|
|
|
|
} |
992
|
|
|
|
|
|
|
|
993
|
|
|
|
|
|
|
sub priv_GetOrganizations { |
994
|
|
|
|
|
|
|
my $self = shift @_; |
995
|
|
|
|
|
|
|
$self->{GetOrganizations} = $self->{soap_priv}->GetOrganizations( $self->{auth_header} ); |
996
|
|
|
|
|
|
|
|
997
|
|
|
|
|
|
|
if ( $self->{GetOrganizations}->fault ) { |
998
|
|
|
|
|
|
|
$self->_fault( $self->{GetOrganizations} ); |
999
|
|
|
|
|
|
|
return $self->{GetOrganizations}->fault; |
1000
|
|
|
|
|
|
|
} |
1001
|
|
|
|
|
|
|
|
1002
|
|
|
|
|
|
|
my $ret = $self->{GetOrganizations}->result; |
1003
|
|
|
|
|
|
|
|
1004
|
|
|
|
|
|
|
my $array = [ $ret ]; |
1005
|
|
|
|
|
|
|
$array = [ $ret->{Organization} ] if ref $ret and ref $ret->{Organization} eq 'HASH'; |
1006
|
|
|
|
|
|
|
$array = $ret->{Organization} if ref $ret and ref $ret->{Organization} eq 'ARRAY'; |
1007
|
|
|
|
|
|
|
|
1008
|
|
|
|
|
|
|
return wantarray ? @$array : $array; |
1009
|
|
|
|
|
|
|
} |
1010
|
|
|
|
|
|
|
|
1011
|
|
|
|
|
|
|
sub priv_GetOrganizationByName { |
1012
|
|
|
|
|
|
|
my $self = shift @_; |
1013
|
|
|
|
|
|
|
my $name = shift @_; |
1014
|
|
|
|
|
|
|
|
1015
|
|
|
|
|
|
|
$self->{GetOrganizationByName} = |
1016
|
|
|
|
|
|
|
$self->{soap_priv}->GetOrganizationByName( |
1017
|
|
|
|
|
|
|
$self->{auth_header}, |
1018
|
|
|
|
|
|
|
SOAP::Data->name('organizationName'=>$name)->type('s:string') |
1019
|
|
|
|
|
|
|
); |
1020
|
|
|
|
|
|
|
|
1021
|
|
|
|
|
|
|
if ( $self->{GetOrganizationByName}->fault ) { |
1022
|
|
|
|
|
|
|
$self->_fault( $self->{GetOrganizationByName} ); |
1023
|
|
|
|
|
|
|
return $self->{GetOrganizationByName}->fault; |
1024
|
|
|
|
|
|
|
} else { |
1025
|
|
|
|
|
|
|
return $self->{GetOrganizationByName}->result; |
1026
|
|
|
|
|
|
|
} |
1027
|
|
|
|
|
|
|
} |
1028
|
|
|
|
|
|
|
|
1029
|
|
|
|
|
|
|
sub priv_GetOrganizationWorkspaces { |
1030
|
|
|
|
|
|
|
my $self = shift @_; |
1031
|
|
|
|
|
|
|
my $oid = shift @_; |
1032
|
|
|
|
|
|
|
|
1033
|
|
|
|
|
|
|
$self->{GetOrganizationWorkspaces} = |
1034
|
|
|
|
|
|
|
$self->{soap_priv}->GetOrganizationWorkspaces( |
1035
|
|
|
|
|
|
|
$self->{auth_header}, |
1036
|
|
|
|
|
|
|
SOAP::Data->name('organizationId'=>$oid)->type('s:int') |
1037
|
|
|
|
|
|
|
); |
1038
|
|
|
|
|
|
|
|
1039
|
|
|
|
|
|
|
if ( $self->{GetOrganizationWorkspaces}->fault ) { |
1040
|
|
|
|
|
|
|
$self->_fault( $self->{GetOrganizationWorkspaces} ); |
1041
|
|
|
|
|
|
|
return $self->{GetOrganizationWorkspaces}->fault; |
1042
|
|
|
|
|
|
|
} |
1043
|
|
|
|
|
|
|
|
1044
|
|
|
|
|
|
|
my $ret = $self->{GetOrganizationWorkspaces}->result; |
1045
|
|
|
|
|
|
|
|
1046
|
|
|
|
|
|
|
my $array = [ $ret ]; |
1047
|
|
|
|
|
|
|
$array = [ $ret->{Workspace} ] if ref $ret and ref $ret->{Workspace} eq 'HASH'; |
1048
|
|
|
|
|
|
|
$array = $ret->{Workspace} if ref $ret and ref $ret->{Workspace} eq 'ARRAY'; |
1049
|
|
|
|
|
|
|
|
1050
|
|
|
|
|
|
|
return wantarray ? @$array : $array; |
1051
|
|
|
|
|
|
|
} |
1052
|
|
|
|
|
|
|
|
1053
|
|
|
|
|
|
|
sub priv_GetTemplate { |
1054
|
|
|
|
|
|
|
my $self = shift @_; |
1055
|
|
|
|
|
|
|
my $id = shift @_; |
1056
|
|
|
|
|
|
|
|
1057
|
|
|
|
|
|
|
$self->{GetTemplate} = |
1058
|
|
|
|
|
|
|
$self->{soap_priv}->GetTemplate( |
1059
|
|
|
|
|
|
|
$self->{auth_header}, |
1060
|
|
|
|
|
|
|
SOAP::Data->name('id'=>$id)->type('s:int') |
1061
|
|
|
|
|
|
|
); |
1062
|
|
|
|
|
|
|
|
1063
|
|
|
|
|
|
|
if ( $self->{GetTemplate}->fault ) { |
1064
|
|
|
|
|
|
|
$self->_fault( $self->{GetTemplate} ); |
1065
|
|
|
|
|
|
|
return $self->{GetTemplate}->fault; |
1066
|
|
|
|
|
|
|
} else { |
1067
|
|
|
|
|
|
|
return $self->{GetTemplate}->result; |
1068
|
|
|
|
|
|
|
} |
1069
|
|
|
|
|
|
|
} |
1070
|
|
|
|
|
|
|
|
1071
|
|
|
|
|
|
|
sub priv_GetUser { |
1072
|
|
|
|
|
|
|
my $self = shift @_; |
1073
|
|
|
|
|
|
|
my $name = shift @_; |
1074
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
$self->{GetUser} = |
1076
|
|
|
|
|
|
|
$self->{soap_priv}->GetUser( |
1077
|
|
|
|
|
|
|
$self->{auth_header}, |
1078
|
|
|
|
|
|
|
SOAP::Data->name('userName'=>$name)->type('s:string') |
1079
|
|
|
|
|
|
|
); |
1080
|
|
|
|
|
|
|
|
1081
|
|
|
|
|
|
|
if ( $self->{GetUser}->fault ) { |
1082
|
|
|
|
|
|
|
$self->_fault( $self->{GetUser} ); |
1083
|
|
|
|
|
|
|
return $self->{GetUser}->fault; |
1084
|
|
|
|
|
|
|
} else { |
1085
|
|
|
|
|
|
|
return $self->{GetUser}->result; |
1086
|
|
|
|
|
|
|
} |
1087
|
|
|
|
|
|
|
} |
1088
|
|
|
|
|
|
|
|
1089
|
|
|
|
|
|
|
sub priv_GetWorkspaceByName { |
1090
|
|
|
|
|
|
|
my $self = shift @_; |
1091
|
|
|
|
|
|
|
my $name = shift @_; |
1092
|
|
|
|
|
|
|
|
1093
|
|
|
|
|
|
|
$self->{GetWorkspaceByName} = |
1094
|
|
|
|
|
|
|
$self->{soap_priv}->GetWorkspaceByName( |
1095
|
|
|
|
|
|
|
$self->{auth_header}, |
1096
|
|
|
|
|
|
|
SOAP::Data->name('workspaceName'=>$name)->type('s:string') |
1097
|
|
|
|
|
|
|
); |
1098
|
|
|
|
|
|
|
|
1099
|
|
|
|
|
|
|
if ( $self->{GetWorkspaceByName}->fault ) { |
1100
|
|
|
|
|
|
|
$self->_fault( $self->{GetWorkspaceByName} ); |
1101
|
|
|
|
|
|
|
return $self->{GetWorkspaceByName}->fault; |
1102
|
|
|
|
|
|
|
} else { |
1103
|
|
|
|
|
|
|
return $self->{GetWorkspaceByName}->result; |
1104
|
|
|
|
|
|
|
} |
1105
|
|
|
|
|
|
|
} |
1106
|
|
|
|
|
|
|
|
1107
|
|
|
|
|
|
|
sub priv_LibraryCloneToWorkspace { |
1108
|
|
|
|
|
|
|
my $self = shift @_; |
1109
|
|
|
|
|
|
|
my $libraryid = shift @_; |
1110
|
|
|
|
|
|
|
my $destworkspaceid = shift @_; |
1111
|
|
|
|
|
|
|
my $isnew = shift @_; |
1112
|
|
|
|
|
|
|
my $newname = shift @_; |
1113
|
|
|
|
|
|
|
my $description = shift @_; |
1114
|
|
|
|
|
|
|
|
1115
|
|
|
|
|
|
|
my $machines = shift @_; |
1116
|
|
|
|
|
|
|
my $storage = shift @_; |
1117
|
|
|
|
|
|
|
|
1118
|
|
|
|
|
|
|
my $existingconfid = shift @_; |
1119
|
|
|
|
|
|
|
my $isfullclone = shift @_; |
1120
|
|
|
|
|
|
|
my $storagelease = shift @_; |
1121
|
|
|
|
|
|
|
|
1122
|
|
|
|
|
|
|
$isnew = 'false' unless $isnew =~ /^true$/i; |
1123
|
|
|
|
|
|
|
$isfullclone = 'false' unless $isfullclone =~ /^true$/i; |
1124
|
|
|
|
|
|
|
|
1125
|
|
|
|
|
|
|
my @machine_data; |
1126
|
|
|
|
|
|
|
|
1127
|
|
|
|
|
|
|
for my $machine (@$machines) { |
1128
|
|
|
|
|
|
|
my @elements; |
1129
|
|
|
|
|
|
|
for my $element ( keys %$machine ) { |
1130
|
|
|
|
|
|
|
push @elements, SOAP::Data->name( $element, $machine->{$element} ); |
1131
|
|
|
|
|
|
|
} |
1132
|
|
|
|
|
|
|
push @machine_data, SOAP::Data->name('machine' => \SOAP::Data->value(@elements)); |
1133
|
|
|
|
|
|
|
} |
1134
|
|
|
|
|
|
|
|
1135
|
|
|
|
|
|
|
$self->{LibraryCloneToWorkspace} = |
1136
|
|
|
|
|
|
|
$self->{soap_priv}->LibraryCloneToWorkspace( |
1137
|
|
|
|
|
|
|
$self->{auth_header}, |
1138
|
|
|
|
|
|
|
SOAP::Data->name('libraryId' => $libraryid )->type('s:int'), |
1139
|
|
|
|
|
|
|
SOAP::Data->name('destWorkspaceId' => $destworkspaceid )->type('s:int'), |
1140
|
|
|
|
|
|
|
SOAP::Data->name('isNewConfiguration' => $isnew )->type('s:boolean'), |
1141
|
|
|
|
|
|
|
SOAP::Data->name('newConfigName' => $newname )->type('s:string'), |
1142
|
|
|
|
|
|
|
SOAP::Data->name('description' => $description )->type('s:string'), |
1143
|
|
|
|
|
|
|
SOAP::Data->name('copyData' => \SOAP::Data->value( |
1144
|
|
|
|
|
|
|
SOAP::Data->name('VMCopyData' => \SOAP::Data->value( |
1145
|
|
|
|
|
|
|
@machine_data, |
1146
|
|
|
|
|
|
|
SOAP::Data->name('storageServerName' => $storage )->type('s:string') |
1147
|
|
|
|
|
|
|
)) |
1148
|
|
|
|
|
|
|
)), |
1149
|
|
|
|
|
|
|
( $existingconfid ? SOAP::Data->name('existingConfigId' => $existingconfid )->type('s:int') : '' ), |
1150
|
|
|
|
|
|
|
SOAP::Data->name('isFullClone' => $isfullclone )->type('s:boolean'), |
1151
|
|
|
|
|
|
|
SOAP::Data->name('storageLeaseInMilliseconds' => $storagelease )->type('s:long') |
1152
|
|
|
|
|
|
|
); |
1153
|
|
|
|
|
|
|
|
1154
|
|
|
|
|
|
|
if ( $self->{LibraryCloneToWorkspace}->fault ) { |
1155
|
|
|
|
|
|
|
$self->_fault( $self->{LibraryCloneToWorkspace} ); |
1156
|
|
|
|
|
|
|
return $self->{LibraryCloneToWorkspace}->fault; |
1157
|
|
|
|
|
|
|
} else { |
1158
|
|
|
|
|
|
|
return $self->{LibraryCloneToWorkspace}->result; |
1159
|
|
|
|
|
|
|
} |
1160
|
|
|
|
|
|
|
} |
1161
|
|
|
|
|
|
|
|
1162
|
|
|
|
|
|
|
sub priv_ListNetworks { |
1163
|
|
|
|
|
|
|
my $self = shift @_; |
1164
|
|
|
|
|
|
|
$self->{ListNetworks} = $self->{soap_priv}->ListNetworks( $self->{auth_header} ); |
1165
|
|
|
|
|
|
|
|
1166
|
|
|
|
|
|
|
if ( $self->{ListNetworks}->fault ) { |
1167
|
|
|
|
|
|
|
$self->_fault( $self->{ListNetworks} ); |
1168
|
|
|
|
|
|
|
return $self->{ListNetworks}->fault; |
1169
|
|
|
|
|
|
|
} |
1170
|
|
|
|
|
|
|
|
1171
|
|
|
|
|
|
|
my $ret = $self->{ListNetworks}->result; |
1172
|
|
|
|
|
|
|
|
1173
|
|
|
|
|
|
|
my $array = $ret ? [ $ret ] : [ ]; |
1174
|
|
|
|
|
|
|
$array = [ $ret->{Network} ] if ref $ret and ref $ret->{Network} eq 'HASH'; |
1175
|
|
|
|
|
|
|
$array = $ret->{Network} if ref $ret and ref $ret->{Network} eq 'ARRAY'; |
1176
|
|
|
|
|
|
|
|
1177
|
|
|
|
|
|
|
return wantarray ? @$array : $array; |
1178
|
|
|
|
|
|
|
} |
1179
|
|
|
|
|
|
|
|
1180
|
|
|
|
|
|
|
sub priv_ListTemplates { |
1181
|
|
|
|
|
|
|
my $self = shift @_; |
1182
|
|
|
|
|
|
|
$self->{ListTemplates} = $self->{soap_priv}->ListTemplates( $self->{auth_header} ); |
1183
|
|
|
|
|
|
|
|
1184
|
|
|
|
|
|
|
if ( $self->{ListTemplates}->fault ) { |
1185
|
|
|
|
|
|
|
$self->_fault( $self->{ListTemplates} ); |
1186
|
|
|
|
|
|
|
return $self->{ListTemplates}->fault; |
1187
|
|
|
|
|
|
|
} |
1188
|
|
|
|
|
|
|
|
1189
|
|
|
|
|
|
|
my $ret = $self->{ListTemplates}->result; |
1190
|
|
|
|
|
|
|
|
1191
|
|
|
|
|
|
|
my $array = $ret ? [ $ret ] : [ ]; |
1192
|
|
|
|
|
|
|
$array = [ $ret->{Template} ] if ref $ret and ref $ret->{Template} eq 'HASH'; |
1193
|
|
|
|
|
|
|
$array = $ret->{Template} if ref $ret and ref $ret->{Template} eq 'ARRAY'; |
1194
|
|
|
|
|
|
|
|
1195
|
|
|
|
|
|
|
return wantarray ? @$array : $array; |
1196
|
|
|
|
|
|
|
} |
1197
|
|
|
|
|
|
|
|
1198
|
|
|
|
|
|
|
sub priv_ListTransportNetworksInCurrentOrg { |
1199
|
|
|
|
|
|
|
my $self = shift @_; |
1200
|
|
|
|
|
|
|
$self->{ListTransportNetworksInCurrentOrg} = $self->{soap_priv}->ListTransportNetworksInCurrentOrg( $self->{auth_header} ); |
1201
|
|
|
|
|
|
|
|
1202
|
|
|
|
|
|
|
if ( $self->{ListTransportNetworksInCurrentOrg}->fault ) { |
1203
|
|
|
|
|
|
|
$self->_fault( $self->{ListTransportNetworksInCurrentOrg} ); |
1204
|
|
|
|
|
|
|
return $self->{ListTransportNetworksInCurrentOrg}->fault; |
1205
|
|
|
|
|
|
|
} |
1206
|
|
|
|
|
|
|
|
1207
|
|
|
|
|
|
|
return $self->{ListTransportNetworksInCurrentOrg}->result; |
1208
|
|
|
|
|
|
|
|
1209
|
|
|
|
|
|
|
#my $ret = $self->{ListTransportNetworksInCurrentOrg}->result; |
1210
|
|
|
|
|
|
|
|
1211
|
|
|
|
|
|
|
#my $array = $ret ? [ $ret ] : [ ]; |
1212
|
|
|
|
|
|
|
#$array = [ $ret->{Network} ] if ref $ret and ref $ret->{Network} eq 'HASH'; |
1213
|
|
|
|
|
|
|
#$array = $ret->{Network} if ref $ret and ref $ret->{Network} eq 'ARRAY'; |
1214
|
|
|
|
|
|
|
|
1215
|
|
|
|
|
|
|
#return wantarray ? @$array : $array; |
1216
|
|
|
|
|
|
|
} |
1217
|
|
|
|
|
|
|
|
1218
|
|
|
|
|
|
|
sub priv_ListUsers { |
1219
|
|
|
|
|
|
|
my $self = shift @_; |
1220
|
|
|
|
|
|
|
$self->{ListUsers} = $self->{soap_priv}->ListUsers( $self->{auth_header} ); |
1221
|
|
|
|
|
|
|
|
1222
|
|
|
|
|
|
|
if ( $self->{ListUsers}->fault ) { |
1223
|
|
|
|
|
|
|
$self->_fault( $self->{ListUsers} ); |
1224
|
|
|
|
|
|
|
return $self->{ListUsers}->fault; |
1225
|
|
|
|
|
|
|
} |
1226
|
|
|
|
|
|
|
|
1227
|
|
|
|
|
|
|
my $ret = $self->{ListUsers}->result; |
1228
|
|
|
|
|
|
|
|
1229
|
|
|
|
|
|
|
my $array = $ret ? [ $ret ] : [ ]; |
1230
|
|
|
|
|
|
|
$array = [ $ret->{User} ] if ref $ret and ref $ret->{User} eq 'HASH'; |
1231
|
|
|
|
|
|
|
$array = $ret->{User} if ref $ret and ref $ret->{User} eq 'ARRAY'; |
1232
|
|
|
|
|
|
|
|
1233
|
|
|
|
|
|
|
return wantarray ? @$array : $array; |
1234
|
|
|
|
|
|
|
} |
1235
|
|
|
|
|
|
|
|
1236
|
|
|
|
|
|
|
sub priv_MachineUpgradeVirtualHardware { |
1237
|
|
|
|
|
|
|
my $self = shift @_; |
1238
|
|
|
|
|
|
|
my $id = shift @_; |
1239
|
|
|
|
|
|
|
$self->{MachineUpgradeVirtualHardware} = |
1240
|
|
|
|
|
|
|
$self->{soap_priv}->MachineUpgradeVirtualHardware( |
1241
|
|
|
|
|
|
|
$self->{auth_header}, |
1242
|
|
|
|
|
|
|
SOAP::Data->name('machineId'=>$id)->type('s:int'), |
1243
|
|
|
|
|
|
|
); |
1244
|
|
|
|
|
|
|
|
1245
|
|
|
|
|
|
|
if ( $self->{MachineUpgradeVirtualHardware}->fault ) { |
1246
|
|
|
|
|
|
|
$self->_fault( $self->{MachineUpgradeVirtualHardware} ); |
1247
|
|
|
|
|
|
|
return $self->{MachineUpgradeVirtualHardware}->fault; |
1248
|
|
|
|
|
|
|
} else { |
1249
|
|
|
|
|
|
|
return $self->{MachineUpgradeVirtualHardware}->result; |
1250
|
|
|
|
|
|
|
} |
1251
|
|
|
|
|
|
|
} |
1252
|
|
|
|
|
|
|
|
1253
|
|
|
|
|
|
|
sub priv_NetworkInterfaceCreate { |
1254
|
|
|
|
|
|
|
my $self = shift @_; |
1255
|
|
|
|
|
|
|
my $vmid = shift @_; |
1256
|
|
|
|
|
|
|
my $netid = shift @_; |
1257
|
|
|
|
|
|
|
my $iptype = shift @_; |
1258
|
|
|
|
|
|
|
my $ipaddr = shift @_; |
1259
|
|
|
|
|
|
|
|
1260
|
|
|
|
|
|
|
$self->{NetworkInterfaceCreate} = |
1261
|
|
|
|
|
|
|
$self->{soap_priv}->NetworkInterfaceCreate( |
1262
|
|
|
|
|
|
|
$self->{auth_header}, |
1263
|
|
|
|
|
|
|
SOAP::Data->name('vmID' =>$vmid )->type('s:int'), |
1264
|
|
|
|
|
|
|
SOAP::Data->name('networkID' =>$netid )->type('s:int'), |
1265
|
|
|
|
|
|
|
SOAP::Data->name('IPAssignmentType' =>$iptype )->type('s:string'), |
1266
|
|
|
|
|
|
|
SOAP::Data->name('IPAddress' =>$ipaddr )->type('s:string'), |
1267
|
|
|
|
|
|
|
); |
1268
|
|
|
|
|
|
|
|
1269
|
|
|
|
|
|
|
if ( $self->{NetworkInterfaceCreate}->fault ) { |
1270
|
|
|
|
|
|
|
$self->_fault( $self->{NetworkInterfaceCreate} ); |
1271
|
|
|
|
|
|
|
return $self->{NetworkInterfaceCreate}->fault; |
1272
|
|
|
|
|
|
|
} else { |
1273
|
|
|
|
|
|
|
return $self->{NetworkInterfaceCreate}->result; |
1274
|
|
|
|
|
|
|
} |
1275
|
|
|
|
|
|
|
} |
1276
|
|
|
|
|
|
|
|
1277
|
|
|
|
|
|
|
sub priv_NetworkInterfaceDelete { |
1278
|
|
|
|
|
|
|
my $self = shift @_; |
1279
|
|
|
|
|
|
|
my $vmid = shift @_; |
1280
|
|
|
|
|
|
|
my $nicid = shift @_; |
1281
|
|
|
|
|
|
|
|
1282
|
|
|
|
|
|
|
$self->{NetworkInterfaceDelete} = |
1283
|
|
|
|
|
|
|
$self->{soap_priv}->NetworkInterfaceDelete( |
1284
|
|
|
|
|
|
|
$self->{auth_header}, |
1285
|
|
|
|
|
|
|
SOAP::Data->name('vmID' => $vmid )->type('s:int'), |
1286
|
|
|
|
|
|
|
SOAP::Data->name('nicID' => $nicid )->type('s:int'), |
1287
|
|
|
|
|
|
|
); |
1288
|
|
|
|
|
|
|
|
1289
|
|
|
|
|
|
|
if ( $self->{NetworkInterfaceDelete}->fault ) { |
1290
|
|
|
|
|
|
|
$self->_fault( $self->{NetworkInterfaceDelete} ); |
1291
|
|
|
|
|
|
|
return $self->{NetworkInterfaceDelete}->fault; |
1292
|
|
|
|
|
|
|
} else { |
1293
|
|
|
|
|
|
|
return $self->{NetworkInterfaceDelete}->result; |
1294
|
|
|
|
|
|
|
} |
1295
|
|
|
|
|
|
|
} |
1296
|
|
|
|
|
|
|
|
1297
|
|
|
|
|
|
|
sub priv_NetworkInterfaceModify { ### INCOMPLETE |
1298
|
|
|
|
|
|
|
my $self = shift @_; |
1299
|
|
|
|
|
|
|
my $vmid = shift @_; |
1300
|
|
|
|
|
|
|
my $netid = shift @_; |
1301
|
|
|
|
|
|
|
my $info = shift @_; |
1302
|
|
|
|
|
|
|
|
1303
|
|
|
|
|
|
|
$self->{NetworkInterfaceModify} = |
1304
|
|
|
|
|
|
|
$self->{soap_priv}->NetworkInterfaceModify( |
1305
|
|
|
|
|
|
|
$self->{auth_header}, |
1306
|
|
|
|
|
|
|
#SOAP::Data->name('vmID' =>$vmid )->type('s:int'), |
1307
|
|
|
|
|
|
|
#SOAP::Data->name('networkID' =>$netid )->type('s:int'), |
1308
|
|
|
|
|
|
|
#SOAP::Data->name('IPAssignmentType' =>$iptype )->type('s:string'), |
1309
|
|
|
|
|
|
|
#SOAP::Data->name('IPAddress' =>$ipaddr )->type('s:string'), |
1310
|
|
|
|
|
|
|
); |
1311
|
|
|
|
|
|
|
|
1312
|
|
|
|
|
|
|
if ( $self->{NetworkInterfaceModify}->fault ) { |
1313
|
|
|
|
|
|
|
$self->_fault( $self->{NetworkInterfaceModify} ); |
1314
|
|
|
|
|
|
|
return $self->{NetworkInterfaceModify}->fault; |
1315
|
|
|
|
|
|
|
} else { |
1316
|
|
|
|
|
|
|
return $self->{NetworkInterfaceModify}->result; |
1317
|
|
|
|
|
|
|
} |
1318
|
|
|
|
|
|
|
} |
1319
|
|
|
|
|
|
|
|
1320
|
|
|
|
|
|
|
sub priv_StorageServerVMFSFindByName { |
1321
|
|
|
|
|
|
|
my $self = shift @_; |
1322
|
|
|
|
|
|
|
my $storeName = shift @_; |
1323
|
|
|
|
|
|
|
|
1324
|
|
|
|
|
|
|
$self->{StorageServerVMFSFindByName} = |
1325
|
|
|
|
|
|
|
$self->{soap_priv}->StorageServerVMFSFindByName( |
1326
|
|
|
|
|
|
|
$self->{auth_header}, |
1327
|
|
|
|
|
|
|
SOAP::Data->name('name' => $storeName)->type('')); |
1328
|
|
|
|
|
|
|
|
1329
|
|
|
|
|
|
|
if ( $self->{StorageServerVMFSFindByName}->fault ) { |
1330
|
|
|
|
|
|
|
$self->_fault( $self->{StorageServerVMFSFindByName} ); |
1331
|
|
|
|
|
|
|
return $self->{StorageServerVMFSFindByName}->fault; |
1332
|
|
|
|
|
|
|
} else { |
1333
|
|
|
|
|
|
|
#return $self->{StorageServerVMFSFindByName}->result; |
1334
|
|
|
|
|
|
|
my $result = $self->{StorageServerVMFSFindByName}->result; |
1335
|
|
|
|
|
|
|
my $datastore = $$result{"label"}; # Need to be fixed. Currently in use? |
1336
|
|
|
|
|
|
|
return $datastore; |
1337
|
|
|
|
|
|
|
} |
1338
|
|
|
|
|
|
|
} |
1339
|
|
|
|
|
|
|
|
1340
|
|
|
|
|
|
|
sub priv_TemplateChangeOwner { |
1341
|
|
|
|
|
|
|
my $self = shift @_; |
1342
|
|
|
|
|
|
|
my $temp = shift @_; |
1343
|
|
|
|
|
|
|
my $own = shift @_; |
1344
|
|
|
|
|
|
|
|
1345
|
|
|
|
|
|
|
$self->{TemplateChangeOwner} = |
1346
|
|
|
|
|
|
|
$self->{soap_priv}->TemplateChangeOwner( |
1347
|
|
|
|
|
|
|
$self->{auth_header}, |
1348
|
|
|
|
|
|
|
SOAP::Data->name('templateId' => $temp )->type('s:int'), |
1349
|
|
|
|
|
|
|
SOAP::Data->name('newOwnerId' => $own )->type('s:int'), |
1350
|
|
|
|
|
|
|
); |
1351
|
|
|
|
|
|
|
|
1352
|
|
|
|
|
|
|
if ( $self->{TemplateChangeOwner}->fault ) { |
1353
|
|
|
|
|
|
|
$self->_fault( $self->{TemplateChangeOwner} ); |
1354
|
|
|
|
|
|
|
return $self->{TemplateChangeOwner}->fault; |
1355
|
|
|
|
|
|
|
} else { |
1356
|
|
|
|
|
|
|
return $self->{TemplateChangeOwner}->result; |
1357
|
|
|
|
|
|
|
} |
1358
|
|
|
|
|
|
|
} |
1359
|
|
|
|
|
|
|
|
1360
|
|
|
|
|
|
|
sub priv_TemplateExport { |
1361
|
|
|
|
|
|
|
my $self = shift @_; |
1362
|
|
|
|
|
|
|
my $temp = shift @_; |
1363
|
|
|
|
|
|
|
my $unc = shift @_; |
1364
|
|
|
|
|
|
|
my $user = shift @_; |
1365
|
|
|
|
|
|
|
my $pass = shift @_; |
1366
|
|
|
|
|
|
|
|
1367
|
|
|
|
|
|
|
$self->{TemplateExport} = |
1368
|
|
|
|
|
|
|
$self->{soap_priv}->TemplateExport( |
1369
|
|
|
|
|
|
|
$self->{auth_header}, |
1370
|
|
|
|
|
|
|
SOAP::Data->name('template_id' =>$temp)->type('s:int'), |
1371
|
|
|
|
|
|
|
SOAP::Data->name('UNCPath' =>$unc )->type('s:string'), |
1372
|
|
|
|
|
|
|
SOAP::Data->name('username' =>$user)->type('s:string'), |
1373
|
|
|
|
|
|
|
SOAP::Data->name('password' =>$pass)->type('s:string'), |
1374
|
|
|
|
|
|
|
); |
1375
|
|
|
|
|
|
|
|
1376
|
|
|
|
|
|
|
if ( $self->{TemplateExport}->fault ) { |
1377
|
|
|
|
|
|
|
$self->_fault( $self->{TemplateExport} ); |
1378
|
|
|
|
|
|
|
return $self->{TemplateExport}->fault; |
1379
|
|
|
|
|
|
|
} else { |
1380
|
|
|
|
|
|
|
return $self->{TemplateExport}->result; |
1381
|
|
|
|
|
|
|
} |
1382
|
|
|
|
|
|
|
} |
1383
|
|
|
|
|
|
|
|
1384
|
|
|
|
|
|
|
sub priv_TemplateImport { |
1385
|
|
|
|
|
|
|
my $self = shift @_; |
1386
|
|
|
|
|
|
|
my $unc = shift @_; |
1387
|
|
|
|
|
|
|
my $user = shift @_; |
1388
|
|
|
|
|
|
|
my $pass = shift @_; |
1389
|
|
|
|
|
|
|
my $name = shift @_; |
1390
|
|
|
|
|
|
|
my $desc = shift @_; |
1391
|
|
|
|
|
|
|
my $stor = shift @_; |
1392
|
|
|
|
|
|
|
|
1393
|
|
|
|
|
|
|
my $list = shift @_; |
1394
|
|
|
|
|
|
|
|
1395
|
|
|
|
|
|
|
# Virtualization Technology: 6 (VMware ESX Server 3.0) |
1396
|
|
|
|
|
|
|
# This comes from the Private API documentation |
1397
|
|
|
|
|
|
|
my $vsid = 6; |
1398
|
|
|
|
|
|
|
|
1399
|
|
|
|
|
|
|
my $paramlist = \SOAP::Data->value( |
1400
|
|
|
|
|
|
|
|
1401
|
|
|
|
|
|
|
#SOAP::Data->name('VMParameter' => \SOAP::Data->value( |
1402
|
|
|
|
|
|
|
# SOAP::Data->name('parameter_name' => 'VCPUCOUNT')->type(''), |
1403
|
|
|
|
|
|
|
# SOAP::Data->name('parameter_value' => '4')->type('') |
1404
|
|
|
|
|
|
|
# )), |
1405
|
|
|
|
|
|
|
|
1406
|
|
|
|
|
|
|
#SOAP::Data->name('VMParameter' => \SOAP::Data->value( |
1407
|
|
|
|
|
|
|
# SOAP::Data->name('parameter_name' => 'GUESTOS')->type(''), |
1408
|
|
|
|
|
|
|
# SOAP::Data->name('parameter_value' => 'RHEL4')->type('') |
1409
|
|
|
|
|
|
|
#)), |
1410
|
|
|
|
|
|
|
|
1411
|
|
|
|
|
|
|
SOAP::Data->name('VMParameter' => \SOAP::Data->value( |
1412
|
|
|
|
|
|
|
SOAP::Data->name('parameter_name' => 'HW_VERSION')->type(''), |
1413
|
|
|
|
|
|
|
SOAP::Data->name('parameter_value' => $7)->type('') |
1414
|
|
|
|
|
|
|
)), |
1415
|
|
|
|
|
|
|
|
1416
|
|
|
|
|
|
|
); |
1417
|
|
|
|
|
|
|
|
1418
|
|
|
|
|
|
|
$self->{TemplateImport} = |
1419
|
|
|
|
|
|
|
$self->{soap_priv}->TemplateImport( |
1420
|
|
|
|
|
|
|
$self->{auth_header}, |
1421
|
|
|
|
|
|
|
SOAP::Data->name('UNCPath' =>$unc )->type('s:string'), |
1422
|
|
|
|
|
|
|
SOAP::Data->name('dirUsername' =>$user)->type('s:string'), |
1423
|
|
|
|
|
|
|
SOAP::Data->name('dirPassword' =>$pass)->type('s:string'), |
1424
|
|
|
|
|
|
|
SOAP::Data->name('name' =>$name)->type('s:string'), |
1425
|
|
|
|
|
|
|
SOAP::Data->name('description' =>$desc)->type('s:string'), |
1426
|
|
|
|
|
|
|
SOAP::Data->name('VSTypeID' =>$vsid)->type('s:int'), |
1427
|
|
|
|
|
|
|
SOAP::Data->name('storageServerName' => $stor)->type('s:string'), |
1428
|
|
|
|
|
|
|
SOAP::Data->name('parameterList' => $paramlist ) |
1429
|
|
|
|
|
|
|
); |
1430
|
|
|
|
|
|
|
|
1431
|
|
|
|
|
|
|
if ( $self->{TemplateImport}->fault ) { |
1432
|
|
|
|
|
|
|
$self->_fault( $self->{TemplateImport} ); |
1433
|
|
|
|
|
|
|
return $self->{TemplateImport}->fault; |
1434
|
|
|
|
|
|
|
} else { |
1435
|
|
|
|
|
|
|
return $self->{TemplateImport}->result; |
1436
|
|
|
|
|
|
|
} |
1437
|
|
|
|
|
|
|
} |
1438
|
|
|
|
|
|
|
|
1439
|
|
|
|
|
|
|
sub priv_TemplateImportFromSMB { |
1440
|
|
|
|
|
|
|
my $self = shift @_; |
1441
|
|
|
|
|
|
|
my $UNCPath = shift @_; |
1442
|
|
|
|
|
|
|
my $username = shift @_; |
1443
|
|
|
|
|
|
|
my $password = shift @_; |
1444
|
|
|
|
|
|
|
my $delete = shift @_; |
1445
|
|
|
|
|
|
|
my $description = shift @_; |
1446
|
|
|
|
|
|
|
my $destStore = shift @_; |
1447
|
|
|
|
|
|
|
my $destName = shift @_; |
1448
|
|
|
|
|
|
|
my $destDesc = shift @_; |
1449
|
|
|
|
|
|
|
|
1450
|
|
|
|
|
|
|
$self->{TemplateImportFromSMB} = |
1451
|
|
|
|
|
|
|
$self->{soap_priv}->TemplateImportFromSMB( |
1452
|
|
|
|
|
|
|
$self->{auth_header}, |
1453
|
|
|
|
|
|
|
|
1454
|
|
|
|
|
|
|
SOAP::Data->name('name' => $destName)->type(''), |
1455
|
|
|
|
|
|
|
SOAP::Data->name('VSTypeID' => $delete)->type(''), |
1456
|
|
|
|
|
|
|
SOAP::Data->name('description' => $description)->type(''), |
1457
|
|
|
|
|
|
|
SOAP::Data->name('storageServerName' => $destStore)->type(''), |
1458
|
|
|
|
|
|
|
|
1459
|
|
|
|
|
|
|
SOAP::Data->name('UNCPath' => $UNCPath)->type(''), |
1460
|
|
|
|
|
|
|
SOAP::Data->name('dirUsername' => $username)->type(''), |
1461
|
|
|
|
|
|
|
SOAP::Data->name('dirPassword' => $password)->type(''), |
1462
|
|
|
|
|
|
|
|
1463
|
|
|
|
|
|
|
SOAP::Data->name('performGuestCustomization' => "1")->type(''), |
1464
|
|
|
|
|
|
|
|
1465
|
|
|
|
|
|
|
SOAP::Data->name('parameterList' => |
1466
|
|
|
|
|
|
|
\SOAP::Data->value( |
1467
|
|
|
|
|
|
|
|
1468
|
|
|
|
|
|
|
SOAP::Data->name('VMParameter' => |
1469
|
|
|
|
|
|
|
\SOAP::Data->value( |
1470
|
|
|
|
|
|
|
SOAP::Data->name('parameter_name' => 'VCPUCOUNT')->type(''), |
1471
|
|
|
|
|
|
|
SOAP::Data->name('parameter_value' => '4')->type(''))), |
1472
|
|
|
|
|
|
|
|
1473
|
|
|
|
|
|
|
SOAP::Data->name('VMParameter' => |
1474
|
|
|
|
|
|
|
\SOAP::Data->value( |
1475
|
|
|
|
|
|
|
SOAP::Data->name('parameter_name' => 'GUESTOS')->type(''), |
1476
|
|
|
|
|
|
|
SOAP::Data->name('parameter_value' => 'RHEL4')->type(''))), |
1477
|
|
|
|
|
|
|
|
1478
|
|
|
|
|
|
|
SOAP::Data->name('VMParameter' => |
1479
|
|
|
|
|
|
|
\SOAP::Data->value( |
1480
|
|
|
|
|
|
|
SOAP::Data->name('parameter_name' => 'HW_VERSION')->type(''), |
1481
|
|
|
|
|
|
|
SOAP::Data->name('parameter_value' => $7)->type(''))), |
1482
|
|
|
|
|
|
|
|
1483
|
|
|
|
|
|
|
|
1484
|
|
|
|
|
|
|
)) |
1485
|
|
|
|
|
|
|
); |
1486
|
|
|
|
|
|
|
|
1487
|
|
|
|
|
|
|
$self->_fault( $self->{TemplateImportFromSMB} ) if $self->{TemplateImportFromSMB}->fault; |
1488
|
|
|
|
|
|
|
return $self->{TemplateImportFromSMB}->result; |
1489
|
|
|
|
|
|
|
} |
1490
|
|
|
|
|
|
|
|
1491
|
|
|
|
|
|
|
sub priv_TemplatePerformAction { |
1492
|
|
|
|
|
|
|
my $self = shift @_; |
1493
|
|
|
|
|
|
|
my $template_id = shift @_; |
1494
|
|
|
|
|
|
|
my $action = shift @_; |
1495
|
|
|
|
|
|
|
|
1496
|
|
|
|
|
|
|
$self->{TemplatePerformAction} = |
1497
|
|
|
|
|
|
|
$self->{soap_priv}->TemplatePerformAction( $self->{auth_header}, |
1498
|
|
|
|
|
|
|
SOAP::Data->name('template_id' => $template_id )->type('s:int'), |
1499
|
|
|
|
|
|
|
SOAP::Data->name('action' => $action )->type('s:int') ); |
1500
|
|
|
|
|
|
|
|
1501
|
|
|
|
|
|
|
if ($self->{TemplatePerformAction}->fault) { |
1502
|
|
|
|
|
|
|
$self->_fault( $self->{TemplatePerformAction} ); |
1503
|
|
|
|
|
|
|
return $self->{TemplatePerformAction}->fault; |
1504
|
|
|
|
|
|
|
} |
1505
|
|
|
|
|
|
|
|
1506
|
|
|
|
|
|
|
return $self->{TemplatePerformAction}->result; |
1507
|
|
|
|
|
|
|
} |
1508
|
|
|
|
|
|
|
|
1509
|
|
|
|
|
|
|
sub priv_WorkspaceCreate { |
1510
|
|
|
|
|
|
|
my $self = shift @_; |
1511
|
|
|
|
|
|
|
my $name = shift @_; |
1512
|
|
|
|
|
|
|
my $ismain = shift @_; |
1513
|
|
|
|
|
|
|
my $description = shift @_; |
1514
|
|
|
|
|
|
|
my $storedquota = shift @_; |
1515
|
|
|
|
|
|
|
my $deployquota = shift @_; |
1516
|
|
|
|
|
|
|
|
1517
|
|
|
|
|
|
|
$self->{WorkspaceCreate} = |
1518
|
|
|
|
|
|
|
$self->{soap_priv}->WorkspaceCreate( $self->{auth_header}, |
1519
|
|
|
|
|
|
|
SOAP::Data->name('name' => $name )->type('s:string'), |
1520
|
|
|
|
|
|
|
SOAP::Data->name('isMain' => $ismain )->type('s:bool'), |
1521
|
|
|
|
|
|
|
SOAP::Data->name('description' => $description )->type('s:string'), |
1522
|
|
|
|
|
|
|
SOAP::Data->name('storedVMQuota' => $storedquota )->type('s:int'), |
1523
|
|
|
|
|
|
|
SOAP::Data->name('deployedVMQuota' => $deployquota )->type('s:int') ); |
1524
|
|
|
|
|
|
|
|
1525
|
|
|
|
|
|
|
$self->_fault( $self->{WorkspaceCreate} ) if $self->{WorkspaceCreate}->fault; |
1526
|
|
|
|
|
|
|
return $self->{WorkspaceCreate}->result; |
1527
|
|
|
|
|
|
|
} |
1528
|
|
|
|
|
|
|
|
1529
|
|
|
|
|
|
|
1; |
1530
|
|
|
|
|
|
|
|
1531
|
|
|
|
|
|
|
__END__ |