File: 01-cumulative

package info (click to toggle)
vmware-manager 0.2.0-4
  • links: PTS
  • area: contrib
  • in suites: bookworm, bullseye, sid, trixie
  • size: 224 kB
  • sloc: perl: 650; makefile: 66
file content (259 lines) | stat: -rw-r--r-- 9,519 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
--- vmware-manager-0.2.0.orig/vmm
+++ vmware-manager-0.2.0/vmm
@@ -2,32 +2,32 @@
 # POD {{{
 =head1 NAME
 
-vmm - Manage VMware virtual machines
+vwm - Manage VMware virtual machines
 
 =head1 SYNOPSIS
 
-	vmm <command> [options]
+	vwm <command> [options]
 
 =over
 	
 =item B<Global syntax:>
 
-	vmm <command> [-f] [-v+] [-w seconds] [@profile]
+	vwm <command> [-f] [-v+] [-w seconds] [@profile]
 
 =item B<Command specific syntax:>
 
-	vmm clone [-o pool] [-c count] [-a datastore...] [-l folder] <source vm> <new vm name>
-	vmm deploy [synonym of 'clone']
-	vmm df [-h] [datastore...]
-	vmm host [maintenance|restore|restart|shutdown|disconnect|reconnect] <hosts...>
-	vmm list [-d col1,col2... | perl string] [-t title] [vm|datastore|host|pool|template][s] [patterns...]
-	vmm migrate [-p low|normal|high] [-o pool] <vms...> <host>
-	vmm move [-o pool] <vms...> <datastore>
-	vmm setpool <low|normal|high> <cpu|mem|all> <pools...>
-	vmm show [vm|datastore|host|pool] [items...]
-	vmm snapshot [-t title] <vms...>
-	vmm state <on|off|suspend|reboot|shutdown|restart|standby> <vms...>
-	vmm version
+	vwm clone [-o pool] [-c count] [-a datastore...] [-l folder] <source vm> <new vm name>
+	vwm deploy [synonym of 'clone']
+	vwm df [-h] [datastore...]
+	vwm host [maintenance|restore|restart|shutdown|disconnect|reconnect] <hosts...>
+	vwm list [-d col1,col2... | perl string] [-t title] [vm|datastore|host|pool|template][s] [patterns...]
+	vwm migrate [-p low|normal|high] [-o pool] <vms...> <host>
+	vwm move [-o pool] <vms...> <datastore>
+	vwm setpool <low|normal|high> <cpu|mem|all> <pools...>
+	vwm show [vm|datastore|host|pool] [items...]
+	vwm snapshot [-t title] <vms...>
+	vwm state <on|off|suspend|reboot|shutdown|restart|standby> <vms...>
+	vwm version
 
 =back
 
@@ -108,7 +108,7 @@ This can be any of the following choices
 =item B<version>
 
 Display various version informaiton about the connected vServer and local API.
-This command is the default if no actual command is specified (i.e. just running 'vmm' with nothing else specified).
+This command is the default if no actual command is specified (i.e. just running 'vwm' with nothing else specified).
 
 =back
 
@@ -134,16 +134,16 @@ Profile name or URL
 Specifies which profile to use when addressing the vServer.
 This can be an entry within the config file or the URL (with optional login details) e.g.
 
-	vmm version @cluster1
-	vmm version @cluster2
-	vmm version @https://cluster1.acme.edu
-	vmm version @https://username@cluster1.acme.edu
-	vmm version @https://username:password@cluster1.acme.edu
+	vwm version @cluster1
+	vwm version @cluster2
+	vwm version @https://cluster1.acme.edu
+	vwm version @https://username@cluster1.acme.edu
+	vwm version @https://username:password@cluster1.acme.edu
 
 Examples 1 and two assume 'custer1' and 'customer2' have been defined in the examples file (see EXAMPLES). The further examples specify the connection information on the command line.
 Specifying the password from the command line is exceptionally silly and should be avoided.
 
