mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
v2v: -o rhv-upload: change precheck script to return a JSON
This way it is possible to communicate data from the precheck script back to virt-v2v. For now there are no results, so the resulting JSON is discarded.
This commit is contained in:
@@ -230,8 +230,14 @@ object
|
||||
error_unless_nbdkit_python_plugin_working ();
|
||||
error_unless_output_alloc_sparse ();
|
||||
(* Python code prechecks. *)
|
||||
if Python_script.run_command precheck_script json_params [] <> 0 then
|
||||
let precheck_fn = tmpdir // "v2vprecheck.json" in
|
||||
let fd = Unix.openfile precheck_fn [O_WRONLY; O_CREAT] 0o600 in
|
||||
if Python_script.run_command ~stdout_fd:fd
|
||||
precheck_script json_params [] <> 0 then
|
||||
error (f_"failed server prechecks, see earlier errors");
|
||||
let json = JSON_parser.json_parser_tree_parse_file precheck_fn in
|
||||
debug "precheck output parsed as: %s"
|
||||
(JSON.string_of_doc ~fmt:JSON.Indented ["", json]);
|
||||
if have_selinux then
|
||||
error_unless_nbdkit_compiled_with_selinux ()
|
||||
|
||||
|
||||
@@ -70,4 +70,8 @@ if len(clusters) == 0:
|
||||
raise RuntimeError("The cluster ‘%s’ does not exist" %
|
||||
(params['rhv_cluster']))
|
||||
|
||||
# Otherwise everything is OK, exit with no error.
|
||||
# Otherwise everything is OK, print a JSON with the results.
|
||||
results = {
|
||||
}
|
||||
|
||||
json.dump(results, sys.stdout)
|
||||
|
||||
Reference in New Issue
Block a user