[Libguestfs] [PATCH] v2v: ova: convert E1000 network interfaces as such

Pino Toscano ptoscano at redhat.com
Fri Mar 23 11:35:36 UTC 2018


So far v2v did not read the model of network interfaces, resulting in
"virtio" as the model for such interfaces.

Start reading the model, if available, mapping only E1000 for now.
There are also other models, e.g. PCNet32 or VmxNet3, but they are
ignored for now: reading them as Source_other_nic would result in v2v
rejecting OVAs previously converted.
---
 v2v/parse_ovf_from_ova.ml               | 7 ++++++-
 v2v/test-v2v-i-ova-formats.expected     | 2 +-
 v2v/test-v2v-i-ova-gz.expected          | 2 +-
 v2v/test-v2v-i-ova-subfolders.expected  | 2 +-
 v2v/test-v2v-i-ova-subfolders.expected2 | 2 +-
 v2v/test-v2v-i-ova-tar.expected         | 2 +-
 v2v/test-v2v-i-ova-tar.expected2        | 2 +-
 v2v/test-v2v-i-ova-two-disks.expected   | 2 +-
 v2v/test-v2v-i-ova-two-disks.expected2  | 2 +-
 9 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/v2v/parse_ovf_from_ova.ml b/v2v/parse_ovf_from_ova.ml
index 24cd29d42..631d7d7f6 100644
--- a/v2v/parse_ovf_from_ova.ml
+++ b/v2v/parse_ovf_from_ova.ml
@@ -235,9 +235,14 @@ let parse_ovf_from_ova ovf_filename =
         | Some connection -> connection, Bridge
         | None -> sprintf "eth%d" i, Network in
       let mac = xpath_string "rasd:Address/text()" in
+      let nic_model =
+        match xpath_string "rasd:ResourceSubType/text()" with
+        | Some "E1000" -> Some Source_e1000
+        | Some _ -> None (* Warn? *)
+        | None -> None in
       let nic = {
         s_mac = mac;
-        s_nic_model = None;
+        s_nic_model = nic_model;
         s_vnet = vnet;
         s_vnet_orig = vnet;
         s_vnet_type = vnet_type;
diff --git a/v2v/test-v2v-i-ova-formats.expected b/v2v/test-v2v-i-ova-formats.expected
index 5e2fabfa9..f7b79d7bc 100644
--- a/v2v/test-v2v-i-ova-formats.expected
+++ b/v2v/test-v2v-i-ova-formats.expected
@@ -17,5 +17,5 @@ disks:
 removable media:
 	CD-ROM [ide] in slot 0
 NICs:
-	Bridge "PG-VLAN60"
+	Bridge "PG-VLAN60" [e1000]
 
diff --git a/v2v/test-v2v-i-ova-gz.expected b/v2v/test-v2v-i-ova-gz.expected
index 31ad9e1f3..9cf048f30 100644
--- a/v2v/test-v2v-i-ova-gz.expected
+++ b/v2v/test-v2v-i-ova-gz.expected
@@ -17,5 +17,5 @@ disks:
 removable media:
 	CD-ROM [ide] in slot 0
 NICs:
-	Bridge "PG-VLAN60"
+	Bridge "PG-VLAN60" [e1000]
 
diff --git a/v2v/test-v2v-i-ova-subfolders.expected b/v2v/test-v2v-i-ova-subfolders.expected
index fc60b06ca..44ec3b2b8 100644
--- a/v2v/test-v2v-i-ova-subfolders.expected
+++ b/v2v/test-v2v-i-ova-subfolders.expected
@@ -17,5 +17,5 @@ disks:
 removable media:
 	CD-ROM [ide] in slot 0
 NICs:
-	Bridge "PG-VLAN60"
+	Bridge "PG-VLAN60" [e1000]
 
diff --git a/v2v/test-v2v-i-ova-subfolders.expected2 b/v2v/test-v2v-i-ova-subfolders.expected2
index a280c4637..f42fc924f 100644
--- a/v2v/test-v2v-i-ova-subfolders.expected2
+++ b/v2v/test-v2v-i-ova-subfolders.expected2
@@ -17,5 +17,5 @@ disks:
 removable media:
 	CD-ROM [ide] in slot 0
 NICs:
-	Bridge "PG-VLAN60"
+	Bridge "PG-VLAN60" [e1000]
 
diff --git a/v2v/test-v2v-i-ova-tar.expected b/v2v/test-v2v-i-ova-tar.expected
index 5e2fabfa9..f7b79d7bc 100644
--- a/v2v/test-v2v-i-ova-tar.expected
+++ b/v2v/test-v2v-i-ova-tar.expected
@@ -17,5 +17,5 @@ disks:
 removable media:
 	CD-ROM [ide] in slot 0
 NICs:
-	Bridge "PG-VLAN60"
+	Bridge "PG-VLAN60" [e1000]
 
diff --git a/v2v/test-v2v-i-ova-tar.expected2 b/v2v/test-v2v-i-ova-tar.expected2
index edc07f363..83928c23e 100644
--- a/v2v/test-v2v-i-ova-tar.expected2
+++ b/v2v/test-v2v-i-ova-tar.expected2
@@ -17,5 +17,5 @@ disks:
 removable media:
 	CD-ROM [ide] in slot 0
 NICs:
-	Bridge "PG-VLAN60"
+	Bridge "PG-VLAN60" [e1000]
 
diff --git a/v2v/test-v2v-i-ova-two-disks.expected b/v2v/test-v2v-i-ova-two-disks.expected
index 232ec5446..61eab9cf6 100644
--- a/v2v/test-v2v-i-ova-two-disks.expected
+++ b/v2v/test-v2v-i-ova-two-disks.expected
@@ -18,5 +18,5 @@ disks:
 removable media:
 	CD-ROM [ide] in slot 0
 NICs:
-	Bridge "PG-VLAN60"
+	Bridge "PG-VLAN60" [e1000]
 
diff --git a/v2v/test-v2v-i-ova-two-disks.expected2 b/v2v/test-v2v-i-ova-two-disks.expected2
index 03377cb18..5a218f5d5 100644
--- a/v2v/test-v2v-i-ova-two-disks.expected2
+++ b/v2v/test-v2v-i-ova-two-disks.expected2
@@ -18,5 +18,5 @@ disks:
 removable media:
 	CD-ROM [ide] in slot 0
 NICs:
-	Bridge "PG-VLAN60"
+	Bridge "PG-VLAN60" [e1000]
 
-- 
2.14.3




More information about the Libguestfs mailing list