pax_global_header00006660000000000000000000000064116256002350014512gustar00rootroot0000000000000052 comment=07c28bd019152882b9673543aea2d433708c5983 vmm_0.2.0.orig/000077500000000000000000000000001162560023500133315ustar00rootroot00000000000000vmm_0.2.0.orig/Distro/000077500000000000000000000000001162560023500145755ustar00rootroot00000000000000vmm_0.2.0.orig/Distro/DEBIAN/000077500000000000000000000000001162560023500155175ustar00rootroot00000000000000vmm_0.2.0.orig/Distro/DEBIAN/control000066400000000000000000000004111162560023500171160ustar00rootroot00000000000000Package: vmm Source: vmm Version: $VERSION Architecture: any Maintainer: Matt Carter Depends: perl (>= 5.10.0) Section: utils Priority: optional Homepage: https://github.com/hash-bang/VMM Description: Small applet to Manage VMware virtual machines vmm_0.2.0.orig/Distro/DEBIAN/copyright000066400000000000000000000020721162560023500174530ustar00rootroot00000000000000Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135 Name: vmm Maintainer: Matt Carter Source: https://github.com/hash-bang/VMM Copyright: 2011 Matt Carter License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. vmm_0.2.0.orig/Distro/vmm_0.1.0.deb000066400000000000000000000437641162560023500166020ustar00rootroot00000000000000! debian-binary 1299116733 0 0 100644 4 ` 2.0 control.tar.gz 1299116733 0 0 100644 921 ` o8y_1Ow:4D{mKT("U$ֱ#ہ㿿INKO8x><Ό=0k89]qFA4 Fn8:?X:ez^N+e;oOU|SW p|@ꌕ.%KySj#(FoؚS)wxgwl\Mye**Dd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~F^M^ښ%k3;AK7YuP79 }ֽp?y{ݱ VrzkG'7-Gp]aƍjދ?yC`,l}ZJ1~qc<}1JʆM.|;.%h}1\M+$ρѳNkQ;j l9Dq>EL@J }zbG3N2x5;=򻦳T[%z%}왾ɧוlz_o3nZLcݿjhÀS9ͨ}Ʊ5%n>tȩ!gG}ym{k{O𸶓nIowJw漻և]0I3O\Tӗ&Uen|>rmxߴ!k} +n%ܔ3?Cr/8t٢)~[f1OF,ƥ{I?c_Z5:ˮ*rx+AC |c:]RWe@k*u7U{֭-+yp蠤s߬O}7˥rק~\︻ʒG;bH'g]?13 ̼N[gS=fzuٽU3:[vH O*;긠V1˂ ߽i˫Cuoܨ9ԀիO|ef예.K}3uWއ[+|NTMt)K#m]]>h/)1UNVk6b49&۴;}Nd9sUW422v=Uޡ4n{^6:iB|行!S!eZ\ėoz-?blumN]{6ίrǤֻ+ls^+J_l'x~/675MhεQ_kI=ۣڣc]8A?+ߘ`[[w> QK-s濕%\LSkXZwKy=^"m Z@=dM/ oiO5D)l4|}?G$2RGhE^I*)T:^^p/X _y^%*1C9!3b vmm_0.2.0.orig/Makefile000066400000000000000000000017551162560023500150010ustar00rootroot00000000000000VERSION := $(shell perl -MExtUtils::MakeMaker -le 'print MM->parse_version(shift)' vmm) DEBFACTORY := DebFactory .PHONY: README.md README.md: vmm pod2text vmm | perl -e '$$_=join("",<>); s/(.*).*(.*)/"$$1\n" . join("", ) . $$2/es; print;' README.md >README.md.tmp mv README.md.tmp README.md git add README.md git commit -m 'Auto update from POD' commit: README.md -git commit -a push: commit git push version: echo "VERSION IS $(VERSION)" clean: -rm -r $(DEBFACTORY) deb: mkdir $(DEBFACTORY) mkdir -p $(DEBFACTORY)/usr/bin $(DEBFACTORY)/usr/share/man $(DEBFACTORY)/usr/share/doc/vmm cp -a vmm $(DEBFACTORY)/usr/bin cp -a docs/vmmrc.example $(DEBFACTORY)/usr/share/doc/vmm cp -ar Distro/DEBIAN $(DEBFACTORY) perl -pi -e 's/\$$VERSION/$(VERSION)/' $(DEBFACTORY)/DEBIAN/control pod2man vmm $(DEBFACTORY)/usr/share/man/vmm.1 gzip -f $(DEBFACTORY)/usr/share/man/vmm.1 dpkg -b $(DEBFACTORY) vmm_$(VERSION).deb mv vmm_$(VERSION).deb Distro make clean vmm_0.2.0.orig/README.md000066400000000000000000000370341162560023500146170ustar00rootroot00000000000000VMM (or VMWare-Manager) is a script which greatly simplifies managing VMware servers in a sane and scriptable way. It performs most of the crucial functionality provided by vSphere without asking too many unnecessary questions. Command line reference ====================== ``` NAME vmm - Manage VMware virtual machines SYNOPSIS vmm [options] Global syntax: vmm [-f] [-v+] [-w seconds] [@profile] Command specific syntax: vmm clone [-o pool] [-c count] [-a datastore...] [-l folder] vmm deploy [synonym of 'clone'] vmm df [-h] [datastore...] vmm host [maintenance|restore|restart|shutdown|disconnect|reconnect] vmm list [-d col1,col2... | perl string] [-t title] [vm|datastore|host|pool|template][s] [patterns...] vmm migrate [-p low|normal|high] [-o pool] vmm move [-o pool] vmm setpool vmm show [vm|datastore|host|pool] [items...] vmm snapshot [-t title] vmm state vmm version COMMANDS clone Clone a given VM or template to another VM name. If -c is specified multiple copies are made. Each VM name will be incremented in the usual Perlish way. e.g.: DB1, DB2, DB3 etc. If -a is unspcified the datastore of the source VM is copied as the new clones datastore. If -a is specified the data store will be set during cloning. If -a contains a comma denoted list the datastores will be alternated during cloning. e.g. -a 1,2 copies to datastore 1 then 2 then starts again at 1. Patterns of repeating datastores can be specified - e.g. '-a 1,2,3,2,1'. deploy Synonym of 'clone'. df Display disk usage information about datastores. If a list of matches is provided, the data store list is filtered for those items. list Display a list of the given items matching a pattern. Possible lists include (selection can be plural or singular): vms (default if unspecified) datastores hosts pools If '-d' is specified without any containing '$' marks the string is evaluated as a CSV with each line extracting the requisite information that would be shown with the 'show' command. See the EXAMPLES section for further information. If '-d' is specified and contains a '$' it is evaluated as a perl expression with $_ being set to the currently active item. If '-t' is spcified the titles header for the table is set. migrate Migrate a given list of VMs to another host. move Move a given list of VMs to another datastore. setpool Set the share level on the given resource pools. show Show information about a given object. If no specific object type is specified 'vm' is assumed. If no specific matching pattern is specified all objects of that type are listed. snapshot Take a snapshot of the matching VM's. If '-t' is specified, it is used as the title of the snapshot. Otherwise the current time is used. state Set the state of a list of VMs. This can be any of the following choices: on - Power up the specified VMs off - Power down the specified VMs. This is a hard power state so data loss could occur. suspend - Power the machine into standby mode. This is a hard power state which does not rely on VMware tools. restart - Hard power cycle the VMs. Like 'off' this is a forced power state so data loss could occur. shutdown - Try shutting down the machine via VMware tools. standby - Try to put the machine into the soft standby state. reboot - Try shutting down the machine via VMware tools. 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). OPTIONS [@profile] Used during: All operations Default: First specified profile in config Type: 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 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. -c Used during: migrate Default: 1 Type: Number Specifies how many VMs should be created during a clone operation. The name of the target VM is incremented in the usual Perlish way. e.g. DBS1, DBS2, DBS3... DBS10 DB00, DB01, DB02... DB99 DBAA, DBAB, DBAC... DBZZ --display [col1,col2...] -d [col1,col2...] Used during: list Default: Name Type: Command seperated list of columns to display in tabular output when using the 'list' command. See also: -s to specify the seperation character to use between the columns. Specify a data store for operations that require it. --datastore [datastore] --ds [datastore] -a [datastore] Used during: migrate Default: Same as source VM Type: Datastore name Specify a data store for operations that require it. --force -f Used during: All operations Default: off Type: Switch 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. --human -h Used during: df Default: off Type: Switch Display the numbers of the 'df' command in a human readable format. --dryrun -n Used during: All operations Default: off Type: Switch Dry run mode. When enabled vmm will continue as normal but no actual call to the VMware VServer is made. --folder -l Used during: clone Default: Source VM / templates folder Type: String Specifies the folder that the cloned machine should be moved into. If unspecified the source VM's folder is used instead. --pool [pool] -o [pool] Used during: clone, migrate, move Default: Same as the source VM Type: Pool name Specifies the alternate pool name to use when migrating or cloning machines. If unspecified the source VM's pool is used instead. --priority [priority] -p [priority] Used during: migrate Default: low Type: Choice of: low, normal, high Specifies the priority when migrating VMs. --seperator [character] -s [character] Used during: list Default: \t (tab) Type: String Specifies the string to display between columns when outputing a list. --title [title] -t [title] Used during: list, snapshot Default: The Unix EPOC (for VMs) Type: String The title of the snapshot to create or the title row of the list table. -v --verbose Used during: All operations Default: 0 Type: Accumulating switch Be more verbose when outputting information to STDERR. Specify multiple times to increase verbosity. -w [seconds] -wait [seconds] Used during: clone, host, migrate, setpool, state Default: 0 Type: Number of seconds Force a wait for the specified number of seconds between operations. DESCRIPTION A command line tool for the manipulation of VMware Virtual Machines (VM). EXAMPLES vmm clone VM01 VM02 Clone VM01 to VM02. Since neither the datasource (-d) or pool (-o) is specified these details are copied from VM01. vmm 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. vmm 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. vmm deploy Template-DBServer DB05 -l Databases Deploys the template Template-DBServer into DB05, moving the destination into the Databases folder. vmm 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. vmm df *2 Display a datastore usage sheet (similar to the Unix 'df' command) for all datastores ending in '2'. vmm host maintenance Moe Homer Put the hosts 'Moe' and 'Homer' into maintenance mode (use 'restore' to recover from this). vmm list vms List all VMs. vmm list vms -d name,host,ip List all VMs - showing their name, currently allocated host and IP address. vmm migrate DBS* Carl Migrate all virtual machines matching 'DBS*' to the 'Carl' host. vmm 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. vmm move DB00 DB01 SAN2 @cluster2 Move VMs DB00 and DB01 to the SAN2 datastore within profile 'cluster2'. vmm show host Lisa Show information on host 'Lisa'. vmm snapshot DB04 DB05 -t 'Todays backup' Take a snapshot of VMs 'DB04' and 'DB05' using the title 'Todays backup' vmm state on DB00 DB01 -w 30 Turn DB00 and DB01 on waiting 30 seconds between machines. vmm 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. FILES /etc/vmmrc VMM config file for all users. .vmmrc VMM config file for the local user. CONFIG The /etc/vmmrc and .vmmrc files will be processed to determine VMM's configuration, the latter file taking precedence. The layout of the config file spcifies which profiles to use. [GLOBAL] rewrite host = s/^(.+?)\./\1/ verbose = 2 profile = Cluster1 dryrun = 0 human = 1 force = 0 seperator = \t http_proxy = http://myproxy.example.com:8080 https_proxy = http://myproxy.example.com:8080 [Cluster1] url = https://cluster1.acme.edu username = admin password = password [Cluster2] url = https://cluster2.acme.edu username = administrator password = changeme [GLOBAL] The meta global section. Any option specified here will be automatically carried into each profiles config. In the main example Cluster1 will have a 'verbose' option of 2. Cluster2 will have a 'verbose' option of 1 since it overrides the global setting. [profile] The name (case-insensitive) of the profile to define. url The connection URL of the vServer system within the profile username and password The authentication information when connecting to the vServer. dryrun Specify a default dry run value. See -n for further information. force If an error is encounted during a multiple VM operation the default behaviour is to stop execution. If this setting is set to '1' this behaviour will be overridden and operations will continue even if an error is encounted. http_proxy https_proxy Forceably set the HTTP(s)_PROXY environment variable to the provided value before connecting. This is included to assist basic login shells where these variables are not imported correctly. human Always output numbers in a human readable format rather than the raw form. priority Specify a default priority when using any command that is '-p' compatible. profile Specify the default profile to use if none is explicitally set. If not specified the first found profile in the config file is used. rewrite host Specify a substitution regular expression to use when correcting host names. The value given in the above example will remove any trailing DNS name correcting 'host1.a.very.long.dns.com' to 'host1'. seperator Specify the seperator character used when outputting tabular data with the 'list' command. verbose Specify a default verbosity level. See -v for further information. INSTALLATION VMM requires a few external modules before it can work correctly. Follow the following stages to get everything working. * 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 * Setup the config file. See either the CONFIG section above or use the sample file from /usr/share/doc/vmm * Run VMM with a simple command to make sure everything is setup right. vmm version * Enjoy BUGS Quite probably. Please report to https://github.com/hash-bang/VMM when found. AUTHOR Matt Carter ``` TODO ==== * Allow pattern ranges e.g. DB{10..20} DB{10,12,15} * Post action triggers - run this script with set options on certain events. e.g. postclone=vittl-linux-init $host $password Future commands * Template, Untemplate * Delete * Bios (Sets the 'bios on next boot' flag) * AttachCD (Sets an ISO to the VM's CD-ROM drive) * ToolsUpgrade (Upgrade VMware tools) vmm_0.2.0.orig/docs/000077500000000000000000000000001162560023500142615ustar00rootroot00000000000000vmm_0.2.0.orig/docs/vmmrc.example000066400000000000000000000004361162560023500167650ustar00rootroot00000000000000[GLOBAL] rewrite host = s/^(.+?)\./\1/ verbose = 2 profile = Cluster1 dryrun = 0 human = 1 force = 0 seperator = \t [Cluster1] url = https://cluster1.acme.edu username = admin password = password [Cluster2] url = https://cluster2.acme.edu username = administrator password = changeme vmm_0.2.0.orig/vmm000077500000000000000000001134701162560023500140640ustar00rootroot00000000000000#!/usr/bin/perl # POD {{{ =head1 NAME vmm - Manage VMware virtual machines =head1 SYNOPSIS vmm [options] =over =item B vmm [-f] [-v+] [-w seconds] [@profile] =item B vmm clone [-o pool] [-c count] [-a datastore...] [-l folder] vmm deploy [synonym of 'clone'] vmm df [-h] [datastore...] vmm host [maintenance|restore|restart|shutdown|disconnect|reconnect] vmm list [-d col1,col2... | perl string] [-t title] [vm|datastore|host|pool|template][s] [patterns...] vmm migrate [-p low|normal|high] [-o pool] vmm move [-o pool] vmm setpool vmm show [vm|datastore|host|pool] [items...] vmm snapshot [-t title] vmm state vmm version =back =head1 COMMANDS =over 8 =item B Clone a given VM or template to another VM name. If -c is specified multiple copies are made. Each VM name will be incremented in the usual Perlish way. e.g.: DB1, DB2, DB3 etc. If -a is unspcified the datastore of the source VM is copied as the new clones datastore. If -a is specified the data store will be set during cloning. If -a contains a comma denoted list the datastores will be alternated during cloning. e.g. -a 1,2 copies to datastore 1 then 2 then starts again at 1. Patterns of repeating datastores can be specified - e.g. '-a 1,2,3,2,1'. =item B Synonym of 'clone'. =item B Display disk usage information about datastores. If a list of matches is provided, the data store list is filtered for those items. =item B Display a list of the given items matching a pattern. Possible lists include (selection can be plural or singular): vms (default if unspecified) datastores hosts pools If '-d' is specified without any containing '$' marks the string is evaluated as a CSV with each line extracting the requisite information that would be shown with the 'show' command. See the EXAMPLES section for further information. If '-d' is specified and contains a '$' it is evaluated as a perl expression with $_ being set to the currently active item. If '-t' is spcified the titles header for the table is set. =item B Migrate a given list of VMs to another host. =item B Move a given list of VMs to another datastore. =item B Set the share level on the given resource pools. =item B Show information about a given object. If no specific object type is specified 'vm' is assumed. If no specific matching pattern is specified all objects of that type are listed. =item B Take a snapshot of the matching VM's. If '-t' is specified, it is used as the title of the snapshot. Otherwise the current time is used. =item B Set the state of a list of VMs. This can be any of the following choices: on - Power up the specified VMs off - Power down the specified VMs. This is a hard power state so data loss could occur. suspend - Power the machine into standby mode. This is a hard power state which does not rely on VMware tools. restart - Hard power cycle the VMs. Like 'off' this is a forced power state so data loss could occur. shutdown - Try shutting down the machine via VMware tools. standby - Try to put the machine into the soft standby state. reboot - Try shutting down the machine via VMware tools. =item B 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). =back =head1 OPTIONS =over 8 =item B<[@profile]> =over =item B All operations =item B First specified profile in config =item B Profile name or URL =back 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 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. =item B<-c> =over =item B migrate =item B 1 =item B Number =back Specifies how many VMs should be created during a clone operation. The name of the target VM is incremented in the usual Perlish way. e.g. DBS1, DBS2, DBS3... DBS10 DB00, DB01, DB02... DB99 DBAA, DBAB, DBAC... DBZZ =item B<--display [col1,col2...]> =item B<-d [col1,col2...]> =over =item B list =item B Name =item B Command seperated list of columns to display in tabular output when using the 'list' command. See also: -s to specify the seperation character to use between the columns. =back Specify a data store for operations that require it. =item B<--datastore [datastore]> =item B<--ds [datastore]> =item B<-a [datastore]> =over =item B migrate =item B Same as source VM =item B Datastore name =back Specify a data store for operations that require it. =item B<--force> =item B<-f> =over =item B All operations =item B off =item B 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. =item B<--human> =item B<-h> =over =item B df =item B off =item B Switch =back Display the numbers of the 'df' command in a human readable format. =item B<--dryrun> =item B<-n> =over =item B All operations =item B off =item B Switch =back Dry run mode. When enabled vmm will continue as normal but no actual call to the VMware VServer is made. =item B<--folder> =item B<-l> =over =item B clone =item B Source VM / templates folder =item B String =back Specifies the folder that the cloned machine should be moved into. If unspecified the source VM's folder is used instead. =item B<--pool [pool]> =item B<-o [pool]> =over =item B clone, migrate, move =item B Same as the source VM =item B Pool name =back Specifies the alternate pool name to use when migrating or cloning machines. If unspecified the source VM's pool is used instead. =item B<--priority [priority]> =item B<-p [priority]> =over =item B migrate =item B low =item B Choice of: low, normal, high =back Specifies the priority when migrating VMs. =item B<--seperator [character]> =item B<-s [character]> =over =item B list =item B \t (tab) =item B String =back Specifies the string to display between columns when outputing a list. =item B<--title [title]> =item B<-t [title]> =over =item B list, snapshot =item B The Unix EPOC (for VMs) =item B String =back The title of the snapshot to create or the title row of the list table. =item B<-v> =item B<--verbose> =over =item B All operations =item B 0 =item B Accumulating switch =back Be more verbose when outputting information to STDERR. Specify multiple times to increase verbosity. =item B<-w [seconds]> =item B<-wait [seconds]> =over =item B clone, host, migrate, setpool, state =item B 0 =item B Number of seconds =back Force a wait for the specified number of seconds between operations. =back =head1 DESCRIPTION A command line tool for the manipulation of VMware Virtual Machines (VM). =head1 EXAMPLES =over =item B Clone VM01 to VM02. Since neither the datasource (-d) or pool (-o) is specified these details are copied from VM01. =item B 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 Same as the above example but spread the datastores across SAN1 and SAN2 and move the machine to the 'Active' pool. =item B Deploys the template Template-DBServer into DB05, moving the destination into the Databases folder. =item B 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 Display a datastore usage sheet (similar to the Unix 'df' command) for all datastores ending in '2'. =item B Put the hosts 'Moe' and 'Homer' into maintenance mode (use 'restore' to recover from this). =item B List all VMs. =item B List all VMs - showing their name, currently allocated host and IP address. =item B Migrate all virtual machines matching 'DBS*' to the 'Carl' host. =item B Migrate all virtual machines matching 'DBS*' with high priority to the 'Active' pool on the 'Lenny' host waiting 60 seconds between machine. =item B Move VMs DB00 and DB01 to the SAN2 datastore within profile 'cluster2'. =item B Show information on host 'Lisa'. =item B Take a snapshot of VMs 'DB04' and 'DB05' using the title 'Todays backup' =item B Turn DB00 and DB01 on waiting 30 seconds between machines. =item B 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. =back =head1 FILES =over 8 =item B VMM config file for all users. =item B<.vmmrc> VMM config file for the local user. =back =head1 CONFIG The /etc/vmmrc and .vmmrc files will be processed to determine VMM's configuration, the latter file taking precedence. The layout of the config file spcifies which profiles to use. [GLOBAL] rewrite host = s/^(.+?)\./\1/ verbose = 2 profile = Cluster1 dryrun = 0 human = 1 force = 0 seperator = \t http_proxy = http://myproxy.example.com:8080 https_proxy = http://myproxy.example.com:8080 [Cluster1] url = https://cluster1.acme.edu username = admin password = password [Cluster2] url = https://cluster2.acme.edu username = administrator password = changeme =over 8 =item B<[GLOBAL]> The meta global section. Any option specified here will be automatically carried into each profiles config. In the main example Cluster1 will have a 'verbose' option of 2. Cluster2 will have a 'verbose' option of 1 since it overrides the global setting. =item B<[profile]> The name (case-insensitive) of the profile to define. =item B The connection URL of the vServer system within the profile =item B and B The authentication information when connecting to the vServer. =item B Specify a default dry run value. See B<-n> for further information. =item B If an error is encounted during a multiple VM operation the default behaviour is to stop execution. If this setting is set to '1' this behaviour will be overridden and operations will continue even if an error is encounted. =item B =item B Forceably set the HTTP(s)_PROXY environment variable to the provided value before connecting. This is included to assist basic login shells where these variables are not imported correctly. =item B Always output numbers in a human readable format rather than the raw form. =item B Specify a default priority when using any command that is '-p' compatible. =item B Specify the default profile to use if none is explicitally set. If not specified the first found profile in the config file is used. =item B Specify a substitution regular expression to use when correcting host names. The value given in the above example will remove any trailing DNS name correcting 'host1.a.very.long.dns.com' to 'host1'. =item B Specify the seperator character used when outputting tabular data with the 'list' command. =item B Specify a default verbosity level. See B<-v> for further information. =back =head1 INSTALLATION VMM requires a few external modules before it can work correctly. Follow the following stages to get everything working. * 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 * Setup the config file. See either the CONFIG section above or use the sample file from /usr/share/doc/vmm * Run VMM with a simple command to make sure everything is setup right. vmm version * Enjoy =head1 BUGS Quite probably. Please report to https://github.com/hash-bang/VMM when found. =head1 AUTHOR Matt Carter =cut # }}} POD package vmm; our $VERSION = '0.2.0'; # Header {{{ use Config::IniFiles; use IO::Handle; use Getopt::Long; use Number::Bytes::Human qw/format_bytes/; use Term::ReadKey; use Text::Glob qw/match_glob glob_to_regex/; use VMware::VIRuntime; Getopt::Long::Configure('bundling', 'ignorecase_always', 'pass_through'); STDERR->autoflush(1); # } Flush the output DIRECTLY to the output buffer without caching STDOUT->autoflush(1); # } use Data::Dump; # FIXME: Debugging modules # }}} Header # Functions {{{ # Flow control {{{ sub fatal { # Print an error message and fatally die print STDERR @_, "\n"; exit 1; } sub say { # Print a message to STDERR based on the verbosity level our $verbose; my $verbosity = shift; print STDERR @_, "\n" if ($verbose >= $verbosity); } sub pause { # Wait a number of seconds (specified by the -w [seconds]) between VM operations # This function purposely ignores the first vm (thus not bothering to wait for the last vm to finish) our $wait; if ($wait > 0) { say(0, "Waiting $wait seconds..."); sleep($wait); } } sub error { my $action = shift; my $subject = shift; if (ref($@) eq 'SoapFault') { say(0, "ERROR: " . $@->detail); } else { say(0, "ERROR: General fault!"); } fatal("Stopping execution. Use -f to force continue.") unless $force; } # }}} Flow control # Filters {{{ sub list { my $type = shift; my @out; return grep { if ($type eq 'VirtualMachine' and !$_->resourcePool) { undef; } else { $_ = $_->name; } } @{Vim::find_entity_views ( view_type => ($type eq 'Template' ? 'VirtualMachine' : $type), # Template is really just VirtualMachine with the above extra work begin_entity => Vim::get_service_content()->rootFolder, filter => {}, )}; return @out; } sub multiglob { # Perform multiple greps and return all matching list items # e.g. multiglob(qw/apple pear orange tomatoe carrot/, qw/*pp* *ar *zz/) = qw/apple pear/ # If the list of matches is empty, all are returned my ($list, $globs) = @_; return @$list unless @$globs; @globs = map { $_ = glob_to_regex($_) } @$globs; #print "LIST [" . Dumper($list) . "]"; #print "GLOBS [" . Dumper($globs) . "]"; return grep { my $found = 0; foreach $glob (@$globs) { if ($_ =~ $glob) { $found = 1; last; } } $found; } @$list; } # }}} Filters # Info grabbers {{{ sub translate { my $type = shift; $type =~ s/s$//; # Translate plurals in singulars my %translate = qw/ vm VirtualMachine template Template host HostSystem datastore Datastore d Datastore pool ResourcePool /; return $translate{$type} ? $translate{$type} : undef; } sub getview { # Return a VMware view object from its type and reference # This function also supports the meta type 'Mor' which looks up the view by the managed object reference my $type = shift; # HostSystem, VirtualMachine, ResourcePool, Folder my $ref = shift; if ($type eq 'Mor') { return Vim::get_view( mo_ref => $ref, ); } else { return Vim::find_entity_view( view_type => $type, filter => { name => $ref }, ); } } sub getinfo { # Generic function to return information from one of the below getinfo functions my $type = shift; my $name = shift; if ($type =~ /^VirtualMachine|Template$/) { return getvminfo($name); } elsif ($type eq 'Datastore') { return getdsinfo($name); } elsif ($type eq 'HostSystem') { return gethostinfo($name); } elsif ($type eq 'ResourcePool') { return getpoolinfo($name); } } sub istemplate { # This view is a template machine ? my $view = shift; return $view->summary->config->template eq '0' ? 0 : 1; } sub getvminfo { my $vm = shift; my $view = getview('VirtualMachine', $vm) or fatal("Unknown VM: '$vm'"); my $template = istemplate($view); my %info = ( name => $view->name, template => $template, os => $view->summary->guest->guestFullName, datastore => Vim::get_view(mo_ref => ${$view->datastore}[0])->name, alloccpu => $view->summary->config->numCpu, allocmem => $view->summary->config->memorySizeMB, allocdisks => $view->summary->config->numVirtualDisks, maxcpu => $view->runtime->maxCpuUsage, maxmem => $view->runtime->maxMemoryUsage, host => Vim::get_view(mo_ref => $view->runtime->host)->name, state => $view->runtime->powerState->val eq 'poweredOn' ? 'on' : 'off', tools => $view->guest->toolsStatus->val eq 'toolsOk' ? 'yes' : 'no', folder => Vim::get_view(mo_ref => $view->parent)->name, ip => 'UNKNOWN', mac => 'UNKNOWN', ); if (!$template) { # Only grab the following if its not a template machine $info{pool} = Vim::get_view(mo_ref => $view->resourcePool)->name; $info{booted} => $view->runtime->bootTime; } if ($view->guest->disk) { foreach (@{$view->guest->disk}) { my $no; $info{'disk_' . $no++} = $_->diskPath . ' ' . $_->capacity . ' ' . $_->freeSpace; } } if ($view->guest->net) { foreach $net (@{$view->guest->net}) { my $no; $info{'net_' . $no++} = $net->network . ' ' . $net->macAddress . ' ' . join(',', @{$net->ipAddress}); $info{ip} = join(',', @{$net->ipAddress}) if $info{ip} eq 'UNKNOWN'; # Lazy accessor for 'ip' $info{mac} = $net->macAddress if $info{mac} eq 'UNKNOWN'; # Lazy accessor for 'mac' } } return %info; } sub getdsinfo { my $ds = shift; our $human; my $view = getview('Datastore', $ds) or fatal("Unknown datastore: '$ds'"); my %info = ( name => $view->name, size => ($human ? format_bytes($view->info->vmfs->capacity) : $view->info->vmfs->capacity), used => ($human ? format_bytes($view->info->vmfs->capacity - $view->info->freeSpace) : $view->info->vmfs->capacity - $view->info->freeSpace), free => ($human ? format_bytes($view->info->freeSpace) : $view->info->freeSpace), percent => sprintf('%d', (($view->info->vmfs->capacity - $view->info->freeSpace) / $view->info->vmfs->capacity * 100)), ); return %info; } sub gethostinfo { my $host = shift; my $view = getview('HostSystem', $host) or fatal("Unknown host: '$ds'"); my %info = ( name => $view->name, cpuuse => $view->summary->quickStats->overallCpuUsage, memuse => $view->summary->quickStats->overallMemoryUsage, mem => $view->hardware->memorySize, cpu => $view->hardware->cpuInfo->hz, ); if ($view->datastore) { foreach $dsmor (@{$view->datastore}) { my $no; my $dsref = getview('Mor', $dsmor); $info{'datastore_' . $no++} = $dsref->name; } } return %info; } sub getpoolinfo { my $pool = shift; my $view = getview('ResourcePool', $pool) or fatal("Unknown pool: '$pool'"); my %info = ( name => $view->name, maxmem => $view->runtime->memory->maxUsage, maxcpu => $view->runtime->cpu->maxUsage, mem => $view->runtime->memory->overallUsage, cpu => $view->runtime->cpu->overallUsage, memshare => $view->config->memoryAllocation->shares->level->val, cpushare => $view->config->cpuAllocation->shares->level->val, ); return %info; } # }}} Info grabbers # }}} Functions # Config loading {{{ my $cfgfile; if (-e "/etc/vmmrc") { $cfgfile = "/etc/vmmrc"; } elsif (-e "$ENV{HOME}/.vmmrc") { $cfgfile = "$ENV{HOME}/.vmmrc"; } else { say(1, "No VMMRC file could be found at either /etc/vmmrc or \$HOME/.vmmrc"); } 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, ); my $profile; # The active profile to use @ARGV = grep { # Scan for '@profile' strings in @ARGV if (/^@(.+)$/) { fatal("Only one profile may be set per invocation. Profile was originally '$profile' when you tried to override with '$_'") if $profile; if (my($cproto, $clogin, $curl) = (m/^\@(https?):\/\/(?:(.*?)@)?(.*)$/)) { # User is specifying user:pass@url, user@url or url my($cuser, $cpass) = ($clogin,undef) unless (($cuser, $cpass) = ($clogin =~ m/^(.*?):(.*)$/)); say(2, "Using custom URL: $curl"); $cfg->newval('CUSTOM', 'url', "$cproto://$curl"); $cfg->newval('CUSTOM', 'username', $cuser) if $cuser; $cfg->newval('CUSTOM', 'password', $cpass) if $cpass; $profile = 'CUSTOM'; } else { # Standard profile alias $profile = $1; } undef; } else { $_; } } @ARGV; $verbose = $cfg->val('global', 'verbose', 0); # Early import from global so 'say' works correctly in the following profile options if ($profile) { # User wants to select a specific profile fatal("Profile not valid: $profile") unless $cfg->exists($profile, 'url'); say(2, "Using user set profile '$profile'"); } elsif ($cfg->exists('global', 'profile')) { # Default profile option set in config $profile = $cfg->val('global', 'profile'); say(2, "Using config file default profile '$profile'"); } elsif ($cfg->val('global', 'profile')) { # Config file specifies default fallback profile $profile = $cfg->val('global', 'profile', $profile); } else { # Use first section found that isn't 'global' $profile = [grep { $_ ne 'global' } $cfg->Sections]->[0]; say(2, "Using first found profile '$profile'"); } fatal("No vServer URL specified for profile $profile") unless $cfg->exists($profile, 'url'); unless ($cfg->val($profile, 'username')) { print "Username: "; my $cuser = ReadLine(0); chomp($cuser); $cfg->newval($profile, 'username', $cuser); } unless ($cfg->val($profile, 'password')) { print "Password: "; ReadMode('noecho'); my $cpass = ReadLine(0); chomp($cpass); print "\n"; $cfg->newval($profile, 'password', $cpass); } # Import various options from the config file. These can be overriden in the GetOptions call below. $verbose = $cfg->val($profile, 'verbose', 0); # Late import which overrides the 'global/verbose' setting now we know what profile to use our $cycleno = 0; # Offset of the object we are operating on our $dryrun = $cfg->val($profile, 'dryrun', 0); our $wait = $cfg->val($profile, 'wait', 0); our $human = $cfg->val($profile, 'human', '0'); our $force = $cfg->val($profile, 'force', '0'); my $priority = $cfg->val($profile, 'priority', 'low'); my $seperator = $cfg->val($profile, 'seperator', "\t"); 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} = $_; } Opts::set_option('url', $cfg->val($profile, 'url')); Opts::set_option('username', $cfg->val($profile, 'username')); Opts::set_option('password', $cfg->val($profile, 'password')); say(3, "Connecting to " . $cfg->val($profile, 'username') . '@' . $cfg->val($profile, 'url')); Util::connect(); # }}} Config loading # Command line options loading {{{ GetOptions( # Global options 'dryrun|n' => \$dryrun, 'force|f' => \$force, 'verbose|v+' => \$verbose, 'wait|w=i' => \$wait, # Specific command options 'count|c=i' => \$count, 'priority|p=s' => \$priority, 'pool|o=s' => \$pool, 'human|h' => \$human, 'display|d=s' => \$display, 'seperator|s=s' => \$seperator, 'title|t=s' => \$title, 'datastore|ds|a=s' => \$datastore, 'folder|l=s' => \$folder, ); my $cmd = shift; # Extract what command we should work with # }}} Command line options loading if ($cmd eq 'df') { # DF {{{ # DF is really just a lazy way of configuring the 'list' command $cmd = 'list'; $display = '$_{name}\t$_{size}\t$_{used}\t$_{free}\t$_{percent}%'; $title = 'Name,Size,Used,Free,%'; unshift @ARGV, 'datastore'; } # }}} if ($cmd =~ /^clone|deploy$/) { # CLONE / DEPLOY {{{ my $poolref; my $folderref; my $source = shift; my $target = shift; my $sourceref = getview('VirtualMachine', $source) or fatal("Invalid source VM / template: '$source'"); my $sourcehost = getview('Mor', $sourceref->runtime->host) or fatal("Invalid host for VM '$source'"); my @dsrefs; if ($pool) { # Requesting a specific pool say(2, "Using pool '$pool'"); $poolref = getview('ResourcePool', $pool) or fatal("Invalid destination pool: $pool"); } else { # Copy pool from source fatal("Cannot determine pool when deploying from a template. You must specify the pool with -o") if istemplate($sourceref); $poolref = getview('Mor', $sourceref->resourcePool); } if ($folder) { # Requesting a specific folder say(2, "Using folder '$folder'"); $folderref = getview('Folder', $folder) or fatal("Invalid destination folder: $folder"); } else { # Copy folder from source $folderref = $sourceref->parent; } if ($datastore) { # User is specifying pattern of datastores foreach (split('\s*,\s*', $datastore)) { say(2, "Loading datastore '$_'"); my $dsref = getview('Datastore', $_) or fatal("Unknown datastore: '$_'"); push @dsrefs, $dsref; } } else { # No DS preferences set - use default clone DS push @dsrefs, getview('Mor', $sourceref->datastore->[0]); } say(1, "Clone source $source ($count clones, across " . scalar(@dsrefs) ." datastores)") if $count > 1; while ($cycleno < $count) { pause() if $cycleno++; while (getview('VirtualMachine', $target)) { say(1, "VM '$target' already exists. Trying next slot"); $target++; } say(1, "Cloning $source -> $target (clone #$cycleno, Pool = " . $poolref->name . ", DS = " . $dsrefs[$dsno]->name . ", Folder = " . $folderref->name . ")"); eval { $sourceref->CloneVM( folder => $folderref, name => $target, spec => VirtualMachineCloneSpec->new( powerOn => 0, template => 0, location => VirtualMachineRelocateSpec->new( datastore => $dsrefs[$dsno], host => $sourcehost, pool => $poolref, ) ) ) unless $dryrun; }; error('clone', $source, @_) if @_; $dsno = 0 if ++$dsno > scalar(@dsrefs)-1; # Move though selected datastores $target++; } # }}} CLONE } elsif ($cmd eq 'list') { # LIST {{{ my $type = shift || 'vm'; my $type = translate($type) or fatal("Unknown list type: '$type'"); my @displaylist; my $displaytype = 0; # 0 - Plain list, 1 - CSV list, 2 - Perl string eval if ($display =~ /\$/) { # Contains a '$' - assume Perl eval $displaytype = 2; } elsif ($display) { # Treat as CSV @displaylist = split(',',$display); $displaytype = 1; } if ($title) { # Output a title $title =~ s/\s*,\s*/$seperator/g; say(0, $title); } my @list = multiglob([list($type)], \@ARGV); if ($displaytype == 0) { # No custom format - just dump list print join "\n", @list; } elsif ($displaytype == 1) { # CSV style extract unless ($title) { foreach $type (@displaylist) { # Print headers print "$type$seperator"; } } print "\n"; foreach $item (@list) { my %info = getinfo($type, $item) or fatal("Dont know how to retrieve info for type '$type'"); my $line = ''; foreach $type (@displaylist) { $line .= ($info{$type} ? $info{$type} : 'UNKNOWN') . $seperator; } $line = substr($line, 0, 0 - length($seperator)); # Strip last $seperator print "$line\n"; } } elsif ($displaytype == 2) { # Perl eval foreach $name (@list) { %_ = getinfo($type, $name) or fatal("Dont know how to retrieve info for type '$type'"); print eval("return \"$display\"") . "\n"; } } print "\n" if @list; # Insert final \n # }}} LIST } elsif ($cmd eq 'host') { # HOST {{{ my $operation = shift; fatal('No operation specified. Choose: maintenance, restore, restart, shutdown, disconnect, reconnect') unless $state; fatal('Invalid power state specified. Choose: maintenance, restore, restart, shutdown, disconnect, reconnect') unless $state =~ /^maintenance|restore|restart|shutdown|disconnect|reconnect$/; my @hosts = multiglob([list('HostSystem')], \@ARGV); fatal('No Hosts\'s match the given pattern') unless scalar(@hosts); foreach $host (@hosts) { pause() if $cycleno++; my $hostref = getview('HostSystem', $host) or fatal("Invalid host: $host"); if ($operation eq 'disconnect') { say(1, "Disconnecting host '$host'"); eval { $hostref->DisconnectHost() unless $dryrun; } } elsif ($operation eq 'reconnect') { say(1, "Reconnecting host '$host'"); eval { $hostref->ReconnectHost() unless $dryrun; } } elsif ($operation eq 'maintenance') { say(1, "Entering maintenance mode for host '$host'"); eval { $hostref->EnterMaintenanceMode(timeout => 0) unless $dryrun; } } elsif ($operation eq 'restore') { say(1, "Leaving maintenance mode for host '$host'"); eval { $hostref->ExitMaintenanceMode(timeout => 0) unless $dryrun; } } elsif ($operation eq 'restart') { say(1, "Restarting host '$host'"); eval { $hostref->RebootHost(force => 1) unless $dryrun; } } elsif ($operation eq 'shutdown') { say(1, "Shutdown host '$host'"); eval { $hostref->ShutdownHost(force => 1) unless $dryrun; } } error("host->$operation", $host, @_) if @_; } # }}} HOST } elsif ($cmd eq 'migrate') { # MIGRATE {{{ fatal("Invalid priority: '$priority'. Choose from: low, normal, high") unless $priority =~ /^low|normal|high$/; my $priorityref = VirtualMachineMovePriority->new($priority) or fatal('Invalid internal priority state. Probably an issue with the VMware libraries'); my $targethost = pop; fatal('No destination host specified') unless $targethost; my $poolref = getview('ResourcePool', $pool) or fatal("Invalid destination pool: $pool") if ($pool); my $targethostref = getview('HostSystem', $targethost) or fatal("Invalid destination host: $targethost"); my @vms = multiglob([list('VirtualMachine')], \@ARGV); fatal('No VM\'s match the given pattern') unless scalar(@vms); say(2, "Migrating to $targethost with $priority priority"); my $success; # Last operation worked foreach $vm (@vms) { pause() if $cycleno++ and $success; $success = 0; say(1, "Migrate $vm -> $targethost"); my $vmref = getview('VirtualMachine', $vm) or fatal("Invalid VM: $vm"); my $vmpoolref = $pool ? $poolref : getview('Mor', $vmref->resourcePool); # User either user specified pool or import from source VM eval { $vmref->MigrateVM( host => $targethostref, pool => $vmpoolref, priority => $priorityref, state => $vm->runtime->powerState->val, ) unless $dryrun; }; if (@_) { # Had errors error('migrate', $vm, @_) ; last unless $force; } else { $success = 1; } } # }}} MIGRATE } elsif ($cmd eq 'move') { # MOVE {{{ my $targetds = pop; fatal('No destination datasore specified') unless $targetds; my $targetdsref = getview('Datastore', $targetds) or fatal("Invalid destination datastore: $targetds"); my $poolref; if ($pool) { $poolref = getview('ResourcePool', $pool) or fatal("Invalid destination pool: $pool"); } my @vms = multiglob([list('VirtualMachine')], \@ARGV); fatal('No VM\'s match the given pattern') unless scalar(@vms); say(2, "Moving " . scalar(@vms) . " VM's to datastore '$targetds'"); my $success; # Last operation worked foreach $vm (@vms) { pause() if $cycleno++ and $success; $success = 0; say(1, "Move $vm -> $targetds"); my $vmref = getview('VirtualMachine', $vm) or fatal("Invalid VM: $vm"); if (getview('Mor', $vmref->datastore->[0])->name eq $targetdsref->name) { say(0, "$vm is already located in datastore '$targetds'"); next; } my $vmhostref = getview('Mor', $vmref->runtime->host) or fatal("Cannot determine VM host for $vm"); my $vmpoolref = $pool ? $poolref : getview('Mor', $vmref->resourcePool); # User either user specified pool or import from source VM eval { $vmref->RelocateVM(spec => VirtualMachineRelocateSpec->new( datastore => $targetdsref, host => $vmhostref, pool => $vmpoolref, )) unless $dryrun; }; if (@_) { # Had errors error('move', $vm, @_); last unless $force; } else { $success = 1; } } # }}} MOVE } elsif ($cmd eq 'state') { # STATE {{{ my $state = shift; fatal('No state specified. Choose: on, off, suspend, reboot, shutdown, restart, standby') unless $state; fatal('Invalid power state specified. Choose: on, off, suspend, reboot, shutdown, restart, standby') unless $state =~ /^on|off|reboot|shutdown|suspend|standby|restart$/; my @vms = multiglob([list('VirtualMachine')], \@ARGV); fatal('No VM\'s match the given pattern') unless scalar(@vms); my $success; foreach $vm (@vms) { pause() if $cycleno++ and $success; $success = 0; my $vmref = getview('VirtualMachine', $vm) or fatal("Invalid virtual machine: $vm"); if ($state eq 'on') { if ($vmref->runtime->powerState->val eq 'poweredOff') { say(1, "Powering on $vm"); $vmref->PowerOnVM() unless $dryrun; $success = 1; } else { say(0, "$vm needs to be powered off before it can be turned on (VMware recognises the power state as '" . $vm->runtime->powerState->val . "')!"); } } elsif ($state =~ /^reboot|off|shutdown|suspend|standby|restart$/) { if ($vmref->runtime->powerState->val ne 'poweredOn') { say(0, "Cannot change VM state to '$state' for '$vm' from the current state '" . $vm->runtime->powerState->val . "'"); } elsif ($state eq 'reboot') { say(1, "Rebooting $vm"); $vmref->ResetVM() unless $dryrun; $success = 1; } elsif ($state eq 'suspend') { say(1, "Suspending $vm"); $vmref->SuspendVM() unless $dryrun; $success = 1; } elsif ($state eq 'off') { say(1, "Powering off $vm"); $vmref->PowerOffVM() unless $dryrun; $success = 1; } elsif ($state eq 'standby') { say(1, "Standby $vm"); $vmref->StandbyGuest() unless $dryrun; $success = 1; } elsif ($state eq 'shutdown') { say(1, "Shutting down $vm"); $vmref->ShutdownGuest() unless $dryrun; $success = 1; } elsif ($state eq 'restart') { say(1, "Restarting $vm"); $vmref->RebootGuest() unless $dryrun; $success = 1; } } } # }}} STATE } elsif ($cmd eq 'setpool') { # SETPOOL {{{ my $level = shift; fatal('You must specify a level to set. Choose from: low, normal, high') unless $level; fatal('Invalid level. Choose from: low, normal, high') unless $level =~ /^low|normal|high$/; my $item = shift; fatal('You must specify what item to set. Choose from: cpu, mem, all') unless $item; fatal('Invalid item selection. Choose from: cpu, mem, all') unless $item =~ /^cpu|mem|all$/; my @pools = multiglob([list('ResourcePool')], \@ARGV) or fatal('No pools match the given pattern'); my $success; foreach $pool (@pools) { pause() if $cycleno++ and $success; $success = 0; my $poolref = getview('ResourcePool', $pool); fatal("Invalid resource pool: $pool") unless $poolref; my $newshare = SharesInfo->new(shares => 0, level => SharesLevel->new($level)); my $cpualloc, $memalloc; if ($item eq 'cpu') { # Set CPU, import RAM $cpualloc = ResourceAllocationInfo->new(shares=>$newshare); $memalloc = $poolref->config->memoryAllocation; } elsif ($item eq 'mem') { # Set RAM, import CPU $cpualloc = $poolref->config->cpuAllocation; $memalloc = ResourceAllocationInfo->new(shares=>$newshare); } else { # Set both to the same value $cpualloc = ResourceAllocationInfo->new(shares=>$newshare); $memalloc = ResourceAllocationInfo->new(shares=>$newshare); } my $config = ResourceConfigSpec->new(cpuAllocation=>$cpualloc, memoryAllocation=>$memalloc); $poolref->UpdateConfig(config => $config) unless $dryrun; $success = 1; } # }}} SETPOOL } elsif ($cmd eq 'show') { # SHOW {{{ my $rawtype = $type = shift; unless ($type = translate($type)) { # First arg is not a recognised type - assume the user ommitted the prefix 'vm' unshift @ARGV, $rawtype; # Add the incorrect type back to pattern list $type = 'VirtualMachine'; say(1, "No specific type requested. Assuming: 'vm'"); } my @items = multiglob([list($type)], \@ARGV); fatal("No matching items found") unless @items; foreach $item (@items) { my %info = getinfo($type, $item); print "$key = $val\n" while (($key, $val) = each %info); print "\n"; } # }}} SHOW } elsif ($cmd eq 'snapshot') { # SNAPSHOT {{{ my @vms = multiglob([list('VirtualMachine')], \@ARGV) or fatal('No VM\'s match the given pattern'); $title = $title || time; my $success; foreach $vm (@vms) { say(1, "Snapshot '$vm'"); pause() if $cycleno++ and $success; $success = 0; my $vmref = getview('VirtualMachine', $vm) or fatal("Invalid virtual machine: $vm"); eval { $vmref->CreateSnapshot( name => $title, description => 'VMM created snapshot', memory => 0, quiesce => 1, ) unless $dryrun; }; if (@_) { error('snapshot', $vm, @_); } else { $success = 1; } } # }}} SNAPSHOT } elsif ($cmd eq 'version' or !$cmd) { # VERSION {{{ my $service = Vim::get_service_content(); print "vServer name: " . $service->about->fullName, "\n"; print "vServer OS: " . $service->about->osType . "\n"; print "API version: " . $service->about->apiVersion . " (build " . $service->about->build, ")\n"; print "Perl toolkit version: " . VMware::VIRuntime->VERSION . "\n"; # }}} VERSION } else { # OTHER {{{ fatal("Unknown command: '$cmd'"); # }}} } # Default config file __DATA__ [GLOBAL] verbose = 1 dryrun = 0 force = 0