-If username and/or password is omitted (such as in examples 3 and 4 above) they will be prompted for when vmm is run.
+If username and/or password is omitted (such as in examples 3 and 4 above) they will be prompted for when vwm is run.
 
 =item B<-c>
 
@@ -228,8 +228,8 @@ Switch
 =back
 
 Force continue if an error occurs.
-Normaly if an error occurs vmm will stop processing any operations specified on the command line.
-If this flag is enabled vmm will continue operation as if no error occured.
+Normaly if an error occurs vwm will stop processing any operations specified on the command line.
+If this flag is enabled vwm will continue operation as if no error occured.
 
 =item B<--human>
 
@@ -268,7 +268,7 @@ Switch
 =back
 
 Dry run mode.
-When enabled vmm will continue as normal but no actual call to the VMware VServer is made.
+When enabled vwm will continue as normal but no actual call to the VMware VServer is made.
 
 =item B<--folder>
 
@@ -414,69 +414,69 @@ A command line tool for the manipulation
 
 =over
 
-=item B<vmm clone VM01 VM02>
+=item B<vwm clone VM01 VM02>
 
 Clone VM01 to VM02.
 Since neither the datasource (-d) or pool (-o) is specified these details are copied from VM01.
 
-=item B<vmm clone DB00 DB01 -c 30>
+=item B<vwm clone DB00 DB01 -c 30>
 
 Clone DB01 to DB02 creating 30 copies. This will actually make the machines DB01 to DB30.
 Since neither the datasource (-d) or pool (-o) is specified these details are copied from VM01.
 
-=item B<vmm clone DB00 DB01 -c 30 -d SAN1,SAN2 -o Active>
+=item B<vwm clone DB00 DB01 -c 30 -d SAN1,SAN2 -o Active>
 
 Same as the above example but spread the datastores across SAN1 and SAN2 and move the machine to the 'Active' pool.
 
-=item B<vmm deploy Template-DBServer DB05 -l Databases>
+=item B<vwm deploy Template-DBServer DB05 -l Databases>
 
 Deploys the template Template-DBServer into DB05, moving the destination into the Databases folder.
 
-=item B<vmm clone Template-DBServer DB05 -l Databases>
+=item B<vwm clone Template-DBServer DB05 -l Databases>
 
 This is exactly the same as above. A clone and deploy operations will automatically figure out if the source is a template and act accordingly.
 
-=item B<vmm df *2>
+=item B<vwm df *2>
 
 Display a datastore usage sheet (similar to the Unix 'df' command) for all datastores ending in '2'.
 
-=item B<vmm host maintenance Moe Homer>
+=item B<vwm host maintenance Moe Homer>
 
 Put the hosts 'Moe' and 'Homer' into maintenance mode (use 'restore' to recover from this).
 
-=item B<vmm list vms>
+=item B<vwm list vms>
 
 List all VMs.
 
-=item B<vmm list vms -d name,host,ip>
+=item B<vwm list vms -d name,host,ip>
 
 List all VMs - showing their name, currently allocated host and IP address.
 
-=item B<vmm migrate DBS* Carl>
+=item B<vwm migrate DBS* Carl>
 
 Migrate all virtual machines matching 'DBS*' to the 'Carl' host.
 
-=item B<vmm migrate DBS* Lenny -w 60 -o Active -p high>
+=item B<vwm migrate DBS* Lenny -w 60 -o Active -p high>
 
 Migrate all virtual machines matching 'DBS*' with high priority to the 'Active' pool on the 'Lenny' host waiting 60 seconds between machine.
 
-=item B<vmm move DB00 DB01 SAN2 @cluster2>
+=item B<vwm move DB00 DB01 SAN2 @cluster2>
 
 Move VMs DB00 and DB01 to the SAN2 datastore within profile 'cluster2'.
 
-=item B<vmm show host Lisa>
+=item B<vwm show host Lisa>
 
 Show information on host 'Lisa'.
 
