Run the lab command from the workstation machine to prepare your environment before each hands-on exercise, and again to clean up after an exercise.
Each hands-on exercise has a unique name within a course.
There are two types of exercises.
The first type, a guided exercise, is a practice exercise that follows a course narrative. If a narrative is followed by a quiz, this usually indicates that the topic did not have an achievable practice exercise.
The second type, an end-of-chapter lab, is a gradable exercise to help verify your learning. When a course includes a comprehensive review, the review exercises are structured as gradable labs. The syntax for running an exercise script is:
[student@workstation ~]$ lab action exerciseThe action is a choice of start, grade, or finish commands.
All exercises support start and finish commands.
Only end-of-chapter labs and comprehensive review labs support the grade command.
start
The start logic for a script verifies the resources required to begin an exercise. This may include configuring settings, creating resources, checking prerequisite services, and verifying necessary outcomes from previous exercises. Exercise start logic allows you to perform any exercise at any time, even if prerequisite exercises have not been performed.
grade
End-of-chapter labs help verify what you have learned after practicing with earlier guided exercises.
The grade action directs the lab command to display a list of grading criteria, with a PASS or FAIL status for each.
To achieve a PASS status for all criteria, fix the failures, and then run the grade action.
finish
The finish logic for a script deletes exercise resources that are no longer necessary.
Clean-up logic allows you to repeatedly perform an exercise, benefiting course performance by ensuring that unneeded objects release their resources.
To list the available exercises for a course, use tab completion in the lab command:
[student@workstation ~]$ lab start Tab Tab
accessing-create ha-node review-cr2
accessing-monitor ha-probe review-cr3
accessing-review ha-review storage-external
advanced-clone multihomed-nmstate storage-intro
advanced-maintenance multihomed-review storage-multiple
advanced-migrate network-external template-intro
advanced-review network-services template-create
advanced-snapshot network-review template-review
ha-loadbalance review-cr1 virtualization-deployWhen you run the lab command with a valid exercise and action, it creates one log file in /tmp/log/labs, plus the directory if it does not exist.
The file, named exercise, captures error messages that are normally displayed on your terminal.
[student@workstation ~]$ls -l /tmp/log/labs-rw-rw-r--. 1 student student 1024 Apr 25 12:00comprehensive-review
Exercise scripts send output to the log file when the scripts fail. Thus, the exercise log is useful for troubleshooting.
Although exercise scripts are always run from the workstation machine, they perform tasks on other systems in the course environment.
Many course environments, including OpenStack and OpenShift, use a command-line tool that is invoked from the workstation machine to communicate with server systems by using API calls.
Because script actions typically distribute tasks to multiple systems, additional troubleshooting is necessary to determine where a failed task occurred. Log in to those other systems and use Linux diagnostic skills to read local system log files and determine the root cause of the lab script failure.