Skip to content

Commit 996b9a7

Browse files
committed
doc: xapi storage layer update to latest code
The storage layer code in xapi has undergone some changes: storage_impl.ml is no longer in the repo and is replaced by `storage_smapiv1_wrapper.ml` and `storage_smapiv1.ml`. Update the relevant docs to reflect this change. Signed-off-by: Vincent Liu <[email protected]>
1 parent 989e349 commit 996b9a7

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

doc/content/xapi/storage/_index.md

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ other layers are accessed through it:
2323
```mermaid
2424
graph TD
2525
A[xapi] --> B[SMAPIv2 interface]
26-
B --> C[SMAPIv2 <-> SMAPIv1 translation: storage_access.ml]
26+
B --> C[SMAPIv2 <-> SMAPIv1 state machine: storage_smapiv1_wrapper.ml]
27+
C --> G[SMAPIv2 <-> SMAPIv1 translation: storage_smapiv1.ml]
2728
B --> D[SMAPIv2 <-> SMAPIv3 translation: xapi-storage-script]
28-
C --> E[SMAPIv1 plugins]
29+
G --> E[SMAPIv1 plugins]
2930
D --> F[SMAPIv3 plugins]
3031
```
3132

3233
## SMAPIv1
3334

3435
These are the files related to SMAPIv1 in `xen-api/ocaml/xapi/`:
3536

36-
- [sm.ml](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/sm.ml):
37-
OCaml "bindings" for the SMAPIv1 Python "drivers" (SM)
38-
- [sm_exec.ml](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/sm_exec.ml):
37+
- sm.ml: OCaml "bindings" for the SMAPIv1 Python "drivers" (SM)
38+
- sm_exec.ml:
3939
support for implementing the above "bindings". The
4040
parameters are converted to XML-RPC, passed to the relevant python
4141
script ("driver"), and then the standard output of the program is
@@ -46,6 +46,10 @@ These are the files related to SMAPIv1 in `xen-api/ocaml/xapi/`:
4646
parameters in the args record.
4747
- `smint.ml`: Contains types, exceptions, ... for the SMAPIv1 OCaml
4848
interface
49+
- `storage_smapiv1_wrapper.ml`: A state machine for SMAPIv1 operations. It computes
50+
the required actions to reach the desired state from the current state.
51+
- `storage_smapiv1.ml`: Contains the actual translation of SMAPIv2 calls to SMAPIv1
52+
calls, by calling the bindings provided in sm.ml.
4953

5054
## SMAPIv2
5155

