|
|
a30de4 |
From 46aaa657c76d473fcd6ac41a84101d7805306f58 Mon Sep 17 00:00:00 2001
|
|
|
a30de4 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
a30de4 |
Date: Wed, 11 Oct 2017 13:43:26 +0100
|
|
|
a30de4 |
Subject: [PATCH] v2v: -i vmx: Allow deviceType field to be completely omitted.
|
|
|
a30de4 |
MIME-Version: 1.0
|
|
|
a30de4 |
Content-Type: text/plain; charset=UTF-8
|
|
|
a30de4 |
Content-Transfer-Encoding: 8bit
|
|
|
a30de4 |
|
|
|
a30de4 |
Microsoft make some VMX files available here which we could not parse.
|
|
|
a30de4 |
These files lack the expected ‘scsi0:0.deviceType’ field:
|
|
|
a30de4 |
https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/
|
|
|
a30de4 |
|
|
|
a30de4 |
According to
|
|
|
a30de4 |
http://faq.sanbarrow.com/index.php?action=artikel&cat=7&id=54&artlang=en
|
|
|
a30de4 |
this is permitted. Also several other deviceType values may be found.
|
|
|
a30de4 |
|
|
|
a30de4 |
Allow such VMX to be parsed.
|
|
|
a30de4 |
|
|
|
a30de4 |
Thanks: Tom Sorensen
|
|
|
a30de4 |
|
|
|
a30de4 |
Cherry picked from commit 418289029da9641b74984eb15eb1563649c38dd1.
|
|
|
a30de4 |
For RHEL 7.5: I inlined the Option.map function since that does not
|
|
|
a30de4 |
exist in this branch.
|
|
|
a30de4 |
---
|
|
|
a30de4 |
v2v/input_vmx.ml | 19 +++++++++++--------
|
|
|
a30de4 |
1 file changed, 11 insertions(+), 8 deletions(-)
|
|
|
a30de4 |
|
|
|
a30de4 |
diff --git a/v2v/input_vmx.ml b/v2v/input_vmx.ml
|
|
|
a30de4 |
index bb09f0bf8..a4f77c2ab 100644
|
|
|
a30de4 |
--- a/v2v/input_vmx.ml
|
|
|
a30de4 |
+++ b/v2v/input_vmx.ml
|
|
|
a30de4 |
@@ -35,7 +35,8 @@ let rec find_disks vmx vmx_filename =
|
|
|
a30de4 |
*
|
|
|
a30de4 |
* In the VMX file:
|
|
|
a30de4 |
* scsi0.virtualDev = "pvscsi" # or may be "lsilogic" etc.
|
|
|
a30de4 |
- * scsi0:0.deviceType = "scsi-hardDisk"
|
|
|
a30de4 |
+ * scsi0:0.deviceType = "disk" | "plainDisk" | "rawDisk" | "scsi-hardDisk"
|
|
|
a30de4 |
+ * | omitted
|
|
|
a30de4 |
* scsi0:0.fileName = "guest.vmdk"
|
|
|
a30de4 |
*)
|
|
|
a30de4 |
and find_scsi_disks vmx vmx_filename =
|
|
|
a30de4 |
@@ -46,7 +47,8 @@ and find_scsi_disks vmx vmx_filename =
|
|
|
a30de4 |
try ignore (get_scsi_controller_target ns); true
|
|
|
a30de4 |
with Scanf.Scan_failure _ | End_of_file | Failure _ -> false
|
|
|
a30de4 |
in
|
|
|
a30de4 |
- let scsi_device_types = [ "scsi-harddisk" ] in
|
|
|
a30de4 |
+ let scsi_device_types = [ Some "disk"; Some "plaindisk"; Some "rawdisk";
|
|
|
a30de4 |
+ Some "scsi-harddisk"; None ] in
|
|
|
a30de4 |
let scsi_controller = Source_SCSI in
|
|
|
a30de4 |
|
|
|
a30de4 |
find_hdds vmx vmx_filename
|
|
|
a30de4 |
@@ -67,7 +69,7 @@ and find_ide_disks vmx vmx_filename =
|
|
|
a30de4 |
try ignore (get_ide_controller_target ns); true
|
|
|
a30de4 |
with Scanf.Scan_failure _ | End_of_file | Failure _ -> false
|
|
|
a30de4 |
in
|
|
|
a30de4 |
- let ide_device_types = [ "ata-harddisk" ] in
|
|
|
a30de4 |
+ let ide_device_types = [ Some "ata-harddisk" ] in
|
|
|
a30de4 |
let ide_controller = Source_IDE in
|
|
|
a30de4 |
|
|
|
a30de4 |
find_hdds vmx vmx_filename
|
|
|
a30de4 |
@@ -86,11 +88,12 @@ and find_hdds vmx vmx_filename
|
|
|
a30de4 |
if not (is_controller_target ns) then false
|
|
|
a30de4 |
else (
|
|
|
a30de4 |
(* Check the deviceType is one we are looking for. *)
|
|
|
a30de4 |
- match Parse_vmx.get_string vmx [ns; "deviceType"] with
|
|
|
a30de4 |
- | Some str ->
|
|
|
a30de4 |
- let str = String.lowercase_ascii str in
|
|
|
a30de4 |
- List.mem str device_types
|
|
|
a30de4 |
- | None -> false
|
|
|
a30de4 |
+ let dt = Parse_vmx.get_string vmx [ns; "deviceType"] in
|
|
|
a30de4 |
+ let dt =
|
|
|
a30de4 |
+ match dt with
|
|
|
a30de4 |
+ | None -> None
|
|
|
a30de4 |
+ | Some dt -> Some (String.lowercase_ascii dt) in
|
|
|
a30de4 |
+ List.mem dt device_types
|
|
|
a30de4 |
)
|
|
|
a30de4 |
| _ -> false
|
|
|
a30de4 |
) vmx in
|
|
|
a30de4 |
--
|
|
|
a30de4 |
2.14.3
|
|
|
a30de4 |
|