Exporting classic virtual system patterns

You can export classic virtual system patterns.

Classic virtual system patterns are topology definitions for repeatable deployment that can be shared. You can export a command line script that reconstructs a classic virtual system pattern on a different system than the one on which it was created. Use this script to export virtual system patterns that were created before PureApplication® Software Version 2.2.2.0 that are not promoted to the new architecture.

Using the artifacts that are generated by the exportPattern.py script, you can export classic virtual system patterns from one system and import them to another system. This command-line interface (CLI) script reconstructs the original classic virtual system pattern on another system by using the importPatterns.py script. The reconstructed classic virtual system pattern contains the same properties as the original script:
  • Parts
  • Property values and metadata
  • Scripts
  • Script environment variables
  • Advanced options
  • Add-ons
  • Add-on parameter values
  • Ordering
  • Status (read-only)

Note that the script environment variables include the set of key/value pairs that are defined to the run time environment of the script, as specified in the Environment section of the Script Packages pane.

To include additional script package configuration parameters, such as executable commands and arguments (as specified in the Executable and Arguments sections, respectively, of the Script Packages pane), you must provide them in a cbscript.json file as part of the script package.

All script package configuration parameters, including executable commands and arguments (as specified in the Executable and Arguments sections, respectively, of the Script Packages pane), are included in the export and subsequent import of the classic virtual system pattern when using the command line interface. If script parameters are also included in a cbscript.json object file as part of the script package, the values exported from the user interface do not overwrite the values in the cbscript.json file.If script parameters are also included in a cbscript.json object file as part of the script package, the values exported from the user interface overwrite any previous values in the cbscript.json file.

Exporting a virtual system pattern

Use the samples/exportPattern.py script to export the classic virtual system pattern. Use the standard CLI syntax to run the script, by using the standard CLI parameters to specify the host name, user ID, and password to access the classic virtual system pattern, and specify additional parameters as needed using the following general format:
pure -h <hostname.com> -u <user> -p <password> --acceptcert
-f <script_location> -p <pattern_name> -t <target_directory>
{--passwords} {--downloadAll | {-d|--download <filter_file>}}

Options

Use the following options with the exportPattern.py script:
-a or --acceptcert
Indicates that SSL certificates from the system are automatically accepted.
-f <script_location>
Specifies the location of the name of the exportPattern.py script. For example:
-f ../samples/exportPattern.py
-p <pattern_name> or --pattern <pattern_name>
Specifies the name of the classic virtual system pattern to be exported. The name you specify must uniquely identify a classic virtual system pattern. If you do not specify the classic virtual system pattern, a list of classic virtual system patterns that are defined is displayed and you are prompted to select one.
-t <target_directory> or --target <target_directory>
Indicates that the exported artifacts will be written to the specified target folder or file name for the .tgz/.tar.gz file.

Typically, you specify the target directory as a local directory. You can, however, write to a remote directory if you have previously mapped it to a local drive. A target directory specified using remote file syntax (for example, \\Client\C$\<file_path>\Patterns) is not supported.

If you are exporting a large amount of data, you should specify the target directory folder name instead of a compressed file name. When you specify a compressed file name as the target, the exported files are first written to a temporary location on the system before they are compressed. If there is not enough temporary space available, an error might occur.

Note: Exporting multiple patterns to the same directory is not supported. Import each pattern to the target rack before exporting the next pattern, or export each pattern into its own target directory.
--passwords
Includes BASE64 encoded passwords in the pattern definition file. By default, password properties are not exported.
By default, only the archive files of script packages of the pattern are exported. To export the associated virtual images, script packages, and add-ons, you can specify the following options:
--downloadAll
Indicates that all associated artifacts are exported with the pattern, including the virtual images, script packages, and add-ons. If you do not specify this option, the patterns.json file is generated as part of the export process.
-d|--download <filter_file>
Indicates that only the artifacts that are listed in the filter file are downloaded. The filter is one JSON file formatted similar to the following example:
{
    "add_ons":[
        {"name":"ADD_ON_NAME"},
        ...
    ],
    "script_packages":[
        {"name":"SCRIPT_PACKAGE_NAME"},
        ...
    ],
    "virtual_images":[
        {"name":"IMAGE_NAME","version":"IMAGE_VERSION","build":"REFID"},
        ...
    ]
}
For example, you might create a filter file named myscriptpackage.json for exporting a script package artifact, specifying the name of the script package that you obtain from the pattern definition file under the references section. The contents might look similar to the following example:
{
    "script_packages":[
        {"name":"WebSphere Application Server Samples"}
    ]
}
You can then specify this filter file in the exportPattern.py script command with the option:
--download C:\tmp\myscriptpackage.json
Similarly, you might create a filter file named myaddon.json for downloading an add-on artifact:
{
    "add_ons":[
        {"name":"Default add user"}
    ]
}

