| 1 | -*- outline -*- |
|---|
| 2 | |
|---|
| 3 | * PXE Manager |
|---|
| 4 | |
|---|
| 5 | The idea is to build an automaton to control when to boot from the |
|---|
| 6 | local drives and when to boot from the network. |
|---|
| 7 | |
|---|
| 8 | The systems can be used to run automated tests. You can also use this |
|---|
| 9 | system only to provision on demand systems or backup your partitions |
|---|
| 10 | using partimage or anything you want to do with an automated PXE |
|---|
| 11 | system... |
|---|
| 12 | |
|---|
| 13 | The systems must be configured to always boot over PXE. |
|---|
| 14 | |
|---|
| 15 | ** Install |
|---|
| 16 | |
|---|
| 17 | - edit the database and PXE config in the settings.py according to |
|---|
| 18 | your local setup. |
|---|
| 19 | |
|---|
| 20 | - you need python-django installed. |
|---|
| 21 | |
|---|
| 22 | - run ./manage.py syncdb to create the needed sql tables. |
|---|
| 23 | |
|---|
| 24 | - create the PXE profiles in pxelinux.cfg/profiles/ ending in |
|---|
| 25 | .prof. The local.prof is mandatory and must point to a local boot |
|---|
| 26 | config. The user running the scripts must have the right to write in |
|---|
| 27 | pxelinux.cfg. I usually create a group and put it under control of |
|---|
| 28 | the files under pxelinux.cfg. |
|---|
| 29 | |
|---|
| 30 | - export these 2 environment variables: |
|---|
| 31 | DJANGO_SETTINGS_MODULE=settings and PYTHONPATH=$PWD. |
|---|
| 32 | |
|---|
| 33 | - run pxemngr syncbootnames to add the names of the PXE profiles in the |
|---|
| 34 | database. |
|---|
| 35 | |
|---|
| 36 | - add the systems that you want to control by this system like this: |
|---|
| 37 | |
|---|
| 38 | pxemngr addsystem <name> <mac address> [<mac address 2>...] |
|---|
| 39 | |
|---|
| 40 | - set which profile you want your system to PXE boot: |
|---|
| 41 | |
|---|
| 42 | pxemngr nextboot <name> <profile name> |
|---|
| 43 | |
|---|
| 44 | If you want to assign a default profile to all systems, use the |
|---|
| 45 | reserved system name 'default'. |
|---|
| 46 | |
|---|
| 47 | - run ./manage.py runserver <ip addr>:<port> to have a web server |
|---|
| 48 | waiting for requests to boot locally. You can also configure django |
|---|
| 49 | to use apache instead of the little embedded server. |
|---|
| 50 | |
|---|
| 51 | - then your PXE scripts must access the following web page |
|---|
| 52 | http://<ipaddr>:<port>/localboot/ to request a local boot |
|---|
| 53 | before rebooting else the PXE boot will continue to loop on the same |
|---|
| 54 | install. |
|---|
| 55 | |
|---|
| 56 | ** Advanced |
|---|
| 57 | |
|---|
| 58 | - in your auto-install scripts, you can access the current profile by |
|---|
| 59 | accessing the following url: http://<ipaddr>:<port>/profile/ |
|---|
| 60 | |
|---|
| 61 | ** Test system |
|---|
| 62 | |
|---|
| 63 | *** Description |
|---|
| 64 | |
|---|
| 65 | The test system allows to provide test scripts to running systems |
|---|
| 66 | declared in the PXE manager database. |
|---|
| 67 | |
|---|
| 68 | The target system can request a test by using this url: |
|---|
| 69 | http://<ipaddr>:<port>/nexttest/ |
|---|
| 70 | |
|---|
| 71 | The tests are usually shell scripts that are built using Django |
|---|
| 72 | templating system. By convention, the tests are usinf a suffix of |
|---|
| 73 | .test. They are stored in the directory set in settings.py under the |
|---|
| 74 | TESTS_DIR variable. A wait.test must exist and will be sent by the |
|---|
| 75 | server to the target system when no test is available. This wait.test |
|---|
| 76 | must wait for some time and then exit to let the system send a new |
|---|
| 77 | test if needed or send back a new wait.test. |
|---|
| 78 | |
|---|
| 79 | After the execution of a test script, the result is sent back to the |
|---|
| 80 | server using the following url: http://<ipaddr>:<port>/upload/<test id>/. I |
|---|
| 81 | usualy run the following curl command to upload the result: |
|---|
| 82 | |
|---|
| 83 | curl --retry 0 -s -f -F "file=@$output" http://<ipaddr>:<port>/upload/<test id>/ |
|---|
| 84 | |
|---|
| 85 | These uploaded files are stored under the directory set by the |
|---|
| 86 | TEST_UPLOAD_DIR variable in settings.py. |
|---|
| 87 | |
|---|
| 88 | The system uses a simple convention in these files to lookup |
|---|
| 89 | information. It parses the lines to store informations, warnings and |
|---|
| 90 | errors lines if they begin by 'I: ', 'W: ' and 'E: '. The system also |
|---|
| 91 | tries to find the version of the system by looking for a line starting |
|---|
| 92 | by 'V: '. |
|---|
| 93 | |
|---|
| 94 | You can then navigate on web pages displaying these parsed |
|---|
| 95 | informations under: http://<ipaddr>:<port>/. |
|---|
| 96 | |
|---|
| 97 | *** Control |
|---|
| 98 | |
|---|
| 99 | To instruct the system about which tests are available, use the |
|---|
| 100 | following command: |
|---|
| 101 | |
|---|
| 102 | pxemngr synctestnames |
|---|
| 103 | |
|---|
| 104 | To assign a test to a target system, use the following command: |
|---|
| 105 | |
|---|
| 106 | pxemngr nexttest <system name> <test name> |
|---|
| 107 | |
|---|
| 108 | To display all the tests scheduled for a system, use: |
|---|
| 109 | |
|---|
| 110 | pxemngr dpytest <system name> |
|---|
| 111 | |
|---|
| 112 | *** Web navigation |
|---|
| 113 | |
|---|
| 114 | By pointing your browser to http://<ipaddr>:<port>/, you can navigate |
|---|
| 115 | in the results of the test system. |
|---|