Richard W.M. Jones
2017-Nov-02 13:03 UTC
[Libguestfs] [PATCH 0/2] v2v: Handle SATA controller (RHBZ#1508874).
https://bugzilla.redhat.com/show_bug.cgi?id=1508874 Also avoids a warning. Rich.
Richard W.M. Jones
2017-Nov-02 13:03 UTC
[Libguestfs] [PATCH 1/2] v2v: Add new Source_SATA for SATA disks.
Some hypervisors including KVM and VMware expose SATA as a separate device emulation from IDE. SATA devices are an evolution of IDE, but in Linux they are handled like SCSI disks. This change adds a new Source_SATA type to model this. In the Linux conversion module we treat them like SCSI (ie. with "sd" prefix). It's not very clear how to handle them for target bus assignment, so I arbitrarily mapped them to the SCSI bus. It's possible we need a new bus type to handle SATA properly. As the code only applies to removable devices it's not very important to get this right. --- v2v/convert_linux.ml | 2 +- v2v/parse_libvirt_xml.ml | 2 ++ v2v/target_bus_assignment.ml | 3 ++- v2v/types.ml | 3 ++- v2v/types.mli | 2 +- v2v/v2v.ml | 2 +- 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml index 33b08f7a4..1c29d9485 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -930,7 +930,7 @@ let convert (g : G.guestfs) inspect source output rcaps let block_prefix_before_conversion match disk.s_controller with | Some Source_IDE -> ide_block_prefix - | Some Source_virtio_SCSI | Some Source_SCSI -> "sd" + | Some (Source_virtio_SCSI | Source_SCSI | Source_SATA) -> "sd" | Some Source_virtio_blk -> "vd" | None -> (* This is basically a guess. It assumes the source used IDE. *) diff --git a/v2v/parse_libvirt_xml.ml b/v2v/parse_libvirt_xml.ml index 421175373..ec5ea5578 100644 --- a/v2v/parse_libvirt_xml.ml +++ b/v2v/parse_libvirt_xml.ml @@ -271,6 +271,7 @@ let parse_libvirt_xml ?conn xml match target_bus, has_virtio_scsi with | None, _ -> None | Some "ide", _ -> Some Source_IDE + | Some "sata", _ -> Some Source_SATA | Some "scsi", true -> Some Source_virtio_SCSI | Some "scsi", false -> Some Source_SCSI | Some "virtio", _ -> Some Source_virtio_blk @@ -367,6 +368,7 @@ let parse_libvirt_xml ?conn xml match target_bus, has_virtio_scsi with | None, _ -> None | Some "ide", _ -> Some Source_IDE + | Some "sata", _ -> Some Source_SATA | Some "scsi", true -> Some Source_virtio_SCSI | Some "scsi", false -> Some Source_SCSI | Some "virtio", _ -> Some Source_virtio_blk diff --git a/v2v/target_bus_assignment.ml b/v2v/target_bus_assignment.ml index 83b77914f..870741fc3 100644 --- a/v2v/target_bus_assignment.ml +++ b/v2v/target_bus_assignment.ml @@ -74,7 +74,8 @@ let rec target_bus_assignment source targets guestcaps | None -> ide_bus (* Wild guess, but should be safe. *) | Some Source_virtio_blk -> virtio_blk_bus | Some Source_IDE -> ide_bus - | Some Source_virtio_SCSI | Some Source_SCSI -> scsi_bus in + | Some (Source_virtio_SCSI | Source_SCSI | Source_SATA) -> + scsi_bus in match r.s_removable_slot with | None -> diff --git a/v2v/types.ml b/v2v/types.ml index 1c0031bb7..490c049af 100644 --- a/v2v/types.ml +++ b/v2v/types.ml @@ -61,7 +61,7 @@ and source_disk = { s_format : string option; s_controller : s_controller option; } -and s_controller = Source_IDE | Source_SCSI | +and s_controller = Source_IDE | Source_SATA | Source_SCSI | Source_virtio_blk | Source_virtio_SCSI and source_removable = { s_removable_type : s_removable_type; @@ -203,6 +203,7 @@ and string_of_source_disk { s_qemu_uri = qemu_uri; s_format = format; and string_of_controller = function | Source_IDE -> "ide" + | Source_SATA -> "sata" | Source_SCSI -> "scsi" | Source_virtio_blk -> "virtio-blk" | Source_virtio_SCSI -> "virtio-scsi" diff --git a/v2v/types.mli b/v2v/types.mli index 12d612202..2b73210ab 100644 --- a/v2v/types.mli +++ b/v2v/types.mli @@ -108,7 +108,7 @@ and source_disk = { } (** A source disk. *) -and s_controller = Source_IDE | Source_SCSI | +and s_controller = Source_IDE | Source_SATA | Source_SCSI | Source_virtio_blk | Source_virtio_SCSI (** Source disk controller. *) diff --git a/v2v/v2v.ml b/v2v/v2v.ml index f04f8ffa2..5b9872b22 100644 --- a/v2v/v2v.ml +++ b/v2v/v2v.ml @@ -800,7 +800,7 @@ and rcaps_from_source source match source_block_type with | Some Source_virtio_blk -> Some Virtio_blk | Some Source_virtio_SCSI -> Some Virtio_SCSI - | Some Source_IDE -> Some IDE + | Some (Source_IDE | Source_SATA) -> Some IDE | Some t -> error (f_"source has unsupported hard disk type ?%s?") (string_of_controller t) | None -> error (f_"source has unrecognized hard disk type") in -- 2.13.2
Richard W.M. Jones
2017-Nov-02 13:03 UTC
[Libguestfs] [PATCH 2/2] v2v: Handle SATA controller (RHBZ#1508874).
This also makes a fix to a related code comment. --- v2v/parse_ovf_from_ova.ml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/v2v/parse_ovf_from_ova.ml b/v2v/parse_ovf_from_ova.ml index 6927e64e4..7dd4cc5c2 100644 --- a/v2v/parse_ovf_from_ova.ml +++ b/v2v/parse_ovf_from_ova.ml @@ -105,10 +105,11 @@ let parse_ovf_from_ova ovf_filename let expr = sprintf "/ovf:Envelope/ovf:VirtualSystem/ovf:VirtualHardwareSection/ovf:Item[rasd:InstanceID/text()=%d]/rasd:ResourceType/text()" id in let controller = xpath_int expr in - (* 6: iscsi controller, 5: ide *) + (* 5: IDE, 6: SCSI controller, 20: SATA *) match controller with - | Some 6 -> Some Source_SCSI | Some 5 -> Some Source_IDE + | Some 6 -> Some Source_SCSI + | Some 20 -> Some Source_SATA | None -> warning (f_"ova disk has no parent controller, please report this as a bug supplying the *.ovf file extracted from the ova"); None -- 2.13.2
Pino Toscano
2017-Nov-02 13:17 UTC
[Libguestfs] [PATCH 0/2] v2v: Handle SATA controller (RHBZ#1508874).
On Thursday, 2 November 2017 14:03:53 CET Richard W.M. Jones wrote:> https://bugzilla.redhat.com/show_bug.cgi?id=1508874 > > Also avoids a warning.LGTM. Thanks, -- Pino Toscano -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part. URL: <http://listman.redhat.com/archives/libguestfs/attachments/20171102/69c8b1ea/attachment.sig>
Maybe Matching Threads
- [PATCH] v2v: add support for virtio-scsi
- [PATCH v2 0/4] v2v: more control over device types
- v2v: -i libvirtxml: Map empty network or bridge name to a default (RHBZ#1257895).
- [PATCH v2] v2v: add support for virtio-scsi
- [PATCH v4] v2v: add support for virtio-scsi