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