-=item B<vmm snapshot DB04 DB05 -t 'Todays backup'>
+=item B<vwm snapshot DB04 DB05 -t 'Todays backup'>
 
 Take a snapshot of VMs 'DB04' and 'DB05' using the title 'Todays backup'
 
-=item B<vmm state on DB00 DB01 -w 30>
+=item B<vwm state on DB00 DB01 -w 30>
 
 Turn DB00 and DB01 on waiting 30 seconds between machines.
 
-=item B<vmm state on DB00 DB01 -w 30 -f>
+=item B<vwm state on DB00 DB01 -w 30 -f>
 
 Turn DB* VMs on.
 -f ensures that even if any of the machines fail to turn on for any reason the remaining machines will still be sent the 'on' command.
@@ -592,15 +592,14 @@ VMM requires a few external modules befo
 
 * Install the VMware Perl SDK from http://www.vmware.com/support/developer/viperltoolkit/
 
-* Install all the required CPAN modules
-	
-	cpan Config::IniFiles Getopt::Long Number::Bytes::Human Term::ReadKey Text::Glob
+ This requires the packages libclass-methodmaker-perl libcrypt-ssleay-perl 
+ libsoap-lite-perl libuuid-perl libxml-libxml-perl.
 
-* Setup the config file. See either the CONFIG section above or use the sample file from /usr/share/doc/vmm
+* Setup the config file. See either the CONFIG section above or use the sample file from /usr/share/doc/vmware-manager.
 
 * Run VMM with a simple command to make sure everything is setup right.
 
-	vmm version
+	vwm version
 
 * Enjoy
 
@@ -624,10 +623,16 @@ our $VERSION = '0.2.0';
 use Config::IniFiles;
 use IO::Handle;
 use Getopt::Long;
-use Number::Bytes::Human qw/format_bytes/;
+use Number::Format qw/format_bytes/;
 use Term::ReadKey;
 use Text::Glob qw/match_glob glob_to_regex/;
-use VMware::VIRuntime;
+
+my $mod="VMware::VIRuntime";
+die "Couldn't load the VMware SDK: maybe you haven't installed it yet?\nPlease check the README file in /usr/share/doc/vmware-manager/ for details.\n"
+    if (!eval "require $mod"); 
+$mod->import();
+
+
 Getopt::Long::Configure('bundling', 'ignorecase_always', 'pass_through');
 STDERR->autoflush(1); # } Flush the output DIRECTLY to the output buffer without caching
 STDOUT->autoflush(1); # }
@@ -879,10 +884,8 @@ our $verbose = 0;
 my $cfg = Config::IniFiles->new(
 	-file => ($cfgfile ? $cfgfile : \*DATA), # Read defaults from __DATA__ section if we cant find a default file.
 	-default => 'global',
-	-fallback => 'global',
 	-nocase => 1,
 	-allowempty => 1,
-	-handle_trailing_comment => 1,
 );
 
 
@@ -948,13 +951,13 @@ my $seperator = $cfg->val($profile, 'sep
 my $title, $display, $pool, $datastore, $folder;
 my $count = 1;
 
-if (my $_ = $cfg->val($profile, 'http_proxy')) {
-	say(2, "Forceably importing HTTP_PROXY as '$_'");
-	$ENV{HTTP_PROXY} = $_;
-}
-if (my $_ = $cfg->val($profile, 'https_proxy')) {
-	say(2, "Forceably importing HTTPS_PROXY as '$_'");
-	$ENV{HTTPS_PROXY} = $_;
+if (my $x = $cfg->val($profile, 'http_proxy')) {
+	say(2, "Forceably importing HTTP_PROXY as '$x'");
+	$ENV{HTTP_PROXY} = $x;
+}
+if (my $x = $cfg->val($profile, 'https_proxy')) {
+	say(2, "Forceably importing HTTPS_PROXY as '$x'");
+	$ENV{HTTPS_PROXY} = $x;
 }
 
 Opts::set_option('url', $cfg->val($profile, 'url'));