On 3/7/23 20:40, Andrey Drobyshev wrote: > From: "Richard W.M. Jones" <rjo...@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 <rjo...@redhat.com> > Signed-off-by: Andrey Drobyshev <andrey.drobys...@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 <ler...@redhat.com> _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs