There are a number of shell scripts provided with Oracle VM to help you use the CLI. If a password is required for any of these scripts, you are prompted at the command line to enter it. The shell scripts use key-based authentication, which is available after the first log in to the CLI.
These scripts are located in:
/u01/app/oracle/ovm-manager-3/ovm_cli/scripts
Table 2.2 Sample scripts
Script Name | Purpose |
|---|---|
| A shell script that acknowledges all events that a user can acknowledge. This script does not acknowledge system events. This script uses localhost as the default host. If you run this script from another host, you can specify the Oracle VM Manager location using the syntax: ackAllEvents -l |
| A shell script that displays an inventory of all objects managed by Oracle VM Manager. |
There are a also a set of shell scripts provided to get you started scripting in the CLI. These scripts are located in:
/u01/app/oracle/ovm-manager-3/ovm_cli/scripts/createdeletescripts
To use any of these scripts, you should first overwrite the default values in the associated *.properties file with values that match those of your environment. Each parameter within the associated properties file is commented to provide guidelines on the information that must be provided within these files. Additional information on how to run the scripts are contained as comments at the start of each script.
Table 2.3 Sample create/delete scripts
Script Name | Purpose |
|---|---|
| A shell script that sets up a complete Oracle VM environment, including storage, server pool, networking, virtual machine resources and a virtual machine, using fibre channel-based storage.
To use this script, edit the
|
|
A shell script that deletes the set up created using the
To use this script, edit the
|
| A shell script that sets up a complete Oracle VM environment, including storage, server pool, networking, virtual machine resources and a virtual machine, using ISCSI-based storage. This script uses a fibre channel LUN for the server pool's clustered file system. The Oracle VM Server must have access to an unmanaged fibre channel storage array. This script creates a storage array using the Oracle NetApp Filer plug-in.
To use this script, edit the
|
|
A shell script that deletes the set up created using the
To use this script, edit the
|
| A shell script that sets up a complete Oracle VM environment, including storage, server pool, networking, virtual machine resources and a virtual machine, using NFS-based storage.
To use this script, edit the
|
|
A shell script that deletes the set up created using the
To use this script, edit the
|
| A shell script that contains the common functions used by other scripts in this directory. Do not run this script directly, instead call it from other scripts. You can see a list of the common functions in this script in Table 2.4, “Sample scripts common functions”. |
To customize any of these scripts for your environment, copy them to a directory outside of the Oracle VM Manager installation tree, edit the script with a text editor and change the variables to suit your environment, or extend further to provide additional functionality.
When you run any of these scripts, the output is displayed to the screen; spool it to a file or other process or script as required.
The common.sh file provides some common
functions used by the sample scripts. The functions available in
this script are listed in
Table 2.4, “Sample scripts common functions”.
Table 2.4 Sample scripts common functions
| Function | Description |
|---|---|
getPass | Prompts for a password. You may want to prompt for an Oracle VM Server, or storage server pasword. When prompted, the input is not echoed on screen. The password can then be securely used with other CLI commands, such as discoverServer. No password is required for authentication with Oracle VM Manager as this uses certificate authentication. |
validateCLI
| Script continues if the CLI command returns success, and terminates if the command returns a failure. |
runCLI
| Script continues, regardless of the outcome of the CLI command. |
deleteRepo
| Deletes a storage repository and all of its contents. |
deleteServerpool
| Remove all Oracle VM Servers from a server pool, and deletes the server pool. |
addVnicFromClonedVmToNetwork
| Use this command when cloning a virtual machine that includes a VNIC. This command associates the VNIC with a network, so enables the virtual machine to be started. |
Optional timer functionality is built into the validateCLI and runCLI functions, which are used by all of the sample scripts to initiate connections to the CLI. This allows you to gather useful performance data, when running any of the sample scripts, by accurately timing and logging how long each of the commands within the scripts take to run. This tool also provides a useful log of every single command run for any of the scripts, providing debugging information that can be used to determine script failure or to understand the sequence of commands being issued by the script.
By default, the timer functionality is disabled, however it can
be enabled by using the command line switch:
-t. For
instance:
filename.txt
./create-nfs-based-VM.sh -t report.txtOutput generated within the specified file for a script where the timer functionality has been enabled may look similar to the following:
TIME(Seconds) Command
18.621 discoverServer ipAddress='10.172.76.80' password=******** takeOwnership=yes
5.587 create serverpool virtualIP='0.0.0.0' clusterEnable=no name='MyServerPool' \
description='this is nfs pool MyServerPool'
...It is worth noting that output logged for the timer functionality is appended to the file specified. This means that if you re-use the same filename, the file is not overwritten with the new data. Instead, the output is simply appended to the bottom of the file.
If no filename is specified for the timer switch, the output is dumped to STDOUT.

