Richard W.M. Jones
2016-Dec-07 10:02 UTC
[Libguestfs] [PATCH v3] v2v: -o vdsm: Add --vdsm-compat flag.
v3: Change the flag from --vdsm-compat-11 to --vdsm-compat=1.1 Also the --machine-readable output has changed. I have also added a test. Rich.
Richard W.M. Jones
2016-Dec-07 10:02 UTC
[Libguestfs] [PATCH v3] v2v: -o vdsm: Add --vdsm-compat flag. -o rhev: Drop support for RHV < 4.1 (RHBZ#1400205).
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 must use RHV 4.1. For -o vdsm, it adds an interim flag (--vdsm-compat=0.10 or --vdsm-compat=1.1) which controls the compat level of the qcow2 output file. VDSM should use --vdsm-compat=1.1 when it is known that modern qemu is available. We can make this the default later when all RHV instances have moved to 4.1. It also adds: vdsm-compat-option to the `virt-v2v --machine-readable' output to indicate that this flag can be used. Thanks: Yaniv Kaul, Michal Skrivanek. --- v2v/cmdline.ml | 7 +++++++ v2v/output_rhev.ml | 4 ---- v2v/output_vdsm.ml | 11 ++++++++--- v2v/output_vdsm.mli | 1 + v2v/test-v2v-o-vdsm-options.sh | 11 +++++++++-- v2v/virt-v2v.pod | 21 ++++++++++++++++++++- 6 files changed, 45 insertions(+), 10 deletions(-) diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml index 2d0a10a..1d325af 100644 --- a/v2v/cmdline.ml +++ b/v2v/cmdline.ml @@ -66,6 +66,9 @@ let parse_cmdline () let vdsm_vm_uuid = ref None in let vdsm_ovf_output = ref None in (* default "." *) + let vdsm_compat = ref "0.10" in + let set_vdsm_compat s = vdsm_compat := s in + let set_string_option_once optname optref arg match !optref with | Some _ -> @@ -198,6 +201,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" ], Getopt.Symbol ("0.10|1.1", ["0.10"; "1.1"], set_vdsm_compat), s_"Write qcow2 with compat=0.10|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 +263,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 = !vdsm_compat 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 +277,7 @@ read the man page virt-v2v(1). printf "virt-v2v\n"; printf "libguestfs-rewrite\n"; printf "colours-option\n"; + printf "vdsm-compat-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 +421,7 @@ read the man page virt-v2v(1). vol_uuids = vdsm_vol_uuids; vm_uuid = vdsm_vm_uuid; ovf_output = vdsm_ovf_output; + compat = vdsm_compat; } 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..6771daf 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 : string; } class output_vdsm os vdsm_params output_alloc @@ -37,13 +38,16 @@ 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 + (match vdsm_params.compat with + | "0.10" -> "" (* currently this is the default, so don't print it *) + | s -> sprintf " --vdsm-compat=%s" s) method supported_firmware = [ TargetBIOS ] @@ -149,9 +153,10 @@ 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, RHBZ#1400205). *) - let compat = if format <> "qcow2" then compat else Some "0.10" in + let compat + if format <> "qcow2" then compat else Some vdsm_params.compat 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..8e69b6d 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 : string; (* --vdsm-compat=0.10|1.1 *) } (** Miscellaneous extra command line parameters used by VDSM. *) diff --git a/v2v/test-v2v-o-vdsm-options.sh b/v2v/test-v2v-o-vdsm-options.sh index 3b7eaae..1de0e17 100755 --- a/v2v/test-v2v-o-vdsm-options.sh +++ b/v2v/test-v2v-o-vdsm-options.sh @@ -1,6 +1,6 @@ #!/bin/bash - # libguestfs virt-v2v test script -# Copyright (C) 2014 Red Hat Inc. +# Copyright (C) 2014-2016 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -21,6 +21,7 @@ unset CDPATH export LANG=C set -e +set -x if [ -n "$SKIP_TEST_V2V_O_VDSM_OPTIONS_SH" ]; then echo "$0: test skipped because environment variable is set" @@ -61,10 +62,12 @@ mkdir $d/12345678-1234-1234-1234-123456789abc/master/vms/VM $VG virt-v2v --debug-gc \ -i libvirt -ic "$libvirt_uri" windows \ -o vdsm -os $d/12345678-1234-1234-1234-123456789abc \ + -of qcow2 \ --vdsm-image-uuid IMAGE \ --vdsm-vol-uuid VOL \ --vdsm-vm-uuid VM \ - --vdsm-ovf-output $d/12345678-1234-1234-1234-123456789abc/master/vms/VM + --vdsm-ovf-output $d/12345678-1234-1234-1234-123456789abc/master/vms/VM \ + --vdsm-compat=1.1 # Test the OVF metadata was created. test -f $d/12345678-1234-1234-1234-123456789abc/master/vms/VM/VM.ovf @@ -77,6 +80,10 @@ test -f VOL.meta # Test the disk file was created. test -f VOL +# Test that a qcow2 file with compat=1.1 was generated. +test "$(guestfish disk-format VOL)" = "qcow2" +qemu-img info VOL | grep 'compat: 1.1' + popd rm -r $d diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod index 4e0c65a..3b65d38 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,25 @@ 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=0.10> + +=item B<--vdsm-compat=1.1> + +If I<-o vdsm> and the output format is qcow2, then we add the qcow2 +I<compat=0.10> option to the output file for compatibility with RHEL 6 +(see L<https://bugzilla.redhat.com/1145582>). + +If I<--vdsm-compat=1.1> is used then modern qcow2 (I<compat=1.1>) +files are generated instead. + +Currently I<--vdsm-compat=0.10> is the default, but this will change +to I<--vdsm-compat=1.1> in a future version of virt-v2v (when we can +assume that everyone is using a modern version of qemu). + +B<Note this option only affects I<-o vdsm> output>. All other output +modes (including I<-o rhev>) generate modern qcow2 I<compat=1.1> +files, always. + =item B<--vdsm-image-uuid> UUID =item B<--vdsm-vol-uuid> UUID -- 2.10.2
Pino Toscano
2016-Dec-07 14:34 UTC
Re: [Libguestfs] [PATCH v3] v2v: -o vdsm: Add --vdsm-compat flag. -o rhev: Drop support for RHV < 4.1 (RHBZ#1400205).
On Wednesday, 7 December 2016 10:02:49 CET Richard W.M. Jones wrote:> 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 must > use RHV 4.1. > > For -o vdsm, it adds an interim flag (--vdsm-compat=0.10 or > --vdsm-compat=1.1) which controls the compat level of the qcow2 output > file. VDSM should use --vdsm-compat=1.1 when it is known that modern > qemu is available. We can make this the default later when all RHV > instances have moved to 4.1. > > It also adds: > > vdsm-compat-option > > to the `virt-v2v --machine-readable' output to indicate that this flag > can be used. > > Thanks: Yaniv Kaul, Michal Skrivanek. > ---LGTM, just one note below.> diff --git a/v2v/test-v2v-o-vdsm-options.sh b/v2v/test-v2v-o-vdsm-options.sh > index 3b7eaae..1de0e17 100755 > --- a/v2v/test-v2v-o-vdsm-options.sh > +++ b/v2v/test-v2v-o-vdsm-options.sh > @@ -21,6 +21,7 @@ > unset CDPATH > export LANG=C > set -e > +set -xThis should be left out, I guess. Thanks, -- Pino Toscano
Reasonably Related Threads
- [PATCH v2] v2v: -o vdsm: Add --vdsm-compat-11 flag, -o rhev: Drop support for RHV < 4.1 (RHBZ#1400205).
- [PATCH 3/3] v2v: vdsm: add --vdsm-fixed-ovf option
- [PATCH] v2v: adding --vdsm-ovf-output option
- [PATCH] v2v: adding --vdsm-ovf-output option
- [PATCH] v2v: adding --vdsm-ovf-output option