/etc/vmmrc
VMM config file for all users.
Manage vmware virtual machines
vwm <command>
[options]
cloneClone 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'.
deploySynonym of 'clone'.
dfDisplay disk usage information about datastores. If a list of matches is provided, the data store list is filtered for those items.
listDisplay a list of the given items matching a pattern.
Possible lists include (selection can be plural or singular):
vms (default if unspecified)datastoreshostspools
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.
migrateMigrate a given list of VMs to another host.
moveMove a given list of VMs to another datastore.
setpoolSet the share level on the given resource pools.
showShow 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.
snapshotTake 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.
stateSet the state of a list of VMs.
This can be any of the following choices:
on - Power up the specified VMsoff - 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.
versionDisplay 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 'vwm' with nothing else specified).
[@profile]Default: First specified profile in configType: Profile name or URLSpecifies 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.
vwm version @cluster1vwm version @cluster2vwm version @https://cluster1.acme.eduvwm version @https://[email protected]vwm version @https://username:[email protected]
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 vwm is run.
-c
Default: 1Type: NumberSpecifies 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...]
Default: NameType: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]
Default: Same as source VMType: Datastore nameSpecify a data store for operations that require it.
--force
-f
Default: offType: SwitchForce continue if an error occurs. 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.
--human
-h
Default: offType: SwitchDisplay the numbers of the 'df' command in a human readable format.
--dryrun
-n
Default: offType: SwitchDry run mode. When enabled vwm will continue as normal but no actual call to the VMware VServer is made.
--folder
-l
Default: Source VM / templates folderType: StringSpecifies the folder that the cloned machine should be moved into. If unspecified the source VM's folder is used instead.
--pool [pool]
-o [pool]
Default: Same as the source VMType: Pool nameSpecifies 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]
Default: lowType: Choice of: low, normal, highSpecifies the priority when migrating VMs.
--seperator [character]
-s [character]
Default: \t (tab)Type: StringSpecifies the string to display between columns when outputing a list.
--title [title]
-t [title]
Default: The Unix EPOC (for VMs)Type: StringThe title of the snapshot to create or the title row of the list table.
-v
--verbose
Default: 0Type: Accumulating switchBe more verbose when outputting information to STDERR. Specify multiple times to increase verbosity.
-w [seconds]
-wait [seconds]
Default: 0Type: Number of secondsForce a wait for the specified number of seconds between operations.
A command line tool for the manipulation of VMware Virtual Machines (VM).
Clone VM01 to VM02. Since neither the datasource (-d) or pool (-o) is specified these details are copied from VM01.
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.
Same as the above example but spread the datastores across SAN1 and SAN2 and move the machine to the 'Active' pool.
Deploys the template Template-DBServer into DB05, moving the destination into the Databases folder.
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.
Display a datastore usage sheet (similar to the Unix 'df' command) for all datastores ending in '2'.
Put the hosts 'Moe' and 'Homer' into maintenance mode (use 'restore' to recover from this).
List all VMs.
List all VMs - showing their name, currently allocated host and IP address.
Migrate all virtual machines matching 'DBS*' to the 'Carl' host.
Migrate all virtual machines matching 'DBS*' with high priority to the 'Active' pool on the 'Lenny' host waiting 60 seconds between machine.
Move VMs DB00 and DB01 to the SAN2 datastore within profile 'cluster2'.
Show information on host 'Lisa'.
Take a snapshot of VMs 'DB04' and 'DB05' using the title 'Todays backup'
Turn DB00 and DB01 on waiting 30 seconds between machines.
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.
/etc/vmmrc
VMM config file for all users.
.vmmrc
VMM config file for the local user.
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 = 2profile = Cluster1dryrun = 0human = 1force = 0seperator = \thttp_proxy = http://myproxy.example.com:8080https_proxy = http://myproxy.example.com:8080[Cluster1]url = https://cluster1.acme.eduusername = adminpassword = password[Cluster2]url = https://cluster2.acme.eduusername = administratorpassword = changeme
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.
urlThe connection URL of the vServer system within the profile
username and passwordThe authentication information when connecting to the vServer.
dryrunSpecify a default dry run value. See -n for further information.
forceIf 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_proxyhttps_proxyForceably 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.
humanAlways output numbers in a human readable format rather than the raw form.
prioritySpecify a default priority when using any command that is '-p' compatible.
profileSpecify the default profile to use if none is explicitally set. If not specified the first found profile in the config file is used.
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'.
seperatorSpecify the seperator character used when outputting tabular data with the 'list' command.
verboseSpecify a default verbosity level. See -v for further information.
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/
This requires the packages libclass-methodmaker-perl libcrypt-ssleay-perllibsoap-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/vmware-manager.
* Run VMM with a simple command to make sure everything is setup right.
vwm version
* Enjoy