Creating a Config-on-the-Fly File

Table of Contents


Creating a Config-on-the-Fly File

You can use a Config-on-the-fly file to define how specific file/registry items being tethered to on the source machine will be configured on the destination machine. For example, you may need to replace source machine identification information (hostname, IP address, etc.) with the destination machine ID information. You can use the Config-on-the-fly file to accomplish this task.

You can specify the Config-on-the-fly file in the Admin Console by clicking the COTF button or using the following property with virtapedit command:

CPROP_CONFIG_FILE

You can:

  • specify the paths to be configured and the actions to be taken for the particular path

  • use container properties (for example, CPROP_SRC_NODENAME) as arguments when setting the CPROP_CONFIG_FILE property (for example, virtapedit <path_to_appliance> CPROP_CONFIG_FILE "StandardCOTF.xml CPROP_SRC_NODENAME")

  • use wildcards in the TARGET tag and the EXCLUDE tag of the COTF file to exclude specific files from rehosting

When you create a container, a Config-on-the-fly file is automatically created in the container's COTF folder:

COTF\StandardCOTF.xml

When you specify a path to be configured, VirtaMove supports paths that are relative to the container folder. That is, VirtaMove supports:

".\COTF\StandardCOTF.xml"

or the absolute full path:

You can also specify only the file name of the COTF file if the file is in the COTF folder. For example:

If a container requires a custom Config-on-the-fly file, copy the file into the COTF folder of the container before you compress and move the container. You can then manually update the CPROP_CONFIG_FILE after you uncompress the container to make sure that it is set to the current location of the custom Config-on-the-fly file.

Config-on-the-fly Nodes

The Config-on-the-fly file defines one or more TARGET nodes:

  • TARGET node - each TARGET node specifies the path(s) to be configured

  • EXCLUDE node - defines paths that you want to exclude from the TARGET node actions

  • ACTION node - specifies the action to be taken on the files found under TARGET path(s)

TARGET Node

The TARGET node uses three attributes to define the path or paths that are to be configured:

  • folder

  • include_subfolders

  • entries

The include_subfolders attribute is optional. If it is omitted, its value is the default value "no". If include_subfolders is set to "no" or not specified, then folder and entries specify the file(s) entries under file directory folder, or the registry key value(s) entries under key folder. If include_subfolders is set to "yes", then folder and entries specify file(s) entries under directory folder and folder's subdirectories, or registry key value(s) entries under key folder and folder's subkeys.

TARGET Example 1

Specifies the file: "C:\Program Files (x86)\Apache Software Foundation\Apache2.2\conf\httpd.conf" (if C:\ drive is the system or home drive.)

Note that Homedrive, SystemDrive, or any other system variable, is resolved relative to the destination and not the source.

TARGET Example 2

Specifies all the registry key values under the key "HKLM\SOFTWARE\my_company\my_app".

The entries attribute supports wildcard names, for example: "sql???.cfg", "HostInfo*", etc. The entries attribute must not be empty.

EXCLUDE Node

The EXCLUDE node defines paths that you want to exclude from the TARGET node actions. You can use wildcards in this node.

The EXCLUDE XML tags are as follows:

Note that Homedrive, SystemDrive, or any other system variable, is resolved relative to the destination machine and not the source machine.

ACTION Node

Each TARGET node can have multiple ACTION nodes. There are three types of ACTION nodes:

For replace, the action searches and replaces tokens (as defined in the SEARCH and REPLACE nodes).

The execute type executes the executable defined in PATH with the arguments defined in ARGUMENTS for each entry matched in this TARGET node. %%TARGET%% placeholder can be used in ARGUMENTS. It will be replaced with a matched entry/file.

The alert action presents a notification whenever a file matching the PATTERN is found inside an appliance.

COTF SEARCH and REPLACE nodes follow the "POSIX-Extended Regular Expressions" rules.

Example replace:

Example execute: