@@ -88,25 +88,25 @@ let missing_uri () =
88
88
let (>>> = ) = Deferred.Result. (>> = )
89
89
90
90
let fork_exec_rpc root_dir script_name args response_of_rpc =
91
- info " %s/%s %s" root_dir script_name (Jsonrpc. to_string args);
91
+ info " %s %s" script_name (Jsonrpc. to_string args);
92
92
( Sys. is_file ~follow_symlinks: true script_name
93
93
>> = function
94
94
| `No | `Unknown ->
95
- error " %s/%s is not a file" root_dir script_name;
95
+ error " %s is not a file" script_name;
96
96
return (Error (backend_error " SCRIPT_MISSING" [ script_name; " Check whether the file exists and has correct permissions" ]))
97
97
| `Yes -> return (Ok () )
98
98
) >>> = fun () ->
99
99
( Unix. access script_name [ `Exec ]
100
100
>> = function
101
101
| Error exn ->
102
- error " %s/%s is not executable" root_dir script_name;
102
+ error " %s is not executable" script_name;
103
103
return (Error (backend_error " SCRIPT_NOT_EXECUTABLE" [ script_name; Exn. to_string exn ]))
104
104
| Ok () -> return (Ok () )
105
105
) >>> = fun () ->
106
106
Process. create ~prog: script_name ~args: [" --json" ] ~working_dir: root_dir ()
107
107
>> = function
108
108
| Error e ->
109
- error " %s/%s failed: %s" root_dir script_name (Error. to_string_hum e);
109
+ error " %s failed: %s" script_name (Error. to_string_hum e);
110
110
return (Error (backend_error " SCRIPT_FAILED" [ script_name; Error. to_string_hum e ]))
111
111
| Ok p ->
112
112
(* Send the request as json on stdin *)
@@ -121,33 +121,33 @@ let fork_exec_rpc root_dir script_name args response_of_rpc =
121
121
(* Expect an exception and backtrace on stdout *)
122
122
begin match Or_error. try_with (fun () -> Jsonrpc. of_string output.Process.Output. stdout) with
123
123
| Error _ ->
124
- error " %s/%s failed and printed bad error json: %s" root_dir script_name output.Process.Output. stdout;
124
+ error " %s failed and printed bad error json: %s" script_name output.Process.Output. stdout;
125
125
return (Error (backend_error " SCRIPT_FAILED" [ script_name; " non-zero exit and bad json on stdout" ; string_of_int code; output.Process.Output. stdout; output.Process.Output. stdout ]))
126
126
| Ok response ->
127
127
begin match Or_error. try_with (fun () -> error_of_rpc response) with
128
128
| Error _ ->
129
- error " %s/%s failed and printed bad error json: %s" root_dir script_name output.Process.Output. stdout;
129
+ error " %s failed and printed bad error json: %s" script_name output.Process.Output. stdout;
130
130
return (Error (backend_error " SCRIPT_FAILED" [ script_name; " non-zero exit and bad json on stdout" ; string_of_int code; output.Process.Output. stdout; output.Process.Output. stdout ]))
131
131
| Ok x -> return (Error (backend_backtrace_error x.code x.params x.backtrace))
132
132
end
133
133
end
134
134
| Error (`Signal signal ) ->
135
- error " %s/%s caught a signal and failed" root_dir script_name;
135
+ error " %s caught a signal and failed" script_name;
136
136
return (Error (backend_error " SCRIPT_FAILED" [ script_name; " signalled" ; Signal. to_string signal; output.Process.Output. stdout; output.Process.Output. stdout ]))
137
137
| Ok () ->
138
138
139
139
(* Parse the json on stdout *)
140
140
begin match Or_error. try_with (fun () -> Jsonrpc. of_string output.Process.Output. stdout) with
141
141
| Error _ ->
142
- error " %s/%s succeeded but printed bad json: %s" root_dir script_name output.Process.Output. stdout;
142
+ error " %s succeeded but printed bad json: %s" script_name output.Process.Output. stdout;
143
143
return (Error (backend_error " SCRIPT_FAILED" [ script_name; " bad json on stdout" ; output.Process.Output. stdout ]))
144
144
| Ok response ->
145
145
begin match Or_error. try_with (fun () -> response_of_rpc response) with
146
146
| Error _ ->
147
- error " %s/%s succeeded but printed bad json: %s" root_dir script_name output.Process.Output. stdout;
147
+ error " %s succeeded but printed bad json: %s" script_name output.Process.Output. stdout;
148
148
return (Error (backend_error " SCRIPT_FAILED" [ script_name; " json did not match schema" ; output.Process.Output. stdout ]))
149
149
| Ok x ->
150
- info " %s/%s succeeded: %s" root_dir script_name output.Process.Output. stdout;
150
+ info " %s succeeded: %s" script_name output.Process.Output. stdout;
151
151
return (Ok x)
152
152
end
153
153
end
@@ -409,7 +409,7 @@ let process root_dir name x =
409
409
(* Stat the SR to look for datasources *)
410
410
let args = Storage.Volume.Types.SR.Stat.In. make
411
411
args.Args.SR.Attach. dbg
412
- uri in
412
+ attach_response (* SR.stat should take the attached URI *) in
413
413
let args = Storage.Volume.Types.SR.Stat.In. rpc_of_t args in
414
414
fork_exec_rpc root_dir (script root_dir name `Volume " SR.stat" ) args Storage.Volume.Types.SR.Stat.Out. t_of_rpc
415
415
>> = fun stat ->
0 commit comments