@@ -119,7 +123,7 @@ translation.
119123
```mermaid
120124
sequenceDiagram
121125
participant q as message-switch
122-
participant v1 as Storage_access.SMAPIv1
126+
participant v1 as Storage_smapiv1.SMAPIv1
123127
participant svr as Storage_mux.Server
124128
125129
Note over q, svr: xapi startup, "Starting SMAPIv1 proxies"
@@ -146,17 +150,17 @@ org.xen.xapi.storage
146150
org.xen.xapi.storage.SR_type_x
147151
end
148152
149-
org.xen.xapi.storage --VDI.attach2--> Storage_impl.Wrapper
153+
org.xen.xapi.storage --VDI.attach2--> Storage_smapiv1_wrapper.Wrapper
150154
151155
subgraph xapi
152156
subgraph Storage_mux.server
153-
Storage_impl.Wrapper --> Storage_mux.mux
157+
Storage_smapiv1_wrapper.Wrapper --> Storage_mux.mux
154158
end
155-
Storage_access.SMAPIv1
159+
Storage_smapiv1.SMAPIv1
156160
end
157161
158162
Storage_mux.mux --VDI.attach2--> org.xen.xapi.storage.SR_type_x
159-
org.xen.xapi.storage.SR_type_x --VDI.attach2--> Storage_access.SMAPIv1
163+
org.xen.xapi.storage.SR_type_x --VDI.attach2--> Storage_smapiv1.SMAPIv1
160164
161165
subgraph SMAPIv1
162166
driver_x[SMAPIv1 driver for SR_type_x]
@@ -180,36 +184,34 @@ translation. However, the former has large portions of code in its intermediate
180184
layers, in addition to the basic SMAPIv2 <-> SMAPIv1 translation in
181185
`storage_access.ml`.
182186

183-
These are the three files in xapi that implement the SMAPIv2 storage interface,
187+
These are the two files in xapi that implement the SMAPIv2 storage interface,
184188
from higher to lower level:
185189

186190
- [xen-api/ocaml/xapi/storage\_mux.ml](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_mux.ml):
187191
- [xen-api/ocaml/xapi/storage\_access.ml](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_access.ml):
188192

189193
Functionality implemented by higher layers is not implemented by the layers below it.
190194

191-
#### Extra functionality in `storage_impl.ml`
192-
193-
In addition to its usual functions, `Storage_impl.Wrapper` also implements the
194-
`UPDATES` and `TASK` SMAPIv2 APIs, without calling the wrapped module.
195+
#### Extra functionality in `storage_task.ml`
195196

196-
These are backed by the `Updates`, `Task_server`, and `Scheduler` modules from
197+
`storage_smapiv1_wrapper.ml` also implements the `UPDATES` and `TASK` SMAPIv2 APIs. These are backed by the `Updates`, `Task_server`, and `Scheduler` modules from
197198
xcp-idl, instantiated in xapi's `Storage_task` module. Migration code in
198199
`Storage_mux` will interact with these to update task progress. There is also
199200
an event loop in xapi that keeps calling `UPDATES.get` to keep the tasks in
200201
xapi's database in sync with the storage manager's tasks.
201202

202-
`Storage_impl.Wrapper` also implements the legacy `VDI.attach` call by simply
203+
`Storage_smapiv1_wrapper.ml` also implements the legacy `VDI.attach` call by simply
203204
calling the newer `VDI.attach2` call in the same module. In general, this is a
204205
good place to implement a compatibility layer for deprecated functionality
205206
removed from other layers, because this is the first module that intercepts a
206207
SMAPIv2 call.
207208

208209
#### Extra functionality in `storage_mux.ml`
209210

210-
`Storage_mux` implements storage motion (SXM): it implements the `DATA` and
211-
`DATA.MIRROR` modules. Migration code will use the `Storage_task` module to run
212-
the operations and update the task's progress.
211+
`Storage_mux` redirects all storage motion (SXM) code to `storage_migrate.ml`,
212+
and the multiplexed will be managed by `storage_migrate.ml`. The main implementation
213+
resides in the `DATA` and `DATA.MIRROR` modules. Migration code will use
214+
the `Storage_task` module to run the operations and update the task's progress.
213215

214216
It also implements the `Policy` module from the SMAPIv2 interface.
215217

@@ -219,7 +221,7 @@ It also implements the `Policy` module from the SMAPIv2 interface.
219221
different interface from SMAPIv2.The
220222
[xapi-storage-script](https://github.com/xapi-project/xen-api/tree/v25.11.0/ocaml/xapi-storage-script)
221223
daemon is a SMAPIv2 plugin separate from xapi that is doing the SMAPIv2
222-
↔ SMAPIv3 translation. It keeps the plugins registered with xcp-idl
224+
↔ SMAPIv3 translation. It keeps the plugins registered with xapi-idl
223225
(their message-switch queues) up to date as their files appear or
224226
disappear from the relevant directory.
225227

@@ -275,7 +277,7 @@ are type-checked using the generated Python bindings, and so are the
275277
outputs. The URIs of the SRs that xapi-storage-script knows about are
276278
stored in the `/var/run/nonpersistent/xapi-storage-script/state.db`
277279
file, these URIs can be used on the command line when an sr argument is
278-
expected.` `
280+
expected.
279281

280282
#### Registration of the various SMAPIv3 plugins
281283

0 commit comments

Comments
 (0)