From 83aad5289c4c1f1ee7c5b2efabcd27d3b7a08420 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Fri, 9 Sep 2016 14:56:11 +0100 Subject: [PATCH] v2v: -i ova: Derive the name from the OVA filename. If the guest has no 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 was present). Modifies the behaviour of commit 1ae4252c93c685cb8561b55c1231502b37212b5a. (cherry picked from commit 98619f9c26076d034574b8822dfcc6799741ed96) --- v2v/input_ova.ml | 3 ++- v2v/name_from_disk.ml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml index 932c96b..c5ff19c 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..9ed02ce 100644 --- a/v2v/name_from_disk.ml +++ b/v2v/name_from_disk.ml @@ -24,7 +24,7 @@ let name_from_disk disk = (* Remove the extension (or suffix), only if it's one usually * used for disk images. *) let suffixes = [ - ".img"; ".qcow2"; ".raw"; ".vmdk"; + ".img"; ".ova"; ".qcow2"; ".raw"; ".vmdk"; "-sda"; ] in let rec loop = function -- 2.7.4