File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -889,9 +889,22 @@ let make_service uuid ty =
889889 url = Constants. path [ Constants. _services; Constants. _driver; uuid; Constants. _SM; ty ];
890890 }
891891
892+ let check_queue_exists queue_name =
893+ let t = Xcp_client. (get_ok (Protocol_unix.Client. connect ~switch: ! switch_path () )) in
894+ let results =
895+ match Protocol_unix.Client. list ~t ~prefix: ! Storage_interface. queue_name ~filter: `Alive () with
896+ | `Ok list -> list
897+ | _ -> failwith " Failed to contact switch" (* Shouldn't ever happen *) in
898+ if not (List. mem queue_name results)
899+ then
900+ let prefix_len = String. length ! Storage_interface. queue_name + 1 in
901+ let driver = String. sub queue_name prefix_len (String. length queue_name - prefix_len) in
902+ raise Api_errors. (Server_error (sr_unknown_driver,[driver]))
903+
892904let external_rpc queue_name uri =
905+ let open Xcp_client in
906+ if ! use_switch then check_queue_exists queue_name;
893907 fun call ->
894- let open Xcp_client in
895908 if ! use_switch
896909 then json_switch_rpc queue_name call
897910 else xml_http_rpc
You can’t perform that action at this time.
0 commit comments