Blame SOURCES/0010-output-Remove-o-json-mode.patch

696189
From a1f1129dc148639ed0b05b737157268d9b824a63 Mon Sep 17 00:00:00 2001
696189
From: "Richard W.M. Jones" <rjones@redhat.com>
696189
Date: Mon, 11 Apr 2022 11:01:46 +0100
696189
Subject: [PATCH] output: Remove -o json mode
696189
696189
This removes the -o json mode completely.
696189
696189
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
696189
(cherry picked from commit 4e6b389b4e27c8d13e57fcaf777d96ad7e08650b)
696189
---
696189
 docs/virt-v2v.pod            |   4 -
696189
 output/Makefile.am           |  51 +-----
696189
 output/create_json.ml        | 338 -----------------------------------
696189
 output/create_json.mli       |  27 ---
696189
 output/output_json.ml        | 153 ----------------
696189
 output/output_json.mli       |  21 ---
696189
 output/var_expander.ml       |  72 --------
696189
 output/var_expander.mli      |  82 ---------
696189
 output/var_expander_tests.ml | 113 ------------
696189
 tests/Makefile.am            |   2 -
696189
 tests/test-v2v-o-json.sh     |  68 -------
696189
 v2v/v2v.ml                   |   7 +-
696189
 12 files changed, 5 insertions(+), 933 deletions(-)
696189
 delete mode 100644 output/create_json.ml
696189
 delete mode 100644 output/create_json.mli
696189
 delete mode 100644 output/output_json.ml
696189
 delete mode 100644 output/output_json.mli
696189
 delete mode 100644 output/var_expander.ml
696189
 delete mode 100644 output/var_expander.mli
696189
 delete mode 100644 output/var_expander_tests.ml
696189
 delete mode 100755 tests/test-v2v-o-json.sh
696189
696189
diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod
696189
index 7ad22f00..912f1bc3 100644
696189
--- a/docs/virt-v2v.pod
696189
+++ b/docs/virt-v2v.pod
696189
@@ -409,10 +409,6 @@ See L</Networks and bridges> below.
696189
 
696189
 This is the same as I<-o local>.
696189
 
696189
-=item B<-o> B<json>
696189
-
696189
-This option is deprecated and will be removed in S<virt-v2v 2.2>.
696189
-
696189
 =item B<-o> B<libvirt>
696189
 
696189
 Set the output method to I<libvirt>.  This is the default.
696189
diff --git a/output/Makefile.am b/output/Makefile.am
696189
index 61caf68b..dd488549 100644
696189
--- a/output/Makefile.am
696189
+++ b/output/Makefile.am
696189
@@ -39,18 +39,15 @@ EXTRA_DIST = \
696189
 	rhv-upload-precheck.py \
696189
 	rhv-upload-transfer.py \
696189
 	rhv-upload-vmcheck.py \
696189
-	test-v2v-python-syntax.sh \
696189
-	var_expander_tests.ml
696189
+	test-v2v-python-syntax.sh
696189
 
696189
 SOURCES_MLI = \
696189
 	changeuid.mli \
696189
-	create_json.mli \
696189
 	create_libvirt_xml.mli \
696189
 	openstack_image_properties.mli \
696189
 	output.mli \
696189
 	output_disk.mli \
696189
 	output_glance.mli \
696189
-	output_json.mli \
696189
 	output_libvirt.mli \
696189
 	output_null.mli \
696189
 	output_openstack.mli \
696189
@@ -66,14 +63,11 @@ SOURCES_MLI = \
696189
 	output_rhv_upload_transfer_source.mli \
696189
 	output_rhv_upload_vmcheck_source.mli \
696189
 	python_script.mli \
696189
-	qemuopts.mli \
696189
-	var_expander.mli
696189
+	qemuopts.mli
696189
 
696189
 SOURCES_ML = \
696189
 	changeuid.ml \
696189
 	python_script.ml \
696189
-	var_expander.ml \
696189
-	create_json.ml \
696189
 	create_libvirt_xml.ml \
696189
 	qemuopts.ml \
696189
 	openstack_image_properties.ml \
696189
@@ -87,7 +81,6 @@ SOURCES_ML = \
696189
 	output.ml \
696189
 	output_disk.ml \
696189
 	output_glance.ml \
696189
-	output_json.ml \
696189
 	output_libvirt.ml \
696189
 	output_null.ml \
696189
 	output_openstack.ml \
696189
@@ -203,47 +196,9 @@ $(MLOUTPUT_CMA): $(OBJECTS) libmloutput.a
696189
 	$(OCAMLFIND) mklib $(OCAMLPACKAGES) \
696189
 	    $(OBJECTS) $(libmloutput_a_OBJECTS) -o mloutput
696189
 
696189
-# Unit tests.
696189
-TESTS =
696189
-if HAVE_OCAML_PKG_OUNIT
696189
-TESTS += \
696189
-	var_expander_tests
696189
-check_PROGRAMS = \
696189
-	var_expander_tests
696189
-endif
696189
-
696189
-var_expander_tests_BOBJECTS = \
696189
-	var_expander.cmo \
696189
-	var_expander_tests.cmo
696189
-var_expander_tests_XOBJECTS = $(var_expander_tests_BOBJECTS:.cmo=.cmx)
696189
-
696189
-var_expander_tests_SOURCES = dummy.c
696189
-var_expander_tests_CPPFLAGS = $(virt_v2v_CPPFLAGS)
696189
-var_expander_tests_CFLAGS = $(virt_v2v_CFLAGS)
696189
-
696189
-if !HAVE_OCAMLOPT
696189
-# Can't call this var_expander_tests_OBJECTS because automake gets confused.
696189
-var_expander_tests_THEOBJECTS = $(var_expander_tests_BOBJECTS)
696189
-var_expander_tests.cmo: OCAMLPACKAGES += -package ounit2
696189
-else
696189
-var_expander_tests_THEOBJECTS = $(var_expander_tests_XOBJECTS)
696189
-var_expander_tests.cmx: OCAMLPACKAGES += -package ounit2
696189
-endif
696189
-
696189
-var_expander_tests_DEPENDENCIES = \
696189
-	$(var_expander_tests_THEOBJECTS) \
696189
-	$(top_builddir)/common/mlpcre/mlpcre.$(MLARCHIVE) \
696189
-	$(top_srcdir)/ocaml-link.sh
696189
-var_expander_tests_LINK = \
696189
-	$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
696189
-	  $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) \
696189
-	  $(OCAMLPACKAGES) -package ounit2 \
696189
-	  $(OCAMLLINKFLAGS) \
696189
-	  $(var_expander_tests_THEOBJECTS) -o $@
696189
-
696189
 # Unit tests.
