diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml index 785e91ef9..a8da63f71 100644 --- a/v2v/cmdline.ml +++ b/v2v/cmdline.ml @@ -597,11 +597,6 @@ read the man page virt-v2v(1). | None -> error (f_"-o rhv-upload: use ‘-oc’ to point to the oVirt or RHV server REST API URL, which is usually https://servername/ovirt-engine/api") | Some oc -> oc in - (* Output format / sparse must currently be raw+sparse. We can - * change this in future. See TODO file for details. XXX - *) - if output_alloc <> Sparse || output_format <> Some "raw" then - error (f_"-o rhv-upload: currently you must use ‘-of raw’ and you cannot use ‘-oa preallocated’ with this output mode. These restrictions will be loosened in a future version."); (* In theory we could make the password optional in future. *) let output_password = match output_password with diff --git a/v2v/output_rhv_upload.ml b/v2v/output_rhv_upload.ml index 129461242..dc0d96d53 100644 --- a/v2v/output_rhv_upload.ml +++ b/v2v/output_rhv_upload.ml @@ -169,6 +169,19 @@ See also \"OUTPUT TO RHV\" in the virt-v2v(1) manual.") error (f_"nbdkit was compiled without SELinux support. You will have to recompile nbdkit with libselinux-devel installed, or else set SELinux to Permissive mode while doing the conversion.") in + (* Output format/sparse must be raw/sparse. We may be able to + * lift this limitation in future, but it requires changes on the + * RHV side. See TODO file for details. XXX + *) + let error_current_limitation required_param = + error (f_"rhv-upload: currently you must use ‘%s’. This restriction will be loosened in a future version.") required_param + in + + let error_unless_output_alloc_sparse () = + if output_alloc <> Sparse then + error_current_limitation "-oa sparse" + in + (* JSON parameters which are invariant between disks. *) let json_params = [ "verbose", JSON.Bool (verbose ()); @@ -220,6 +233,7 @@ object error_unless_python_binary_on_path (); error_unless_nbdkit_working (); error_unless_nbdkit_python3_working (); + error_unless_output_alloc_sparse (); if have_selinux then error_unless_nbdkit_compiled_with_selinux () @@ -260,7 +274,9 @@ object let disk_format = match t.target_format with - | ("raw" | "qcow2") as fmt -> fmt + | "raw" as fmt -> fmt + | "qcow2" -> + error_current_limitation "-of raw" | _ -> error (f_"rhv-upload: -of %s: Only output format ‘raw’ or ‘qcow2’ is supported. If the input is in a different format then force one of these output formats by adding either ‘-of raw’ or ‘-of qcow2’ on the command line.") t.target_format in