... h1. Server side setup
* What needs to be setup on the server? ** The install image ** DHCP information *** client address *** boot file *** DNS information *** routing information ** Boot file (In the case of X86, it is pxegrub) ** install service *** Start the webserver *** Register the service with dns-sd *** setup default manifest ** Menu.lst ** HTTP links to the image so that the client can download using HTTP
h1. Server side tools
* Source code is located at usr/src/cmd/installadm and usr/src/cmd/ai-webserver * installadm ** create-service -- Create a service, and image ** delete-service -- Delete a service and optionally the image ** list -- List services or manifests associated to a service ** create-client -- Setup a client ** delete-client -- Delete a client setup ** start -- Start a service ** stop -- Stop a service ** add -- Add a manifest ** remove -- delete a manifest ** help ** version
h1. installadm source code flow
Source Code: _installadm.c_ All installadm commands will be handled by the main() of the installadm.c. The code checks for minimum arguments and calls the function derived from the cmds[] array.
h1. create-service
_installadm create-service_ is the main setup command needed to setup Automated Installation. This single command sets up AI image (contains tools and software to perform the installation), Registers an install service, setup DHCP paramters needed by the client to initiate the installation, and setup configuration that allows the client to pick up the correct installation software and parameters.
Source code: _installadm.c, setup-image.sh, setup-service.sh, setup-dhcp.sh, setup-tftp-links.sh, and installadm-common.sh_
The _create-service_ results in the function _do_create_service()_ being called. The function do_create_service does the following: # Extract and validate command line options # Check whether source image is valid # Check whether target exists and has a valid image. If so display a message and get out. # Invoke the script _/usr/lib/installadm/setup-image_ to extract an AI image to a directory using the source image # _setup_image_ does the following: ## Make sure that the target is an absolute path name and local ## If the source is an ISO image, lofi mount the source image ## Check whether there is enough space in the target file system ## Copy the contents of source to target ## Start the image web server if it is not running already ## Create a link from the web server document root to the target so that it can be accessed. # Now start the install service by invoking the script _/usr/lib/installadm/setup-service_ ## Look whether this service is already running ## If not running, start the service and start a web server on the specified port ## _dns-sd_ command is used to register the service and for lookup # Call _setup-dhcp_ to configure DHCP for this service ## If the DHCP server setup is needed (IP address information provided in the command line): ### initialize dhcp server using the command _/usr/sbin/dhcpconfig_ ### Add the IP addresses to the DHCP table ## Add the macro for this service to the DHCP table. If DHCP server is remote or no access to DHCP srever, print out the information about the macro to be added so that the user can add it manually. ## If the DHCP server is on the same machine and IP addresses are provided, assign the server macro to the IP Addresses. # Call _setup-tftp-links_ if the AI client is X86 and it does the following: ## Enable TFTP service if not enabled already ## Mount the _<target>/boot_ as a loop back file system so that the X86 client access it using TFTP ## Create pxegrub file and add a link to the bootfile name passed or generated ## Create a menu.lst name based on boot file name or derived from the service name # Save the information about service, target, and boot file in a text file so that we can find and delete them later.
h1. delete-service
_installadm delete-service_ is the command that deletes a service, update/remove configuration files and deletes the target if requested.
Source code: _installadm.c, setup-image.sh, setup-service.sh, setup-dhcp.sh, setup-tftp-links.sh, and installadm-common.sh_
# Remove the service if it is running # If -x option is provided, the target directory also will be removed. Using the service name, get the target, service and bootfile information. # Remove the target directory # Right now the TFTP links and DHCP data are not deleted but may be deleted in the future
h1. create-client
_installadm create-client_ is the command that configures a specific client with an AI image and an install service using its Mac address.
Source code: _installadm.c, create-client.sh, setup-tftp-links.sh, and installadm-common.sh_
# Gets the arguments and invokes _/usr/lib/installadm/create-client_ which does the following: ## Validates Mac Address, service name and AI image directory ## Mount <AI image dir>/boot as a loop back file system under /tftpboot if it is not already mounted. ## Remove the previous configuration information if the client was configured before. ## Generate a boot file name using the MAC address. For example if the MAC address is 0:9:db:4f:db:c8, then the generated boot file 010019DB4FDBC8. ## Link the generated name to a valid boot file (PXE grub) ## Create a menu.lst with file name based on the generated boot file. For example menu.lst.010019DB4FDBC8 ### kernel pointing to loop back mount/platform/i86pc/kernel ### install_media set to image directory (target directory) ### install_service set to service_name ### live mode set to 1 to indicate OpenSolaris Installation ### module set to loop back mount/x86.microroot ## Configure DHCP macro if the write access to DHCP server is allowed. Otherwise print what needed to be added to the DHCP.
h1. delete-client
_installadm delete-client_ is the command that removes the configuration a specific client added using create-client.
Source code: _installadm.c, and delete-client.sh_
# Gets the arguments and invokes _/usr/lib/installadm/create-client_ which does the following: ## Validates Mac Address, service name and AI image directory ## Remove the configuration files under /tftpboot directory corresponding to the client
h1. add (manifest)
Source code: _installadm.c, and publish-manifest.py
# Gets the service name and manifest from the command line. # Find the web server associated with this service and get the port number where the web server is running (/var/ai/<port> is the document root of the webserver) # Invokes _/usr/lib/installadm/publish-manifest_ with manifest and document root as the arguments. ## Call parseOptions() to get the manifest, directory and port ## Open the AI database (AI.db) ## Verify whether database is valid ## Get the AI manifest and SC manifest ## Validate AI manifest (relax NG schema) ## Get the criteria from the input ## If the name of the AI manifest is default, it means that default manifest is getting updated ### Remove the existing default manifest |