h1. What is AI Engine?
AI Engine is the core install component that performs the actual installation. _/usr/bin/auto-install_ is the command that perform AI Engine tasks. _auto-install_ is called with an a manifest (combined AI manifest and SC manifest in a single file) got from the install service as an input. _auto_install_ does the following things:
# Split the input manifest in to an AI manifest and an SC manifest
# Validate the AI manifest
# Get the install target
## Call Orchestrator to get the targets on the system
## Orchestrator uses Target Discovery Module (TD) to get the disks, partitions and slices on the system.
# Perform the partition and slice actions specified by the user in the AI manifest
# Parse SC manifest and get the system configuration.
# Call Orchestrator to perform the install
## Orchestrator is used by GUI install and Automated Install
## Orchestrator first uses Target Instantiation Module (TI) to create ZFS root file system
## Orchestrator uses Transfer Module (TM) to initialize and get the packages to the system from IPS repository
## Orchestrator finally uses Install Completion Tasks (ICT) to set up files and configuration needed for successful reboot and cleaning up the unneeded files on the system.
h1. AI Engine Code Flow
Source Code:
Top Directory: _slim_source/usr/src/cmd/auto-install_
Files: _auto_install.h auto_install.c auto_parse.c auto_parse_manifest.c auto_td.c_
The SMF method _auto_installer_ will get the AI combined manifest from the install server (from AI web server using HTTP) and calls 'auto-install' with the manifest as an argument. (The SMF method code will be discussed later)
# The _main()_ of the _auto-install (file: auto_install.c)_ parses the command and get the profile name
# The function _auto_split_manifests()_ called to separate the combined manifest in to AI and SC manifests.
# _auto_split_manifests() (file: auto_install.c)_ does the following:
## Open the input file (combined manifest)
## AI manifest contents will be written to _/tmp/ai_manifest.xml_ and SC manifest contents to _/tmp/sc_manifest.xml_
## AI manifest starts with _<ai_manifest_ and ends with _</ai_manifest>_. So look for the start and end marker and write the data between the markers to the AI manifest file.
## SC manifest starts with _<?xml version='1.0'?>_ and ends with _</service_bundle>_. So look for the start and end marker and write the data between the markers to the SC manifest file.
## If we are able to successfully separate the AI and SC manifests return AUTO_VALID_MANIFEST indicating success
# Now validate the AI manifest by passing AI manifest to _ai_validate_and_setup_manifest()_
# _ai_validate_and_setup_manifest() (file: auto_parse.c)_ in turn calls _ai_create_manifestserv() (file auto_parse_manifest.c)_
## This is the C interface to ai_create_manifestserv (python module)
## The python module parses the AI manifest and creates a tree representation of the AI manifest in the memory so that future calls to get a value for a XML field (name) can be looked up.
## The C interface initializes the python module and creates the tree object
## The handle is saved and returned to the caller and will be used in the future lookup calls
# Call _auto_perform_install()_ to setup parameters needed to call _om_perform_slim_install() (lib/liborchestrator/perform_slim_install.c)_
## Even though AI engine has two code path one taking disk as the input and another taking manifest as the input. AI uses the code path with AI manifest as the input. The disk path is used for debugging and testing AI engine.
## _auto_perform_install()_ calls _install_from_manifest()_ to take the code path to install using the AI manifest
## First it calls ai_get_manifest_disk_info() to get the target related XML parameters
## Next calls auto_select_install_target() which inturn calls auto_validate_target() (auto_td.c) to do the following:
### Initiate Target discovery (using Orchestrator interfaces)
### Get the list of available disks in the system
### If disk ame is provided in the AI manifest, then look for the disk in the system. If the disk doesn't exist on the system return error.
### If the disk name is not explicitly given but a set of disk parameters are provided, try to find the disk that matches the given disk parameters (by calling disk_criteria_match()). If cannot find a matching disk, return error.
### If the disk name is not given and was not asked to find a disk matching a set of disk parameters, then AI assumes that the user wanted to find a default disk for installation. So we call select_default_disk() to find a disk with Slice size is more than the recommended space. If such a disk not found, return error
### If there is a valid disk, check whether there are partitions already defined. If defined save the information about the partition to use it later by Orchestrator. If not defined, make a note that the whole disk will be used for Solaris.
### Do similar things for the Slice.
## Create data structures for the partitions to be created/deleted. If there are no existing partitions, create data structures and to initialize a partition table. Validate the created/modified data structure. All the partition related code is in liborchestrator/disk_parts.c
## Repeat the previous step for Slices. All the partition related code is in liborchestrator/disk_clices.c
## Create a NV_list using the values from AI manifest (disk target) and SC manifest (time zone, user name, password, and root password). The SC manifest should be parsed to get the values. Add the IPD information from AI manifest.
## If HTTP proxy is specified, set environment variable for the proxy to be used later.
## Add the list of packages to be installed
## Call om_perfoem_slim_install() to start the installation. If the Automated Installer failed before making this call, no changes are made on the system. This function modifies partitions and slices. It also creates ZFS root file systems on one of the slices.
# Installation is complete. Tear down the XML tree and exit.
# The SMF method auto-installer will exit successful and the system can be rebooted.
AI Engine is the core install component that performs the actual installation. _/usr/bin/auto-install_ is the command that perform AI Engine tasks. _auto-install_ is called with an a manifest (combined AI manifest and SC manifest in a single file) got from the install service as an input. _auto_install_ does the following things:
# Split the input manifest in to an AI manifest and an SC manifest
# Validate the AI manifest
# Get the install target
## Call Orchestrator to get the targets on the system
## Orchestrator uses Target Discovery Module (TD) to get the disks, partitions and slices on the system.
# Perform the partition and slice actions specified by the user in the AI manifest
# Parse SC manifest and get the system configuration.
# Call Orchestrator to perform the install
## Orchestrator is used by GUI install and Automated Install
## Orchestrator first uses Target Instantiation Module (TI) to create ZFS root file system
## Orchestrator uses Transfer Module (TM) to initialize and get the packages to the system from IPS repository
## Orchestrator finally uses Install Completion Tasks (ICT) to set up files and configuration needed for successful reboot and cleaning up the unneeded files on the system.
h1. AI Engine Code Flow
Source Code:
Top Directory: _slim_source/usr/src/cmd/auto-install_
Files: _auto_install.h auto_install.c auto_parse.c auto_parse_manifest.c auto_td.c_
The SMF method _auto_installer_ will get the AI combined manifest from the install server (from AI web server using HTTP) and calls 'auto-install' with the manifest as an argument. (The SMF method code will be discussed later)
# The _main()_ of the _auto-install (file: auto_install.c)_ parses the command and get the profile name
# The function _auto_split_manifests()_ called to separate the combined manifest in to AI and SC manifests.
# _auto_split_manifests() (file: auto_install.c)_ does the following:
## Open the input file (combined manifest)
## AI manifest contents will be written to _/tmp/ai_manifest.xml_ and SC manifest contents to _/tmp/sc_manifest.xml_
## AI manifest starts with _<ai_manifest_ and ends with _</ai_manifest>_. So look for the start and end marker and write the data between the markers to the AI manifest file.
## SC manifest starts with _<?xml version='1.0'?>_ and ends with _</service_bundle>_. So look for the start and end marker and write the data between the markers to the SC manifest file.
## If we are able to successfully separate the AI and SC manifests return AUTO_VALID_MANIFEST indicating success
# Now validate the AI manifest by passing AI manifest to _ai_validate_and_setup_manifest()_
# _ai_validate_and_setup_manifest() (file: auto_parse.c)_ in turn calls _ai_create_manifestserv() (file auto_parse_manifest.c)_
## This is the C interface to ai_create_manifestserv (python module)
## The python module parses the AI manifest and creates a tree representation of the AI manifest in the memory so that future calls to get a value for a XML field (name) can be looked up.
## The C interface initializes the python module and creates the tree object
## The handle is saved and returned to the caller and will be used in the future lookup calls
# Call _auto_perform_install()_ to setup parameters needed to call _om_perform_slim_install() (lib/liborchestrator/perform_slim_install.c)_
## Even though AI engine has two code path one taking disk as the input and another taking manifest as the input. AI uses the code path with AI manifest as the input. The disk path is used for debugging and testing AI engine.
## _auto_perform_install()_ calls _install_from_manifest()_ to take the code path to install using the AI manifest
## First it calls ai_get_manifest_disk_info() to get the target related XML parameters
## Next calls auto_select_install_target() which inturn calls auto_validate_target() (auto_td.c) to do the following:
### Initiate Target discovery (using Orchestrator interfaces)
### Get the list of available disks in the system
### If disk ame is provided in the AI manifest, then look for the disk in the system. If the disk doesn't exist on the system return error.
### If the disk name is not explicitly given but a set of disk parameters are provided, try to find the disk that matches the given disk parameters (by calling disk_criteria_match()). If cannot find a matching disk, return error.
### If the disk name is not given and was not asked to find a disk matching a set of disk parameters, then AI assumes that the user wanted to find a default disk for installation. So we call select_default_disk() to find a disk with Slice size is more than the recommended space. If such a disk not found, return error
### If there is a valid disk, check whether there are partitions already defined. If defined save the information about the partition to use it later by Orchestrator. If not defined, make a note that the whole disk will be used for Solaris.
### Do similar things for the Slice.
## Create data structures for the partitions to be created/deleted. If there are no existing partitions, create data structures and to initialize a partition table. Validate the created/modified data structure. All the partition related code is in liborchestrator/disk_parts.c
## Repeat the previous step for Slices. All the partition related code is in liborchestrator/disk_clices.c
## Create a NV_list using the values from AI manifest (disk target) and SC manifest (time zone, user name, password, and root password). The SC manifest should be parsed to get the values. Add the IPD information from AI manifest.
## If HTTP proxy is specified, set environment variable for the proxy to be used later.
## Add the list of packages to be installed
## Call om_perfoem_slim_install() to start the installation. If the Automated Installer failed before making this call, no changes are made on the system. This function modifies partitions and slices. It also creates ZFS root file systems on one of the slices.
# Installation is complete. Tear down the XML tree and exit.
# The SMF method auto-installer will exit successful and the system can be rebooted.