@@ -52,31 +52,29 @@ These are the files related to SMAPIv1 in `xen-api/ocaml/xapi/`:
5252These are the files related to SMAPIv2, which need to be modified to
5353implement 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 -> ; 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
8785We 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
8987main ` 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 )
9290on 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 ) ,
9492and this is the main entry point for incoming SMAPIv2 function calls.
9593` Storage_mux ` does not really multiplex between different plugins right
9694now: [ 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 ) ,
9896the 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 )
10098on the various "` org.xen.xapi.storage.<sr type> ` " queues for each
10199supported SR type. (This will change with SMAPIv3, which is accessed via
102100a SMAPIv2 plugin outside of xapi that translates between SMAPIv2 and
103101SMAPIv3.) 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 ) ,
105103which 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 ) ,
107105and 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 ) ,
109107the relevant "` org.xen.xapi.storage.<sr type> ` " queue needed for that
110108PBD 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 )
112110for the SR of that PBD.\
113111So basically what happens is that xapi registers itself as a SMAPIv2
114112server, and forwards incoming function calls to itself through
@@ -185,9 +183,8 @@ layers, in addition to the basic SMAPIv2 <-> SMAPIv1 translation in
185183These are the three files in xapi that implement the SMAPIv2 storage interface,
186184from 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
192189Functionality 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
222219different 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 )
224221daemon 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.
267264When it finds a new datapath plugin, it adds the plugin to a lookup table and
268265uses 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
270267subdirectory to a new server instance that uses these volume scripts.
271268
272269To 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
355352In 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 ) ,
359356we translate some of the SMAPIv1/SM error codes to XenAPI errors, and
360357for others, we just [ construct an error
361358code] ( https://github.com/xapi-project/xen-api/blob/v1.127.0/ocaml/xapi/sm_exec.ml#L214 )
362359of the form ` SR_BACKEND_FAILURE_<SM error number> ` .
363360
364361The 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 )
366363defines a number of SMAPIv2 errors, ultimately all errors from the various
367364SMAPIv2 storage servers in xapi will be returned as one of these. Most of the
368365errors aren't converted into a specific exception in ` Storage_interface ` , but
369366are simply wrapped with ` Storage_interface.Backend_error ` .
370367
371368The
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 )
373370function is used by the client code in xapi to translate the SMAPIv2
374371errors 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
379376In the message forwarding layer, first we check the validity of VDI
380377operations using ` mark_vdi ` and ` mark_sr ` . These first check that the
381378operation 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 ) ,
383380for ` mark_vdi ` , which also inspects the current operations of the VDI,
384381and then, if the operation is valid, it is added to the VDI's current
385382operations, and update\_ allowed\_ operations is called. Then we forward
@@ -390,7 +387,7 @@ VDI's SR.
390387
391388For the VDI operations, we check at two different places whether the SR
392389is 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 ) ,
394391for the resize operation, and then, at the SMAPIv1 level, in
395392` Sm.assert_pbd_is_plugged ` . ` Sm.assert_pbd_is_plugged ` performs the
396393same checks, plus it checks that the PBD is attached to the localhost,
0 commit comments