Andrey Drobyshev
2023-Mar-10 17:54 UTC
[Libguestfs] [V2V PATCH v3 5/6] v2v, in-place: introduce --block-driver command line option
From: "Richard W.M. Jones" <rjones at redhat.com> The option takes values of "virtio-scsi", "virtio-blk" (with the latter being the default). It maps on the convert option with the same name introduced in the previous commits, thus allowing us to alter the order in which the VirtIO block drivers are going to be searched for. This is useful if we want the virtio-scsi driver to be installed during conversion instead of the default virtio-blk. Also update the docs accordingly. Originally-by: Richard W.M. Jones <rjones at redhat.com> Signed-off-by: Andrey Drobyshev <andrey.drobyshev at virtuozzo.com> --- docs/virt-v2v-in-place.pod | 10 ++++++++++ docs/virt-v2v.pod | 10 ++++++++++ in-place/in_place.ml | 11 ++++++++++- v2v/v2v.ml | 11 ++++++++++- 4 files changed, 40 insertions(+), 2 deletions(-) diff --git a/docs/virt-v2v-in-place.pod b/docs/virt-v2v-in-place.pod index 6e1c5363..1e993e8c 100644 --- a/docs/virt-v2v-in-place.pod +++ b/docs/virt-v2v-in-place.pod @@ -47,6 +47,16 @@ Display help. See I<--network> below. +=item B<--block-driver virtio-blk> + +=item B<--block-driver virtio-scsi> + +When choosing a block driver for Windows guests, prefer C<virtio-blk> or +C<virtio-scsi>. The default is C<virtio-blk>. + +Note this has no effect for Linux guests at the moment. That may be +added in future. + =item B<--colors> =item B<--colours> diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod index b458607d..e096418b 100644 --- a/docs/virt-v2v.pod +++ b/docs/virt-v2v.pod @@ -207,6 +207,16 @@ The options are silently ignored for other input methods. See I<--network> below. +=item B<--block-driver virtio-blk> + +=item B<--block-driver virtio-scsi> + +When choosing a block driver for Windows guests, prefer C<virtio-blk> or +C<virtio-scsi>. The default is C<virtio-blk>. + +Note this has no effect for Linux guests at the moment. That may be +added in future. + =item B<--colors> =item B<--colours> diff --git a/in-place/in_place.ml b/in-place/in_place.ml index 2049db16..e8c260c2 100644 --- a/in-place/in_place.ml +++ b/in-place/in_place.ml @@ -43,6 +43,7 @@ let rec main () let bandwidth = ref None in let bandwidth_file = ref None in + let block_driver = ref None in let input_conn = ref None in let input_format = ref None in let input_password = ref None in @@ -156,6 +157,8 @@ let rec main () let argspec = [ [ S 'b'; L"bridge" ], Getopt.String ("in:out", add_bridge), s_"Map bridge ?in? to ?out?"; + [ L"block-driver" ], Getopt.String ("driver", set_string_option_once "--block-driver" block_driver), + s_"Prefer 'virtio-blk' or 'virtio-scsi'"; [ S 'i' ], Getopt.String ("disk|libvirt|libvirtxml|ova|vmx", set_input_mode), s_"Set input mode (default: libvirt)"; [ M"ic" ], Getopt.String ("uri", set_string_option_once "-ic" input_conn), @@ -211,6 +214,12 @@ read the man page virt-v2v-in-place(1). (* Dereference the arguments. *) let args = List.rev !args in + let block_driver + match !block_driver with + | None | Some "virtio-blk" -> Virtio_blk + | Some "virtio-scsi" -> Virtio_SCSI + | Some driver -> + error (f_"unknown block driver ?--block-driver %s?") driver in let input_conn = !input_conn in let input_mode = !input_mode in let print_source = !print_source in @@ -294,7 +303,7 @@ read the man page virt-v2v-in-place(1). (* Get the conversion options. *) let conv_options = { - Convert.block_driver = Virtio_blk; + Convert.block_driver = block_driver; keep_serial_console = true; ks = opthandle.ks; network_map; diff --git a/v2v/v2v.ml b/v2v/v2v.ml index 22f7c631..3b2eafbd 100644 --- a/v2v/v2v.ml +++ b/v2v/v2v.ml @@ -48,6 +48,7 @@ let rec main () let bandwidth = ref None in let bandwidth_file = ref None in + let block_driver = ref None in let input_conn = ref None in let input_format = ref None in let input_password = ref None in @@ -230,6 +231,8 @@ let rec main () s_"Set bandwidth dynamically from file"; [ S 'b'; L"bridge" ], Getopt.String ("in:out", add_bridge), s_"Map bridge ?in? to ?out?"; + [ L"block-driver" ], Getopt.String ("driver", set_string_option_once "--block-driver" block_driver), + s_"Prefer 'virtio-blk' or 'virtio-scsi'"; [ L"compressed" ], Getopt.Unit (fun () -> set_output_option_compat "compressed" ""), s_"Compress output file (-of qcow2 only)"; [ S 'i' ], Getopt.String ("disk|libvirt|libvirtxml|ova|vmx", set_input_mode), @@ -351,6 +354,12 @@ read the man page virt-v2v(1). (* Dereference the arguments. *) let args = List.rev !args in + let block_driver + match !block_driver with + | None | Some "virtio-blk" -> Virtio_blk + | Some "virtio-scsi" -> Virtio_SCSI + | Some driver -> + error (f_"unknown block driver ?--block-driver %s?") driver in let input_conn = !input_conn in let input_mode = !input_mode in let input_transport @@ -524,7 +533,7 @@ read the man page virt-v2v(1). (* Get the conversion options. *) let conv_options = { - Convert.block_driver = Virtio_blk; + Convert.block_driver = block_driver; keep_serial_console = not remove_serial_console; ks = opthandle.ks; network_map; -- 2.31.1
Laszlo Ersek
2023-Mar-13 11:05 UTC
[Libguestfs] [V2V PATCH v3 5/6] v2v, in-place: introduce --block-driver command line option
On 3/10/23 18:54, Andrey Drobyshev wrote:> From: "Richard W.M. Jones" <rjones at redhat.com> > > The option takes values of "virtio-scsi", "virtio-blk" (with the latter > being the default). It maps on the convert option with the same name > introduced in the previous commits, thus allowing us to alter the order in > which the VirtIO block drivers are going to be searched for. This is > useful if we want the virtio-scsi driver to be installed during > conversion instead of the default virtio-blk. > > Also update the docs accordingly. > > Originally-by: Richard W.M. Jones <rjones at redhat.com> > Signed-off-by: Andrey Drobyshev <andrey.drobyshev at virtuozzo.com> > --- > docs/virt-v2v-in-place.pod | 10 ++++++++++ > docs/virt-v2v.pod | 10 ++++++++++ > in-place/in_place.ml | 11 ++++++++++- > v2v/v2v.ml | 11 ++++++++++- > 4 files changed, 40 insertions(+), 2 deletions(-) > > diff --git a/docs/virt-v2v-in-place.pod b/docs/virt-v2v-in-place.pod > index 6e1c5363..1e993e8c 100644 > --- a/docs/virt-v2v-in-place.pod > +++ b/docs/virt-v2v-in-place.pod > @@ -47,6 +47,16 @@ Display help. > > See I<--network> below. > > +=item B<--block-driver virtio-blk> > + > +=item B<--block-driver virtio-scsi> > + > +When choosing a block driver for Windows guests, prefer C<virtio-blk> or > +C<virtio-scsi>. The default is C<virtio-blk>. > + > +Note this has no effect for Linux guests at the moment. That may be > +added in future. > + > =item B<--colors> > > =item B<--colours> > diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod > index b458607d..e096418b 100644 > --- a/docs/virt-v2v.pod > +++ b/docs/virt-v2v.pod > @@ -207,6 +207,16 @@ The options are silently ignored for other input methods. > > See I<--network> below. > > +=item B<--block-driver virtio-blk> > + > +=item B<--block-driver virtio-scsi> > + > +When choosing a block driver for Windows guests, prefer C<virtio-blk> or > +C<virtio-scsi>. The default is C<virtio-blk>. > + > +Note this has no effect for Linux guests at the moment. That may be > +added in future. > + > =item B<--colors> > > =item B<--colours> > diff --git a/in-place/in_place.ml b/in-place/in_place.ml > index 2049db16..e8c260c2 100644 > --- a/in-place/in_place.ml > +++ b/in-place/in_place.ml > @@ -43,6 +43,7 @@ let rec main () > > let bandwidth = ref None in > let bandwidth_file = ref None in > + let block_driver = ref None in > let input_conn = ref None in > let input_format = ref None in > let input_password = ref None in > @@ -156,6 +157,8 @@ let rec main () > let argspec = [ > [ S 'b'; L"bridge" ], Getopt.String ("in:out", add_bridge), > s_"Map bridge ?in? to ?out?"; > + [ L"block-driver" ], Getopt.String ("driver", set_string_option_once "--block-driver" block_driver), > + s_"Prefer 'virtio-blk' or 'virtio-scsi'"; > [ S 'i' ], Getopt.String ("disk|libvirt|libvirtxml|ova|vmx", set_input_mode), > s_"Set input mode (default: libvirt)"; > [ M"ic" ], Getopt.String ("uri", set_string_option_once "-ic" input_conn), > @@ -211,6 +214,12 @@ read the man page virt-v2v-in-place(1). > > (* Dereference the arguments. *) > let args = List.rev !args in > + let block_driver > + match !block_driver with > + | None | Some "virtio-blk" -> Virtio_blk > + | Some "virtio-scsi" -> Virtio_SCSI > + | Some driver -> > + error (f_"unknown block driver ?--block-driver %s?") driver in > let input_conn = !input_conn in > let input_mode = !input_mode in > let print_source = !print_source in > @@ -294,7 +303,7 @@ read the man page virt-v2v-in-place(1). > > (* Get the conversion options. *) > let conv_options = { > - Convert.block_driver = Virtio_blk; > + Convert.block_driver = block_driver; > keep_serial_console = true; > ks = opthandle.ks; > network_map; > diff --git a/v2v/v2v.ml b/v2v/v2v.ml > index 22f7c631..3b2eafbd 100644 > --- a/v2v/v2v.ml > +++ b/v2v/v2v.ml > @@ -48,6 +48,7 @@ let rec main () > > let bandwidth = ref None in > let bandwidth_file = ref None in > + let block_driver = ref None in > let input_conn = ref None in > let input_format = ref None in > let input_password = ref None in > @@ -230,6 +231,8 @@ let rec main () > s_"Set bandwidth dynamically from file"; > [ S 'b'; L"bridge" ], Getopt.String ("in:out", add_bridge), > s_"Map bridge ?in? to ?out?"; > + [ L"block-driver" ], Getopt.String ("driver", set_string_option_once "--block-driver" block_driver), > + s_"Prefer 'virtio-blk' or 'virtio-scsi'"; > [ L"compressed" ], Getopt.Unit (fun () -> set_output_option_compat "compressed" ""), > s_"Compress output file (-of qcow2 only)"; > [ S 'i' ], Getopt.String ("disk|libvirt|libvirtxml|ova|vmx", set_input_mode), > @@ -351,6 +354,12 @@ read the man page virt-v2v(1). > > (* Dereference the arguments. *) > let args = List.rev !args in > + let block_driver > + match !block_driver with > + | None | Some "virtio-blk" -> Virtio_blk > + | Some "virtio-scsi" -> Virtio_SCSI > + | Some driver -> > + error (f_"unknown block driver ?--block-driver %s?") driver in > let input_conn = !input_conn in > let input_mode = !input_mode in > let input_transport > @@ -524,7 +533,7 @@ read the man page virt-v2v(1). > > (* Get the conversion options. *) > let conv_options = { > - Convert.block_driver = Virtio_blk; > + Convert.block_driver = block_driver; > keep_serial_console = not remove_serial_console; > ks = opthandle.ks; > network_map;Acked-by: Laszlo Ersek <lersek at redhat.com>
Laszlo Ersek
2023-Mar-14 12:59 UTC
[Libguestfs] [V2V PATCH v3 5/6] v2v, in-place: introduce --block-driver command line option
On 3/10/23 18:54, Andrey Drobyshev wrote:> From: "Richard W.M. Jones" <rjones at redhat.com> > > The option takes values of "virtio-scsi", "virtio-blk" (with the latter > being the default). It maps on the convert option with the same name > introduced in the previous commits, thus allowing us to alter the order in > which the VirtIO block drivers are going to be searched for. This is > useful if we want the virtio-scsi driver to be installed during > conversion instead of the default virtio-blk. > > Also update the docs accordingly. > > Originally-by: Richard W.M. Jones <rjones at redhat.com> > Signed-off-by: Andrey Drobyshev <andrey.drobyshev at virtuozzo.com> > --- > docs/virt-v2v-in-place.pod | 10 ++++++++++ > docs/virt-v2v.pod | 10 ++++++++++ > in-place/in_place.ml | 11 ++++++++++- > v2v/v2v.ml | 11 ++++++++++- > 4 files changed, 40 insertions(+), 2 deletions(-) > > diff --git a/docs/virt-v2v-in-place.pod b/docs/virt-v2v-in-place.pod > index 6e1c5363..1e993e8c 100644 > --- a/docs/virt-v2v-in-place.pod > +++ b/docs/virt-v2v-in-place.pod > @@ -47,6 +47,16 @@ Display help. > > See I<--network> below. > > +=item B<--block-driver virtio-blk> > + > +=item B<--block-driver virtio-scsi> > + > +When choosing a block driver for Windows guests, prefer C<virtio-blk> or > +C<virtio-scsi>. The default is C<virtio-blk>. > + > +Note this has no effect for Linux guests at the moment. That may be > +added in future. > + > =item B<--colors> > > =item B<--colours> > diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod > index b458607d..e096418b 100644 > --- a/docs/virt-v2v.pod > +++ b/docs/virt-v2v.pod > @@ -207,6 +207,16 @@ The options are silently ignored for other input methods. > > See I<--network> below. > > +=item B<--block-driver virtio-blk> > + > +=item B<--block-driver virtio-scsi> > + > +When choosing a block driver for Windows guests, prefer C<virtio-blk> or > +C<virtio-scsi>. The default is C<virtio-blk>. > + > +Note this has no effect for Linux guests at the moment. That may be > +added in future. > + > =item B<--colors> > > =item B<--colours>I needed to fix up the above two (documentation) hunks. Namely, in preparation for merging this series, I ran "make check", and it failed. As written, the patch breaks "test-v2v-docs.sh"; the test complains about the manuals not documenting the "--block-driver" option. The proper way to document the new options is to highlight the options and the option-arguments separately:> diff --git a/docs/virt-v2v-in-place.pod b/docs/virt-v2v-in-place.pod > index 1e993e8c7973..ce57e22969a3 100644 > --- a/docs/virt-v2v-in-place.pod > +++ b/docs/virt-v2v-in-place.pod > @@ -47,9 +47,9 @@ Display help. > > See I<--network> below. > > -=item B<--block-driver virtio-blk> > +=item B<--block-driver> B<virtio-blk> > > -=item B<--block-driver virtio-scsi> > +=item B<--block-driver> B<virtio-scsi> > > When choosing a block driver for Windows guests, prefer C<virtio-blk> or > C<virtio-scsi>. The default is C<virtio-blk>. > diff --git a/docs/virt-v2v.pod b/docs/virt-v2v.pod > index e096418b2c25..4d2f241ad723 100644 > --- a/docs/virt-v2v.pod > +++ b/docs/virt-v2v.pod > @@ -207,9 +207,9 @@ The options are silently ignored for other input methods. > > See I<--network> below. > > -=item B<--block-driver virtio-blk> > +=item B<--block-driver> B<virtio-blk> > > -=item B<--block-driver virtio-scsi> > +=item B<--block-driver> B<virtio-scsi> > > When choosing a block driver for Windows guests, prefer C<virtio-blk> or > C<virtio-scsi>. The default is C<virtio-blk>.Showcased by prior art such as> =item B<-i> B<disk>Andrey, please don't forget to re-run "make check" before posting. Thanks Laszlo