| 1 |
:title: Driver Development Guide |
| 2 |
|
| 3 |
Driver Development Guide |
| 4 |
######################## |
| 5 |
|
| 6 |
The goal of this document is to explain how to develop a new kind of Cyborg |
| 7 |
accelerator driver. |
| 8 |
|
| 9 |
.. note:: |
| 10 |
|
| 11 |
Make sure you have installed Openstack environment using devstack_ before development. |
| 12 |
|
| 13 |
.. _devstack: https://docs.openstack.org/cyborg/latest/contributor/devstack_setup.html |
| 14 |
|
| 15 |
Derive a new driver class |
| 16 |
========================= |
| 17 |
|
| 18 |
Imply the necessary interface, the list of interfaces is as follows: |
| 19 |
|
| 20 |
.. code-block:: python |
| 21 |
|
| 22 |
class NewCyborgDriver(object): |
| 23 |
"""Cyborg new accelerator driver. |
| 24 |
""" |
| 25 |
|
| 26 |
def discover(self): |
| 27 |
"""Discover specific accelerator |
| 28 |
:return: list of cyborg.objects.driver_objects.driver_device. |
| 29 |
DriverDevice |
| 30 |
""" |
| 31 |
pass |
| 32 |
|
| 33 |
Modify setup.cfg |
| 34 |
================ |
| 35 |
|
| 36 |
Add the new driver map into file ``cyborg/setup.cfg``: |
| 37 |
|
| 38 |
.. code-block:: cfg |
| 39 |
|
| 40 |
[entry_points] |
| 41 |
cyborg.accelerator.driver = |
| 42 |
intel_fpga_driver = cyborg.accelerator.drivers.fpga.intel.driver:IntelFPGADriver |
| 43 |
new_driver_name = cyborg.accelerator.drivers.example.driver:NewCyborgDriver |
| 44 |
|
| 45 |
Reinstall and Test |
| 46 |
================== |
| 47 |
|
| 48 |
Reinstall cyborg: |
| 49 |
|
| 50 |
.. code-block:: console |
| 51 |
|
| 52 |
$ python setup.py develop |
| 53 |
|
| 54 |
Restart cyborg-agent: |
| 55 |
|
| 56 |
.. code-block:: console |
| 57 |
|
| 58 |
$ sudo systemctl restart devstack@cyborg-agent |