Skip to content

Commit 989e349

Browse files
committed
doc: Update xapi storage layer code links
Change all the link to the latest xapi version v25.11.0 Signed-off-by: Vincent Liu <[email protected]>
1 parent 5c45898 commit 989e349

File tree

1 file changed

+28
-31
lines changed

1 file changed

+28
-31
lines changed

doc/content/xapi/storage/_index.md

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -52,31 +52,29 @@ These are the files related to SMAPIv1 in `xen-api/ocaml/xapi/`:
5252
These are the files related to SMAPIv2, which need to be modified to
5353
implement new calls:
5454

55-
- [xcp-idl/storage/storage\_interface.ml](https://github.com/xapi-project/xcp-idl/blob/v1.62.0/storage/storage_interface.ml):
55+
- [xcp-idl/storage/storage\_interface.ml](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-idl/storage/storage_interface.ml):
5656
Contains the SMAPIv2 interface
57-
- [xcp-idl/storage/storage\_skeleton.ml](https://github.com/xapi-project/xcp-idl/blob/v1.62.0/storage/storage_skeleton.ml):
57+
- [xcp-idl/storage/storage\_skeleton.ml](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-idl/storage/storage_skeleton.ml):
5858
A stub SMAPIv2 storage server implementation that matches the
5959
SMAPIv2 storage server interface (this is verified by
60-
[storage\_skeleton\_test.ml](https://github.com/xapi-project/xcp-idl/blob/v1.62.0/storage/storage_skeleton_test.ml)),
60+
[storage\_skeleton\_test.ml](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-idl/storage/storage_skeleton_test.ml)),
6161
each of its function just raise a `Storage_interface.Unimplemented`
6262
error. This skeleton is used to automatically fill the unimplemented
6363
methods of the below storage servers to satisfy the interface.
64-
- [xen-api/ocaml/xapi/storage\_access.ml](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/storage_access.ml):
65-
[module SMAPIv1](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/storage_access.ml#L104):
66-
a SMAPIv2 server that does SMAPIv2 -&gt; SMAPIv1 translation.
64+
- [xen-api/ocaml/xapi/storage\_smapiv1.ml](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_smapiv1.ml):
65+
a SMAPIv2 server that does SMAPIv2 -> SMAPIv1 translation.
6766
It passes the XML-RPC requests as the first command-line argument to the
6867
corresponding Python script, which returns an XML-RPC response on standard
6968
output.
70-
- [xen-api/ocaml/xapi/storage\_impl.ml](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/storage_impl.ml):
71-
The
72-
[Wrapper](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/storage_impl.ml#L302)
69+
- [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):
70+
The [Wrapper](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_smapiv1_wrapper.ml#L360)
7371
module wraps a SMAPIv2 server (Server\_impl) and takes care of
7472
locking and datapaths (in case of multiple connections (=datapaths)
7573
from VMs to the same VDI, it will use the superstate computed by the
76-
[Vdi_automaton](https://github.com/xapi-project/xcp-idl/blob/v1.62.0/storage/vdi_automaton.ml)
74+
[Vdi_automaton](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-idl/storage/vdi_automaton.ml)
7775
in xcp-idl). It also implements some functionality, like the `DP`
7876
module, that is not implemented in lower layers.
79-
- [xen-api/ocaml/xapi/storage\_mux.ml](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/storage_mux.ml):
77+
- [xen-api/ocaml/xapi/storage\_mux.ml](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_mux.ml):
8078
A SMAPIv2 server, which multiplexes between other servers. A
8179
different SMAPIv2 server can be registered for each SR. Then it
8280
forwards the calls for each SR to the "storage plugin" registered
@@ -85,30 +83,30 @@ implement new calls:
8583
### How SMAPIv2 works:
8684

8785
We use [message-switch] under the hood for RPC communication between
88-
[xcp-idl](https://github.com/xapi-project/xcp-idl) components. The
86+
[xapi-idl](https://github.com/xapi-project/xen-api/tree/v25.11.0/ocaml/xapi-idl) components. The
8987
main `Storage_mux.Server` (basically `Storage_impl.Wrapper(Mux)`) is
9088
[registered to
91-
listen](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/storage_access.ml#L1279)
89+
listen](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_access.ml#L500)
9290
on the "`org.xen.xapi.storage`" queue [during xapi's
93-
startup](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/xapi.ml#L801),
91+
startup](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/xapi.ml#L1080),
9492
and this is the main entry point for incoming SMAPIv2 function calls.
9593
`Storage_mux` does not really multiplex between different plugins right
9694
now: [earlier during xapi's
97-
startup](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/xapi.ml#L799),
95+
startup](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/xapi.ml#L1076),
9896
the same SMAPIv1 storage server module [is
99-
registered](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/storage_access.ml#L934)
97+
registered](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_access.ml#L934)
10098
on the various "`org.xen.xapi.storage.<sr type>`" queues for each
10199
supported SR type. (This will change with SMAPIv3, which is accessed via
102100
a SMAPIv2 plugin outside of xapi that translates between SMAPIv2 and
103101
SMAPIv3.) Then, in
104-
[Storage\_access.create\_sr](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/storage_access.ml#L1531),
102+
[Storage\_access.create\_sr](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_access.ml#L802),
105103
which is called
106-
[during SR.create](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/xapi_sr.ml#L326),
104+
[during SR.create](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/xapi_sr.ml#L391),
107105
and also
108-
[during PBD.plug](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/xapi_pbd.ml#L121),
106+
[during PBD.plug](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/xapi_pbd.ml#L175),
109107
the relevant "`org.xen.xapi.storage.<sr type>`" queue needed for that
110108
PBD is [registered with Storage_mux in
111-
Storage\_access.bind](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/storage_access.ml#L1107)
109+
Storage\_access.bind](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_access.ml#L267)
112110
for the SR of that PBD.\
113111
So basically what happens is that xapi registers itself as a SMAPIv2
114112
server, and forwards incoming function calls to itself through
@@ -185,9 +183,8 @@ layers, in addition to the basic SMAPIv2 <-> SMAPIv1 translation in
185183
These are the three files in xapi that implement the SMAPIv2 storage interface,
186184
from higher to lower level:
187185

188-
- [xen-api/ocaml/xapi/storage\_impl.ml](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/storage_impl.ml):
189-
- [xen-api/ocaml/xapi/storage\_mux.ml](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/storage_mux.ml):
190-
- [xen-api/ocaml/xapi/storage\_access.ml](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/storage_access.ml):
186+
- [xen-api/ocaml/xapi/storage\_mux.ml](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_mux.ml):
187+
- [xen-api/ocaml/xapi/storage\_access.ml](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_access.ml):
191188

192189
Functionality implemented by higher layers is not implemented by the layers below it.
193190

@@ -220,7 +217,7 @@ It also implements the `Policy` module from the SMAPIv2 interface.
220217

221218
[SMAPIv3](https://xapi-project.github.io/xapi-storage/) has a slightly
222219
different interface from SMAPIv2.The
223-
[xapi-storage-script](https://github.com/xapi-project/xapi-storage-script)
220+
[xapi-storage-script](https://github.com/xapi-project/xen-api/tree/v25.11.0/ocaml/xapi-storage-script)
224221
daemon is a SMAPIv2 plugin separate from xapi that is doing the SMAPIv2
225222
↔ SMAPIv3 translation. It keeps the plugins registered with xcp-idl
226223
(their message-switch queues) up to date as their files appear or
@@ -266,7 +263,7 @@ stored in subdirectories of the
266263
`/usr/libexec/xapi-storage-script/datapath/` directories, respectively.
267264
When it finds a new datapath plugin, it adds the plugin to a lookup table and
268265
uses it the next time that datapath is required. When it finds a new volume
269-
plugin, it binds a new [message-switch] queue named after the plugin's
266+
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
270267
subdirectory to a new server instance that uses these volume scripts.
271268

272269
To invoke a SMAPIv3 method, it executes a program named
@@ -353,23 +350,23 @@ org.xen.xapi.storage.SR_type_x --VDI.attach2-->xapi-storage-script
353350
## Error reporting
354351

355352
In our SMAPIv1 OCaml "bindings" in xapi
356-
([xen-api/ocaml/xapi/sm\_exec.ml](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/sm_exec.ml)),
353+
([xen-api/ocaml/xapi/sm\_exec.ml](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/sm_exec.ml)),
357354
[when we inspect the error codes returned from a call to
358-
SM](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/sm_exec.ml#L199),
355+
SM](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/sm_exec.ml#L421),
359356
we translate some of the SMAPIv1/SM error codes to XenAPI errors, and
360357
for others, we just [construct an error
361358
code](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/sm_exec.ml#L214)
362359
of the form `SR_BACKEND_FAILURE_<SM error number>`.
363360

364361
The file
365-
[xcp-idl/storage/storage\_interface.ml](https://github.com/xapi-project/xcp-idl/blob/v1.62.0/storage/storage_interface.ml#L362)
362+
[xcp-idl/storage/storage\_interface.ml](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi-idl/storage/storage_interface.ml#L343)
366363
defines a number of SMAPIv2 errors, ultimately all errors from the various
367364
SMAPIv2 storage servers in xapi will be returned as one of these. Most of the
368365
errors aren't converted into a specific exception in `Storage_interface`, but
369366
are simply wrapped with `Storage_interface.Backend_error`.
370367

371368
The
372-
[Storage\_access.transform\_storage\_exn](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/storage_access.ml#L29)
369+
[Storage\_utils.transform\_storage\_exn](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/storage_utils.ml#L133)
373370
function is used by the client code in xapi to translate the SMAPIv2
374371
errors into XenAPI errors again, this unwraps the errors wrapped with
375372
`Storage_interface.Backend_error`.
@@ -379,7 +376,7 @@ errors into XenAPI errors again, this unwraps the errors wrapped with
379376
In the message forwarding layer, first we check the validity of VDI
380377
operations using `mark_vdi` and `mark_sr`. These first check that the
381378
operation is valid operations,
382-
using [Xapi\_vdi.check\_operation\_error](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/xapi_vdi.ml#L57),
379+
using [Xapi\_vdi.check\_operation\_error](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/xapi_vdi.ml#L65),
383380
for `mark_vdi`, which also inspects the current operations of the VDI,
384381
and then, if the operation is valid, it is added to the VDI's current
385382
operations, and update\_allowed\_operations is called. Then we forward
@@ -390,7 +387,7 @@ VDI's SR.
390387

391388
For the VDI operations, we check at two different places whether the SR
392389
is attached: first, at the Xapi level, [in
393-
Xapi\_vdi.check\_operation\_error](https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/xapi_vdi.ml#L98),
390+
Xapi\_vdi.check\_operation\_error](https://github.com/xapi-project/xen-api/blob/v25.11.0/ocaml/xapi/xapi_vdi.ml#L133),
394391
for the resize operation, and then, at the SMAPIv1 level, in
395392
`Sm.assert_pbd_is_plugged`. `Sm.assert_pbd_is_plugged` performs the
396393
same checks, plus it checks that the PBD is attached to the localhost,

0 commit comments

Comments
 (0)