@@ -233,7 +233,7 @@ let default_vdi_info =
233
233
failwith (Printf. sprintf " Error creating default_vdi_info: %s" m)
234
234
235
235
type sr_health = Healthy | Recovering | Unreachable | Unavailable
236
- [@@ deriving rpcty ]
236
+ [@@ deriving rpcty , show {with_path = false } ]
237
237
238
238
type sr_info = {
239
239
sr_uuid : string option
@@ -354,6 +354,7 @@ module Errors = struct
354
354
| Cancelled of string
355
355
| Redirect of string option
356
356
| Sr_attached of string
357
+ | Sr_unhealthy of sr_health
357
358
| Unimplemented of string
358
359
| Activated_on_another_host of uuid
359
360
| Duplicated_key of string
@@ -617,12 +618,24 @@ module StorageAPI (R : RPC) = struct
617
618
let destroy =
618
619
declare " SR.destroy" [] (dbg_p @-> sr_p @-> returning unit_p err)
619
620
620
- (* * [scan task sr] returns a list of VDIs contained within an attached SR *)
621
+ (* * [scan task sr] returns a list of VDIs contained within an attached SR.
622
+ @deprecated This function is deprecated, and is only here to keep backward
623
+ compatibility with old xapis that call Remote.SR.scan during SXM.
624
+ Use the scan2 function instead.
625
+ *)
621
626
let scan =
622
627
let open TypeCombinators in
623
628
let result = Param. mk ~name: " result" (list vdi_info) in
624
629
declare " SR.scan" [] (dbg_p @-> sr_p @-> returning result err)
625
630
631
+ (* * [scan2 task sr] returns a list of VDIs contained within an attached SR,
632
+ as well as the sr_info of the scanned [sr]. This operation is implemented as
633
+ a combination of scan and stats. *)
634
+ let scan2 =
635
+ let open TypeCombinators in
636
+ let result = Param. mk ~name: " result" (pair (list vdi_info, sr_info)) in
637
+ declare " SR.scan2" [] (dbg_p @-> sr_p @-> returning result err)
638
+
626
639
(* * [update_snapshot_info_src sr vdi url dest dest_vdi snapshot_pairs] *
627
640
updates the fields is_a_snapshot, snapshot_time and snapshot_of for a *
628
641
list of snapshots on a remote SR. *)
@@ -1160,6 +1173,8 @@ module type Server_impl = sig
1160
1173
1161
1174
val scan : context -> dbg :debug_info -> sr :sr -> vdi_info list
1162
1175
1176
+ val scan2 : context -> dbg :debug_info -> sr :sr -> vdi_info list * sr_info
1177
+
1163
1178
val update_snapshot_info_src :
1164
1179
context
1165
1180
-> dbg :debug_info
@@ -1449,6 +1464,7 @@ module Server (Impl : Server_impl) () = struct
1449
1464
S.SR. reset (fun dbg sr -> Impl.SR. reset () ~dbg ~sr ) ;
1450
1465
S.SR. destroy (fun dbg sr -> Impl.SR. destroy () ~dbg ~sr ) ;
1451
1466
S.SR. scan (fun dbg sr -> Impl.SR. scan () ~dbg ~sr ) ;
1467
+ S.SR. scan2 (fun dbg sr -> Impl.SR. scan2 () ~dbg ~sr ) ;
1452
1468
S.SR. update_snapshot_info_src
1453
1469
(fun dbg sr vdi url dest dest_vdi snapshot_pairs verify_dest ->
1454
1470
Impl.SR. update_snapshot_info_src () ~dbg ~sr ~vdi ~url ~dest ~dest_vdi
0 commit comments