Support for RHEV with RHEL 6 nodes required us to output the old style
qcow2 compat=0.10 images.  Since RHEV 3.6 GA, RHEL 6 has not been
supported as a RHEV node type.  Since RHV 4.1, compat=1.1 is supported.

Support for compat=1.1 is uncertain in RHV 4.0 even on RHEL 7 nodes.

There are significant downsides to using qcow2 compat=0.10 instead of
the modern default (compat=1.1).

Therefore this patch does two things:

For -o rhev, it drops support for compat=0.10 completely.  You now
must use RHV 4.1.

For -o vdsm, it adds an interim flag (--vdsm-compat-11) which turns
off the previous behaviour.  We can drop this flag later when all RHV
instances have moved to 4.1.

It also adds:

  vdsm-compat-11-option

to the `virt-v2v --machine-readable' output to indicate that this flag
can be used.

Thanks: Yaniv Kaul, Michal Skrivanek.
---
 v2v/cmdline.ml      |  5 +++++
 v2v/output_rhev.ml  |  4 ----
 v2v/output_vdsm.ml  | 11 ++++++++---
 v2v/output_vdsm.mli |  1 +
 v2v/virt-v2v.pod    | 11 ++++++++++-
 5 files changed, 24 insertions(+), 8 deletions(-)

diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
index 2d0a10a..9a56d60 100644
--- a/v2v/cmdline.ml
+++ b/v2v/cmdline.ml
@@ -65,6 +65,7 @@ let parse_cmdline () =
   let password_file = ref None in
   let vdsm_vm_uuid = ref None in
   let vdsm_ovf_output = ref None in (* default "." *)
+  let vdsm_compat_11 = ref false in
 
   let set_string_option_once optname optref arg =
     match !optref with
@@ -198,6 +199,7 @@ let parse_cmdline () =
     [ L"print-source" ], Getopt.Set print_source, s_"Print source and stop";
     [ L"qemu-boot" ], Getopt.Set qemu_boot,       s_"Boot in qemu (-o qemu 
only)";
     [ L"root" ],    Getopt.String ("ask|... ", set_root_choice), s_"How to 
choose root filesystem";
+    [ L"vdsm-compat-11" ], Getopt.Set vdsm_compat_11, s_"Write qcow2 with 
compat=1.1";
     [ L"vdsm-image-uuid" ], Getopt.String ("uuid", add_vdsm_image_uuid), 
s_"Output image UUID(s)";
     [ L"vdsm-vol-uuid" ], Getopt.String ("uuid", add_vdsm_vol_uuid), s_"Output 
vol UUID(s)";
     [ L"vdsm-vm-uuid" ], Getopt.String ("uuid", set_string_option_once 
"--vdsm-vm-uuid" vdsm_vm_uuid),
@@ -259,6 +261,7 @@ read the man page virt-v2v(1).
   let print_source = !print_source in
   let qemu_boot = !qemu_boot in
   let root_choice = !root_choice in
+  let vdsm_compat_11 = !vdsm_compat_11 in
   let vdsm_image_uuids = List.rev !vdsm_image_uuids in
   let vdsm_vol_uuids = List.rev !vdsm_vol_uuids in
   let vdsm_vm_uuid = !vdsm_vm_uuid in
@@ -272,6 +275,7 @@ read the man page virt-v2v(1).
     printf "virt-v2v\n";
     printf "libguestfs-rewrite\n";
     printf "colours-option\n";
+    printf "vdsm-compat-11-option\n";
     List.iter (printf "input:%s\n") (Modules_list.input_modules ());
     List.iter (printf "output:%s\n") (Modules_list.output_modules ());
     List.iter (printf "convert:%s\n") (Modules_list.convert_modules ());
@@ -415,6 +419,7 @@ read the man page virt-v2v(1).
         vol_uuids = vdsm_vol_uuids;
         vm_uuid = vdsm_vm_uuid;
         ovf_output = vdsm_ovf_output;
+        compat_11 = vdsm_compat_11;
       } in
       Output_vdsm.output_vdsm os vdsm_params output_alloc in
 
diff --git a/v2v/output_rhev.ml b/v2v/output_rhev.ml
index e45043b..3280150 100644
--- a/v2v/output_rhev.ml
+++ b/v2v/output_rhev.ml
@@ -248,10 +248,6 @@ object
     Changeuid.func changeuid_t (
       fun () ->
         let g = open_guestfs ~identifier:"rhev_disk_create" () in
-        (* For qcow2, override v2v-supplied compat option, because RHEL 6
-         * nodes cannot handle qcow2 v3 (RHBZ#1145582).
-         *)
-        let compat = if format <> "qcow2" then compat else Some "0.10" in
         g#disk_create ?backingfile ?backingformat ?preallocation ?compat
           ?clustersize path format size;
         (* Make it sufficiently writable so that possibly root, or
diff --git a/v2v/output_vdsm.ml b/v2v/output_vdsm.ml
index 7cd94c0..fbddee8 100644
--- a/v2v/output_vdsm.ml
+++ b/v2v/output_vdsm.ml
@@ -30,6 +30,7 @@ type vdsm_params = {
   vol_uuids : string list;
   vm_uuid : string;
   ovf_output : string;
+  compat_11 : bool;
 }
 
 class output_vdsm os vdsm_params output_alloc =
@@ -37,13 +38,14 @@ object
   inherit output
 
   method as_options =
-    sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s" os
+    sprintf "-o vdsm -os %s%s%s --vdsm-vm-uuid %s --vdsm-ovf-output %s%s" os
       (String.concat ""
          (List.map (sprintf " --vdsm-image-uuid %s") vdsm_params.image_uuids))
       (String.concat ""
          (List.map (sprintf " --vdsm-vol-uuid %s") vdsm_params.vol_uuids))
       vdsm_params.vm_uuid
       vdsm_params.ovf_output
+      (if vdsm_params.compat_11 then " --vdsm-compat-11" else "")
 
   method supported_firmware = [ TargetBIOS ]
 
@@ -149,9 +151,12 @@ object
     ?clustersize path format size =
     let g = open_guestfs ~identifier:"vdsm_disk_create" () in
     (* For qcow2, override v2v-supplied compat option, because RHEL 6
-     * nodes cannot handle qcow2 v3 (RHBZ#1145582).
+     * nodes cannot handle qcow2 v3 (RHBZ#1145582).  Using
+     * --vdsm-compat-11 disables the override.
      *)
-    let compat = if format <> "qcow2" then compat else Some "0.10" in
+    let compat =
+      if vdsm_params.compat_11 || format <> "qcow2" then compat
+      else Some "0.10" in
     g#disk_create ?backingfile ?backingformat ?preallocation ?compat
       ?clustersize path format size
 
diff --git a/v2v/output_vdsm.mli b/v2v/output_vdsm.mli
index 532227a..3b089c7 100644
--- a/v2v/output_vdsm.mli
+++ b/v2v/output_vdsm.mli
@@ -23,6 +23,7 @@ type vdsm_params = {
   vol_uuids : string list;            (* --vdsm-vol-uuid (multiple) *)
   vm_uuid : string;                   (* --vdsm-vm-uuid *)
   ovf_output : string;                (* --vdsm-ovf-output *)
+  compat_11 : bool;                   (* --vdsm-compat-11 *)
 }
 (** Miscellaneous extra command line parameters used by VDSM. *)
 
diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod
index 4e0c65a..1654b35 100644
--- a/v2v/virt-v2v.pod
+++ b/v2v/virt-v2v.pod
@@ -199,7 +199,7 @@ QEMU and KVM only.
 
 =item OpenStack Glance
 
-=item Red Hat Enterprise Virtualization (RHEV) 2.2 and up
+=item Red Hat Enterprise Virtualization (RHEV) 4.1 and up
 
 =item Local libvirt
 
@@ -604,6 +604,15 @@ boot an operating system from the first VirtIO disk.  
Specifically,
 F</boot> must be on the first VirtIO disk, and it cannot chainload an
 OS which is not in the first VirtIO disk.
 
+=item B<--vdsm-compat-11>
+
+If I<-o vdsm> and the output format is qcow2, then by default the
+I<compat=0.10> option is added to the output file for compatibility
+with RHEL 6 (see L<https://bugzilla.redhat.com/1145582>).  However if
+this flag is given, then I<compat=1.1> is used instead (which is the
+default for all other output modes).  This flag will become the
+default in a future version of virt-v2v.
+
 =item B<--vdsm-image-uuid> UUID
 
 =item B<--vdsm-vol-uuid> UUID
-- 
2.10.2

_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs

Reply via email to