Results

The file directory structure for the exported classic virtual system pattern is similar to the following example:
	/
		patterns.json    //The JSON serialization format for the exported pattern
		/images
			test_image.ova
		/script_packages
			test_script1.zip
			test_script1.zip
		/add_ons
			test_add_on.zip
The JSON serialization format for the classic virtual system pattern is similar to the following example:
[
   {
      "references":{
         "virtual_images":[
            {"name":"IMAGE_NAME","version":"IMAGE_VERSION","build":"REFID"},
            {"name":"IMAGE_NAME","version":"IMAGE_VERSION","build":"REFID","file":"OVA_FILE_FOR_IMPORT"},
                //"file" is the relative path for the OVA file when exporting the virtual image
            ...
         ],
         "add_ons":[
            {"name":"ADD_ON_NAME","type":"ADD_ON_TYPE"},       //"type" is optional.
            {"name":"ADD_ON_NAME","type":"ADD_ON_TYPE","file":"ADD_ON_FILE"},
                //"file" is the relative file path when exporting the add-on.
            ...
         ],
         "script_packages":[
            {"name":"SCRIPT_PACKAGE_NAME"},
            {"name":"SCRIPT_PACKAGE_NAME","file":"SCRIPT_PACKAGE_FILE"},
               //"file" is the relative file path when exporting the script package.
            ...
         ],
   },
      "name":"PATTERN_NAME",
      "description":"PATTERN_DESCRIPTION",      //The existing description, if applicable.
      "parts":[
         {
            "virtual_image_ref":"IMAGE_INDEX,
                  //The index for the images in the reference section, beginning with 0.
            "part":PART_NAME",
            "count": COUNT,                     //The count for the image part. The default is 1.
            "properties":[
               {
                  "class":"PROPERTY_CLASS",
                  "key":"PROPERTY_KEY",
                  "value":"PROPERTY_VALUE",
                  "locked":true | false         //Optional. The default is false.
               },
               ...
            ],
            "script_packages":[
               {
                  "script_package_ref":"SCRIPT_PACKAGE_INDEX",
                        //The index for the script packages in the reference section.
                  "parameters":[
                     {
                        "key":"PARAM_KEY",
                        "value":"PARAM_VALUE",
                        "locked":true | false   //Optional. The default is false.
                     },
                     ...
                  ]
                  starts_after:[ {"part_ref":PART_INDEX_1,"script_ref":PART_SCRIPT_INDEX_1}, ...]
                        //Optional. Specifies the order in which the script parts are started.
               }
            ],
            "add-ons":[
               {
                  "add_on_ref":ADD_ON_INDEX,
                        //The index for the script packages in the reference section.
                  "parameters":[
                     {
                        "key":"PARAM_KEY",
                        "value":"PARAM_VALUE",
                        "locked":true | false   //Optional. The default is false.
                     }
                     ...
                  ],
               }
            ],
            "configurations":[         //Optional. For script packages that are shipped with the virtual image.
               {,
                  "name":"CONFIGURATION_NAME",
                  "parameters":[
                     {
                        "key":"PARAM_KEY",
                        "value":"PARAM_VALUE",
                        "locked":true | false   //Optional. The default is false.
                     },
                     ...
                  ],
               }
            ],
            starts_after:[PART_INDEX_1,PART_INDEX_2, ... ]
                 //Optional. Specifies the order in which the parts are started.
         }
      ],
      "advanced_options":[
         ...
      ]
      "read_only":true | false     //Optional. The default is false.
   },
   ...
}

Helpful tips

Exporting the virtual images can take an extended amount of time depending on the size of the images. You can reduce the download time and the amount of space required by not downloading virtual images that are already included in the target environment, for example WebSphere Application Server Hypervisor Edition virtual images.

You can export the classic virtual system pattern without first specifying the -d or --downloadAll options. You can then extract the reference part from the exported pattern definition to create your filter file.

References to images in the JSON file refer to exact image numbers. You might need to update these references when importing to another system if it has different versions of those images.