[V2V PATCH v2 0/5] Bring support for virtio-scsi back to Windows
Discussion on v1: https://listman.redhat.com/archives/libguestfs/2023-February/030849.html https://listman.redhat.com/archives/libguestfs/2023-March/030917.html v1 -> v2: * Adapt the patch suggested by Richard, splitting it up into 3: https://listman.redhat.com/archives/libguestfs/2023-March/030975.html Now we have "--block-driver" command line option which regulates the order in which block drivers are being searched for (and, as a consequence, the default driver). Andrey Drobyshev (2): Revert "Remove guestcaps_block_type Virtio_SCSI" convert_windows: add Inject_virtio_win.Virtio_SCSI as a possible block type Richard W.M. Jones (3): convert: introduce "block_driver" convert option convert_windows: set block driver priority according to block_driver option v2v, in-place: introduce --block-driver command line option convert/convert.ml | 11 +++++++---- convert/convert.mli | 1 + convert/convert_linux.ml | 11 ++++++++--- convert/convert_linux.mli | 3 ++- convert/convert_windows.ml | 11 ++++++++++- convert/convert_windows.mli | 3 ++- convert/target_bus_assignment.ml | 1 + docs/virt-v2v-in-place.pod | 10 ++++++++++ docs/virt-v2v.pod | 10 ++++++++++ in-place/in_place.ml | 12 +++++++++++- inspector/inspector.ml | 3 ++- lib/create_ovf.ml | 1 + lib/types.ml | 3 ++- lib/types.mli | 2 +- output/openstack_image_properties.ml | 7 +++++++ v2v/v2v.ml | 12 +++++++++++- 16 files changed, 86 insertions(+), 15 deletions(-) -- 2.31.1
This code is needed to check whether virtio-scsi driver was installed. This reverts commit f0afc439524853508938b2bfc758896f053462e3. --- convert/convert.ml | 2 +- convert/convert_linux.ml | 9 +++++++-- convert/target_bus_assignment.ml | 1 + lib/create_ovf.ml | 1 + lib/types.ml | 3 ++- lib/types.mli | 2 +- output/openstack_image_properties.ml | 7 +++++++ 7 files changed, 20 insertions(+), 5 deletions(-) diff --git a/convert/convert.ml b/convert/convert.ml index 0aa0e5cd..084619c8 100644 --- a/convert/convert.ml +++ b/convert/convert.ml @@ -252,7 +252,7 @@ and do_convert g source inspect i_firmware keep_serial_console interfaces = (* Did we manage to install virtio drivers? *) if not (quiet ()) then ( match guestcaps.gcaps_block_bus with - | Virtio_blk -> + | Virtio_blk | Virtio_SCSI -> info (f_"This guest has virtio drivers installed.") | IDE -> info (f_"This guest does not have virtio drivers installed.") diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml index d5c0f24d..dab4f36d 100644 --- a/convert/convert_linux.ml +++ b/convert/convert_linux.ml @@ -1068,8 +1068,12 @@ let convert (g : G.guestfs) source inspect i_firmware keep_serial_console _ = (* Update 'alias scsi_hostadapter ...' *) let paths = augeas_modprobe ". =~ regexp('scsi_hostadapter.*')" in (match block_type with - | Virtio_blk -> - let block_module = "virtio_blk" in + | Virtio_blk | Virtio_SCSI -> + let block_module = + match block_type with + | Virtio_blk -> "virtio_blk" + | Virtio_SCSI -> "virtio_scsi" + | IDE -> assert false in if paths <> [] then ( (* There's only 1 scsi controller in the converted guest. @@ -1142,6 +1146,7 @@ let convert (g : G.guestfs) source inspect i_firmware keep_serial_console _ = let block_prefix_after_conversion = match block_type with | Virtio_blk -> "vd" + | Virtio_SCSI -> "sd" | IDE -> ide_block_prefix in let map = diff --git a/convert/target_bus_assignment.ml b/convert/target_bus_assignment.ml index 54c9516b..d13340c7 100644 --- a/convert/target_bus_assignment.ml +++ b/convert/target_bus_assignment.ml @@ -35,6 +35,7 @@ let rec target_bus_assignment source_disks source_removables guestcaps = let bus = match guestcaps.gcaps_block_bus with | Virtio_blk -> virtio_blk_bus + | Virtio_SCSI -> scsi_bus | IDE -> ide_bus in List.iteri ( fun i d -> diff --git a/lib/create_ovf.ml b/lib/create_ovf.ml index 5e444868..f0b32e01 100644 --- a/lib/create_ovf.ml +++ b/lib/create_ovf.ml @@ -920,6 +920,7 @@ and add_disks sizes guestcaps output_alloc output_format "ovf:disk-interface", (match guestcaps.gcaps_block_bus with | Virtio_blk -> "VirtIO" + | Virtio_SCSI -> "VirtIO_SCSI" | IDE -> "IDE"); "ovf:disk-type", "System"; (* RHBZ#744538 *) "ovf:boot", if is_bootable_drive then "True" else "False"; diff --git a/lib/types.ml b/lib/types.ml index e16da007..75c14fd4 100644 --- a/lib/types.ml +++ b/lib/types.ml @@ -400,12 +400,13 @@ type guestcaps = { gcaps_arch_min_version : int; gcaps_virtio_1_0 : bool; } -and guestcaps_block_type = Virtio_blk | IDE +and guestcaps_block_type = Virtio_blk | Virtio_SCSI | IDE and guestcaps_net_type = Virtio_net | E1000 | RTL8139 and guestcaps_machine = I440FX | Q35 | Virt let string_of_block_type = function | Virtio_blk -> "virtio-blk" + | Virtio_SCSI -> "virtio-scsi" | IDE -> "ide" let string_of_net_type = function | Virtio_net -> "virtio-net" diff --git a/lib/types.mli b/lib/types.mli index 4a183dd3..65ef2e35 100644 --- a/lib/types.mli +++ b/lib/types.mli @@ -280,7 +280,7 @@ type guestcaps = { } (** Guest capabilities after conversion. eg. Was virtio found or installed? *) -and guestcaps_block_type = Virtio_blk | IDE +and guestcaps_block_type = Virtio_blk | Virtio_SCSI | IDE and guestcaps_net_type = Virtio_net | E1000 | RTL8139 and guestcaps_machine = I440FX | Q35 | Virt diff --git a/output/openstack_image_properties.ml b/output/openstack_image_properties.ml index c75d72fe..c76ad913 100644 --- a/output/openstack_image_properties.ml +++ b/output/openstack_image_properties.ml @@ -35,6 +35,7 @@ let create source inspect { target_buses; guestcaps; target_firmware } = "hw_disk_bus", (match guestcaps.gcaps_block_bus with | Virtio_blk -> "virtio" + | Virtio_SCSI -> "scsi" | IDE -> "ide"); "hw_vif_model", (match guestcaps.gcaps_net_bus with @@ -69,6 +70,12 @@ let create source inspect { target_buses; guestcaps; target_firmware } = List.push_back properties ("hw_cpu_threads", string_of_int threads); ); + (match guestcaps.gcaps_block_bus with + | Virtio_SCSI -> + List.push_back properties ("hw_scsi_model", "virtio-scsi") + | Virtio_blk | IDE -> () + ); + (match inspect.i_major_version, inspect.i_minor_version with | 0, 0 -> () | x, 0 -> List.push_back properties ("os_version", string_of_int x) -- 2.31.1
On 3/7/23 20:40, Andrey Drobyshev wrote:
This code is needed to check whether virtio-scsi driver was installed.
This reverts commit f0afc439524853508938b2bfc758896f053462e3. --- convert/convert.ml | 2 +- convert/convert_linux.ml | 9 +++++++-- convert/target_bus_assignment.ml | 1 + lib/create_ovf.ml | 1 + lib/types.ml | 3 ++- lib/types.mli | 2 +- output/openstack_image_properties.ml | 7 +++++++ 7 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/convert/convert.ml b/convert/convert.ml index 0aa0e5cd..084619c8 100644 --- a/convert/convert.ml +++ b/convert/convert.ml @@ -252,7 +252,7 @@ and do_convert g source inspect i_firmware keep_serial_console interfaces = (* Did we manage to install virtio drivers? *) if not (quiet ()) then ( match guestcaps.gcaps_block_bus with - | Virtio_blk -> + | Virtio_blk | Virtio_SCSI -> info (f_"This guest has virtio drivers installed.") | IDE -> info (f_"This guest does not have virtio drivers installed.") diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml index d5c0f24d..dab4f36d 100644 --- a/convert/convert_linux.ml +++ b/convert/convert_linux.ml @@ -1068,8 +1068,12 @@ let convert (g : G.guestfs) source inspect i_firmware keep_serial_console _ = (* Update 'alias scsi_hostadapter ...' *) let paths = augeas_modprobe ". =~ regexp('scsi_hostadapter.*')" in (match block_type with - | Virtio_blk -> - let block_module = "virtio_blk" in + | Virtio_blk | Virtio_SCSI -> + let block_module = + match block_type with + | Virtio_blk -> "virtio_blk" + | Virtio_SCSI -> "virtio_scsi" + | IDE -> assert false in
if paths <> [] then ( (* There's only 1 scsi controller in the converted guest. @@ -1142,6 +1146,7 @@ let convert (g : G.guestfs) source inspect i_firmware keep_serial_console _ = let block_prefix_after_conversion = match block_type with | Virtio_blk -> "vd" + | Virtio_SCSI -> "sd" | IDE -> ide_block_prefix in
let map = diff --git a/convert/target_bus_assignment.ml b/convert/target_bus_assignment.ml index 54c9516b..d13340c7 100644 --- a/convert/target_bus_assignment.ml +++ b/convert/target_bus_assignment.ml @@ -35,6 +35,7 @@ let rec target_bus_assignment source_disks source_removables guestcaps = let bus = match guestcaps.gcaps_block_bus with | Virtio_blk -> virtio_blk_bus + | Virtio_SCSI -> scsi_bus | IDE -> ide_bus in List.iteri ( fun i d -> diff --git a/lib/create_ovf.ml b/lib/create_ovf.ml index 5e444868..f0b32e01 100644 --- a/lib/create_ovf.ml +++ b/lib/create_ovf.ml @@ -920,6 +920,7 @@ and add_disks sizes guestcaps output_alloc output_format "ovf:disk-interface", (match guestcaps.gcaps_block_bus with | Virtio_blk -> "VirtIO" + | Virtio_SCSI -> "VirtIO_SCSI" | IDE -> "IDE"); "ovf:disk-type", "System"; (* RHBZ#744538 *) "ovf:boot", if is_bootable_drive then "True" else "False"; diff --git a/lib/types.ml b/lib/types.ml index e16da007..75c14fd4 100644 --- a/lib/types.ml +++ b/lib/types.ml @@ -400,12 +400,13 @@ type guestcaps = { gcaps_arch_min_version : int; gcaps_virtio_1_0 : bool; } -and guestcaps_block_type = Virtio_blk | IDE +and guestcaps_block_type = Virtio_blk | Virtio_SCSI | IDE and guestcaps_net_type = Virtio_net | E1000 | RTL8139 and guestcaps_machine = I440FX | Q35 | Virt
let string_of_block_type = function | Virtio_blk -> "virtio-blk" + | Virtio_SCSI -> "virtio-scsi" | IDE -> "ide" let string_of_net_type = function | Virtio_net -> "virtio-net" diff --git a/lib/types.mli b/lib/types.mli index 4a183dd3..65ef2e35 100644 --- a/lib/types.mli +++ b/lib/types.mli @@ -280,7 +280,7 @@ type guestcaps = { } (** Guest capabilities after conversion. eg. Was virtio found or installed? *)
-and guestcaps_block_type = Virtio_blk | IDE +and guestcaps_block_type = Virtio_blk | Virtio_SCSI | IDE and guestcaps_net_type = Virtio_net | E1000 | RTL8139 and guestcaps_machine = I440FX | Q35 | Virt
diff --git a/output/openstack_image_properties.ml b/output/openstack_image_properties.ml index c75d72fe..c76ad913 100644 --- a/output/openstack_image_properties.ml +++ b/output/openstack_image_properties.ml @@ -35,6 +35,7 @@ let create source inspect { target_buses; guestcaps; target_firmware } = "hw_disk_bus", (match guestcaps.gcaps_block_bus with | Virtio_blk -> "virtio" + | Virtio_SCSI -> "scsi" | IDE -> "ide"); "hw_vif_model", (match guestcaps.gcaps_net_bus with @@ -69,6 +70,12 @@ let create source inspect { target_buses; guestcaps; target_firmware } = List.push_back properties ("hw_cpu_threads", string_of_int threads); );
+ (match guestcaps.gcaps_block_bus with + | Virtio_SCSI -> + List.push_back properties ("hw_scsi_model", "virtio-scsi") + | Virtio_blk | IDE -> () + ); + (match inspect.i_major_version, inspect.i_minor_version with | 0, 0 -> () | x, 0 -> List.push_back properties ("os_version", string_of_int x)
Looks like a reasonable revert to me. Acked-by: Laszlo Ersek <lersek@redhat.com>
On 3/13/23 10:13, Laszlo Ersek wrote:
On 3/7/23 20:40, Andrey Drobyshev wrote:
This code is needed to check whether virtio-scsi driver was installed.
This reverts commit f0afc439524853508938b2bfc758896f053462e3. --- convert/convert.ml | 2 +- convert/convert_linux.ml | 9 +++++++-- convert/target_bus_assignment.ml | 1 + lib/create_ovf.ml | 1 + lib/types.ml | 3 ++- lib/types.mli | 2 +- output/openstack_image_properties.ml | 7 +++++++ 7 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/convert/convert.ml b/convert/convert.ml index 0aa0e5cd..084619c8 100644 --- a/convert/convert.ml +++ b/convert/convert.ml @@ -252,7 +252,7 @@ and do_convert g source inspect i_firmware keep_serial_console interfaces = (* Did we manage to install virtio drivers? *) if not (quiet ()) then ( match guestcaps.gcaps_block_bus with - | Virtio_blk -> + | Virtio_blk | Virtio_SCSI -> info (f_"This guest has virtio drivers installed.") | IDE -> info (f_"This guest does not have virtio drivers installed.") diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml index d5c0f24d..dab4f36d 100644 --- a/convert/convert_linux.ml +++ b/convert/convert_linux.ml @@ -1068,8 +1068,12 @@ let convert (g : G.guestfs) source inspect i_firmware keep_serial_console _ = (* Update 'alias scsi_hostadapter ...' *) let paths = augeas_modprobe ". =~ regexp('scsi_hostadapter.*')" in (match block_type with - | Virtio_blk -> - let block_module = "virtio_blk" in + | Virtio_blk | Virtio_SCSI -> + let block_module = + match block_type with + | Virtio_blk -> "virtio_blk" + | Virtio_SCSI -> "virtio_scsi" + | IDE -> assert false in
if paths <> [] then ( (* There's only 1 scsi controller in the converted guest. @@ -1142,6 +1146,7 @@ let convert (g : G.guestfs) source inspect i_firmware keep_serial_console _ = let block_prefix_after_conversion = match block_type with | Virtio_blk -> "vd" + | Virtio_SCSI -> "sd" | IDE -> ide_block_prefix in
let map = diff --git a/convert/target_bus_assignment.ml b/convert/target_bus_assignment.ml index 54c9516b..d13340c7 100644 --- a/convert/target_bus_assignment.ml +++ b/convert/target_bus_assignment.ml @@ -35,6 +35,7 @@ let rec target_bus_assignment source_disks source_removables guestcaps = let bus = match guestcaps.gcaps_block_bus with | Virtio_blk -> virtio_blk_bus + | Virtio_SCSI -> scsi_bus | IDE -> ide_bus in List.iteri ( fun i d -> diff --git a/lib/create_ovf.ml b/lib/create_ovf.ml index 5e444868..f0b32e01 100644 --- a/lib/create_ovf.ml +++ b/lib/create_ovf.ml @@ -920,6 +920,7 @@ and add_disks sizes guestcaps output_alloc output_format "ovf:disk-interface", (match guestcaps.gcaps_block_bus with | Virtio_blk -> "VirtIO" + | Virtio_SCSI -> "VirtIO_SCSI" | IDE -> "IDE"); "ovf:disk-type", "System"; (* RHBZ#744538 *) "ovf:boot", if is_bootable_drive then "True" else "False"; diff --git a/lib/types.ml b/lib/types.ml index e16da007..75c14fd4 100644 --- a/lib/types.ml +++ b/lib/types.ml @@ -400,12 +400,13 @@ type guestcaps = { gcaps_arch_min_version : int; gcaps_virtio_1_0 : bool; } -and guestcaps_block_type = Virtio_blk | IDE +and guestcaps_block_type = Virtio_blk | Virtio_SCSI | IDE and guestcaps_net_type = Virtio_net | E1000 | RTL8139 and guestcaps_machine = I440FX | Q35 | Virt
let string_of_block_type = function | Virtio_blk -> "virtio-blk" + | Virtio_SCSI -> "virtio-scsi" | IDE -> "ide" let string_of_net_type = function | Virtio_net -> "virtio-net" diff --git a/lib/types.mli b/lib/types.mli index 4a183dd3..65ef2e35 100644 --- a/lib/types.mli +++ b/lib/types.mli @@ -280,7 +280,7 @@ type guestcaps = { } (** Guest capabilities after conversion. eg. Was virtio found or installed? *)
-and guestcaps_block_type = Virtio_blk | IDE +and guestcaps_block_type = Virtio_blk | Virtio_SCSI | IDE and guestcaps_net_type = Virtio_net | E1000 | RTL8139 and guestcaps_machine = I440FX | Q35 | Virt
diff --git a/output/openstack_image_properties.ml b/output/openstack_image_properties.ml index c75d72fe..c76ad913 100644 --- a/output/openstack_image_properties.ml +++ b/output/openstack_image_properties.ml @@ -35,6 +35,7 @@ let create source inspect { target_buses; guestcaps; target_firmware } = "hw_disk_bus", (match guestcaps.gcaps_block_bus with | Virtio_blk -> "virtio" + | Virtio_SCSI -> "scsi" | IDE -> "ide"); "hw_vif_model", (match guestcaps.gcaps_net_bus with @@ -69,6 +70,12 @@ let create source inspect { target_buses; guestcaps; target_firmware } = List.push_back properties ("hw_cpu_threads", string_of_int threads); );
+ (match guestcaps.gcaps_block_bus with + | Virtio_SCSI -> + List.push_back properties ("hw_scsi_model", "virtio-scsi") + | Virtio_blk | IDE -> () + ); + (match inspect.i_major_version, inspect.i_minor_version with | 0, 0 -> () | x, 0 -> List.push_back properties ("os_version", string_of_int x)
Looks like a reasonable revert to me.
Acked-by: Laszlo Ersek <lersek@redhat.com>
Hi Laszlo, You're reviewing v2, but the latest series which Richard has approved is v3: https://listman.redhat.com/archives/libguestfs/2023-March/031035.html https://listman.redhat.com/archives/libguestfs/2023-March/031041.html I added you to Cc, but maybe it wasn't delivered?
On 3/13/23 09:22, Andrey Drobyshev wrote:
On 3/13/23 10:13, Laszlo Ersek wrote:
On 3/7/23 20:40, Andrey Drobyshev wrote:
This code is needed to check whether virtio-scsi driver was installed.
This reverts commit f0afc439524853508938b2bfc758896f053462e3. --- convert/convert.ml | 2 +- convert/convert_linux.ml | 9 +++++++-- convert/target_bus_assignment.ml | 1 + lib/create_ovf.ml | 1 + lib/types.ml | 3 ++- lib/types.mli | 2 +- output/openstack_image_properties.ml | 7 +++++++ 7 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/convert/convert.ml b/convert/convert.ml index 0aa0e5cd..084619c8 100644 --- a/convert/convert.ml +++ b/convert/convert.ml @@ -252,7 +252,7 @@ and do_convert g source inspect i_firmware keep_serial_console interfaces = (* Did we manage to install virtio drivers? *) if not (quiet ()) then ( match guestcaps.gcaps_block_bus with - | Virtio_blk -> + | Virtio_blk | Virtio_SCSI -> info (f_"This guest has virtio drivers installed.") | IDE -> info (f_"This guest does not have virtio drivers installed.") diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml index d5c0f24d..dab4f36d 100644 --- a/convert/convert_linux.ml +++ b/convert/convert_linux.ml @@ -1068,8 +1068,12 @@ let convert (g : G.guestfs) source inspect i_firmware keep_serial_console _ = (* Update 'alias scsi_hostadapter ...' *) let paths = augeas_modprobe ". =~ regexp('scsi_hostadapter.*')" in (match block_type with - | Virtio_blk -> - let block_module = "virtio_blk" in + | Virtio_blk | Virtio_SCSI -> + let block_module = + match block_type with + | Virtio_blk -> "virtio_blk" + | Virtio_SCSI -> "virtio_scsi" + | IDE -> assert false in
if paths <> [] then ( (* There's only 1 scsi controller in the converted guest. @@ -1142,6 +1146,7 @@ let convert (g : G.guestfs) source inspect i_firmware keep_serial_console _ = let block_prefix_after_conversion = match block_type with | Virtio_blk -> "vd" + | Virtio_SCSI -> "sd" | IDE -> ide_block_prefix in
let map = diff --git a/convert/target_bus_assignment.ml b/convert/target_bus_assignment.ml index 54c9516b..d13340c7 100644 --- a/convert/target_bus_assignment.ml +++ b/convert/target_bus_assignment.ml @@ -35,6 +35,7 @@ let rec target_bus_assignment source_disks source_removables guestcaps = let bus = match guestcaps.gcaps_block_bus with | Virtio_blk -> virtio_blk_bus + | Virtio_SCSI -> scsi_bus | IDE -> ide_bus in List.iteri ( fun i d -> diff --git a/lib/create_ovf.ml b/lib/create_ovf.ml index 5e444868..f0b32e01 100644 --- a/lib/create_ovf.ml +++ b/lib/create_ovf.ml @@ -920,6 +920,7 @@ and add_disks sizes guestcaps output_alloc output_format "ovf:disk-interface", (match guestcaps.gcaps_block_bus with | Virtio_blk -> "VirtIO" + | Virtio_SCSI -> "VirtIO_SCSI" | IDE -> "IDE"); "ovf:disk-type", "System"; (* RHBZ#744538 *) "ovf:boot", if is_bootable_drive then "True" else "False"; diff --git a/lib/types.ml b/lib/types.ml index e16da007..75c14fd4 100644 --- a/lib/types.ml +++ b/lib/types.ml @@ -400,12 +400,13 @@ type guestcaps = { gcaps_arch_min_version : int; gcaps_virtio_1_0 : bool; } -and guestcaps_block_type = Virtio_blk | IDE +and guestcaps_block_type = Virtio_blk | Virtio_SCSI | IDE and guestcaps_net_type = Virtio_net | E1000 | RTL8139 and guestcaps_machine = I440FX | Q35 | Virt
let string_of_block_type = function | Virtio_blk -> "virtio-blk" + | Virtio_SCSI -> "virtio-scsi" | IDE -> "ide" let string_of_net_type = function | Virtio_net -> "virtio-net" diff --git a/lib/types.mli b/lib/types.mli index 4a183dd3..65ef2e35 100644 --- a/lib/types.mli +++ b/lib/types.mli @@ -280,7 +280,7 @@ type guestcaps = { } (** Guest capabilities after conversion. eg. Was virtio found or installed? *)
-and guestcaps_block_type = Virtio_blk | IDE +and guestcaps_block_type = Virtio_blk | Virtio_SCSI | IDE and guestcaps_net_type = Virtio_net | E1000 | RTL8139 and guestcaps_machine = I440FX | Q35 | Virt
diff --git a/output/openstack_image_properties.ml b/output/openstack_image_properties.ml index c75d72fe..c76ad913 100644 --- a/output/openstack_image_properties.ml +++ b/output/openstack_image_properties.ml @@ -35,6 +35,7 @@ let create source inspect { target_buses; guestcaps; target_firmware } = "hw_disk_bus", (match guestcaps.gcaps_block_bus with | Virtio_blk -> "virtio" + | Virtio_SCSI -> "scsi" | IDE -> "ide"); "hw_vif_model", (match guestcaps.gcaps_net_bus with @@ -69,6 +70,12 @@ let create source inspect { target_buses; guestcaps; target_firmware } = List.push_back properties ("hw_cpu_threads", string_of_int threads); );
+ (match guestcaps.gcaps_block_bus with + | Virtio_SCSI -> + List.push_back properties ("hw_scsi_model", "virtio-scsi") + | Virtio_blk | IDE -> () + ); + (match inspect.i_major_version, inspect.i_minor_version with | 0, 0 -> () | x, 0 -> List.push_back properties ("os_version", string_of_int x)
Looks like a reasonable revert to me.
Acked-by: Laszlo Ersek <lersek@redhat.com>
Hi Laszlo,
You're reviewing v2, but the latest series which Richard has approved is v3:
https://listman.redhat.com/archives/libguestfs/2023-March/031035.html https://listman.redhat.com/archives/libguestfs/2023-March/031041.html
I added you to Cc, but maybe it wasn't delivered?
I had an emergency last Wednesday mid-review and could only resume email processing this morning. Whenever I resume email processing, I relatively firmly stick with a FIFO method. In other words, I usually don't fetch new email until I process all previous, pending email. Sometimes this causes me to do double work or to create a bit of confusion. On the other hand, it very safely ensures that no email falls through the cracks. The LIFO method (process most recent email first) runs a very high risk of losing old email. "Old" does not translate to "irrelevant". So yes, I fully expected this morning that you could have posted a v3 meanwhile. Now someone could be tempted to suggest, "why don't you fetch email in the morning, then prioritize everything properly, and *then* work in a priority queue order". The problem is that prioritzing everything itself is huge work. After having been out for 2 work days, I've found 330 new emails this morning. For me, the only thing that works is delaying the fetching of new email, until I'm done with the old batch. So, I can be slow, or I can be lossy. I prefer slow. Laszlo
On 3/13/23 10:40, Laszlo Ersek wrote:
On 3/13/23 09:22, Andrey Drobyshev wrote:
On 3/13/23 10:13, Laszlo Ersek wrote:
On 3/7/23 20:40, Andrey Drobyshev wrote:
This code is needed to check whether virtio-scsi driver was installed.
This reverts commit f0afc439524853508938b2bfc758896f053462e3. --- convert/convert.ml | 2 +- convert/convert_linux.ml | 9 +++++++-- convert/target_bus_assignment.ml | 1 + lib/create_ovf.ml | 1 + lib/types.ml | 3 ++- lib/types.mli | 2 +- output/openstack_image_properties.ml | 7 +++++++ 7 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/convert/convert.ml b/convert/convert.ml index 0aa0e5cd..084619c8 100644 --- a/convert/convert.ml +++ b/convert/convert.ml @@ -252,7 +252,7 @@ and do_convert g source inspect i_firmware keep_serial_console interfaces = (* Did we manage to install virtio drivers? *) if not (quiet ()) then ( match guestcaps.gcaps_block_bus with - | Virtio_blk -> + | Virtio_blk | Virtio_SCSI -> info (f_"This guest has virtio drivers installed.") | IDE -> info (f_"This guest does not have virtio drivers installed.") diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml index d5c0f24d..dab4f36d 100644 --- a/convert/convert_linux.ml +++ b/convert/convert_linux.ml @@ -1068,8 +1068,12 @@ let convert (g : G.guestfs) source inspect i_firmware keep_serial_console _ = (* Update 'alias scsi_hostadapter ...' *) let paths = augeas_modprobe ". =~ regexp('scsi_hostadapter.*')" in (match block_type with - | Virtio_blk -> - let block_module = "virtio_blk" in + | Virtio_blk | Virtio_SCSI -> + let block_module = + match block_type with + | Virtio_blk -> "virtio_blk" + | Virtio_SCSI -> "virtio_scsi" + | IDE -> assert false in
if paths <> [] then ( (* There's only 1 scsi controller in the converted guest. @@ -1142,6 +1146,7 @@ let convert (g : G.guestfs) source inspect i_firmware keep_serial_console _ = let block_prefix_after_conversion = match block_type with | Virtio_blk -> "vd" + | Virtio_SCSI -> "sd" | IDE -> ide_block_prefix in
let map = diff --git a/convert/target_bus_assignment.ml b/convert/target_bus_assignment.ml index 54c9516b..d13340c7 100644 --- a/convert/target_bus_assignment.ml +++ b/convert/target_bus_assignment.ml @@ -35,6 +35,7 @@ let rec target_bus_assignment source_disks source_removables guestcaps = let bus = match guestcaps.gcaps_block_bus with | Virtio_blk -> virtio_blk_bus + | Virtio_SCSI -> scsi_bus | IDE -> ide_bus in List.iteri ( fun i d -> diff --git a/lib/create_ovf.ml b/lib/create_ovf.ml index 5e444868..f0b32e01 100644 --- a/lib/create_ovf.ml +++ b/lib/create_ovf.ml @@ -920,6 +920,7 @@ and add_disks sizes guestcaps output_alloc output_format "ovf:disk-interface", (match guestcaps.gcaps_block_bus with | Virtio_blk -> "VirtIO" + | Virtio_SCSI -> "VirtIO_SCSI" | IDE -> "IDE"); "ovf:disk-type", "System"; (* RHBZ#744538 *) "ovf:boot", if is_bootable_drive then "True" else "False"; diff --git a/lib/types.ml b/lib/types.ml index e16da007..75c14fd4 100644 --- a/lib/types.ml +++ b/lib/types.ml @@ -400,12 +400,13 @@ type guestcaps = { gcaps_arch_min_version : int; gcaps_virtio_1_0 : bool; } -and guestcaps_block_type = Virtio_blk | IDE +and guestcaps_block_type = Virtio_blk | Virtio_SCSI | IDE and guestcaps_net_type = Virtio_net | E1000 | RTL8139 and guestcaps_machine = I440FX | Q35 | Virt
let string_of_block_type = function | Virtio_blk -> "virtio-blk" + | Virtio_SCSI -> "virtio-scsi" | IDE -> "ide" let string_of_net_type = function | Virtio_net -> "virtio-net" diff --git a/lib/types.mli b/lib/types.mli index 4a183dd3..65ef2e35 100644 --- a/lib/types.mli +++ b/lib/types.mli @@ -280,7 +280,7 @@ type guestcaps = { } (** Guest capabilities after conversion. eg. Was virtio found or installed? *)
-and guestcaps_block_type = Virtio_blk | IDE +and guestcaps_block_type = Virtio_blk | Virtio_SCSI | IDE and guestcaps_net_type = Virtio_net | E1000 | RTL8139 and guestcaps_machine = I440FX | Q35 | Virt
diff --git a/output/openstack_image_properties.ml b/output/openstack_image_properties.ml index c75d72fe..c76ad913 100644 --- a/output/openstack_image_properties.ml +++ b/output/openstack_image_properties.ml @@ -35,6 +35,7 @@ let create source inspect { target_buses; guestcaps; target_firmware } = "hw_disk_bus", (match guestcaps.gcaps_block_bus with | Virtio_blk -> "virtio" + | Virtio_SCSI -> "scsi" | IDE -> "ide"); "hw_vif_model", (match guestcaps.gcaps_net_bus with @@ -69,6 +70,12 @@ let create source inspect { target_buses; guestcaps; target_firmware } = List.push_back properties ("hw_cpu_threads", string_of_int threads); );
+ (match guestcaps.gcaps_block_bus with + | Virtio_SCSI -> + List.push_back properties ("hw_scsi_model", "virtio-scsi") + | Virtio_blk | IDE -> () + ); + (match inspect.i_major_version, inspect.i_minor_version with | 0, 0 -> () | x, 0 -> List.push_back properties ("os_version", string_of_int x)
Looks like a reasonable revert to me.
Acked-by: Laszlo Ersek <lersek@redhat.com>
Hi Laszlo,
You're reviewing v2, but the latest series which Richard has approved is v3:
https://listman.redhat.com/archives/libguestfs/2023-March/031035.html https://listman.redhat.com/archives/libguestfs/2023-March/031041.html
I added you to Cc, but maybe it wasn't delivered?
I had an emergency last Wednesday mid-review and could only resume email processing this morning. Whenever I resume email processing, I relatively firmly stick with a FIFO method. In other words, I usually don't fetch new email until I process all previous, pending email. Sometimes this causes me to do double work or to create a bit of confusion. On the other hand, it very safely ensures that no email falls through the cracks. The LIFO method (process most recent email first) runs a very high risk of losing old email. "Old" does not translate to "irrelevant".
So yes, I fully expected this morning that you could have posted a v3 meanwhile.
Now someone could be tempted to suggest, "why don't you fetch email in the morning, then prioritize everything properly, and *then* work in a priority queue order". The problem is that prioritzing everything itself is huge work. After having been out for 2 work days, I've found 330 new emails this morning.
For me, the only thing that works is delaying the fetching of new email, until I'm done with the old batch. So, I can be slow, or I can be lossy. I prefer slow.
Laszlo
Thanks for detailed explanation, using FIFO makes perfect sense. And of course there's no rush whatsoever -- I just thought that maybe you've missed it. Andrey
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com> --- convert/convert_windows.ml | 1 + 1 files changed, 1 insertions(+) diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml index 9d8d271d..4f672487 100644 --- a/convert/convert_windows.ml +++ b/convert/convert_windows.ml @@ -273,6 +273,7 @@ let convert (g : G.guestfs) _ inspect i_firmware _ static_ips = and of_virtio_win_block_type = function | Inject_virtio_win.Virtio_blk -> Virtio_blk + | Inject_virtio_win.Virtio_SCSI -> Virtio_SCSI | IDE -> IDE and of_virtio_win_net_type = function -- 2.31.1
On Tue, Mar 07, 2023 at 09:40:07PM +0200, Andrey Drobyshev wrote:
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com> --- convert/convert_windows.ml | 1 + 1 files changed, 1 insertions(+)
diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml index 9d8d271d..4f672487 100644 --- a/convert/convert_windows.ml +++ b/convert/convert_windows.ml @@ -273,6 +273,7 @@ let convert (g : G.guestfs) _ inspect i_firmware _ static_ips =
and of_virtio_win_block_type = function | Inject_virtio_win.Virtio_blk -> Virtio_blk + | Inject_virtio_win.Virtio_SCSI -> Virtio_SCSI | IDE -> IDE
You don't need the "Inject_virtio_win." prefix there, since OCaml will infer from the first line (which has the prefix) that you mean the type from Inject_virtio_win instead of the same-named type from lib/types.mli. (Although as you can see it works either way). It's probably better to omit it, since it is also omitted on the third (IDE) line, or I suppose adjust the third line to add it. Rich.
and of_virtio_win_net_type = function -- 2.31.1
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
On 3/8/23 22:35, Richard W.M. Jones wrote:
On Tue, Mar 07, 2023 at 09:40:07PM +0200, Andrey Drobyshev wrote:
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com> --- convert/convert_windows.ml | 1 + 1 files changed, 1 insertions(+)
diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml index 9d8d271d..4f672487 100644 --- a/convert/convert_windows.ml +++ b/convert/convert_windows.ml @@ -273,6 +273,7 @@ let convert (g : G.guestfs) _ inspect i_firmware _ static_ips =
and of_virtio_win_block_type = function | Inject_virtio_win.Virtio_blk -> Virtio_blk + | Inject_virtio_win.Virtio_SCSI -> Virtio_SCSI | IDE -> IDE
You don't need the "Inject_virtio_win." prefix there, since OCaml will infer from the first line (which has the prefix) that you mean the type from Inject_virtio_win instead of the same-named type from lib/types.mli. (Although as you can see it works either way). It's probably better to omit it, since it is also omitted on the third (IDE) line, or I suppose adjust the third line to add it.
Agreed, makes sense, thanks for pointing out.
Rich.
and of_virtio_win_net_type = function -- 2.31.1
On 3/7/23 20:40, Andrey Drobyshev wrote:
Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com> --- convert/convert_windows.ml | 1 + 1 files changed, 1 insertions(+)
diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml index 9d8d271d..4f672487 100644 --- a/convert/convert_windows.ml +++ b/convert/convert_windows.ml @@ -273,6 +273,7 @@ let convert (g : G.guestfs) _ inspect i_firmware _ static_ips =
and of_virtio_win_block_type = function | Inject_virtio_win.Virtio_blk -> Virtio_blk + | Inject_virtio_win.Virtio_SCSI -> Virtio_SCSI | IDE -> IDE
and of_virtio_win_net_type = function
Acked-by: Laszlo Ersek <lersek@redhat.com>
From: "Richard W.M. Jones" <rjones@redhat.com> When injecting a block VirtIO driver during conversion, we rely on the predefined list of names of such drivers. Order in this list denotes the priority (see common/mlcustomize/inject_virtio_win.ml). This commit introduces the "block_driver" convert option, setting its value to the default Virtio_blk and making sure it's being properly passed to the conversion functions. Along with the means of altering the drivers list (introduced in a separate commit in the common submodule), this option will be brought to command line, giving us the opportunity to choose the block driver to be used on conversion. Originally-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com> --- convert/convert.ml | 9 ++++++--- convert/convert.mli | 1 + convert/convert_linux.ml | 2 +- convert/convert_linux.mli | 3 ++- convert/convert_windows.ml | 2 +- convert/convert_windows.mli | 3 ++- in-place/in_place.ml | 3 ++- inspector/inspector.ml | 3 ++- v2v/v2v.ml | 3 ++- 9 files changed, 19 insertions(+), 10 deletions(-) diff --git a/convert/convert.ml b/convert/convert.ml index 084619c8..9c76f76d 100644 --- a/convert/convert.ml +++ b/convert/convert.ml @@ -31,6 +31,7 @@ open Utils module G = Guestfs type options = { + block_driver : guestcaps_block_type; keep_serial_console : bool; ks : key_store; network_map : Networks.t; @@ -88,7 +89,7 @@ let rec convert dir options source = (* Conversion. *) let guestcaps = do_convert g source inspect i_firmware - options.keep_serial_console options.static_ips in + options.block_driver options.keep_serial_console options.static_ips in g#umount_all (); @@ -221,7 +222,8 @@ and do_fstrim g inspect = ) fses (* Conversion. *) -and do_convert g source inspect i_firmware keep_serial_console interfaces = +and do_convert g source inspect i_firmware + block_driver keep_serial_console interfaces = (match inspect.i_product_name with | "unknown" -> message (f_"Converting the guest to run on KVM") @@ -246,7 +248,8 @@ and do_convert g source inspect i_firmware keep_serial_console interfaces = inspect.i_type inspect.i_distro in debug "picked conversion module %s" conversion_name; let guestcaps = - convert g source inspect i_firmware keep_serial_console interfaces in + convert g source inspect i_firmware + block_driver keep_serial_console interfaces in debug "%s" (string_of_guestcaps guestcaps); (* Did we manage to install virtio drivers? *) diff --git a/convert/convert.mli b/convert/convert.mli index 3bd39e2d..c63bf6f0 100644 --- a/convert/convert.mli +++ b/convert/convert.mli @@ -17,6 +17,7 @@ *) type options = { + block_driver : Types.guestcaps_block_type; (** [--block-driver] option *) keep_serial_console : bool; ks : Tools_utils.key_store; (** [--key] option *) network_map : Networks.t; (** [-b] and [-n] options *) diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml index dab4f36d..8d702084 100644 --- a/convert/convert_linux.ml +++ b/convert/convert_linux.ml @@ -34,7 +34,7 @@ open Linux_kernels module G = Guestfs (* The conversion function. *) -let convert (g : G.guestfs) source inspect i_firmware keep_serial_console _ = +let convert (g : G.guestfs) source inspect i_firmware _ keep_serial_console _ = (*----------------------------------------------------------------------*) (* Inspect the guest first. We already did some basic inspection in * the common v2v.ml code, but that has to deal with generic guests diff --git a/convert/convert_linux.mli b/convert/convert_linux.mli index 6eb272e9..dc6968fe 100644 --- a/convert/convert_linux.mli +++ b/convert/convert_linux.mli @@ -23,5 +23,6 @@ Mint and Kali are supported by this module. *) val convert : Guestfs.guestfs -> Types.source -> Types.inspect -> - Firmware.i_firmware -> bool -> Types.static_ip list -> + Firmware.i_firmware -> Types.guestcaps_block_type -> + bool -> Types.static_ip list -> Types.guestcaps diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml index 4f672487..1ace2948 100644 --- a/convert/convert_windows.ml +++ b/convert/convert_windows.ml @@ -38,7 +38,7 @@ module G = Guestfs * time the Windows VM is booted on KVM. *) -let convert (g : G.guestfs) _ inspect i_firmware _ static_ips = +let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips = (*----------------------------------------------------------------------*) (* Inspect the Windows guest. *) diff --git a/convert/convert_windows.mli b/convert/convert_windows.mli index 42dac9f5..33a14f65 100644 --- a/convert/convert_windows.mli +++ b/convert/convert_windows.mli @@ -21,5 +21,6 @@ This module converts a Windows guest to run on KVM. *) val convert : Guestfs.guestfs -> Types.source -> Types.inspect -> - Firmware.i_firmware -> bool -> Types.static_ip list -> + Firmware.i_firmware -> Types.guestcaps_block_type -> + bool -> Types.static_ip list -> Types.guestcaps diff --git a/in-place/in_place.ml b/in-place/in_place.ml index 68ef9965..2049db16 100644 --- a/in-place/in_place.ml +++ b/in-place/in_place.ml @@ -294,7 +294,8 @@ read the man page virt-v2v-in-place(1). (* Get the conversion options. *) let conv_options = { - Convert.keep_serial_console = true; + Convert.block_driver = Virtio_blk; + keep_serial_console = true; ks = opthandle.ks; network_map; root_choice; diff --git a/inspector/inspector.ml b/inspector/inspector.ml index a6428946..02d1a0e7 100644 --- a/inspector/inspector.ml +++ b/inspector/inspector.ml @@ -324,7 +324,8 @@ read the man page virt-v2v-inspector(1). (* Get the conversion options. *) let conv_options = { - Convert.keep_serial_console = true; + Convert.block_driver = Virtio_blk; + keep_serial_console = true; ks = opthandle.ks; network_map; root_choice; diff --git a/v2v/v2v.ml b/v2v/v2v.ml index 13fe477a..22f7c631 100644 --- a/v2v/v2v.ml +++ b/v2v/v2v.ml @@ -524,7 +524,8 @@ read the man page virt-v2v(1). (* Get the conversion options. *) let conv_options = { - Convert.keep_serial_console = not remove_serial_console; + Convert.block_driver = Virtio_blk; + keep_serial_console = not remove_serial_console; ks = opthandle.ks; network_map; root_choice; -- 2.31.1
On 3/7/23 20:40, Andrey Drobyshev wrote:
From: "Richard W.M. Jones" <rjones@redhat.com>
When injecting a block VirtIO driver during conversion, we rely on the predefined list of names of such drivers. Order in this list denotes the priority (see common/mlcustomize/inject_virtio_win.ml).
This commit introduces the "block_driver" convert option, setting its value to the default Virtio_blk and making sure it's being properly passed to the conversion functions. Along with the means of altering the drivers list (introduced in a separate commit in the common submodule), this option will be brought to command line, giving us the opportunity to choose the block driver to be used on conversion.
Originally-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com> --- convert/convert.ml | 9 ++++++--- convert/convert.mli | 1 + convert/convert_linux.ml | 2 +- convert/convert_linux.mli | 3 ++- convert/convert_windows.ml | 2 +- convert/convert_windows.mli | 3 ++- in-place/in_place.ml | 3 ++- inspector/inspector.ml | 3 ++- v2v/v2v.ml | 3 ++- 9 files changed, 19 insertions(+), 10 deletions(-)
diff --git a/convert/convert.ml b/convert/convert.ml index 084619c8..9c76f76d 100644 --- a/convert/convert.ml +++ b/convert/convert.ml @@ -31,6 +31,7 @@ open Utils module G = Guestfs
type options = { + block_driver : guestcaps_block_type; keep_serial_console : bool; ks : key_store; network_map : Networks.t; @@ -88,7 +89,7 @@ let rec convert dir options source = (* Conversion. *) let guestcaps = do_convert g source inspect i_firmware - options.keep_serial_console options.static_ips in + options.block_driver options.keep_serial_console options.static_ips in
g#umount_all ();
@@ -221,7 +222,8 @@ and do_fstrim g inspect = ) fses
(* Conversion. *) -and do_convert g source inspect i_firmware keep_serial_console interfaces = +and do_convert g source inspect i_firmware + block_driver keep_serial_console interfaces = (match inspect.i_product_name with | "unknown" -> message (f_"Converting the guest to run on KVM") @@ -246,7 +248,8 @@ and do_convert g source inspect i_firmware keep_serial_console interfaces = inspect.i_type inspect.i_distro in debug "picked conversion module %s" conversion_name; let guestcaps = - convert g source inspect i_firmware keep_serial_console interfaces in + convert g source inspect i_firmware + block_driver keep_serial_console interfaces in debug "%s" (string_of_guestcaps guestcaps);
(* Did we manage to install virtio drivers? *) diff --git a/convert/convert.mli b/convert/convert.mli index 3bd39e2d..c63bf6f0 100644 --- a/convert/convert.mli +++ b/convert/convert.mli @@ -17,6 +17,7 @@ *)
type options = { + block_driver : Types.guestcaps_block_type; (** [--block-driver] option *) keep_serial_console : bool; ks : Tools_utils.key_store; (** [--key] option *) network_map : Networks.t; (** [-b] and [-n] options *) diff --git a/convert/convert_linux.ml b/convert/convert_linux.ml index dab4f36d..8d702084 100644 --- a/convert/convert_linux.ml +++ b/convert/convert_linux.ml @@ -34,7 +34,7 @@ open Linux_kernels module G = Guestfs
(* The conversion function. *) -let convert (g : G.guestfs) source inspect i_firmware keep_serial_console _ = +let convert (g : G.guestfs) source inspect i_firmware _ keep_serial_console _ = (*----------------------------------------------------------------------*) (* Inspect the guest first. We already did some basic inspection in * the common v2v.ml code, but that has to deal with generic guests diff --git a/convert/convert_linux.mli b/convert/convert_linux.mli index 6eb272e9..dc6968fe 100644 --- a/convert/convert_linux.mli +++ b/convert/convert_linux.mli @@ -23,5 +23,6 @@ Mint and Kali are supported by this module. *)
val convert : Guestfs.guestfs -> Types.source -> Types.inspect -> - Firmware.i_firmware -> bool -> Types.static_ip list -> + Firmware.i_firmware -> Types.guestcaps_block_type -> + bool -> Types.static_ip list -> Types.guestcaps diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml index 4f672487..1ace2948 100644 --- a/convert/convert_windows.ml +++ b/convert/convert_windows.ml @@ -38,7 +38,7 @@ module G = Guestfs * time the Windows VM is booted on KVM. *)
-let convert (g : G.guestfs) _ inspect i_firmware _ static_ips = +let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips = (*----------------------------------------------------------------------*) (* Inspect the Windows guest. *)
diff --git a/convert/convert_windows.mli b/convert/convert_windows.mli index 42dac9f5..33a14f65 100644 --- a/convert/convert_windows.mli +++ b/convert/convert_windows.mli @@ -21,5 +21,6 @@ This module converts a Windows guest to run on KVM. *)
val convert : Guestfs.guestfs -> Types.source -> Types.inspect -> - Firmware.i_firmware -> bool -> Types.static_ip list -> + Firmware.i_firmware -> Types.guestcaps_block_type -> + bool -> Types.static_ip list -> Types.guestcaps diff --git a/in-place/in_place.ml b/in-place/in_place.ml index 68ef9965..2049db16 100644 --- a/in-place/in_place.ml +++ b/in-place/in_place.ml @@ -294,7 +294,8 @@ read the man page virt-v2v-in-place(1).
(* Get the conversion options. *) let conv_options = { - Convert.keep_serial_console = true; + Convert.block_driver = Virtio_blk; + keep_serial_console = true; ks = opthandle.ks; network_map; root_choice; diff --git a/inspector/inspector.ml b/inspector/inspector.ml index a6428946..02d1a0e7 100644 --- a/inspector/inspector.ml +++ b/inspector/inspector.ml @@ -324,7 +324,8 @@ read the man page virt-v2v-inspector(1).
(* Get the conversion options. *) let conv_options = { - Convert.keep_serial_console = true; + Convert.block_driver = Virtio_blk; + keep_serial_console = true; ks = opthandle.ks; network_map; root_choice; diff --git a/v2v/v2v.ml b/v2v/v2v.ml index 13fe477a..22f7c631 100644 --- a/v2v/v2v.ml +++ b/v2v/v2v.ml @@ -524,7 +524,8 @@ read the man page virt-v2v(1).
(* Get the conversion options. *) let conv_options = { - Convert.keep_serial_console = not remove_serial_console; + Convert.block_driver = Virtio_blk; + keep_serial_console = not remove_serial_console; ks = opthandle.ks; network_map; root_choice;
Acked-by: Laszlo Ersek <lersek@redhat.com>
From: "Richard W.M. Jones" <rjones@redhat.com> If "block_driver" option is set to Virtio_SCSI, prepend the block drivers priority list with "vioscsi" so that we first search for "vioscsi.sys" during the drivers injection phase. Originally-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com> --- convert/convert_windows.ml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml index 1ace2948..6bc2343b 100644 --- a/convert/convert_windows.ml +++ b/convert/convert_windows.ml @@ -47,6 +47,14 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips = *) let virtio_win = Inject_virtio_win.from_environment g inspect.i_root Config.datadir in + (match block_driver with + | Virtio_blk -> () (* the default, no need to do anything *) + | Virtio_SCSI -> + let drivers = Inject_virtio_win.get_block_driver_priority virtio_win in + let drivers = "vioscsi" :: drivers in + Inject_virtio_win.set_block_driver_priority virtio_win drivers + | IDE -> assert false (* not possible - but maybe ...? *) + ); (* If the Windows guest appears to be using group policy. * -- 2.31.1
On 3/7/23 20:40, Andrey Drobyshev wrote:
From: "Richard W.M. Jones" <rjones@redhat.com>
If "block_driver" option is set to Virtio_SCSI, prepend the block drivers priority list with "vioscsi" so that we first search for "vioscsi.sys" during the drivers injection phase.
Originally-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@virtuozzo.com> --- convert/convert_windows.ml | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/convert/convert_windows.ml b/convert/convert_windows.ml index 1ace2948..6bc2343b 100644 --- a/convert/convert_windows.ml +++ b/convert/convert_windows.ml @@ -47,6 +47,14 @@ let convert (g : G.guestfs) _ inspect i_firmware block_driver _ static_ips = *) let virtio_win = Inject_virtio_win.from_environment g inspect.i_root Config.datadir in + (match block_driver with + | Virtio_blk -> () (* the default, no need to do anything *) + | Virtio_SCSI -> + let drivers = Inject_virtio_win.get_block_driver_priority virtio_win in + let drivers = "vioscsi" :: drivers in + Inject_virtio_win.set_block_driver_priority virtio_win drivers + | IDE -> assert false (* not possible - but maybe ...? *)
I'd suggest updating the comment: "not possible -- restricted by cmdline option parsing" either way Acked-by: Laszlo Ersek <lersek@redhat.com>
+ );
(* If the Windows guest appears to be using group policy. *
From: "Richard W.M. Jones" <rjones@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@redhat.com> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@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
On 3/7/23 20:40, Andrey Drobyshev wrote:
From: "Richard W.M. Jones" <rjones@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@redhat.com> Signed-off-by: Andrey Drobyshev <andrey.drobyshev@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@redhat.com>
The patch series looks generally fine, but it really needs a test ... We find that having tests prevents unnoticed regressions from happening later. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
On 3/8/23 22:46, Richard W.M. Jones wrote:
The patch series looks generally fine, but it really needs a test ...
We find that having tests prevents unnoticed regressions from happening later.
Rich.
Could you please elaborate on how do you imagine such a test case? Basically what I've been doing while making this series is installing a guest Win on the VM with an IDE controller only, then plugging virtio-scsi controller instead of IDE and running in-place conversion. VM should be able to boot as a result. I guess in the test we should play such a trick with both virtio-blk and virtio-scsi. But can we do that using phony windows.img from the test-data? And how do we actually check whether the guest is bootable after our manipulations?
On 3/9/23 16:50, Andrey Drobyshev wrote:
On 3/8/23 22:46, Richard W.M. Jones wrote:
The patch series looks generally fine, but it really needs a test ...
We find that having tests prevents unnoticed regressions from happening later.
Rich.
Could you please elaborate on how do you imagine such a test case? Basically what I've been doing while making this series is installing a guest Win on the VM with an IDE controller only, then plugging virtio-scsi controller instead of IDE and running in-place conversion. VM should be able to boot as a result.
I guess in the test we should play such a trick with both virtio-blk and virtio-scsi. But can we do that using phony windows.img from the test-data? And how do we actually check whether the guest is bootable after our manipulations?
A quick follow-up: I see that the test framework generally just checks for the presence of various files and folders after the conversion. Do you think that feeding v2v a VM config with either virtio-blk/virito-scsi controllers and running is-file on viostor.sys or vioscsi.sys accordingly would be enough?
On Thu, Mar 09, 2023 at 05:03:02PM +0200, Andrey Drobyshev wrote:
On 3/9/23 16:50, Andrey Drobyshev wrote:
On 3/8/23 22:46, Richard W.M. Jones wrote:
The patch series looks generally fine, but it really needs a test ...
We find that having tests prevents unnoticed regressions from happening later.
Rich.
Could you please elaborate on how do you imagine such a test case? Basically what I've been doing while making this series is installing a guest Win on the VM with an IDE controller only, then plugging virtio-scsi controller instead of IDE and running in-place conversion. VM should be able to boot as a result.
I guess in the test we should play such a trick with both virtio-blk and virtio-scsi. But can we do that using phony windows.img from the test-data? And how do we actually check whether the guest is bootable after our manipulations?
A quick follow-up: I see that the test framework generally just checks for the presence of various files and folders after the conversion. Do you think that feeding v2v a VM config with either virtio-blk/virito-scsi controllers and running is-file on viostor.sys or vioscsi.sys accordingly would be enough?
Yeah I would just copy one of the existing Windows tests, eg: tests/test-v2v-i-disk.sh and modify it to add the new --block-driver parameter. Depending on how far you want to go, you might poke inside the guest image after the test to see if expected files exist using guestfish. But often it's enough to simply test that the new option doesn't break. Don't forget to use a new uniquely named temporary directory ("d=..." variable). Of course we cannot test real Windows in the test suite :-( Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org
participants (3)
-
Andrey Drobyshev -
Laszlo Ersek -
Richard W.M. Jones