696189
 TESTS_ENVIRONMENT = $(top_builddir)/run --test
696189
-TESTS += test-v2v-python-syntax.sh
696189
+TESTS = test-v2v-python-syntax.sh
696189
 
696189
 # Dependencies.
696189
 .depend: \
696189
diff --git a/output/create_json.ml b/output/create_json.ml
696189
deleted file mode 100644
696189
index cbc27fdc..00000000
696189
--- a/output/create_json.ml
696189
+++ /dev/null
696189
@@ -1,338 +0,0 @@
696189
-(* virt-v2v
696189
- * Copyright (C) 2019 Red Hat Inc.
696189
- *
696189
- * This program is free software; you can redistribute it and/or modify
696189
- * it under the terms of the GNU General Public License as published by
696189
- * the Free Software Foundation; either version 2 of the License, or
696189
- * (at your option) any later version.
696189
- *
696189
- * This program is distributed in the hope that it will be useful,
696189
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
696189
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
696189
- * GNU General Public License for more details.
696189
- *
696189
- * You should have received a copy of the GNU General Public License along
696189
- * with this program; if not, write to the Free Software Foundation, Inc.,
696189
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
696189
- *)
696189
-
696189
-open Std_utils
696189
-open C_utils
696189
-open Tools_utils
696189
-
696189
-open Types
696189
-open Utils
696189
-
696189
-module G = Guestfs
696189
-
696189
-let json_list_of_string_list =
696189
-  List.map (fun x -> JSON.String x)
696189
-
696189
-let json_list_of_string_string_list =
696189
-  List.map (fun (x, y) -> x, JSON.String y)
696189
-
696189
-let push_optional_string lst name = function
696189
-  | None -> ()
696189
-  | Some v -> List.push_back lst (name, JSON.String v)
696189
-
696189
-let push_optional_int lst name = function
696189
-  | None -> ()
696189
-  | Some v -> List.push_back lst (name, JSON.Int (Int64.of_int v))
696189
-
696189
-let json_unknown_string = function
696189
-  | "unknown" -> JSON.Null
696189
-  | v -> JSON.String v
696189
-
696189
-let create_json_metadata source inspect
696189
-      { guestcaps; target_buses; target_firmware; target_nics }
696189
-      outdisk_name output_format output_name =
696189
-  let doc = ref [
696189
-    "version", JSON.Int 1L;
696189
-    "name", JSON.String output_name;
696189
-    "memory", JSON.Int source.s_memory;
696189
-    "vcpu", JSON.Int (Int64.of_int source.s_vcpu);
696189
-  ] in
696189
-
696189
-  (match source.s_genid with
696189
-   | None -> ()
696189
-   | Some genid -> List.push_back doc ("genid", JSON.String genid)
696189
-  );
696189
-
696189
-  if source.s_cpu_vendor <> None || source.s_cpu_model <> None ||
696189
-     source.s_cpu_topology <> None then (
696189
-    let cpu = ref [] in
696189
-
696189
-    push_optional_string cpu "vendor" source.s_cpu_vendor;
696189
-    push_optional_string cpu "model" source.s_cpu_model;
696189
-    (match source.s_cpu_topology with
696189
-     | None -> ()
696189
-     | Some { s_cpu_sockets; s_cpu_cores; s_cpu_threads } ->
696189
-        let attrs = [
696189
-          "sockets", JSON.Int (Int64.of_int s_cpu_sockets);
696189
-          "cores", JSON.Int (Int64.of_int s_cpu_cores);
696189
-          "threads", JSON.Int (Int64.of_int s_cpu_threads);
696189
-        ] in
696189
-        List.push_back cpu ("topology", JSON.Dict attrs)
696189
-    );
696189
-
696189
-    List.push_back doc ("cpu", JSON.Dict !cpu);
696189
-  );
696189
-
696189
-  let firmware =
696189
-    let firmware_type =
696189
-      match target_firmware with
696189
-      | TargetBIOS -> "bios"
696189
-      | TargetUEFI -> "uefi" in
696189
-
696189
-    let fw = ref [
696189
-      "type", JSON.String firmware_type;
696189
-    ] in
696189
-
696189
-    (match target_firmware with
696189
-     | TargetBIOS -> ()
696189
-     | TargetUEFI ->
696189
-       let uefi_firmware = find_uefi_firmware guestcaps.gcaps_arch in
696189
-       let flags =
696189
-         List.map (
696189
-           function
696189
-           | Uefi.UEFI_FLAG_SECURE_BOOT_REQUIRED -> "secure_boot_required"
696189
-         ) uefi_firmware.Uefi.flags in
696189
-
696189
-       let uefi = ref [
696189
-         "code", JSON.String uefi_firmware.Uefi.code;
696189
-         "vars", JSON.String uefi_firmware.Uefi.vars;
696189
-         "flags", JSON.List (json_list_of_string_list flags);
696189
-       ] in
696189
-
696189
-       push_optional_string uefi "code-debug" uefi_firmware.Uefi.code_debug;
696189
-
696189
-       List.push_back fw ("uefi", JSON.Dict !uefi)
696189
-    );
696189
-
696189
-    !fw in
696189
-  List.push_back doc ("firmware", JSON.Dict firmware);
696189
-
696189
-  List.push_back doc ("features",
696189
-                      JSON.List (json_list_of_string_list source.s_features));
696189
-
696189
-  let machine =
696189
-    match guestcaps.gcaps_machine with
696189
-    | I440FX -> "pc"
696189
-    | Q35 -> "q35"
696189
-    | Virt -> "virt" in
696189
-  List.push_back doc ("machine", JSON.String machine);
696189
-
696189
-  let disks, removables =
696189
-    let disks = ref []
696189
-    and removables = ref [] in
696189
-
696189
-    let iter_bus bus_name drive_prefix i = function
696189
-    | BusSlotEmpty -> ()
696189
-    | BusSlotDisk d ->
696189
-       (* Find the corresponding target disk. *)
696189
-       let outdisk = outdisk_name d.s_disk_id in
696189
-
696189
-       let disk = [
696189
-         "dev", JSON.String (drive_prefix ^ drive_name i);
696189
-         "bus", JSON.String bus_name;
696189
-         "format", JSON.String output_format;
696189
-         "file", JSON.String outdisk;
696189
-       ] in
696189
-
696189
-       List.push_back disks (JSON.Dict disk)
696189
-
696189
-    | BusSlotRemovable { s_removable_type = CDROM } ->
696189
-       let cdrom = [
696189
-         "type", JSON.String "cdrom";
696189
-         "dev", JSON.String (drive_prefix ^ drive_name i);
696189
-         "bus", JSON.String bus_name;
696189
-       ] in
696189
-
696189
-       List.push_back removables (JSON.Dict cdrom)
696189
-
696189
-    | BusSlotRemovable { s_removable_type = Floppy } ->
696189
-       let floppy = [
696189
-         "type", JSON.String "floppy";
696189
-         "dev", JSON.String (drive_prefix ^ drive_name i);
696189
-       ] in
696189
-
696189
-       List.push_back removables (JSON.Dict floppy)
696189
-    in
696189
-
696189
-    Array.iteri (iter_bus "virtio" "vd") target_buses.target_virtio_blk_bus;
696189
-    Array.iteri (iter_bus "ide" "hd") target_buses.target_ide_bus;
696189
-    Array.iteri (iter_bus "scsi" "sd") target_buses.target_scsi_bus;
696189
-    Array.iteri (iter_bus "floppy" "fd") target_buses.target_floppy_bus;
696189
-
696189
-    !disks, !removables in
696189
-  List.push_back doc ("disks", JSON.List disks);
696189
-  List.push_back doc ("removables", JSON.List removables);
696189
-
696189
-  let nics =
696189
-    List.map (
696189
-      fun { s_mac = mac; s_vnet_type = vnet_type; s_nic_model = nic_model;
696189
-            s_vnet = vnet; } ->
696189
-        let vnet_type_str =
696189
-          match vnet_type with
696189
-          | Bridge -> "bridge"
696189
-          | Network -> "network" in
696189
-
696189
-        let nic = ref [
696189
-          "vnet", JSON.String vnet;
696189
-          "vnet-type", JSON.String vnet_type_str;
696189
-        ] in
696189
-
696189
-        let nic_model_str = Option.map string_of_nic_model nic_model in
696189
-        push_optional_string nic "model" nic_model_str;
696189
-
696189
-        push_optional_string nic "mac" mac;
696189
-
696189
-        JSON.Dict !nic
696189
-    ) target_nics in
696189
-  List.push_back doc ("nics", JSON.List nics);
696189
-
696189
-  let guestcaps_dict =
696189
-    let block_bus =
696189
-      match guestcaps.gcaps_block_bus with
696189
-      | Virtio_blk -> "virtio-blk"
696189
-      | IDE -> "ide" in
696189
-    let net_bus =
696189
-      match guestcaps.gcaps_net_bus with
696189
-      | Virtio_net -> "virtio-net"
696189
-      | E1000 -> "e1000"
696189
-      | RTL8139 -> "rtl8139" in
696189
-    let video = "vga" in
696189
-    let machine =
696189
-      match guestcaps.gcaps_machine with
696189
-      | I440FX -> "i440fx"
696189
-      | Q35 -> "q35"
696189
-      | Virt -> "virt" in
696189
-
696189
-    [
696189
-      "block-bus", JSON.String block_bus;
696189
-      "net-bus", JSON.String net_bus;
696189
-      "video", JSON.String video;
696189
-      "machine", JSON.String machine;
696189
-      "arch", JSON.String guestcaps.gcaps_arch;
696189
-      "virtio-rng", JSON.Bool guestcaps.gcaps_virtio_rng;
696189
-      "virtio-balloon", JSON.Bool guestcaps.gcaps_virtio_balloon;
696189
-      "isa-pvpanic", JSON.Bool guestcaps.gcaps_isa_pvpanic;
696189
-      "virtio-socket", JSON.Bool guestcaps.gcaps_virtio_socket;
696189
-      "acpi", JSON.Bool guestcaps.gcaps_acpi;
696189
-      "virtio-1-0", JSON.Bool guestcaps.gcaps_virtio_1_0;
696189
-    ] in
696189
-  List.push_back doc ("guestcaps", JSON.Dict guestcaps_dict);
696189
-
696189
-  (match source.s_sound with
696189
-   | None -> ()
696189
-   | Some { s_sound_model = model } ->
696189
-     let sound = [
696189
-       "model", JSON.String (string_of_source_sound_model model);
696189
-     ] in
696189
-     List.push_back doc ("sound", JSON.Dict sound)
696189
-   );
696189
-
696189
-  (match source.s_display with
696189
-   | None -> ()
696189
-   | Some d ->
696189
-     let display_type =
696189
-       match d.s_display_type with
696189
-       | Window -> "window"
696189
-       | VNC -> "vnc"
696189
-       | Spice -> "spice" in
696189
-
696189
-     let display = ref [
696189
-       "type", JSON.String display_type;
696189
-     ] in
696189
-
696189
-     push_optional_string display "keymap" d.s_keymap;
696189
-     push_optional_string display "password" d.s_password;
696189
-
696189
-     let listen =
696189
-       match d.s_listen with
696189
-       | LNoListen -> None
696189
-       | LAddress address ->
696189
-         Some [
696189
-           "type", JSON.String "address";
696189
-           "address", JSON.String address;
696189
-         ]
696189
-       | LNetwork network ->
696189
-         Some [
696189
-           "type", JSON.String "network";
696189
-           "network", JSON.String network;
696189
-         ]
696189
-       | LSocket None ->
696189
-         Some [
696189
-           "type", JSON.String "socket";
696189
-           "socket", JSON.Null;
696189
-         ]
696189
-       | LSocket (Some socket) ->
696189
-         Some [
696189
-           "type", JSON.String "socket";
696189
-           "socket", JSON.String socket;
696189
-         ]
696189
-       | LNone ->
696189
-         Some [
696189
-           "type", JSON.String "none";
696189
-         ] in
696189
-     (match listen with
696189
-      | None -> ()
696189
-      | Some l -> List.push_back display ("listen", JSON.Dict l)
696189
-     );
696189
-
696189
-     push_optional_int display "port" d.s_port;
696189
-
696189
-     List.push_back doc ("display", JSON.Dict !display)
696189
-  );
696189
-
696189
-  let inspect_dict =
696189
-    let apps =
696189
-      List.map (
696189
-        fun { G.app2_name = name; app2_display_name = display_name;
696189
-              app2_epoch = epoch; app2_version = version;
696189
-              app2_release = release; app2_arch = arch; } ->
696189
-          JSON.Dict [
696189
-            "name", JSON.String name;
696189
-            "display-name", JSON.String display_name;
696189
-            "epoch", JSON.Int (Int64.of_int32 epoch);
696189
-            "version", JSON.String version;
696189
-            "release", JSON.String release;
696189
-            "arch", JSON.String arch;
696189
-          ]
696189
-      ) inspect.i_apps in
696189
-
696189
-    let firmware_dict =
696189
-      match inspect.i_firmware with
696189
-      | I_BIOS ->
696189
-        [
696189
-          "type", JSON.String "bios";
696189
-        ]
696189
-      | I_UEFI devices ->
696189
-        [
696189
-          "type", JSON.String "uefi";
696189
-          "devices", JSON.List (json_list_of_string_list devices);
696189
-        ] in
696189
-
696189
-    [
696189
-      "root", JSON.String inspect.i_root;
696189
-      "type", JSON.String inspect.i_type;
696189
-      "distro", json_unknown_string inspect.i_distro;
696189
-      "osinfo", json_unknown_string inspect.i_osinfo;
696189
-      "arch", JSON.String inspect.i_arch;
696189
-      "major-version", JSON.Int (Int64.of_int inspect.i_major_version);
696189
-      "minor-version", JSON.Int (Int64.of_int inspect.i_minor_version);
696189
-      "package-format", json_unknown_string inspect.i_package_format;
696189
-      "package-management", json_unknown_string inspect.i_package_management;
696189
-      "product-name", json_unknown_string inspect.i_product_name;
696189
-      "product-variant", json_unknown_string inspect.i_product_variant;
696189
-      "mountpoints", JSON.Dict (json_list_of_string_string_list inspect.i_mountpoints);
696189
-      "applications", JSON.List apps;
696189
-      "windows-systemroot", JSON.String inspect.i_windows_systemroot;
696189
-      "windows-software-hive", JSON.String inspect.i_windows_software_hive;
696189
-      "windows-system-hive", JSON.String inspect.i_windows_system_hive;
696189
-      "windows-current-control-set", JSON.String inspect.i_windows_current_control_set;
696189
-      "firmware", JSON.Dict firmware_dict;
696189
-    ] in
696189
-  List.push_back doc ("inspect", JSON.Dict inspect_dict);
696189
-
696189
-  !doc
696189
diff --git a/output/create_json.mli b/output/create_json.mli
696189
deleted file mode 100644
696189
index 97086ff5..00000000
696189
--- a/output/create_json.mli
696189
+++ /dev/null
696189
@@ -1,27 +0,0 @@
696189
-(* virt-v2v
696189
- * Copyright (C) 2019 Red Hat Inc.
696189
- *
696189
- * This program is free software; you can redistribute it and/or modify
696189
- * it under the terms of the GNU General Public License as published by
696189
- * the Free Software Foundation; either version 2 of the License, or
696189
- * (at your option) any later version.
696189
- *
696189
- * This program is distributed in the hope that it will be useful,
696189
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
696189
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
696189
- * GNU General Public License for more details.
696189
- *
696189
- * You should have received a copy of the GNU General Public License along
696189
- * with this program; if not, write to the Free Software Foundation, Inc.,
696189
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
696189
- *)
696189
-
696189
-(** Create JSON metadata for [-o json]. *)
696189
-
696189
-val create_json_metadata : Types.source -> Types.inspect ->
696189
-                           Types.target_meta ->
696189
-                           (int -> string) -> string -> string ->
696189
-                           JSON.doc
696189
-(** [create_json_metadata source targets outdisk_map output_format output_name]
696189
-    creates the JSON with the majority of the data that virt-v2v used for the
696189
-    conversion. *)
696189
diff --git a/output/output_json.ml b/output/output_json.ml
696189
deleted file mode 100644
696189
index 6e81b639..00000000
696189
--- a/output/output_json.ml
696189
+++ /dev/null
696189
@@ -1,153 +0,0 @@
696189
-(* virt-v2v
696189
- * Copyright (C) 2009-2021 Red Hat Inc.
696189
- *
696189
- * This program is free software; you can redistribute it and/or modify
696189
- * it under the terms of the GNU General Public License as published by
696189
- * the Free Software Foundation; either version 2 of the License, or
696189
- * (at your option) any later version.
696189
- *
696189
- * This program is distributed in the hope that it will be useful,
696189
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
696189
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
696189
- * GNU General Public License for more details.
696189
- *
696189
- * You should have received a copy of the GNU General Public License along
696189
- * with this program; if not, write to the Free Software Foundation, Inc.,
696189
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
696189
- *)
696189
-
696189
-open Printf
696189
-open Unix
696189
-
696189
-open C_utils
696189
-open Std_utils
696189
-open Tools_utils
696189
-open Common_gettext.Gettext
696189
-
696189
-open Types
696189
-open Utils
696189
-
696189
-open Output
696189
-
696189
-module Json = struct
696189
-  type poptions = string * Types.output_allocation * string * string * string
696189
-
696189
-  type t = unit
696189
-
696189
-  let to_string options =
696189
-    "-o json" ^
696189
-      match options.output_storage with
696189
-      | Some os -> " -os " ^ os
696189
-      | None -> ""
696189
-
696189
-  let query_output_options () =
696189
-    printf (f_"Output options (-oo) which can be used with -o json:
696189
-
696189
-  -oo json-disks-pattern=PATTERN   Pattern for the disks.
696189
-")
696189
-
696189
-  let parse_options options source =
696189
-    if options.output_conn <> None then
696189
-      error_option_cannot_be_used_in_output_mode "json" "-oc";
696189
-    if options.output_password <> None then
696189
-      error_option_cannot_be_used_in_output_mode "json" "-op";
696189
-
696189
-    let known_pattern_variables = ["DiskNo"; "DiskDeviceName"; "GuestName"] in
696189
-    let json_disks_pattern = ref None in
696189
-    List.iter (
696189
-      fun (k, v) ->
696189
-        match k with
696189
-        | "json-disks-pattern" ->
696189
-           if !json_disks_pattern <> None then
696189
-             error (f_"-o json: -oo json-disks-pattern set more than once");
696189
-           let vars =
696189
-             try Var_expander.scan_variables v
696189
-             with Var_expander.Invalid_variable var ->
696189
-               error (f_"-o json: -oo json-disks-pattern: invalid variable %%{%s}")
696189
-                 var in
696189
-           List.iter (
696189
-             fun var ->
696189
-               if not (List.mem var known_pattern_variables) then
696189
-                 error (f_"-o json: -oo json-disks-pattern: unhandled variable %%{%s}")
696189
-                   var
696189
-           ) vars;
696189
-           json_disks_pattern := Some v
696189
-        | k ->
696189
-           error (f_"-o json: unknown output option ‘-oo %s’") k
696189
-      ) options.output_options;
696189
-
696189
-    let json_disks_pattern =
696189
-      Option.default "%{GuestName}-%{DiskDeviceName}" !json_disks_pattern in
696189
-
696189
-    (* -os must be set to a directory. *)
696189
-    let output_storage =
696189
-      match options.output_storage with
696189
-      | None ->
696189
-         error (f_"-o json: output directory was not specified, use '-os /dir'")
696189
-      | Some d when not (is_directory d) ->
696189
-         error (f_"-os %s: output directory does not exist or is not a directory") d
696189
-      | Some d -> d in
696189
-
696189
-    let output_name = Option.default source.s_name options.output_name in
696189
-
696189
-    (json_disks_pattern,
696189
-     options.output_alloc, options.output_format, output_name, output_storage)
696189
-
696189
-  let rec setup dir options source =
696189
-    let disks = get_disks dir in
696189
-    let json_disks_pattern,
696189
-        output_alloc, output_format, output_name,
696189
-        output_storage = options in
696189
-
696189
-    List.iter (
696189
-      fun (i, size) ->
696189
-        let socket = sprintf "%s/out%d" dir i in
696189
-        On_exit.unlink socket;
696189
-
696189
-        (* Create the actual output disk. *)
696189
-        let outdisk = json_path output_storage output_name
696189
-                        json_disks_pattern i in
696189
-        mkdir_p (Filename.dirname outdisk) 0o755;
696189
-
696189
-        output_to_local_file output_alloc output_format outdisk size socket
696189
-    ) disks
696189
-
696189
-  (* For -o json, return the output disk name of the i'th disk. *)
696189
-  and json_path os output_name json_disks_pattern i =
696189
-    let outname =
696189
-      let vars_fn = function
696189
-        | "DiskNo" -> Some (string_of_int (i+1))
696189
-        | "DiskDeviceName" -> Some (sprintf "sd%s" (drive_name i))
696189
-        | "GuestName" -> Some output_name
696189
-        | _ -> assert false
696189
-      in
696189
-      Var_expander.replace_fn json_disks_pattern vars_fn in
696189
-    let outdisk = os // outname in
696189
-    let outdisk = absolute_path outdisk in
696189
-    outdisk
696189
-
696189
-  let finalize dir options () source inspect target_meta =
696189
-    let json_disks_pattern,
696189
-        output_alloc, output_format, output_name, output_storage = options in
696189
-
696189
-    let doc =
696189
-      Create_json.create_json_metadata source inspect target_meta
696189
-        (json_path output_storage output_name json_disks_pattern)
696189
-        output_format output_name in
696189
-    let doc_string = JSON.string_of_doc ~fmt:JSON.Indented doc in
696189
-
696189
-    if verbose () then (
696189
-      eprintf "resulting JSON:\n";
696189
-      output_string Stdlib.stderr doc_string;
696189
-      eprintf "\n\n%!";
696189
-    );
696189
-
696189
-    let file = output_storage // output_name ^ ".json" in
696189
-    with_open_out file (
696189
-      fun chan ->
696189
-        output_string chan doc_string;
696189
-        output_char chan '\n'
696189
-    )
696189
-
696189
-  let request_size = None
696189
-end
696189
diff --git a/output/output_json.mli b/output/output_json.mli
696189
deleted file mode 100644
696189
index 00786ef7..00000000
696189
--- a/output/output_json.mli
696189
+++ /dev/null
696189
@@ -1,21 +0,0 @@
696189
-(* virt-v2v
696189
- * Copyright (C) 2009-2021 Red Hat Inc.
696189
- *
696189
- * This program is free software; you can redistribute it and/or modify
696189
- * it under the terms of the GNU General Public License as published by
696189
- * the Free Software Foundation; either version 2 of the License, or
696189
- * (at your option) any later version.
696189
- *
696189
- * This program is distributed in the hope that it will be useful,
696189
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
696189
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
696189
- * GNU General Public License for more details.
696189
- *
696189
- * You should have received a copy of the GNU General Public License along
696189
- * with this program; if not, write to the Free Software Foundation, Inc.,
696189
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
696189
- *)
696189
-
696189
-(** [-o json] output mode. *)
696189
-
696189
-module Json : Output.OUTPUT
696189
diff --git a/output/var_expander.ml b/output/var_expander.ml
696189
deleted file mode 100644
696189
index 24b9bafe..00000000
696189
--- a/output/var_expander.ml
696189
+++ /dev/null
696189
@@ -1,72 +0,0 @@
696189
-(* virt-v2v
696189
- * Copyright (C) 2019 Red Hat Inc.
696189
- *
696189
- * This program is free software; you can redistribute it and/or modify
696189
- * it under the terms of the GNU General Public License as published by
696189
- * the Free Software Foundation; either version 2 of the License, or
696189
- * (at your option) any later version.
696189
- *
696189
- * This program is distributed in the hope that it will be useful,
696189
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
696189
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
696189
- * GNU General Public License for more details.
696189
- *
696189
- * You should have received a copy of the GNU General Public License along
696189
- * with this program; if not, write to the Free Software Foundation, Inc.,
696189
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
696189
- *)
696189
-
696189
-open Std_utils
696189
-
696189
-exception Invalid_variable of string
696189
-
696189
-let var_re = PCRE.compile "(^|[^%])%{([^}]+)}"
696189
-
696189
-let check_variable var =
696189
-  String.iter (
696189
-    function
696189
-    | '0'..'9'
696189
-    | 'a'..'z'
696189
-    | 'A'..'Z'
696189
-    | '_'
696189
-    | '-' -> ()
696189
-    | _ -> raise (Invalid_variable var)
696189
-  ) var
696189
-
696189
-let scan_variables str =
696189
-  let res = ref [] in
696189
-  let offset = ref 0 in
696189
-  while PCRE.matches ~offset:!offset var_re str; do
696189
-    let var = PCRE.sub 2 in
696189
-    check_variable var;
696189
-    let _, end_ = PCRE.subi 0 in
696189
-    List.push_back res var;
696189
-    offset := end_
696189
-  done;
696189
-  List.remove_duplicates !res
696189
-
696189
-let replace_fn str fn =
696189
-  let res = ref str in
696189
-  let offset = ref 0 in
696189
-  while PCRE.matches ~offset:!offset var_re !res; do
696189
-    let var = PCRE.sub 2 in
696189
-    check_variable var;
696189
-    let start_, end_ = PCRE.subi 0 in
696189
-    match fn var with
696189
-    | None ->
696189
-      offset := end_
696189
-    | Some text ->
696189
-      let prefix_len =
696189
-        let prefix_start, prefix_end = PCRE.subi 1 in
696189
-        prefix_end - prefix_start in
696189
-      res := (String.sub !res 0 (start_ + prefix_len)) ^ text ^ (String.sub !res end_ (String.length !res - end_));
696189
-      offset := start_ + prefix_len + String.length text
696189
-  done;
696189
-  !res
696189
-
696189
-let replace_list str lst =
696189
-  let fn var =
696189
-    try Some (List.assoc var lst)
696189
-    with Not_found -> None
696189
-  in
696189
-  replace_fn str fn
696189
diff --git a/output/var_expander.mli b/output/var_expander.mli
696189
deleted file mode 100644
696189
index 80aa33c2..00000000
696189
--- a/output/var_expander.mli
696189
+++ /dev/null
696189
@@ -1,82 +0,0 @@
696189
-(* virt-v2v
696189
- * Copyright (C) 2019 Red Hat Inc.
696189
- *
696189
- * This program is free software; you can redistribute it and/or modify
696189
- * it under the terms of the GNU General Public License as published by
696189
- * the Free Software Foundation; either version 2 of the License, or
696189
- * (at your option) any later version.
696189
- *
696189
- * This program is distributed in the hope that it will be useful,
696189
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
696189
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
696189
- * GNU General Public License for more details.
696189
- *
696189
- * You should have received a copy of the GNU General Public License along
696189
- * with this program; if not, write to the Free Software Foundation, Inc.,
696189
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
696189
- *)
696189
-
696189
-(** Simple variable expander.
696189
-
696189
-    This module provides the support to expand variables in strings,
696189
-    specified in the form of [%{name}].
696189
-
696189
-    For example:
696189
-
696189
-{v
696189
-let str = "variable-%{INDEX} in %{INDEX} replaced %{INDEX} times"
696189
-let index = ref 0
696189
-let fn = function
696189
-  | "INDEX" ->
696189
-    incr index;
696189
-    Some (string_of_int !index)
696189
-  | _ -> None
696189
-in
696189
-let str = Var_expander.replace_fn str fn
696189
-(* now str is "variable-1 in 2 replaced 3 times" *)
696189
-v}
696189
-
696189
-    The names of variables can contain only ASCII letters (uppercase,
696189
-    and lowercase), digits, underscores, and dashes.
696189
-
696189
-    The replacement is done in a single pass: this means that if a
696189
-    variable is replaced with the text of a variable, that new text
696189
-    is kept as is in the final output.  In practice:
696189
-
696189
-{v
696189
-let str = "%{VAR}"
696189
-let str = Var_expander.replace_list str [("VAR", "%{VAR}")]
696189
-(* now str is "%{VAR}" *)
696189
-v}
696189
-*)
696189
-
696189
-exception Invalid_variable of string
696189
-(** Invalid variable name error.
696189
-
696189
-    In case a variable contains characters not allowed, then this
696189
-    exception with the actual unacceptable variable. *)
696189
-
696189
-val scan_variables : string -> string list
696189
-(** Scan the pattern string for all the variables available.
696189
-
696189
-    This can raise {!Invalid_variable} in case there are invalid
696189
-    variable names. *)
696189
-
696189
-val replace_fn : string -> (string -> string option) -> string
696189
-(** Replaces a string expanding all the variables.
696189
-
696189
-    The replacement function specify how a variable is replaced;
696189
-    if [None] is returned, then that variable is not replaced.
696189
-
696189
-    This can raise {!Invalid_variable} in case there are invalid
696189
-    variable names. *)
696189
-
696189
-val replace_list : string -> (string * string) list -> string
696189
-(** Replaces a string expanding all the variables.
696189
-
696189
-    The replacement list specify how a variable is replaced;
696189
-    if it is not specified in the list, then that variable is not
696189
-    replaced.
696189
-
696189
-    This can raise {!Invalid_variable} in case there are invalid
696189
-    variable names. *)
696189
diff --git a/output/var_expander_tests.ml b/output/var_expander_tests.ml
696189
deleted file mode 100644
696189
index 35b62836..00000000
696189
--- a/output/var_expander_tests.ml
696189
+++ /dev/null
696189
@@ -1,113 +0,0 @@
696189
-(* virt-v2v
696189
- * Copyright (C) 2019 Red Hat Inc.
696189
- *
696189
- * This program is free software; you can redistribute it and/or modify
696189
- * it under the terms of the GNU General Public License as published by
696189
- * the Free Software Foundation; either version 2 of the License, or
696189
- * (at your option) any later version.
696189
- *
696189
- * This program is distributed in the hope that it will be useful,
696189
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
696189
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
696189
- * GNU General Public License for more details.
696189
- *
696189
- * You should have received a copy of the GNU General Public License along
696189
- * with this program; if not, write to the Free Software Foundation, Inc.,
696189
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
696189
- *)
696189
-
696189
-open Printf
696189
-open OUnit
696189
-
696189
-open Std_utils
696189
-
696189
-let assert_equal_string = assert_equal ~printer:identity
696189
-let assert_equal_stringlist = assert_equal ~printer:(fun x -> "(" ^ (String.escaped (String.concat "," x)) ^ ")")
696189
-
696189
-let replace_none_fn _ = None
696189
-let replace_empty_fn _ = Some ""
696189
-
696189
-let test_no_replacement () =
696189
-  assert_equal_string "" (Var_expander.replace_fn "" replace_none_fn);
696189
-  assert_equal_string "x" (Var_expander.replace_fn "x" replace_none_fn);
696189
-  assert_equal_string "%{}" (Var_expander.replace_fn "%{}" replace_none_fn);
696189
-  assert_equal_string "%{EMPTY}" (Var_expander.replace_fn "%{EMPTY}" replace_none_fn);
696189
-  assert_equal_string "%{EMPTY} %{no}" (Var_expander.replace_fn "%{EMPTY} %{no}" replace_none_fn);
696189
-  assert_equal_string "a %{EMPTY} b" (Var_expander.replace_fn "a %{EMPTY} b" replace_none_fn);
696189
-  ()
696189
-
696189
-let test_replacements () =
696189
-  assert_equal_string "" (Var_expander.replace_fn "%{EMPTY}" replace_empty_fn);
696189
-  assert_equal_string "x " (Var_expander.replace_fn "x %{EMPTY}" replace_empty_fn);
696189
-  assert_equal_string "xy" (Var_expander.replace_fn "x%{EMPTY}y" replace_empty_fn);
696189
-  assert_equal_string "x<->y" (Var_expander.replace_fn "x%{FOO}y" (function | "FOO" -> Some "<->" | _ -> None));
696189
-  assert_equal_string "a x b" (Var_expander.replace_fn "a %{FOO} b" (function | "FOO" -> Some "x" | _ -> None));
696189
-  assert_equal_string "%{FOO} x" (Var_expander.replace_fn "%{FOO} %{BAR}" (function | "BAR" -> Some "x" | _ -> None));
696189
-  assert_equal_string "%{FOO}" (Var_expander.replace_fn "%{BAR}" (function | "BAR" -> Some "%{FOO}" | _ -> None));
696189
-  assert_equal_string "%{FOO} x" (Var_expander.replace_fn "%{BAR} %{FOO}" (function | "BAR" -> Some "%{FOO}" | "FOO" -> Some "x" | _ -> None));
696189
-  begin
696189
-    let str = "%{INDEX}, %{INDEX}, %{INDEX}" in
696189
-    let index = ref 0 in
696189
-    let fn = function
696189
-      | "INDEX" ->
696189
-        incr index;
696189
-        Some (string_of_int !index)
696189
-      | _ -> None
696189
-    in
696189
-    assert_equal_string "1, 2, 3" (Var_expander.replace_fn str fn)
696189
-  end;
696189
-  ()
696189
-
696189
-let test_escape () =
696189
-  assert_equal_string "%%{FOO}" (Var_expander.replace_fn "%%{FOO}" replace_empty_fn);
696189
-  assert_equal_string "x %%{FOO} x" (Var_expander.replace_fn "%{FOO} %%{FOO} %{FOO}" (function | "FOO" -> Some "x" | _ -> None));
696189
-  ()
696189
-
696189
-let test_list () =
696189
-  assert_equal_string "x %{NONE}" (Var_expander.replace_list "%{FOO} %{NONE}" [("FOO", "x")]);
696189
-  ()
696189
-
696189
-let test_scan_variables () =
696189
-  let assert_invalid_variable var =
696189
-    let str = "%{" ^ var ^ "}" in
696189
-    assert_raises (Var_expander.Invalid_variable var)
696189
-                  (fun () -> Var_expander.scan_variables str)
696189
-  in
696189
-  assert_equal_stringlist [] (Var_expander.scan_variables "");
696189
-  assert_equal_stringlist [] (Var_expander.scan_variables "foo");
696189
-  assert_equal_stringlist ["FOO"] (Var_expander.scan_variables "%{FOO}");
696189
-  assert_equal_stringlist ["FOO"; "BAR"] (Var_expander.scan_variables "%{FOO} %{BAR}");
696189
-  assert_equal_stringlist ["FOO"; "BAR"] (Var_expander.scan_variables "%{FOO} %{BAR} %{FOO}");
696189
-  assert_equal_stringlist ["FOO"; "BAR"] (Var_expander.scan_variables "%{FOO} %%{ESCAPED} %{BAR}");
696189
-  assert_invalid_variable "FOO/BAR";
696189
-  ()
696189
-
696189
-let test_errors () =
696189
-  let assert_invalid_variable var =
696189
-    let str = "%{" ^ var ^ "}" in
696189
-    assert_raises (Var_expander.Invalid_variable var)
696189
-                  (fun () -> Var_expander.replace_fn str replace_none_fn)
696189
-  in
696189
-  assert_invalid_variable "FOO/BAR";
696189
-  assert_invalid_variable "FOO:BAR";
696189
-  assert_invalid_variable "FOO(BAR";
696189
-  assert_invalid_variable "FOO)BAR";
696189
-  assert_invalid_variable "FOO@BAR";
696189
-  ()
696189
-
696189
-(* Suites declaration. *)
696189
-let suite =
696189
-  TestList ([
696189
-    "basic" >::: [
696189
-      "no_replacement" >:: test_no_replacement;
696189
-      "replacements" >:: test_replacements;
696189
-      "escape" >:: test_escape;
696189
-      "list" >:: test_list;
696189
-      "scan_variables" >:: test_scan_variables;
696189
-      "errors" >:: test_errors;
696189
-    ];
696189
-  ])
696189
-
696189
-let () =
696189
-  ignore (run_test_tt_main suite);
696189
-  Printf.fprintf stderr "\n"
696189
diff --git a/tests/Makefile.am b/tests/Makefile.am
696189
index db32e42b..e787a86c 100644
696189
--- a/tests/Makefile.am
696189
+++ b/tests/Makefile.am
696189
@@ -81,7 +81,6 @@ TESTS = \
696189
 	test-v2v-machine-readable.sh \
696189
 	test-v2v-networks-and-bridges.sh \
696189
 	test-v2v-o-glance.sh \
696189
-	test-v2v-o-json.sh \
696189
 	test-v2v-o-libvirt.sh \
696189
 	test-v2v-o-null.sh \
696189
 	test-v2v-o-openstack.sh \
696189
@@ -241,7 +240,6 @@ EXTRA_DIST += \
696189
 	test-v2v-networks-and-bridges.sh \
696189
 	test-v2v-networks-and-bridges-expected.xml \
696189
 	test-v2v-o-glance.sh \
696189
-	test-v2v-o-json.sh \
696189
 	test-v2v-o-libvirt.sh \
696189
 	test-v2v-o-null.sh \
696189
 	test-v2v-o-openstack.sh \
696189
diff --git a/tests/test-v2v-o-json.sh b/tests/test-v2v-o-json.sh
696189
deleted file mode 100755
696189
index 15e7ad5a..00000000
696189
--- a/tests/test-v2v-o-json.sh
696189
+++ /dev/null
696189
@@ -1,68 +0,0 @@
696189
-#!/bin/bash -
696189
-# libguestfs virt-v2v test script
696189
-# Copyright (C) 2019 Red Hat Inc.
696189
-#
696189
-# This program is free software; you can redistribute it and/or modify
696189
-# it under the terms of the GNU General Public License as published by
696189
-# the Free Software Foundation; either version 2 of the License, or
696189
-# (at your option) any later version.
696189
-#
696189
-# This program is distributed in the hope that it will be useful,
696189
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
696189
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
696189
-# GNU General Public License for more details.
696189
-#
696189
-# You should have received a copy of the GNU General Public License
696189
-# along with this program; if not, write to the Free Software
696189
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
696189
-
696189
-# Test -o json.
696189
-
696189
-set -e
696189
-set -x
696189
-
696189
-source ./functions.sh
696189
-set -e
696189
-set -x
696189
-
696189
-skip_if_skipped
696189
-requires test -f ../test-data/phony-guests/windows.img
696189
-requires jq --version
696189
-
696189
-libvirt_uri="test://$abs_top_builddir/test-data/phony-guests/guests.xml"
696189
-
696189
-export VIRT_TOOLS_DATA_DIR="$srcdir/../test-data/fake-virt-tools"
696189
-
696189
-guestname=windows
696189
-
696189
-d=test-v2v-o-json.d
696189
-rm -rf $d
696189
-cleanup_fn rm -r $d
696189
-mkdir $d
696189
-
696189
-json=$d/$guestname.json
696189
-disk=$d/$guestname-sda
696189
-
696189
-$VG virt-v2v --debug-gc \
696189
-    -i libvirt -ic "$libvirt_uri" windows \
696189
-    -o json -os $d -on $guestname
696189
-
696189
-# Test the disk was created.
696189
-test -f $disk
696189
-
696189
-# Test the JSON.
696189
-test x$(jq -r '.name' $json) = xwindows
696189
-test x$(jq -r '.inspect.type' $json) = xwindows
696189
-test x$(jq -r '.inspect.distro' $json) = xwindows
696189
-test $(jq -r '.disks | length' $json) -eq 1
696189
-test $(jq -r '.disks[0].file' $json) = $(realpath $disk)
696189
-test $(jq -r '.nics | length' $json) -eq 1
696189
-test $(jq -r '.removables | length' $json) -eq 0
696189
-
696189
-# libguestfs 1.40 didn't have osinfo inspection data, but we want this
696189
-# test to work with 1.40, so ignore if jq returns this field as
696189
-# "null".
696189
-osinfo=$(jq -r '.inspect.osinfo' $json)
696189
-if [ "x$osinfo" != "xnull" ]; then
696189
-    test x$osinfo = xwin7
696189
-fi
696189
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
696189
index e00f9814..994982ac 100644
696189
--- a/v2v/v2v.ml
696189
+++ b/v2v/v2v.ml
696189
@@ -194,7 +194,6 @@ let rec main () =
696189
     match mode with
696189
     | "libvirt" -> output_mode := `Libvirt
696189
     | "disk" | "local" -> output_mode := `Disk
696189
-    | "json" -> output_mode := `JSON
696189
     | "null" -> output_mode := `Null
696189
     | "openstack" | "osp" | "rhosp" -> output_mode := `Openstack
696189
     | "ovirt" | "rhv" | "rhev" -> output_mode := `RHV
696189
@@ -241,7 +240,7 @@ let rec main () =
696189
       s_"Map network ‘in’ to ‘out’";
696189
     [ L"no-trim" ],  Getopt.String ("-", no_trim_warning),
696189
       s_"Ignored for backwards compatibility";
696189
-    [ S 'o' ],       Getopt.String ("json|libvirt|local|null|openstack|qemu|rhv|rhv-upload|vdsm", set_output_mode),
696189
+    [ S 'o' ],       Getopt.String ("libvirt|local|null|openstack|qemu|rhv|rhv-upload|vdsm", set_output_mode),
696189
       s_"Set output mode (default: libvirt)";
696189
     [ M"oa" ],       Getopt.String ("sparse|preallocated", set_output_alloc),
696189
                                     s_"Set output allocation mode";
696189
@@ -376,7 +375,6 @@ read the man page virt-v2v(1).
696189
       pr "input:libvirtxml\n";
696189
       pr "input:ova\n";
696189
       pr "input:vmx\n";
696189
-      pr "output:json\n";
696189
       pr "output:libvirt\n";
696189
       pr "output:local\n";
696189
       pr "output:null\n";
696189
@@ -472,8 +470,7 @@ read the man page virt-v2v(1).
696189
     | `Openstack -> (module Output_openstack.Openstack)
696189
     | `RHV_Upload -> (module Output_rhv_upload.RHVUpload)
696189
     | `RHV -> (module Output_rhv.RHV)
696189
-    | `VDSM -> (module Output_vdsm.VDSM)
696189
-    | `JSON -> (module Output_json.Json) in
696189
+    | `VDSM -> (module Output_vdsm.VDSM) in
696189
 
696189
   let output_options = {
696189
     Output.output_alloc = output_alloc;