2.8 Sample Scripts

There are a number of shell and Expect scripts provided with Oracle VM to help you use the CLI. These scripts are located in:

/u01/app/oracle/ovm-manager-3/ovm_cli/expectscripts

Warning

Some of the sample scripts store the Oracle VM Manager login credentials in plain text. These scripts should not be used in a production environment, and especially should not be used on a machine with low security settings. You should implement your own security methods for the login credentials.

Table 2.2 Sample scripts

Script Name

Purpose

ackAllEvents

An Expect script that acknowledges all events that a user can acknowledge. This script does not acknowledge system events.

To use this script, edit it and change the following lines to include the login credentials for Oracle VM Manager:

set username username
set password password

To run the script, enter:

# ./ackAllEvents

inventory

An Expect script that displays an inventory of all objects managed by Oracle VM Manager.

To use this script, edit it and change the following lines to include the login credentials for Oracle VM Manager:

set username username
set password password

To run the script, enter:

# ./inventory

There are a also a set of Expect scripts provided to get you started scripting in the CLI. These scripts are located in:

/u01/app/oracle/ovm-manager-3/ovm_cli/expectscripts/createdeletescripts

A text file named README in the directory provides information on using these scripts and may have additional information not included in this section.

Warning

Some of the sample scripts store the Oracle VM Manager login credentials in plain text. These scripts should not be used in a production environment, and especially should not be used on a machine with low security settings. You should implement your own security methods for the login credentials.

Table 2.3 Sample create/delete scripts

Script Name

Purpose

create-fc-based-VM.cli

An Expect 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 fc-based-VM.properties file in the same directory and change the parameters to suit your environment. To run the script, enter:

# ./runOVMCLITest  -test=create-fc-based-VM.cli \
    -arguments=fc-based-VM.properties

delete-fc-based-VM.cli

An Expect script that deletes the set up created using the create-fc-based-VM.cli script.

To use this script, edit the fc-based-VM.properties file in the same directory and change the parameters to suit your environment. To run the script, enter:

# ./runOVMCLITest  -test=delete-fc-based-VM.cli \
    -arguments=fc-based-VM.properties

create-iscsi-based-VM.cli

An Expect 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 iscsi-based-VM.properties file in the same directory and change the parameters to suit your environment. To run the script, enter:

# ./runOVMCLITest  -test=create-iscsi-based-VM.cli \
    -arguments=iscsi-based-VM.properties

delete-iscsi-based-VM.cli

An Expect script that deletes the set up created using the create-iscsi-based-VM.cli script.

To use this script, edit the iscsi-based-VM.properties file in the same directory and change the parameters to suit your environment. To run the script, enter:

# ./runOVMCLITest  -test=delete-iscsi-based-VM.cli \
    -arguments=iscsi-based-VM.properties

create-nfs-based-VM.cli

An Expect 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 nfs-based-VM.properties file in the same directory and change the parameters to suit your environment. To run the script, enter:

# ./runOVMCLITest  -test=create-nfs-based-VM.cli \
    -arguments=nfs-based-VM.properties

delete-nfs-based-VM.cli

An Expect script that deletes the set up created using the create-nfs-based-VM.cli script.

To use this script, edit the nfs-based-VM.properties file in the same directory and change the parameters to suit your environment. To run the script, enter:

# ./runOVMCLITest  -test=delete-nfs-based-VM.cli \
    -arguments=nfs-based-VM.properties

runAllCreateDeleteTests.sh

An Expect script that runs all the create/delete scripts provided in the directory.

To use this script, edit the *-based-VM.properties files in the same directory and change the parameters to suit your environment. To run the script, enter:

# ./runAllCreateDeleteTests.sh

runOVMCLITest

A shell script to run the *-based-VM.cli Expect scripts which create/delete the Oracle VM environment. To run the script, enter:

# ./runOVMCLITest  -test=cli_script -arguments=properties_file

commonExpectDef.cli

An Expect script that contains the common functions used by other scripts in this directory. Do not run this script directly.

runCLI.py

A Python script used by runOVMCLITest that reads the arguments defined in the property files and generates Expect scripts. Do not run this script directly.


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 an Expect script, the output is displayed to the screen; spool it to a file or other process or script as required.