| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package LabmanSoap; |
|
2
|
1
|
|
|
1
|
|
49145
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
39
|
|
|
3
|
1
|
|
|
1
|
|
427
|
use SOAP::Lite ( maptype => {} ); |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
use Data::Dumper; |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
VMWare::LabmanSoap - access Vmware Labmanager SOAP API |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 1.0 |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = '1.0'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
This module has been tested using Labmanger 4.0 (4.0.1.1233). |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
Code to checkout, deploy, undeploy and delete a configuration: |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use LabmanSoapInternal; |
|
26
|
|
|
|
|
|
|
$libraryConfigName = "lib_config_name"; |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
$mySoapObj = LabmanSoapInternal->new('LM_Username','LM_Password','LM_Hostname','Organization_Name','WorkSpace_Name'); |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
#Get the id of the config you are going to check out |
|
31
|
|
|
|
|
|
|
@lib_config_id = $mySoapObj->GetSingleConfigurationByName("${libraryConfigName}","id"); |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
#Checkout the config |
|
34
|
|
|
|
|
|
|
$checked_out_config_id = $mySoapObj->ConfigurationCheckout($lib_config_id[0],"NEW_WORKSPACE_NAME"); |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
#Deploy the config |
|
37
|
|
|
|
|
|
|
$mySoapObj->ConfigurationDeploy($checked_out_config_id,4); # The 4 is for the fencemode |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
#Deploy the config to DVS |
|
40
|
|
|
|
|
|
|
$mySoapObj->ConfigurationDeployEx2($checked_out_config_id,2); # 2 is the id of the network |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#Undeploy the config |
|
43
|
|
|
|
|
|
|
$mySoapObj->ConfigurationUndeploy($chkd_out_id); |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
#Delete the config |
|
46
|
|
|
|
|
|
|
$mySoapObj->ConfigurationDelete($chkd_out_id); |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
#Check for last SOAP error |
|
49
|
|
|
|
|
|
|
if ($mySoapObj->{'LASTERROR'}->{'detail'}->{'message'}->{'format'}) { print }; |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
This module provides a Perl interface to VMWare's Labmanager SOAP interface. It has a one-to-one mapping for most of the commands exposed in the external API as well as a few commands exposed in the internal API. The most useful Internal API command is ConfigurationDeployEx2 which allows you to deploy to distributed virtual switches. |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Using this module you can checkout, deploy, undeploy and delete configurations. You can also get lists of configurations and guest information as well. |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
Lab Manager is a product created by VMWare that provides development and test teams with a virtual environment to deploy systems and networks of systems in a short period of a time. |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 METHODS |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 new |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
This method creates the Labmanager object. |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head3 Arguments |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=over 4 |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item * username |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item * password |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item * hostname |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item * organization |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * workspace |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=back |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub new |
|
84
|
|
|
|
|
|
|
{ |
|
85
|
|
|
|
|
|
|
my($class) = shift; |
|
86
|
|
|
|
|
|
|
my($self) = {}; |
|
87
|
|
|
|
|
|
|
my($username) = shift; |
|
88
|
|
|
|
|
|
|
my($password) = shift; |
|
89
|
|
|
|
|
|
|
my($hostname) = shift; |
|
90
|
|
|
|
|
|
|
my($orgname) = shift; |
|
91
|
|
|
|
|
|
|
my($workspace) = shift; |
|
92
|
|
|
|
|
|
|
$self->{'soap'} = SOAP::Lite |
|
93
|
|
|
|
|
|
|
-> on_action(sub { return "http://vmware.com/labmanager/" . $_[1]; } ) |
|
94
|
|
|
|
|
|
|
-> default_ns('http://vmware.com/labmanager') |
|
95
|
|
|
|
|
|
|
-> proxy('https://' . $hostname . '/LabManager/SOAP/LabManagerInternal.asmx'); |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
$self->{'soap'}->readable(1); |
|
98
|
|
|
|
|
|
|
$self->{'auth_header'} = SOAP::Header->new( |
|
99
|
|
|
|
|
|
|
name => 'AuthenticationHeader', |
|
100
|
|
|
|
|
|
|
attr => { xmlns => "http://vmware.com/labmanager" }, |
|
101
|
|
|
|
|
|
|
value => { username => $username, password => $password, organizationname => $orgname, workspacename => $workspace }, |
|
102
|
|
|
|
|
|
|
); |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
if ($self->{'soap'}->fault){ $self->{'LASTERROR'} = $self->{'soap'}->fault } |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
bless($self, $class); |
|
107
|
|
|
|
|
|
|
return($self) |
|
108
|
|
|
|
|
|
|
} |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 ConfigurationCapture |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This method captures a Workspace configuration and saves it to a specified Lab Manager storage server with a name. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head3 Arguments |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=over 4 |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item * New library name - The name that you want the captured config to be. |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=back |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=cut |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
sub ConfigurationCapture |
|
129
|
|
|
|
|
|
|
{ |
|
130
|
|
|
|
|
|
|
my($self) = shift; |
|
131
|
|
|
|
|
|
|
my($configID) = shift; |
|
132
|
|
|
|
|
|
|
my($newLibName) = shift; |
|
133
|
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
$self->{'ConfigurationCapture'} = |
|
135
|
|
|
|
|
|
|
$self->{'soap'}->ConfigurationCapture( |
|
136
|
|
|
|
|
|
|
$self->{'auth_header'}, |
|
137
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID )->type('s:int'), |
|
138
|
|
|
|
|
|
|
SOAP::Data->name('newLibraryName' => "${newLibName}")->type('s:string') |
|
139
|
|
|
|
|
|
|
); |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
if ($self->{'ConfigurationCapture'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationCapture'}->fault } |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
return $self->{'ConfigurationCapture'}->result; |
|
144
|
|
|
|
|
|
|
} |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=head2 ConfigurationCheckout |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
This method checks out a configuration from the configuration library and moves it to the Workspace under a different name. It returns the ID of the checked out configuration in the WorkSpace. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=head3 Arguments |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=over 4 |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * New workspace name - The name you want the new config in the workspace to be. |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=back |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=cut |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
sub ConfigurationCheckout |
|
164
|
|
|
|
|
|
|
{ |
|
165
|
|
|
|
|
|
|
my($self) = shift; |
|
166
|
|
|
|
|
|
|
my($configID) = shift; |
|
167
|
|
|
|
|
|
|
my($configName) = shift; |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
$self->{'ConfigurationCheckout'} = |
|
171
|
|
|
|
|
|
|
$self->{'soap'}->ConfigurationCheckout( |
|
172
|
|
|
|
|
|
|
$self->{'auth_header'}, SOAP::Data->name('configurationId' => $configID )->type('s:int'), |
|
173
|
|
|
|
|
|
|
SOAP::Data->name('workspaceName' => ${configName} )->type('s:string') |
|
174
|
|
|
|
|
|
|
); |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
if ($self->{'ConfigurationCheckout'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationCheckout'}->fault } |
|
177
|
|
|
|
|
|
|
return $self->{'ConfigurationCheckout'}->result; |
|
178
|
|
|
|
|
|
|
} |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head2 ConfigurationClone |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
This method clones a Workspace configuration, saves it in a storage server, and makes it visible in the Workspace under the new name. Arguements: |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=head3 Arguments |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=over 4 |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item * New workspace name - The name of the clone that is being created. |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=back |
|
193
|
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=cut |
|
195
|
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
sub ConfigurationClone |
|
197
|
|
|
|
|
|
|
{ |
|
198
|
|
|
|
|
|
|
my($self) = shift; |
|
199
|
|
|
|
|
|
|
my($configID) = shift; |
|
200
|
|
|
|
|
|
|
my($newWSName) = shift; |
|
201
|
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
$self->{'ConfigurationClone'} = |
|
203
|
|
|
|
|
|
|
$self->{'soap'}->ConfigurationClone($self->{'auth_header'}, |
|
204
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID )->type('s:int'), |
|
205
|
|
|
|
|
|
|
SOAP::Data->name('newWorkspaceName' => "${newWSName}" )->type('s:string') ); |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
if ($self->{'ConfigurationClone'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationClone'}->fault } |
|
208
|
|
|
|
|
|
|
return $self->{'ConfigurationClone'}->result; |
|
209
|
|
|
|
|
|
|
} |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=head2 ConfigurationDelete |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
This method deletes a configuration from the Workspace. You cannot delete a deployed configuration. Doesn't return anything. Arguments: |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
=head3 Arguments |
|
216
|
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
=over 4 |
|
218
|
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
=item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. |
|
220
|
|
|
|
|
|
|
|
|
221
|
|
|
|
|
|
|
=back |
|
222
|
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
=cut |
|
224
|
|
|
|
|
|
|
|
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
sub ConfigurationDelete |
|
227
|
|
|
|
|
|
|
{ |
|
228
|
|
|
|
|
|
|
my($self) = shift; |
|
229
|
|
|
|
|
|
|
my($configID) = shift; |
|
230
|
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
$self->{'ConfigurationDelete'} = |
|
232
|
|
|
|
|
|
|
$self->{'soap'}->ConfigurationDelete( $self->{'auth_header'}, |
|
233
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID)->type('s:int') ); |
|
234
|
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
if ($self->{'ConfigurationDelete'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationDelete'}->fault } |
|
236
|
|
|
|
|
|
|
$self->{'ConfigurationDelete'}->result ? return $self->{'ConfigurationDelete'}->result : return $self->{'LASTERROR'}; |
|
237
|
|
|
|
|
|
|
} |
|
238
|
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
|
|
240
|
|
|
|
|
|
|
=head2 ConfigurationDeploy |
|
241
|
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
This method allows you to deploy an undeployed configuration which resides in the Workspace. |
|
243
|
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
=head3 Arguments |
|
245
|
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
=over 4 |
|
247
|
|
|
|
|
|
|
|
|
248
|
|
|
|
|
|
|
=item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. |
|
249
|
|
|
|
|
|
|
|
|
250
|
|
|
|
|
|
|
=item * Fencemode - 1 = not fenced; 2 = block traffic in and out; 3 = allow out ; 4 allow in and out |
|
251
|
|
|
|
|
|
|
|
|
252
|
|
|
|
|
|
|
=back |
|
253
|
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
=cut |
|
255
|
|
|
|
|
|
|
|
|
256
|
|
|
|
|
|
|
sub ConfigurationDeploy |
|
257
|
|
|
|
|
|
|
{ |
|
258
|
|
|
|
|
|
|
my($self) = shift; |
|
259
|
|
|
|
|
|
|
my($configID) = shift; |
|
260
|
|
|
|
|
|
|
my($fencemode) = shift; # 1 = not fenced; 2 = block traffic in and out; 3 = allow out ; 4 allow in and out |
|
261
|
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
$self->{'ConfigurationDeploy'} = |
|
263
|
|
|
|
|
|
|
$self->{'soap'}->ConfigurationDeploy( $self->{'auth_header'}, |
|
264
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID )->type('s:int'), |
|
265
|
|
|
|
|
|
|
SOAP::Data->name('isCached' => "false")->type('s:boolean'), |
|
266
|
|
|
|
|
|
|
SOAP::Data->name('fenceMode' => "${fencemode}")->type('s:int') ); |
|
267
|
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
if ($self->{'ConfigurationDeploy'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationDeploy'}->fault } |
|
269
|
|
|
|
|
|
|
return $self->{'ConfigurationDeploy'}->result; |
|
270
|
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
} |
|
272
|
|
|
|
|
|
|
|
|
273
|
|
|
|
|
|
|
=head2 ConfigurationDeployEx2 |
|
274
|
|
|
|
|
|
|
|
|
275
|
|
|
|
|
|
|
This method allows you to deploy an undeployed configuration which resides in the Workspace to a Distributed Virtual Switch. Arguments: |
|
276
|
|
|
|
|
|
|
|
|
277
|
|
|
|
|
|
|
=head3 Arguments |
|
278
|
|
|
|
|
|
|
|
|
279
|
|
|
|
|
|
|
=over 4 |
|
280
|
|
|
|
|
|
|
|
|
281
|
|
|
|
|
|
|
=item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. |
|
282
|
|
|
|
|
|
|
|
|
283
|
|
|
|
|
|
|
=item * Network ID |
|
284
|
|
|
|
|
|
|
|
|
285
|
|
|
|
|
|
|
=item * Fencemode(string) - Choices: Nonfenced or FenceBlockInAndOut or FenceAllowOutOnly or FenceAllowInAndOut |
|
286
|
|
|
|
|
|
|
|
|
287
|
|
|
|
|
|
|
=back |
|
288
|
|
|
|
|
|
|
|
|
289
|
|
|
|
|
|
|
=cut |
|
290
|
|
|
|
|
|
|
|
|
291
|
|
|
|
|
|
|
sub ConfigurationDeployEx2 |
|
292
|
|
|
|
|
|
|
{ |
|
293
|
|
|
|
|
|
|
my $self = shift; |
|
294
|
|
|
|
|
|
|
my $configID = shift; |
|
295
|
|
|
|
|
|
|
my $networkId = shift; |
|
296
|
|
|
|
|
|
|
my $fenceMode = 'FenceAllowInAndOut'; |
|
297
|
|
|
|
|
|
|
|
|
298
|
|
|
|
|
|
|
my $net_elem = SOAP::Data->name( 'FenceNetworkOption' => \SOAP::Data->value( |
|
299
|
|
|
|
|
|
|
SOAP::Data->name('configuredNetID' => ${networkId})->type('s:int'), |
|
300
|
|
|
|
|
|
|
SOAP::Data->name('DeployFenceMode'=> ${fenceMode})->type('tns:SOAPFenceMode') |
|
301
|
|
|
|
|
|
|
) |
|
302
|
|
|
|
|
|
|
); |
|
303
|
|
|
|
|
|
|
|
|
304
|
|
|
|
|
|
|
my $bridge_elem = SOAP::Data->name( 'BridgeNetworkOption' => \SOAP::Data->value( |
|
305
|
|
|
|
|
|
|
SOAP::Data->name('externalNetId' => "${networkId}")->type('s:int') |
|
306
|
|
|
|
|
|
|
) |
|
307
|
|
|
|
|
|
|
); |
|
308
|
|
|
|
|
|
|
|
|
309
|
|
|
|
|
|
|
my @net_array; |
|
310
|
|
|
|
|
|
|
my @bridge_array; |
|
311
|
|
|
|
|
|
|
push(@net_array,$net_elem); |
|
312
|
|
|
|
|
|
|
push(@bridge_array,$bridge_elem); |
|
313
|
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
$self->{'ConfigurationDeployEx2'} = |
|
315
|
|
|
|
|
|
|
$self->{'soap'}->ConfigurationDeployEx2( $self->{'auth_header'}, |
|
316
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID )->type('s:int'), |
|
317
|
|
|
|
|
|
|
SOAP::Data->name('honorBootOrders' => 1)->type('s:boolean'), |
|
318
|
|
|
|
|
|
|
SOAP::Data->name('startAfterDeploy' => 1)->type('s:boolean'), |
|
319
|
|
|
|
|
|
|
SOAP::Data->name('fenceNetworkOptions' => \SOAP::Data->value( @net_array )->type('tns:ArrayOfFenceNetworkOption')), |
|
320
|
|
|
|
|
|
|
#Do not uncomment unless you know how to make it work: |
|
321
|
|
|
|
|
|
|
#SOAP::Data->name('bridgeNetworkOptions' =>\SOAP::Data->value( @bridge_array )->type('tns:ArrayOfBridgeNetworkOption')), |
|
322
|
|
|
|
|
|
|
SOAP::Data->name('isCrossHost' => 1)->type('s:boolean') |
|
323
|
|
|
|
|
|
|
); |
|
324
|
|
|
|
|
|
|
|
|
325
|
|
|
|
|
|
|
if ($self->{'ConfigurationDeployEx2'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationDeployEx2'}->fault } |
|
326
|
|
|
|
|
|
|
return $self->{'ConfigurationDeployEx2'}->result; |
|
327
|
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
} |
|
329
|
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
=head2 ConfigurationPerformAction |
|
331
|
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
This method performs one of the following configuration actions as indicated by the action identifier: |
|
333
|
|
|
|
|
|
|
|
|
334
|
|
|
|
|
|
|
=over 4 |
|
335
|
|
|
|
|
|
|
|
|
336
|
|
|
|
|
|
|
=item 1 Power On. Turns on a configuration. |
|
337
|
|
|
|
|
|
|
|
|
338
|
|
|
|
|
|
|
=item 2 Power Off. Turns off a configuration. Nothing is saved. |
|
339
|
|
|
|
|
|
|
|
|
340
|
|
|
|
|
|
|
=item 3 Suspend. Freezes the CPU and state of a configuration. |
|
341
|
|
|
|
|
|
|
|
|
342
|
|
|
|
|
|
|
=item 4 Resume. Resumes a suspended configuration. |
|
343
|
|
|
|
|
|
|
|
|
344
|
|
|
|
|
|
|
=item 5 Reset. Reboots a configuration. |
|
345
|
|
|
|
|
|
|
|
|
346
|
|
|
|
|
|
|
=item 6 Snapshot. Saves a configuration state at a specific point in time. |
|
347
|
|
|
|
|
|
|
|
|
348
|
|
|
|
|
|
|
=back |
|
349
|
|
|
|
|
|
|
|
|
350
|
|
|
|
|
|
|
=head3 Arguments |
|
351
|
|
|
|
|
|
|
|
|
352
|
|
|
|
|
|
|
=over 4 |
|
353
|
|
|
|
|
|
|
|
|
354
|
|
|
|
|
|
|
=item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. |
|
355
|
|
|
|
|
|
|
|
|
356
|
|
|
|
|
|
|
=item * Action - use a numerical value from the list above. |
|
357
|
|
|
|
|
|
|
|
|
358
|
|
|
|
|
|
|
=back |
|
359
|
|
|
|
|
|
|
|
|
360
|
|
|
|
|
|
|
=cut |
|
361
|
|
|
|
|
|
|
|
|
362
|
|
|
|
|
|
|
sub ConfigurationPerformAction |
|
363
|
|
|
|
|
|
|
{ |
|
364
|
|
|
|
|
|
|
my($self) = shift; |
|
365
|
|
|
|
|
|
|
my($configID) = shift; |
|
366
|
|
|
|
|
|
|
my($action) = shift; # 1-Pwr On, 2-Pwr off, 3-Suspend, 4-Resume, 5-Reset, 6-Snapshot |
|
367
|
|
|
|
|
|
|
$self->{'ConfigurationPerformAction'} = |
|
368
|
|
|
|
|
|
|
$self->{'soap'}->ConfigurationPerformAction( $self->{'auth_header'}, |
|
369
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID )->type('s:int'), |
|
370
|
|
|
|
|
|
|
SOAP::Data->name('action' => $action )->type('s:int') ); |
|
371
|
|
|
|
|
|
|
|
|
372
|
|
|
|
|
|
|
if ($self->{'ConfigurationPerformAction'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationPerformAction'}->fault } |
|
373
|
|
|
|
|
|
|
} |
|
374
|
|
|
|
|
|
|
|
|
375
|
|
|
|
|
|
|
=head2 ConfigurationSetPublicPrivate |
|
376
|
|
|
|
|
|
|
|
|
377
|
|
|
|
|
|
|
Use this call to set the state of a configuration to public” or private.” If the configuration state is public, others are able to access this configuration. If the configuration is private, only its owner can view it. |
|
378
|
|
|
|
|
|
|
|
|
379
|
|
|
|
|
|
|
=head3 Arguments |
|
380
|
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
=over 4 |
|
382
|
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
=item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. |
|
384
|
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
=item * True or False (boolean) - Accepts true | false | 1 | 0 |
|
386
|
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=back |
|
388
|
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
=cut |
|
390
|
|
|
|
|
|
|
|
|
391
|
|
|
|
|
|
|
sub ConfigurationSetPublicPrivate |
|
392
|
|
|
|
|
|
|
{ |
|
393
|
|
|
|
|
|
|
|
|
394
|
|
|
|
|
|
|
my($self) = shift; |
|
395
|
|
|
|
|
|
|
my($configID) = shift; |
|
396
|
|
|
|
|
|
|
my($trueOrFalse) =shift; |
|
397
|
|
|
|
|
|
|
|
|
398
|
|
|
|
|
|
|
$self->{'ConfigurationSetPublicPrivate'} = |
|
399
|
|
|
|
|
|
|
$self->{'soap'}->ConfigurationSetPublicPrivate( $self->{'auth_header'}, |
|
400
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID )->type('s:int'), |
|
401
|
|
|
|
|
|
|
SOAP::Data->name('isPublic' => $trueOrFalse)->type('s:boolean') ); |
|
402
|
|
|
|
|
|
|
|
|
403
|
|
|
|
|
|
|
if ($self->{'ConfigurationSetPublicPrivate'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationSetPublicPrivate'}->fault } |
|
404
|
|
|
|
|
|
|
} |
|
405
|
|
|
|
|
|
|
|
|
406
|
|
|
|
|
|
|
=head2 ConfigurationUndeploy |
|
407
|
|
|
|
|
|
|
|
|
408
|
|
|
|
|
|
|
Undeploys a configuration in the Workspace. Nothing is returned. |
|
409
|
|
|
|
|
|
|
|
|
410
|
|
|
|
|
|
|
=head3 Arguments |
|
411
|
|
|
|
|
|
|
|
|
412
|
|
|
|
|
|
|
=over 4 |
|
413
|
|
|
|
|
|
|
|
|
414
|
|
|
|
|
|
|
=item * Configuration ID - Use the GetConfigurationByName method to retrieve this if you do not know it. |
|
415
|
|
|
|
|
|
|
|
|
416
|
|
|
|
|
|
|
=back |
|
417
|
|
|
|
|
|
|
|
|
418
|
|
|
|
|
|
|
=cut |
|
419
|
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
sub ConfigurationUndeploy |
|
421
|
|
|
|
|
|
|
{ |
|
422
|
|
|
|
|
|
|
my($self) = shift; |
|
423
|
|
|
|
|
|
|
my($configID) = shift; |
|
424
|
|
|
|
|
|
|
|
|
425
|
|
|
|
|
|
|
$self->{'ConfigurationUndeploy'} = |
|
426
|
|
|
|
|
|
|
$self->{'soap'}->ConfigurationUndeploy( $self->{'auth_header'}, |
|
427
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $configID )->type('s:int')); |
|
428
|
|
|
|
|
|
|
|
|
429
|
|
|
|
|
|
|
if ($self->{'ConfigurationUndeploy'}->fault){ $self->{'LASTERROR'} = $self->{'ConfigurationUndeploy'}->fault } |
|
430
|
|
|
|
|
|
|
} |
|
431
|
|
|
|
|
|
|
|
|
432
|
|
|
|
|
|
|
=head2 GetConfiguration |
|
433
|
|
|
|
|
|
|
|
|
434
|
|
|
|
|
|
|
This method prints a list of attributes of a Configuration matching the configuration ID passed. It will return an array if you specify which attributes you would like to access |
|
435
|
|
|
|
|
|
|
|
|
436
|
|
|
|
|
|
|
=head3 Arguments |
|
437
|
|
|
|
|
|
|
|
|
438
|
|
|
|
|
|
|
=over 4 |
|
439
|
|
|
|
|
|
|
|
|
440
|
|
|
|
|
|
|
=item * Config Name |
|
441
|
|
|
|
|
|
|
|
|
442
|
|
|
|
|
|
|
=item * Attribute(s) (optional) - if left blank, prints out and returns an array of all attributes. |
|
443
|
|
|
|
|
|
|
|
|
444
|
|
|
|
|
|
|
=back |
|
445
|
|
|
|
|
|
|
|
|
446
|
|
|
|
|
|
|
=head3 Attributes |
|
447
|
|
|
|
|
|
|
|
|
448
|
|
|
|
|
|
|
=over 4 |
|
449
|
|
|
|
|
|
|
|
|
450
|
|
|
|
|
|
|
=item * mustBeFenced |
|
451
|
|
|
|
|
|
|
|
|
452
|
|
|
|
|
|
|
=item * autoDeleteDateTime |
|
453
|
|
|
|
|
|
|
|
|
454
|
|
|
|
|
|
|
=item * bucketName |
|
455
|
|
|
|
|
|
|
|
|
456
|
|
|
|
|
|
|
=item * name |
|
457
|
|
|
|
|
|
|
|
|
458
|
|
|
|
|
|
|
=item * autoDeleteInMilliSeconds |
|
459
|
|
|
|
|
|
|
|
|
460
|
|
|
|
|
|
|
=item * description |
|
461
|
|
|
|
|
|
|
|
|
462
|
|
|
|
|
|
|
=item * isDeployed |
|
463
|
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
=item * fenceMode |
|
465
|
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
=item * id |
|
467
|
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
=item * type |
|
469
|
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
=item * isPublic |
|
471
|
|
|
|
|
|
|
|
|
472
|
|
|
|
|
|
|
=item * dateCreated |
|
473
|
|
|
|
|
|
|
|
|
474
|
|
|
|
|
|
|
=back |
|
475
|
|
|
|
|
|
|
|
|
476
|
|
|
|
|
|
|
=cut |
|
477
|
|
|
|
|
|
|
|
|
478
|
|
|
|
|
|
|
|
|
479
|
|
|
|
|
|
|
sub GetConfiguration |
|
480
|
|
|
|
|
|
|
{ |
|
481
|
|
|
|
|
|
|
my($self) = shift; |
|
482
|
|
|
|
|
|
|
my($config) = shift; |
|
483
|
|
|
|
|
|
|
push(my(@attribs), @_); |
|
484
|
|
|
|
|
|
|
my @myattribs; |
|
485
|
|
|
|
|
|
|
|
|
486
|
|
|
|
|
|
|
$self->{'GetConfiguration'} = |
|
487
|
|
|
|
|
|
|
$self->{'soap'}->GetConfiguration( $self->{'auth_header'}, |
|
488
|
|
|
|
|
|
|
SOAP::Data->name('id' => ${config})->type('s:int')); |
|
489
|
|
|
|
|
|
|
|
|
490
|
|
|
|
|
|
|
if ($self->{'GetConfiguration'}->fault){ $self->{'LASTERROR'} = $self->{'GetConfiguration'}->fault } |
|
491
|
|
|
|
|
|
|
|
|
492
|
|
|
|
|
|
|
my($r) = $self->{'GetConfiguration'}->result; |
|
493
|
|
|
|
|
|
|
|
|
494
|
|
|
|
|
|
|
if (!@attribs) #If nothing is passed to this method, print everything |
|
495
|
|
|
|
|
|
|
{ |
|
496
|
|
|
|
|
|
|
foreach my $key ( keys(%$r) ) |
|
497
|
|
|
|
|
|
|
{ |
|
498
|
|
|
|
|
|
|
print "$key: $$r{$key}\n "; |
|
499
|
|
|
|
|
|
|
push(@myattribs,$$r{$key}); |
|
500
|
|
|
|
|
|
|
} |
|
501
|
|
|
|
|
|
|
} |
|
502
|
|
|
|
|
|
|
else |
|
503
|
|
|
|
|
|
|
{ |
|
504
|
|
|
|
|
|
|
foreach my $key ( @attribs ) |
|
505
|
|
|
|
|
|
|
{ |
|
506
|
|
|
|
|
|
|
push(@myattribs,$$r{$key}); |
|
507
|
|
|
|
|
|
|
} |
|
508
|
|
|
|
|
|
|
return (@myattribs); |
|
509
|
|
|
|
|
|
|
} |
|
510
|
|
|
|
|
|
|
} |
|
511
|
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
=head2 GetMachine |
|
513
|
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
This call takes the numeric identifier of a machine and returns its corresponding Machine object. |
|
515
|
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
=head3 Arguments |
|
517
|
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
=over 4 |
|
519
|
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
=item * Machine ID - Use GetMachineByName to retrieve this |
|
521
|
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
=item * Attribute(s) (optional) - if left blank, prints out and returns an array of all attributes. |
|
523
|
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
=back |
|
525
|
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
=head3 Attributes |
|
527
|
|
|
|
|
|
|
|
|
528
|
|
|
|
|
|
|
=over 4 |
|
529
|
|
|
|
|
|
|
|
|
530
|
|
|
|
|
|
|
=item * configID |
|
531
|
|
|
|
|
|
|
|
|
532
|
|
|
|
|
|
|
=item * macAddress |
|
533
|
|
|
|
|
|
|
|
|
534
|
|
|
|
|
|
|
=item * status |
|
535
|
|
|
|
|
|
|
|
|
536
|
|
|
|
|
|
|
=item * OwnerFullName |
|
537
|
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
=item * name |
|
539
|
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
=item * description |
|
541
|
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
=item * isDeployed |
|
543
|
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
=item * internalIP |
|
545
|
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
=item * memory |
|
547
|
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
=item * DatastoreNameResidesOn |
|
549
|
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
=item * id |
|
551
|
|
|
|
|
|
|
|
|
552
|
|
|
|
|
|
|
=back |
|
553
|
|
|
|
|
|
|
|
|
554
|
|
|
|
|
|
|
=cut |
|
555
|
|
|
|
|
|
|
|
|
556
|
|
|
|
|
|
|
sub GetMachine |
|
557
|
|
|
|
|
|
|
{ |
|
558
|
|
|
|
|
|
|
my($self) = shift; |
|
559
|
|
|
|
|
|
|
my($config) = shift; |
|
560
|
|
|
|
|
|
|
push(my(@attribs), @_); |
|
561
|
|
|
|
|
|
|
my @myattribs; |
|
562
|
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
$self->{'GetMachine'} = |
|
564
|
|
|
|
|
|
|
$self->{'soap'}->GetMachine( $self->{'auth_header'}, |
|
565
|
|
|
|
|
|
|
SOAP::Data->name('machineId' => ${config})->type('s:int')); |
|
566
|
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
if ($self->{'GetMachine'}->fault){ $self->{'LASTERROR'} = $self->{'GetMachine'}->fault } |
|
568
|
|
|
|
|
|
|
my($r) = $self->{'GetMachine'}->result; |
|
569
|
|
|
|
|
|
|
|
|
570
|
|
|
|
|
|
|
if (!@attribs) #If nothing is passed to this method, print everything |
|
571
|
|
|
|
|
|
|
{ |
|
572
|
|
|
|
|
|
|
foreach my $key ( keys(%$r) ) |
|
573
|
|
|
|
|
|
|
{ |
|
574
|
|
|
|
|
|
|
print "$key: $$r{$key}\n "; |
|
575
|
|
|
|
|
|
|
push(@myattribs,$$r{$key}); |
|
576
|
|
|
|
|
|
|
} |
|
577
|
|
|
|
|
|
|
} |
|
578
|
|
|
|
|
|
|
else |
|
579
|
|
|
|
|
|
|
{ |
|
580
|
|
|
|
|
|
|
foreach my $key ( @attribs ) |
|
581
|
|
|
|
|
|
|
{ |
|
582
|
|
|
|
|
|
|
push(@myattribs,$$r{$key}); |
|
583
|
|
|
|
|
|
|
} |
|
584
|
|
|
|
|
|
|
return (@myattribs); |
|
585
|
|
|
|
|
|
|
} |
|
586
|
|
|
|
|
|
|
} |
|
587
|
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
|
|
589
|
|
|
|
|
|
|
=head2 GetMachineByName |
|
590
|
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
This call takes a configuration identifier and a machine name and returns the matching Machine object. |
|
592
|
|
|
|
|
|
|
|
|
593
|
|
|
|
|
|
|
=head3 Arguments |
|
594
|
|
|
|
|
|
|
|
|
595
|
|
|
|
|
|
|
=over 4 |
|
596
|
|
|
|
|
|
|
|
|
597
|
|
|
|
|
|
|
=item * Configuration ID - Config where Guest VM lives |
|
598
|
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
=item * Name of guest |
|
600
|
|
|
|
|
|
|
|
|
601
|
|
|
|
|
|
|
=item * Attribute(s) (optional) - if left blank, prints out and returns an array of all attributes. |
|
602
|
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
=back |
|
604
|
|
|
|
|
|
|
|
|
605
|
|
|
|
|
|
|
=head3 Attributes |
|
606
|
|
|
|
|
|
|
|
|
607
|
|
|
|
|
|
|
=over 4 |
|
608
|
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
=item * configID |
|
610
|
|
|
|
|
|
|
|
|
611
|
|
|
|
|
|
|
=item * macAddress |
|
612
|
|
|
|
|
|
|
|
|
613
|
|
|
|
|
|
|
=item * status |
|
614
|
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
=item * OwnerFullName |
|
616
|
|
|
|
|
|
|
|
|
617
|
|
|
|
|
|
|
=item * name |
|
618
|
|
|
|
|
|
|
|
|
619
|
|
|
|
|
|
|
=item * description |
|
620
|
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
=item * isDeployed |
|
622
|
|
|
|
|
|
|
|
|
623
|
|
|
|
|
|
|
=item * internalIP |
|
624
|
|
|
|
|
|
|
|
|
625
|
|
|
|
|
|
|
=item * memory |
|
626
|
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
=item * DatastoreNameResidesOn |
|
628
|
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
=item * id |
|
630
|
|
|
|
|
|
|
|
|
631
|
|
|
|
|
|
|
=back |
|
632
|
|
|
|
|
|
|
|
|
633
|
|
|
|
|
|
|
=cut |
|
634
|
|
|
|
|
|
|
|
|
635
|
|
|
|
|
|
|
sub GetMachineByName |
|
636
|
|
|
|
|
|
|
{ |
|
637
|
|
|
|
|
|
|
my($self) = shift; |
|
638
|
|
|
|
|
|
|
my($config) = shift; |
|
639
|
|
|
|
|
|
|
my($name) = shift; |
|
640
|
|
|
|
|
|
|
push(my(@attribs), @_); |
|
641
|
|
|
|
|
|
|
my @myattribs; |
|
642
|
|
|
|
|
|
|
|
|
643
|
|
|
|
|
|
|
$self->{'GetMachineByName'} = |
|
644
|
|
|
|
|
|
|
$self->{'soap'}->GetMachineByName( $self->{'auth_header'}, |
|
645
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => ${config})->type('s:int'), |
|
646
|
|
|
|
|
|
|
SOAP::Data->name('name' => ${name})->type('s:string')); |
|
647
|
|
|
|
|
|
|
|
|
648
|
|
|
|
|
|
|
if ($self->{'GetMachineByName'}->fault){ $self->{'LASTERROR'} = $self->{'GetMachineByName'}->fault } |
|
649
|
|
|
|
|
|
|
|
|
650
|
|
|
|
|
|
|
my($r) = $self->{'GetMachineByName'}->result; |
|
651
|
|
|
|
|
|
|
|
|
652
|
|
|
|
|
|
|
|
|
653
|
|
|
|
|
|
|
if (!@attribs) #If nothing is passed to this method, print everything |
|
654
|
|
|
|
|
|
|
{ |
|
655
|
|
|
|
|
|
|
foreach my $key ( keys(%$r) ) |
|
656
|
|
|
|
|
|
|
{ |
|
657
|
|
|
|
|
|
|
print "$key: $$r{$key}\n "; |
|
658
|
|
|
|
|
|
|
push(@myattribs,$$r{$key}); |
|
659
|
|
|
|
|
|
|
} |
|
660
|
|
|
|
|
|
|
} |
|
661
|
|
|
|
|
|
|
else |
|
662
|
|
|
|
|
|
|
{ |
|
663
|
|
|
|
|
|
|
foreach my $key ( @attribs ) |
|
664
|
|
|
|
|
|
|
{ |
|
665
|
|
|
|
|
|
|
push(@myattribs,$$r{$key}); |
|
666
|
|
|
|
|
|
|
} |
|
667
|
|
|
|
|
|
|
return (@myattribs); |
|
668
|
|
|
|
|
|
|
} |
|
669
|
|
|
|
|
|
|
} |
|
670
|
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
=head2 GetSingleConfigurationByName |
|
672
|
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
This call takes a configuration name, searches for it in both the configuration library and workspace and returns its corresponding Configuration object. Returns an array of attributes or one or more specified attributes. |
|
674
|
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
=head3 Arguments |
|
676
|
|
|
|
|
|
|
|
|
677
|
|
|
|
|
|
|
=over 4 |
|
678
|
|
|
|
|
|
|
|
|
679
|
|
|
|
|
|
|
=item * Configuration name |
|
680
|
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
=item * Attribute(s) (optional) - if left blank, prints out and returns an array of all attributes. |
|
682
|
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
=back |
|
684
|
|
|
|
|
|
|
|
|
685
|
|
|
|
|
|
|
=head3 Attributes |
|
686
|
|
|
|
|
|
|
|
|
687
|
|
|
|
|
|
|
=over 4 |
|
688
|
|
|
|
|
|
|
|
|
689
|
|
|
|
|
|
|
=item * mustBeFenced |
|
690
|
|
|
|
|
|
|
|
|
691
|
|
|
|
|
|
|
=item * autoDeleteDateTime |
|
692
|
|
|
|
|
|
|
|
|
693
|
|
|
|
|
|
|
=item * bucketName (aka workspace) |
|
694
|
|
|
|
|
|
|
|
|
695
|
|
|
|
|
|
|
=item * name |
|
696
|
|
|
|
|
|
|
|
|
697
|
|
|
|
|
|
|
=item * autoDeleteInMilliSeconds |
|
698
|
|
|
|
|
|
|
|
|
699
|
|
|
|
|
|
|
=item * description |
|
700
|
|
|
|
|
|
|
|
|
701
|
|
|
|
|
|
|
=item * isDeployed |
|
702
|
|
|
|
|
|
|
|
|
703
|
|
|
|
|
|
|
=item * fenceMode |
|
704
|
|
|
|
|
|
|
|
|
705
|
|
|
|
|
|
|
=item * id |
|
706
|
|
|
|
|
|
|
|
|
707
|
|
|
|
|
|
|
=item * type |
|
708
|
|
|
|
|
|
|
|
|
709
|
|
|
|
|
|
|
=item * isPublic |
|
710
|
|
|
|
|
|
|
|
|
711
|
|
|
|
|
|
|
=item * dateCreated |
|
712
|
|
|
|
|
|
|
|
|
713
|
|
|
|
|
|
|
=back |
|
714
|
|
|
|
|
|
|
|
|
715
|
|
|
|
|
|
|
=cut |
|
716
|
|
|
|
|
|
|
|
|
717
|
|
|
|
|
|
|
|
|
718
|
|
|
|
|
|
|
sub GetSingleConfigurationByName |
|
719
|
|
|
|
|
|
|
{ |
|
720
|
|
|
|
|
|
|
my($self) = shift; |
|
721
|
|
|
|
|
|
|
my($config) = shift; |
|
722
|
|
|
|
|
|
|
push(my(@attribs), @_); |
|
723
|
|
|
|
|
|
|
my @myattribs; |
|
724
|
|
|
|
|
|
|
|
|
725
|
|
|
|
|
|
|
$self->{'GetSingleConfigurationByName'} = |
|
726
|
|
|
|
|
|
|
$self->{'soap'}->GetSingleConfigurationByName( $self->{'auth_header'}, |
|
727
|
|
|
|
|
|
|
SOAP::Data->name('name' => ${config})->type('s:string')); |
|
728
|
|
|
|
|
|
|
|
|
729
|
|
|
|
|
|
|
if ($self->{'GetSingleConfigurationByName'}->fault){ $self->{'LASTERROR'} = $self->{'GetSingleConfigurationByName'}->fault } |
|
730
|
|
|
|
|
|
|
|
|
731
|
|
|
|
|
|
|
|
|
732
|
|
|
|
|
|
|
|
|
733
|
|
|
|
|
|
|
my($r) = $self->{'GetSingleConfigurationByName'}->result; |
|
734
|
|
|
|
|
|
|
getLastSOAPError(); |
|
735
|
|
|
|
|
|
|
|
|
736
|
|
|
|
|
|
|
if (!@attribs) #If nothing is passed to this method, print all the info for the config |
|
737
|
|
|
|
|
|
|
{ |
|
738
|
|
|
|
|
|
|
foreach my $key ( keys(%$r) ) |
|
739
|
|
|
|
|
|
|
{ |
|
740
|
|
|
|
|
|
|
print "$key: $$r{$key}\n "; |
|
741
|
|
|
|
|
|
|
push( @myattribs,$$r{$key}); |
|
742
|
|
|
|
|
|
|
} |
|
743
|
|
|
|
|
|
|
} |
|
744
|
|
|
|
|
|
|
else |
|
745
|
|
|
|
|
|
|
{ |
|
746
|
|
|
|
|
|
|
foreach my $key ( @attribs ) |
|
747
|
|
|
|
|
|
|
{ |
|
748
|
|
|
|
|
|
|
push( @myattribs,$$r{$key}); |
|
749
|
|
|
|
|
|
|
} |
|
750
|
|
|
|
|
|
|
return ( @myattribs); |
|
751
|
|
|
|
|
|
|
} |
|
752
|
|
|
|
|
|
|
} |
|
753
|
|
|
|
|
|
|
|
|
754
|
|
|
|
|
|
|
=head2 ListConfigurations |
|
755
|
|
|
|
|
|
|
|
|
756
|
|
|
|
|
|
|
This method prints a list of Type Configuration. Depending on configuration type requested, one object is returned for each configuration in the configuration library or each configuration in the workspace. |
|
757
|
|
|
|
|
|
|
|
|
758
|
|
|
|
|
|
|
=head3 Arguments |
|
759
|
|
|
|
|
|
|
|
|
760
|
|
|
|
|
|
|
=over 4 |
|
761
|
|
|
|
|
|
|
|
|
762
|
|
|
|
|
|
|
=item * configurationType (Configuration Type must be either 1 for Workspace or 2 for Library) |
|
763
|
|
|
|
|
|
|
|
|
764
|
|
|
|
|
|
|
=back |
|
765
|
|
|
|
|
|
|
|
|
766
|
|
|
|
|
|
|
=cut |
|
767
|
|
|
|
|
|
|
|
|
768
|
|
|
|
|
|
|
|
|
769
|
|
|
|
|
|
|
sub ListConfigurations |
|
770
|
|
|
|
|
|
|
{ |
|
771
|
|
|
|
|
|
|
my($self) = shift; |
|
772
|
|
|
|
|
|
|
my($configType) = shift; #1 =WorkSpace, 2=Library |
|
773
|
|
|
|
|
|
|
unless($configType == 1 || $configType == 2 ) |
|
774
|
|
|
|
|
|
|
{ |
|
775
|
|
|
|
|
|
|
$self->{'LASTERROR'} = "Configuration Type must be either 1 for Workspace or 2 for Library"; |
|
776
|
|
|
|
|
|
|
} |
|
777
|
|
|
|
|
|
|
$self->{'ListConfigurations'} = $self->{'soap'}->ListConfigurations( $self->{'auth_header'}, SOAP::Data->name('configurationType' => $configType)->type('s:int')); |
|
778
|
|
|
|
|
|
|
if ($self->{'ListConfigurations'}->fault){ $self->{'LASTERROR'} = $self->{'ListConfigurations'}->fault } |
|
779
|
|
|
|
|
|
|
my($r) = $self->{'ListConfigurations'}->result; |
|
780
|
|
|
|
|
|
|
my($array) = $$r{'Configuration'}; # returns a reference to an array |
|
781
|
|
|
|
|
|
|
|
|
782
|
|
|
|
|
|
|
if ( $array ) { |
|
783
|
|
|
|
|
|
|
for (my $i=0;$i
|
|
784
|
|
|
|
|
|
|
{ |
|
785
|
|
|
|
|
|
|
|
|
786
|
|
|
|
|
|
|
my $hash = $$array[$i]; #returns a reference to a hash |
|
787
|
|
|
|
|
|
|
foreach my $k (keys(%$hash)) |
|
788
|
|
|
|
|
|
|
{ |
|
789
|
|
|
|
|
|
|
print "\n$k: $$hash{$k}"; |
|
790
|
|
|
|
|
|
|
} |
|
791
|
|
|
|
|
|
|
print "\n*********************\n"; |
|
792
|
|
|
|
|
|
|
} |
|
793
|
|
|
|
|
|
|
} |
|
794
|
|
|
|
|
|
|
|
|
795
|
|
|
|
|
|
|
} |
|
796
|
|
|
|
|
|
|
|
|
797
|
|
|
|
|
|
|
=head2 ListMachines |
|
798
|
|
|
|
|
|
|
|
|
799
|
|
|
|
|
|
|
This method returns an array of type Machine. The method returns one Machine object for each virtual machine in a configuration. |
|
800
|
|
|
|
|
|
|
|
|
801
|
|
|
|
|
|
|
=head3 Arguments |
|
802
|
|
|
|
|
|
|
|
|
803
|
|
|
|
|
|
|
=over 4 |
|
804
|
|
|
|
|
|
|
|
|
805
|
|
|
|
|
|
|
=item * Configuration ID |
|
806
|
|
|
|
|
|
|
|
|
807
|
|
|
|
|
|
|
=back |
|
808
|
|
|
|
|
|
|
|
|
809
|
|
|
|
|
|
|
=cut |
|
810
|
|
|
|
|
|
|
|
|
811
|
|
|
|
|
|
|
|
|
812
|
|
|
|
|
|
|
sub ListMachines # Works but Not completely. Need to test with a config with more than one VM |
|
813
|
|
|
|
|
|
|
{ |
|
814
|
|
|
|
|
|
|
my($self) = shift; |
|
815
|
|
|
|
|
|
|
my($config) = shift; |
|
816
|
|
|
|
|
|
|
$self->{'ListMachines'} = |
|
817
|
|
|
|
|
|
|
$self->{'soap'}->ListMachines( $self->{'auth_header'}, |
|
818
|
|
|
|
|
|
|
SOAP::Data->name('configurationId' => $config)->type('s:int')); |
|
819
|
|
|
|
|
|
|
|
|
820
|
|
|
|
|
|
|
if ($self->{'ListMachines'}->fault){ $self->{'LASTERROR'} = $self->{'ListMachines'}->fault } |
|
821
|
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
my($r) = $self->{'ListMachines'}->result; |
|
823
|
|
|
|
|
|
|
#print keys %{$$r{'Machine'}}; |
|
824
|
|
|
|
|
|
|
#print $$r{'Machine'}{'configID'}; |
|
825
|
|
|
|
|
|
|
my($attribs) = $$r{'Machine'}; # returns a hash |
|
826
|
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
|
|
828
|
|
|
|
|
|
|
foreach my $k (keys(%$attribs)) |
|
829
|
|
|
|
|
|
|
{ |
|
830
|
|
|
|
|
|
|
print "\n$k: $$attribs{$k}"; |
|
831
|
|
|
|
|
|
|
} |
|
832
|
|
|
|
|
|
|
print "\n*********************\n"; |
|
833
|
|
|
|
|
|
|
|
|
834
|
|
|
|
|
|
|
return %$attribs; |
|
835
|
|
|
|
|
|
|
|
|
836
|
|
|
|
|
|
|
|
|
837
|
|
|
|
|
|
|
} |
|
838
|
|
|
|
|
|
|
|
|
839
|
|
|
|
|
|
|
# Not Supported, but works (I believe) |
|
840
|
|
|
|
|
|
|
sub GetConsoleAccessInfo |
|
841
|
|
|
|
|
|
|
{ |
|
842
|
|
|
|
|
|
|
# Attribs: ServerAddress, ServerPort,VmxLocation,Ticket |
|
843
|
|
|
|
|
|
|
my($self) = shift; |
|
844
|
|
|
|
|
|
|
my($machineId) = shift; |
|
845
|
|
|
|
|
|
|
push(my(@attribs), @_); |
|
846
|
|
|
|
|
|
|
my @myattribs; |
|
847
|
|
|
|
|
|
|
|
|
848
|
|
|
|
|
|
|
$self->{'GetConsoleAccessInfo'} = |
|
849
|
|
|
|
|
|
|
$self->{'soap'}->GetConsoleAccessInfo( $self->{'auth_header'}, |
|
850
|
|
|
|
|
|
|
SOAP::Data->name('machineId' => $machineId)->type('s:int')); |
|
851
|
|
|
|
|
|
|
|
|
852
|
|
|
|
|
|
|
if ($self->{'GetConsoleAccessInfo'}->fault){ $self->{'LASTERROR'} = $self->{'GetConsoleAccessInfo'}->fault } |
|
853
|
|
|
|
|
|
|
my($r) = $self->{'GetConsoleAccessInfo'}->result; |
|
854
|
|
|
|
|
|
|
my($attribs) = $r; # returns a hash |
|
855
|
|
|
|
|
|
|
|
|
856
|
|
|
|
|
|
|
if (!@attribs) #If nothing is passed to this method, print all the info for the config |
|
857
|
|
|
|
|
|
|
{ |
|
858
|
|
|
|
|
|
|
foreach my $key ( keys(%$r) ) |
|
859
|
|
|
|
|
|
|
{ |
|
860
|
|
|
|
|
|
|
print "$key: $$r{$key}\n "; |
|
861
|
|
|
|
|
|
|
} |
|
862
|
|
|
|
|
|
|
} |
|
863
|
|
|
|
|
|
|
else |
|
864
|
|
|
|
|
|
|
{ |
|
865
|
|
|
|
|
|
|
foreach my $key ( @attribs ) |
|
866
|
|
|
|
|
|
|
{ |
|
867
|
|
|
|
|
|
|
push( @myattribs,$$r{$key}); |
|
868
|
|
|
|
|
|
|
} |
|
869
|
|
|
|
|
|
|
return ( @myattribs); |
|
870
|
|
|
|
|
|
|
} |
|
871
|
|
|
|
|
|
|
} |
|
872
|
|
|
|
|
|
|
|
|
873
|
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
=head2 LiveLink |
|
875
|
|
|
|
|
|
|
|
|
876
|
|
|
|
|
|
|
This method allows you to create a LiveLink URL to a library configuration. Responds with a livelink URL |
|
877
|
|
|
|
|
|
|
|
|
878
|
|
|
|
|
|
|
=head3 Arguments |
|
879
|
|
|
|
|
|
|
|
|
880
|
|
|
|
|
|
|
=over 4 |
|
881
|
|
|
|
|
|
|
|
|
882
|
|
|
|
|
|
|
=item * config Name |
|
883
|
|
|
|
|
|
|
|
|
884
|
|
|
|
|
|
|
=back |
|
885
|
|
|
|
|
|
|
|
|
886
|
|
|
|
|
|
|
=cut |
|
887
|
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
sub LiveLink |
|
889
|
|
|
|
|
|
|
{ |
|
890
|
|
|
|
|
|
|
my($self) = shift; |
|
891
|
|
|
|
|
|
|
my($configName) = shift; |
|
892
|
|
|
|
|
|
|
$self->{'LiveLink'} = |
|
893
|
|
|
|
|
|
|
$self->{'soap'}->LiveLink( $self->{'auth_header'}, |
|
894
|
|
|
|
|
|
|
SOAP::Data->name('configName' => $configName)->type('s:string')); |
|
895
|
|
|
|
|
|
|
|
|
896
|
|
|
|
|
|
|
if ($self->{'LiveLink'}->fault){ $self->{'LASTERROR'} = $self->{'LiveLink'}->fault } |
|
897
|
|
|
|
|
|
|
my($r) = $self->{'LiveLink'}->result; |
|
898
|
|
|
|
|
|
|
return $r; |
|
899
|
|
|
|
|
|
|
} |
|
900
|
|
|
|
|
|
|
|
|
901
|
|
|
|
|
|
|
=head2 MachinePerformAction |
|
902
|
|
|
|
|
|
|
|
|
903
|
|
|
|
|
|
|
This method performs one of the following machine actions as indicated by the action identifier: |
|
904
|
|
|
|
|
|
|
|
|
905
|
|
|
|
|
|
|
=over 4 |
|
906
|
|
|
|
|
|
|
|
|
907
|
|
|
|
|
|
|
=item 1 Power on. Turns on a machine. |
|
908
|
|
|
|
|
|
|
|
|
909
|
|
|
|
|
|
|
=item 2 Power off. Turns off a machine. Nothing is saved. |
|
910
|
|
|
|
|
|
|
|
|
911
|
|
|
|
|
|
|
=item 3 Suspend. Freezes a machine CPU and state. |
|
912
|
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
=item 4 Resume. Resumes a suspended machine. |
|
914
|
|
|
|
|
|
|
|
|
915
|
|
|
|
|
|
|
=item 5 Reset. Reboots a machine. |
|
916
|
|
|
|
|
|
|
|
|
917
|
|
|
|
|
|
|
=item 6 Snapshot. Save a machine state at a specific point in time. |
|
918
|
|
|
|
|
|
|
|
|
919
|
|
|
|
|
|
|
=item 7 Revert. Returns a machine to a snapshot state. |
|
920
|
|
|
|
|
|
|
|
|
921
|
|
|
|
|
|
|
=item 8 Shutdown. Shuts down a machine before turning off. |
|
922
|
|
|
|
|
|
|
|
|
923
|
|
|
|
|
|
|
=back |
|
924
|
|
|
|
|
|
|
|
|
925
|
|
|
|
|
|
|
=head3 Arguments |
|
926
|
|
|
|
|
|
|
|
|
927
|
|
|
|
|
|
|
=over 4 |
|
928
|
|
|
|
|
|
|
|
|
929
|
|
|
|
|
|
|
=item * Action (use numeral from list aboive) |
|
930
|
|
|
|
|
|
|
|
|
931
|
|
|
|
|
|
|
=item * Machine ID |
|
932
|
|
|
|
|
|
|
|
|
933
|
|
|
|
|
|
|
=back |
|
934
|
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
=cut |
|
936
|
|
|
|
|
|
|
|
|
937
|
|
|
|
|
|
|
sub MachinePerformAction |
|
938
|
|
|
|
|
|
|
{ |
|
939
|
|
|
|
|
|
|
|
|
940
|
|
|
|
|
|
|
my($self) = shift; |
|
941
|
|
|
|
|
|
|
my($configID) = shift; |
|
942
|
|
|
|
|
|
|
# Actions: 1-Pwr On, 2-Pwr off, 3-Suspend, 4-Resume, 5-Reset, 6-Snapshot , 7-Revert, 8-Shutdown |
|
943
|
|
|
|
|
|
|
my($action) = shift; |
|
944
|
|
|
|
|
|
|
$self->{'MachinePerformAction'} = |
|
945
|
|
|
|
|
|
|
$self->{'soap'}->MachinePerformAction( $self->{'auth_header'}, |
|
946
|
|
|
|
|
|
|
SOAP::Data->name('machineId' => $configID )->type('s:int'), |
|
947
|
|
|
|
|
|
|
SOAP::Data->name('action' => $action )->type('s:int') ); |
|
948
|
|
|
|
|
|
|
|
|
949
|
|
|
|
|
|
|
if ( $self->{'MachinePerformAction'}->fault ){ $self->{'LASTERROR'} = $self->{'MachinePerformAction'}->fault } |
|
950
|
|
|
|
|
|
|
} |
|
951
|
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
=head3 getLastSOAPError |
|
953
|
|
|
|
|
|
|
|
|
954
|
|
|
|
|
|
|
Returns last error reported by SOAP service. |
|
955
|
|
|
|
|
|
|
|
|
956
|
|
|
|
|
|
|
=cut |
|
957
|
|
|
|
|
|
|
|
|
958
|
|
|
|
|
|
|
sub getLastSOAPError |
|
959
|
|
|
|
|
|
|
{ |
|
960
|
|
|
|
|
|
|
my($self) = shift; |
|
961
|
|
|
|
|
|
|
if ( $self->{'LASTERROR'} ) |
|
962
|
|
|
|
|
|
|
{ |
|
963
|
|
|
|
|
|
|
return join(': ', 'LabManager SOAP error', |
|
964
|
|
|
|
|
|
|
$self->{'LASTERROR'}->faultcode, |
|
965
|
|
|
|
|
|
|
$self->{'LASTERROR'}->faultstring, |
|
966
|
|
|
|
|
|
|
$self->{'LASTERROR'}->faultdetail |
|
967
|
|
|
|
|
|
|
) . "\n"; |
|
968
|
|
|
|
|
|
|
} |
|
969
|
|
|
|
|
|
|
} |
|
970
|
|
|
|
|
|
|
|
|
971
|
|
|
|
|
|
|
|
|
972
|
|
|
|
|
|
|
|
|
973
|
|
|
|
|
|
|
|
|
974
|
|
|
|
|
|
|
return(1); |
|
975
|
|
|
|
|
|
|
|
|
976
|
|
|
|
|
|
|
|
|
977
|
|
|
|
|
|
|
=head1 AUTHOR |
|
978
|
|
|
|
|
|
|
|
|
979
|
|
|
|
|
|
|
David F. Kinder, Jr, dkinder@davidkinder.net |
|
980
|
|
|
|
|
|
|
|
|
981
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
|
982
|
|
|
|
|
|
|
|
|
983
|
|
|
|
|
|
|
SOAP::Lite; |
|
984
|
|
|
|
|
|
|
|
|
985
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
986
|
|
|
|
|
|
|
|
|
987
|
|
|
|
|
|
|
VMWare Labamanger L |
|
988
|
|
|
|
|
|
|
VMWare Labmanager SOAP API Guide http://www.vmware.com/pdf/lm40_soap_api_guide.pdf |
|
989
|
|
|
|
|
|
|
VMWare Lab Manager: Automated Reconfiguration of Transiently Used Infrastructure http://www.vmware.com/files/pdf/lm_whitepaper.pdf |
|
990
|
|
|
|
|
|
|
|
|
991
|
|
|
|
|
|
|
=cut |