@@ -26,57 +26,60 @@ D --> F[SMAPIv3 plugins]
2626
2727## SMAPIv1
2828
29- These are the files related to SMAPIv1 in ` xen-api/ocaml/xapi/ ` :
30-
31- - sm.ml: OCaml "bindings" for the SMAPIv1 Python "drivers" (SM)
32- - sm_exec.ml:
33- support for implementing the above "bindings". The
34- parameters are converted to XML-RPC, passed to the relevant python
35- script ("driver"), and then the standard output of the program is
36- parsed as an XML-RPC response (we use
37- ` xen-api-libs-transitional/http-svr/xMLRPC.ml ` for parsing XML-RPC).
29+ These are the files related to SMAPIv1 in [ ` /ocaml/xapi/ ` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi ) :
30+
31+ - [ ` sm.ml ` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/sm.ml ) :
32+ OCaml "bindings" for the SMAPIv1 Python "drivers" (SM)
33+ - [ ` sm_exec.ml ` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/sm_exec.ml ) :
34+ support for implementing the above "bindings".
35+ The parameters are converted to XML-RPC, passed to the relevant python script ("driver"),
36+ and then the standard output of the program is parsed as an XML-RPC response (we use
37+ [ ` ocaml/libs/http-lib/xMLRPC.ml ` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/libs/http-lib/xMLRPC.ml )
38+ for parsing XML-RPC).
3839 When adding new functionality, we can modify ` type call ` to add parameters,
3940 but when we don't add any common ones, we should just pass the new
4041 parameters in the args record.
41- - ` smint.ml ` : Contains types, exceptions, ... for the SMAPIv1 OCaml
42- interface
43- - ` storage_smapiv1_wrapper.ml ` : A state machine for SMAPIv1 operations. It computes
44- the required actions to reach the desired state from the current state.
45- - ` storage_smapiv1.ml ` : Contains the actual translation of SMAPIv2 calls to SMAPIv1
46- calls, by calling the bindings provided in sm.ml.
42+ - [ ` smint.ml ` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/smint.ml ) :
43+ Contains types, exceptions, ... for the SMAPIv1 OCaml interface.
44+ - [ ` storage_smapiv1_wrapper.ml ` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_smapiv1_wrapper.ml ) :
45+ The [ ` Wrapper ` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_smapiv1_wrapper.ml#L360 )
46+ module wraps a SMAPIv2 server (` Server_impl ` ) and takes care of
47+ locking and datapaths (in case of multiple connections (=datapaths)
48+ from VMs to the same VDI, using a state machine for SMAPIv1 operations.
49+ It will use the superstate computed by the
50+ [ ` vdi_automaton.ml ` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-idl/storage/vdi_automaton.ml )
51+ in xapi-idl) to compute the required actions to reach the desired state from the current one.
52+ It also implements some functionality, like the ` DP ` module, that is not implemented in lower layers.
53+ - [ ` storage_smapiv1.ml ` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_smapiv1.ml ) :
54+ a SMAPIv2 server that translates SMAPIv2 calls to SMAPIv1 ones, by calling
55+ [ ` ocaml/xapi/sm.ml ` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/sm.ml ) .
56+ It calls passes the XML-RPC requests as the first command-line argument to the
57+ corresponding Python script, which returns an XML-RPC response on standard
58+ output.
4759
4860## SMAPIv2
4961
5062These are the files related to SMAPIv2, which need to be modified to
5163implement new calls:
5264
53- - [ xcp -idl/storage/storage \_ interface .ml] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-idl/storage/storage_interface.ml ) :
65+ - [ ` ocaml/xapi -idl/storage/storage_interface .ml` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-idl/storage/storage_interface.ml ) :
5466 Contains the SMAPIv2 interface
55- - [ xcp -idl/storage/storage \_ skeleton .ml] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-idl/storage/storage_skeleton.ml ) :
67+ - [ ` ocaml/xapi -idl/storage/storage_skeleton .ml` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-idl/storage/storage_skeleton.ml ) :
5668 A stub SMAPIv2 storage server implementation that matches the
5769 SMAPIv2 storage server interface (this is verified by
58- [ storage \_ skeleton \_ test .ml] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-idl/storage/storage_skeleton_test.ml ) ),
70+ [ ` storage_skeleton_test .ml` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-idl/storage/storage_skeleton_test.ml ) ),
5971 each of its function just raise a ` Storage_interface.Unimplemented `
6072 error. This skeleton is used to automatically fill the unimplemented
6173 methods of the below storage servers to satisfy the interface.
62- - [ xen-api/ocaml/xapi/storage\_ smapiv1.ml] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_smapiv1.ml ) :
63- a SMAPIv2 server that does SMAPIv2 -> SMAPIv1 translation.
64- It passes the XML-RPC requests as the first command-line argument to the
65- corresponding Python script, which returns an XML-RPC response on standard
66- output.
67- - [ xen-api/ocaml/xapi/storage_smapiv1_wrapper.ml] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_smapiv1_wrapper.ml ) :
68- The [ Wrapper] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_smapiv1_wrapper.ml#L360 )
69- module wraps a SMAPIv2 server (Server\_ impl) and takes care of
70- locking and datapaths (in case of multiple connections (=datapaths)
71- from VMs to the same VDI, it will use the superstate computed by the
72- [ Vdi_automaton] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-idl/storage/vdi_automaton.ml )
73- in xcp-idl). It also implements some functionality, like the ` DP `
74- module, that is not implemented in lower layers.
75- - [ xen-api/ocaml/xapi/storage\_ mux.ml] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_mux.ml ) :
74+ - [ ` ocaml/xapi/storage_mux.ml ` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_mux.ml ) :
7675 A SMAPIv2 server, which multiplexes between other servers. A
7776 different SMAPIv2 server can be registered for each SR. Then it
7877 forwards the calls for each SR to the "storage plugin" registered
7978 for that SR.
79+ - [ ` ocaml/xapi/storage_smapiv1_wrapper.ml ` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_smapiv1_wrapper.ml ) :
80+ Implements a state machine to compute SMAPIv1 actions needed to reach the desired state, see [ SMAPIv1] ( #smapiv1 ) .
81+ - [ ` ocaml/xapi/storage_smapiv1.ml ` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_smapiv1.ml ) :
82+ Translates the SMAPIv2 calls to SMAPIv1, see [ SMAPIv1] ( #smapiv1 ) .
8083
8184### How SMAPIv2 works:
8285
@@ -211,31 +214,28 @@ It also implements the `Policy` module from the SMAPIv2 interface.
211214
212215## SMAPIv3
213216
214- [ SMAPIv3] ( https://xapi-project.github.io/xapi-storage/ ) has a slightly
215- different interface from SMAPIv2.The
216- [ xapi-storage-script] ( https://github.com/xapi-project/xen-api/tree/v25.11.0/ocaml/xapi-storage-script )
217- daemon is a SMAPIv2 plugin separate from xapi that is doing the SMAPIv2
218- ↔ SMAPIv3 translation. It keeps the plugins registered with xapi-idl
219- (their message-switch queues) up to date as their files appear or
220- disappear from the relevant directory.
217+ [ SMAPIv3] ( https://xapi-project.github.io/xapi-storage/ ) has a slightly different interface from SMAPIv2.
218+ The
219+ [ ` xapi-storage-script ` ] ( https://github.com/xapi-project/xen-api/tree/v25.11.0/ocaml/xapi-storage-script )
220+ daemon is a SMAPIv2 plugin separate from xapi that is doing the SMAPIv2 ↔ SMAPIv3 translation.
221+ It keeps the plugins registered with xapi-idl (their message-switch queues)
222+ up to date as their files appear or disappear from the relevant directory.
221223
222224### SMAPIv3 Interface
223225
224226The SMAPIv3 interface is defined using an OCaml-based IDL from the
225- [ ocaml-rpc] ( https://github.com/mirage/ocaml-rpc ) library, and is in this
226- repo: < https://github.com/xapi-project/xapi-storage >
227+ [ ` ocaml-rpc ` ] ( https://github.com/mirage/ocaml-rpc ) library, and is located at
228+ [ ` xen-api/ocaml/xapi-storage ` ] ( https://github.com/xapi-project/xen-api/tree/v25.11.0/ocaml/ xapi-storage )
227229
228230From this interface we generate
229231
230- - OCaml RPC client bindings used in
231- [ xapi-storage-script] ( https://github.com/xapi-project/xapi-storage-script )
232- - The [ SMAPIv3 API
233- reference] ( https://xapi-project.github.io/xapi-storage )
232+ - OCaml RPC client bindings used in ` xapi-storage-script `
233+ - The
234+ [ SMAPIv3 API reference] ( https://xapi-project.github.io/xapi-storage )
234235- Python bindings, used by the SM scripts that implement the SMAPIv3
235236 interface.
236- - These bindings are built by running "` make ` " in the root
237- [ xapi-storage] ( https://github.com/xapi-project/xapi-storage ) ,
238- and appear in the` _build/default/python/xapi/storage/api/v5 `
237+ - These bindings are built by running ` make ` at the root level,
238+ and appear in the` _build/default/ocaml/xapi-storage/python/xapi/storage/api/v5/ `
239239 directory.
240240 - On a XenServer host, they are stored in the
241241 ` /usr/lib/python3.6/site-packages/xapi/storage/api/v5/ `
@@ -258,20 +258,20 @@ stored in subdirectories of the
258258` /usr/libexec/xapi-storage-script/volume/ ` and
259259` /usr/libexec/xapi-storage-script/datapath/ ` directories, respectively.
260260When it finds a new datapath plugin, it adds the plugin to a lookup table and
261- uses it the next time that datapath is required. When it finds a new volume
262- plugin, it binds a new [ message-switch] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-storage-script/main.ml#L2023 ) queue named after the plugin's
263- subdirectory to a new server instance that uses these volume scripts.
261+ uses it the next time that datapath is required.
262+ When it finds a new volume plugin, it binds a new
263+ [ ` message-switch ` ] ( https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-storage-script/main.ml#L2023 )
264+ queue named after the plugin's subdirectory to a new server instance that uses these volume scripts.
264265
265266To invoke a SMAPIv3 method, it executes a program named
266- ` <Interface name>.<function name> ` in the plugin's directory, for
267- example
267+ ` <Interface name>.<function name> ` in the plugin's directory,
268+ for example
268269` /usr/libexec/xapi-storage-script/volume/org.xen.xapi.storage.gfs2/SR.ls ` .
269270The inputs to each script can be passed as command-line arguments and
270- are type-checked using the generated Python bindings, and so are the
271- outputs. The URIs of the SRs that xapi-storage-script knows about are
272- stored in the ` /var/run/nonpersistent/xapi-storage-script/state.db `
273- file, these URIs can be used on the command line when an sr argument is
274- expected.
271+ are type-checked using the generated Python bindings, and so are the outputs.
272+ The URIs of the SRs that xapi-storage-script knows about are stored in the
273+ ` /var/run/nonpersistent/xapi-storage-script/state.db ` file,
274+ these URIs can be used on the command line when an sr argument is expected.
275275
276276#### Registration of the various SMAPIv3 plugins
277277
0 commit comments