Debian Codegraph @

doc/source/user/index.rst

raw
1 =====
2 Usage
3 =====
4
5 Sphinx Configuration
6 --------------------
7
8 To use the extension, add ``'sphinx_feature_classification.support_matrix'`` to
9 the ``extensions`` list in the ``conf.py`` file in your Sphinx project.
10
11 .. code-block:: python
12 :caption: conf.py
13
14 extensions = [
15 'sphinx_feature_classification.support_matrix',
16 # ... other extensions
17 ]
18
19 Once added, include the ``support_matrix`` directive in your chosen document.
20 The directive takes a single argument: a relative path to the INI file in which
21 the driver matrix is defined.
22
23 .. code-block:: rst
24 :caption: support-matrix.rst
25
26 .. support_matrix:: support-matrix.ini
27
28 See below for more details on the format of this file.
29
30
31 Drivers vs. Features vs. Implementations
32 ----------------------------------------
33
34 Drivers
35 Drivers are *backends* that are used to implement a set of features. What a
36 driver actually is depends entirely on the project being documented. For a
37 project like OpenStack Compute (nova), this could be a virtualization driver
38 (*libvirt*, *Hyper-V*, *PowerVM*, etc.). For a project like OpenStack
39 Storage, this could be a block storage driver (*LVM*, *NFS*, *RBD*, etc.). It
40 is entirely project-specific.
41
42 Features
43 Features are more clear cut. Features are something that your project should
44 support (or *must* support). For a project like OpenStack Compute (nova),
45 this could be the ability to restart an instance. For a project like
46 OpenStack Storage (cinder), this could be the ability to create a snapshot of
47 a volume.
48
49 Implementation
50 Implementations refer to the state of a feature within a given driver. As not
51 all features are required, not all drivers may implement them.
52
53
54 Documenting Your Drivers
55 ------------------------
56
57 This extension uses an INI file to render your driver matrix in Sphinx. For
58 example, you may wish to call this file ``support-matrix.ini``. This file
59 should be placed somewhere within your Sphinx source directory. Within the INI
60 file, there are multiple sections.
61
62 Driver Sections
63 ~~~~~~~~~~~~~~~
64
65 Driver sections are prefixed with ``driver.``. You can specify as many of them
66 as you need for your project. The section has various options that can be
67 specified.
68
69 ``title``
70 :Mandatory: **Yes**
71
72 Friendly name of the driver.
73
74 ``link``
75 :Mandatory: No
76
77 A link to documentation of the driver.
78
79 For example:
80
81 .. code-block:: INI
82 :caption: support-matrix.ini
83
84 [driver.slow-driver]
85 title=Slow Driver
86 link=https://docs.openstack.org/foo/latest/some-slow-driver-doc
87
88 [driver.fast-driver]
89 title=Fast Driver
90 link=https://docs.openstack.org/foo/latest/some-fast-driver-doc
91
92 Feature Sections
93 ~~~~~~~~~~~~~~~~
94
95 Feature sections are prefixed with ``operation.``. As with driver sections, you
96 can specify as many of them as you need for your project. These sections are
97 also used to describe the feature and indicate the implementation status of the
98 feature among the various drivers, as seen below. These sections have the
99 following options:
100
101 ``title``
102 :Mandatory: **Yes**
103
104 Friendly name of the feature.
105
106 ``status``
107 :Mandatory: **Yes**
108
109 The importance of the feature or whether it's required. One of:
110
111 ``mandatory``
112 Unconditionally required to be implemented.
113
114 ``optional``
115 Optional to support; nice to have.
116
117 ``choice(group)``
118 At least one of the options within the named group must be implemented.
119
120 ``condition``
121 Required, if the referenced condition is met.
122
123 ``notes``
124 :Mandatory: No
125
126 Additional information about the feature.
127
128 ``cli``
129 :Mandatory: No
130
131 A sample CLI command that can be used to utilize the feature.
132
133 ``api``
134 :Mandatory: No
135
136 The alias for this feature in the API.
137
138 In addition, there are some driver specific options that should be repeated
139 for every driver defined earlier in the file.
140
141 ``driver.XXX``
142 :Mandatory: **Yes** (for each driver)
143
144 The level of implementation of this feature in driver ``XXX``. One of:
145
146 ``complete``
147 Fully implemented, expected to work at all times.
148
149 ``partial``
150 Implemented, but with caveats about when it will work. For example, some
151 configurations, hardware or guest OS' may not support it.
152
153 ``missing``
154 Not implemented at all.
155
156 ``driver-notes.XXX``
157 :Mandatory: No
158
159 Additional information about the implementation of this feature in driver
160 ``XXX``. While this is optional, it is highly recommended for implementations
161 in the ``partial`` state.
162
163 For example:
164
165 .. code-block:: INI
166 :caption: support-matrix.ini
167
168 [operation.attach-volume]
169 title=Attach block volume to instance
170 status=optional
171 notes=The attach volume operation provides a means to hotplug additional
172 block storage to a running instance.
173 cli=my-project attach-volume <instance> <volume>
174 api=volume-attach
175 driver.slow-driver=complete
176 driver.fast-driver=complete
177
178 [operation.detach-volume]
179 title=Detach block volume from instance
180 status=condition(operation.attach-volume==complete)
181 notes=The detach volume operation provides a means to remove additional
182 block storage from a running instance.
183 cli=my-project detach-volume <instance> <volume>
184 api=volume-detach
185 driver.slow-driver=complete
186 driver-notes.slow-driver=Works without issue if instance is off. When
187 hotplugging, requires version foo of the driver.
188 driver.fast-driver=complete
189
190 Notice that a driver is only required to implement detach-volume if they
191 completed implementing ``attach-volume``.
192
193
194 Example
195 -------
196
197 This is simply the combined example from above.
198
199 .. code-block:: INI
200 :caption: support-matrix.ini
201
202 [driver.slow-driver]
203 title=Slow Driver
204 link=https://docs.openstack.org/foo/latest/some-slow-driver-doc
205
206 [driver.fast-driver]
207 title=Fast Driver
208 link=https://docs.openstack.org/foo/latest/some-fast-driver-doc
209
210 [operation.attach-volume]
211 title=Attach block volume to instance
212 status=optional
213 notes=The attach volume operation provides a means to hotplug additional
214 block storage to a running instance.
215 cli=my-project attach-volume <instance> <volume>
216 api=volume-attach
217 driver.slow-driver=complete
218 driver.fast-driver=complete
219
220 [operation.detach-volume]
221 title=Detach block volume from instance
222 status=condition(operation.attach-volume==complete)
223 notes=The detach volume operation provides a means to remove additional
224 block storage from a running instance.
225 cli=my-project detach-volume <instance> <volume>
226 api=volume-detach
227 driver.slow-driver=complete
228 driver-notes.slow-driver=Works without issue if instance is off. When
229 hotplugging, requires version foo of the driver.
230 driver.fast-driver=complete