From a94c3a9ccb4c01131b19cf2800327e9d176d7ccf Mon Sep 17 00:00:00 2001 From: wangzh21 Date: Tue, 26 Mar 2019 23:05:38 +0800 Subject: [PATCH] Add cyborg driver development guide Change-Id: I0a235b1f7a08a608c4ad943b53adf41e4495fa77 --- .../contributor/driver-development-guide.rst | 58 +++++++++++++++++++ doc/source/index.rst | 1 + 2 files changed, 59 insertions(+) create mode 100644 doc/source/contributor/driver-development-guide.rst diff --git a/doc/source/contributor/driver-development-guide.rst b/doc/source/contributor/driver-development-guide.rst new file mode 100644 index 00000000..5fbe8dda --- /dev/null +++ b/doc/source/contributor/driver-development-guide.rst @@ -0,0 +1,58 @@ +:title: Driver Development Guide + +Driver Development Guide +######################## + +The goal of this document is to explain how to develop a new kind of Cyborg +accelerator driver. + +.. note:: + + Make sure you have installed Openstack environment using devstack_ before development. + +.. _devstack: https://docs.openstack.org/cyborg/latest/contributor/devstack_setup.html + +Derive a new driver class +========================= + +Imply the necessary interface, the list of interfaces is as follows: + +.. code-block:: python + + class NewCyborgDriver(object): + """Cyborg new accelerator driver. + """ + + def discover(self): + """Discover specific accelerator + :return: list of cyborg.objects.driver_objects.driver_device. + DriverDevice + """ + pass + +Modify setup.cfg +================ + +Add the new driver map into file ``cyborg/setup.cfg``: + +.. code-block:: cfg + + [entry_points] + cyborg.accelerator.driver = + intel_fpga_driver = cyborg.accelerator.drivers.fpga.intel.driver:IntelFPGADriver + new_driver_name = cyborg.accelerator.drivers.example.driver:NewCyborgDriver + +Reinstall and Test +================== + +Reinstall cyborg: + +.. code-block:: console + + $ python setup.py develop + +Restart cyborg-agent: + +.. code-block:: console + + $ sudo systemctl restart devstack@cyborg-agent diff --git a/doc/source/index.rst b/doc/source/index.rst index 82b61ba2..ab0eb54c 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -64,6 +64,7 @@ Developer Documentation contributor/contributing contributor/devstack_setup + contributor/driver-development-guide specs/index Indices and tables