If the guest has no <Name> element in the OVF, previously we chose
"default" as the name. This changes that so it uses a name derived
from the basename of the OVA file instead.
For example:
virt-v2v -i ova /path/to/myguest.ova [...]
would use "myguest" as the name (assuming no <Name> was present).
Modifies the behaviour of
commit 1ae4252c93c685cb8561b55c1231502b37212b5a.
---
v2v/input_ova.ml | 3 ++-
v2v/name_from_disk.ml | 1 +
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
index 974caeb..c1dff71 100644
--- a/v2v/input_ova.ml
+++ b/v2v/input_ova.ml
@@ -23,6 +23,7 @@ open Common_utils
open Types
open Utils
+open Name_from_disk
class input_ova ova =
let tmpdir =
@@ -186,7 +187,7 @@ object
match xpath_string "/ovf:Envelope/ovf:VirtualSystem/ovf:Name/text()"
with
| None | Some "" ->
warning (f_"could not parse ovf:Name from OVF document");
- "default"
+ name_from_disk ova
| Some name -> name in
(* Search for memory. *)
diff --git a/v2v/name_from_disk.ml b/v2v/name_from_disk.ml
index 73caf34..878b7c6 100644
--- a/v2v/name_from_disk.ml
+++ b/v2v/name_from_disk.ml
@@ -26,6 +26,7 @@ let name_from_disk disk =
let suffixes = [
".img"; ".qcow2"; ".raw"; ".vmdk";
"-sda";
+ ".ova";
] in
let rec loop = function
| suff :: xs ->
--
2.9.3