Bookmark this page

Performing Lab Exercises

Run the lab command from workstation 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, it 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 to 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 as follows:

[student@workstation ~]$ ​lab action exercise

The action is a choice of start, grade, or finish. All exercises support start and finish. Only end-of-chapter labs and comprehesive review labs support grade.

start

A script's start logic verifies the required resources to begin an exercise. It might include configuring settings, creating resources, checking prerequisite services, and verifying necessary outcomes from previous exercises. With exercise start logic, you can perform any exercise at any time, even if you did not perform prerequisite exercises.

grade

End-of-chapter labs help to verify what you 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 rerun the grade action.

finish

A script's finish logic deletes exercise resources that are no longer necessary. With cleanup logic, you can repeatedly perform an exercise, and it helps course performance by ensuring that unneeded objects release their resources.

To list the available exercises, use tab completion in the lab command with an action:

[student@workstation ~]$ lab start Tab Tab
    api-review             cluster-admin          comprehensive-review1
    api-s3                 cluster-maint          comprehensive-review2
    api-swift              cluster-review         comprehensive-review3
    block-devices          component-auth         comprehensive-review4
    block-import           component-osd          comprehensive-review5
    block-review           component-pool         configure-monitor
    block-snapshot         component-review       configure-network
...output omitted...

Troubleshooting Lab Scripts

The lab command displays a list of action steps or grading criteria while it runs, with a PASS or FAIL status for each. If the status is FAIL, the script will display additional information captured from the step's command output. The output displayed, and how useful it might be for troubleshooting, will vary depending on what the step was doing.

 [student@workstation ~]$ lab grade comprehensive-review1

  Grading lab.

   · Checking lab systems ............................................ SUCCESS
   · Verify that cluster is running on the hosts ..................... SUCCESS
   · Verify that cluster health is ok ................................ SUCCESS
   · Verify that number of OSDs is 11 ................................ FAIL
      - '11 osds' not found in command output at 'clienta'
   · Verify OSD public_network ....................................... FAIL
      - '172.25.250.0/24' not found in command output at 'clienta'
   · Verify OSD cluster_network ...................................... SUCCESS

  Overall lab grade: FAIL

All exercise scripts are stored on the workstation system in the folder /home/student/.venv/labs/lib/python3.6/site-packages/SKU/, where the SKU is the course code. When you run the lab command with a valid action and exercise, it creates an exercise log file in /tmp/log/labs, and captures command output and error messages into the file.

[student@workstation ~]$ lab start cluster-review
...output omitted...
[student@workstation ~]$ ls -l /tmp/log/labs/
-rw-rw-r--. 1 student student 7520 Nov 02 05:34 cluster-review

Although exercise scripts are always run from workstation, they perform tasks on other systems in the course environment. Many course environments, including OpenStack and OpenShift, use a command-line interface (CLI) that is invoked from workstation to communicate with server systems and components by using REST 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.

Updating the Lab Files

Performing maintenance on the lab command and script files should only be done on the advice of your instructor or Red Hat support personnel. Incorrect use of the lab command or versioning can make your course environment unable to run lab commands or for you to perform exercises. List all available lab actions by using the --help option.

 [student@workstation ~]$ lab upgrade SKU
...output omitted...
 [student@workstation ~]$ lab --help
...output omitted...
Revision: rh342-8.4-6dd89bd