It will now print a warning but is otherwise ignored: virt-v2v: warning: the --no-trim option has been removed and now does nothing
See: https://www.redhat.com/archives/libguestfs/2016-April/msg00178.html --- v2v/cmdline.ml | 25 ++++--------------------- v2v/cmdline.mli | 1 - v2v/v2v.ml | 45 +++++---------------------------------------- v2v/virt-v2v.pod | 24 ------------------------ 4 files changed, 9 insertions(+), 86 deletions(-) diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml index 2f0dace..d35e3ba 100644 --- a/v2v/cmdline.ml +++ b/v2v/cmdline.ml @@ -38,7 +38,6 @@ type cmdline = { do_copy : bool; in_place : bool; network_map : string NetworkMap.t; - no_trim : string list; output_alloc : output_allocation; output_format : string option; output_name : string option; @@ -109,23 +108,8 @@ let parse_cmdline () = add_network, add_bridge in - let no_trim = ref [] in - let set_no_trim = function - | "all" | "ALL" | "*" -> - (* Note: this is a magic value tested in the main code. The - * no_trim list does NOT support wildcards. - *) - no_trim := ["*"] - | mps -> - let mps = String.nsplit "," mps in - List.iter ( - fun mp -> - if String.length mp = 0 then - error (f_"--no-trim: empty parameter"); - if mp.[0] <> '/' then - error (f_"--no-trim: %s: mountpoint/device name does not begin with '/'") mp; - ) mps; - no_trim := mps + let no_trim_warning _ = + warning (f_"the --no-trim option has been removed and now does nothing") in let output_mode = ref `Not_set in @@ -199,7 +183,8 @@ let parse_cmdline () = "-n", Arg.String add_network, "in:out " ^ s_"Map network 'in' to 'out'"; "--network", Arg.String add_network, "in:out " ^ ditto; "--no-copy", Arg.Clear do_copy, " " ^ s_"Just write the metadata"; - "--no-trim", Arg.String set_no_trim, "all|mp,mp,.." ^ " " ^ s_"Don't trim selected mounts"; + "--no-trim", Arg.String no_trim_warning, + "-" ^ " " ^ s_"Ignored for backwards compatibility"; "-o", Arg.String set_output_mode, o_options ^ " " ^ s_"Set output mode (default: libvirt)"; "-oa", Arg.String set_output_alloc, "sparse|preallocated " ^ s_"Set output allocation mode"; @@ -264,7 +249,6 @@ read the man page virt-v2v(1). let in_place = !in_place in let machine_readable = !machine_readable in let network_map = !network_map in - let no_trim = !no_trim in let output_alloc = match !output_alloc with | `Not_set | `Sparse -> Sparse @@ -454,7 +438,6 @@ read the man page virt-v2v(1). { compressed = compressed; debug_overlays = debug_overlays; do_copy = do_copy; in_place = in_place; network_map = network_map; - no_trim = no_trim; output_alloc = output_alloc; output_format = output_format; output_name = output_name; print_source = print_source; root_choice = root_choice; diff --git a/v2v/cmdline.mli b/v2v/cmdline.mli index 2ae73fd..1095989 100644 --- a/v2v/cmdline.mli +++ b/v2v/cmdline.mli @@ -38,7 +38,6 @@ type cmdline = { do_copy : bool; in_place : bool; network_map : string NetworkMap.t; - no_trim : string list; output_alloc : Types.output_allocation; output_format : string option; output_name : string option; diff --git a/v2v/v2v.ml b/v2v/v2v.ml index 1b9e79c..e6ff8e2 100644 --- a/v2v/v2v.ml +++ b/v2v/v2v.ml @@ -98,14 +98,13 @@ let rec main () = g#umount_all (); - if cmdline.no_trim <> ["*"] && - (cmdline.do_copy || cmdline.debug_overlays) then ( + if cmdline.do_copy || cmdline.debug_overlays then ( (* Doing fstrim on all the filesystems reduces the transfer size * because unused blocks are marked in the overlay and thus do * not have to be copied. *) message (f_"Mapping filesystem data to avoid copying unused and blank areas"); - do_fstrim g cmdline.no_trim inspect; + do_fstrim g inspect; ); (match conversion_mode with @@ -367,10 +366,8 @@ and check_free_space mpstats = ) ) mpstats -(* Perform the fstrim. The trimming bit is easy. Dealing with the - * [--no-trim] parameter .. not so much. - *) -and do_fstrim g no_trim inspect = +(* Perform the fstrim. *) +and do_fstrim g inspect = (* Get all filesystems. *) let fses = g#list_filesystems () in @@ -378,39 +375,7 @@ and do_fstrim g no_trim inspect = function (_, ("unknown"|"swap")) -> None | (dev, _) -> Some dev ) fses in - let fses = - if no_trim = [] then fses - else ( - if verbose () then ( - printf "no_trim: %s\n" (String.concat " " no_trim); - printf "filesystems before considering no_trim: %s\n" - (String.concat " " fses) - ); - - (* Drop any filesystems that match a device name in the no_trim list. *) - let fses = List.filter ( - fun dev -> - not (List.mem (g#canonical_device_name dev) no_trim) - ) fses in - - (* Drop any mountpoints matching the no_trim list. *) - let dev_to_mp = - List.map (fun (mp, dev) -> g#canonical_device_name dev, mp) - inspect.i_mountpoints in - let fses = List.filter ( - fun dev -> - try not (List.mem (List.assoc dev dev_to_mp) no_trim) - with Not_found -> true - ) fses in - - if verbose () then - printf "filesystems after considering no_trim: %s\n%!" - (String.concat " " fses); - - fses - ) in - - (* Trim the remaining filesystems. *) + (* Trim the filesystems. *) List.iter ( fun dev -> g#umount_all (); diff --git a/v2v/virt-v2v.pod b/v2v/virt-v2v.pod index bce79c1..b654711 100644 --- a/v2v/virt-v2v.pod +++ b/v2v/virt-v2v.pod @@ -401,29 +401,6 @@ a faulty guest (one with no disks). This option is not compatible with I<-o glance> for technical reasons. -=item B<--no-trim all> - -=item B<--no-trim> mp[,mp...] - -By default virt-v2v runs L<fstrim(8)> to reduce the amount of data -that needs to be copied. This is known to break some buggy -bootloaders causing boot failures after conversion (see for example -L<https://bugzilla.redhat.com/show_bug.cgi?id=1141145#c27>). - -You can use I<--no-trim all> to disable all trimming. Note this will -greatly increase the amount of data that has to be copied and can make -virt-v2v run much more slowly. - -You can also disable trimming on selected filesystems only (specified -by a comma-separated list of their mount point(s) in the guest). -Typically you would use I<--no-trim /boot> to work around the grub bug -mentioned above. - -You can also disable trimming on partitions using the libguestfs -naming scheme for devices, eg: I<--no-trim /dev/sdb2> means do not -trim the second partition on the second block device. Use -L<virt-filesystems(1)> to list filesystem names in a guest. - =item B<-o disk> This is the same as I<-o local>. @@ -1947,7 +1924,6 @@ L<virt-sysprep(1)>, L<guestfs(3)>, L<guestfish(1)>, L<qemu-img(1)>, -L<fstrim(8)>, L<virt-v2v-copy-to-local(1)>, L<virt-v2v-test-harness(1)>, L<engine-image-uploader(8)>, -- 2.7.4 _______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
