Shahar Havivi
2016-Sep-06 10:52 UTC
[Libguestfs] [PATCH] virt-v2v: Support for ova exported from AWS
1. AWS the name tag is not mandatory - using default as a name 2. AWD doesn't prefix 'ovf:' as prefix to disk path There is an open bug for oVirt: https://bugzilla.redhat.com/show_bug.cgi?id=1371843 Signed-off-by: Shahar Havivi <shaharh@redhat.com> --- v2v/input_ova.ml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml index d640d4a..46b6bb6 100644 --- a/v2v/input_ova.ml +++ b/v2v/input_ova.ml @@ -202,9 +202,7 @@ object (* Search for vm name. *) let name - xpath_to_string "/ovf:Envelope/ovf:VirtualSystem/ovf:Name/text()" "" in - if name = "" then - error (f_"could not parse ovf:Name from OVF document"); + xpath_to_string "/ovf:Envelope/ovf:VirtualSystem/ovf:Name/text()" "default" in (* Search for memory. *) let memory = xpath_to_int "/ovf:Envelope/ovf:VirtualSystem/ovf:VirtualHardwareSection/ovf:Item[rasd:ResourceType/text()=4]/rasd:VirtualQuantity/text()" (1024 * 1024) in @@ -263,10 +261,10 @@ object Xml.xpathctx_set_current_context xpathctx n; let file_id = xpath_to_string "rasd:HostResource/text()" "" in - let rex = Str.regexp "^ovf:/disk/\\(.*\\)" in + let rex = Str.regexp "^\\(ovf:\\)?/disk/\\(.*\\)" in if Str.string_match rex file_id 0 then ( (* Chase the references through to the actual file name. *) - let file_id = Str.matched_group 1 file_id in + let file_id = Str.matched_group 2 file_id in let expr = sprintf "/ovf:Envelope/ovf:DiskSection/ovf:Disk[@ovf:diskId='%s']/@ovf:fileRef" file_id in let file_ref = xpath_to_string expr "" in if file_ref == "" then error (f_"error parsing disk fileRef"); -- 2.4.3
Richard W.M. Jones
2016-Sep-06 11:04 UTC
Re: [Libguestfs] [PATCH] virt-v2v: Support for ova exported from AWS
On Tue, Sep 06, 2016 at 01:52:29PM +0300, Shahar Havivi wrote:> 1. AWS the name tag is not mandatory - using default as a name > 2. AWD doesn't prefix 'ovf:' as prefix to disk path > > There is an open bug for oVirt: > https://bugzilla.redhat.com/show_bug.cgi?id=1371843 > > Signed-off-by: Shahar Havivi <shaharh@redhat.com> > > v2v/input_ova.ml | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > > diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml > index d640d4a..46b6bb6 100644 > --- a/v2v/input_ova.ml > +++ b/v2v/input_ova.ml > @@ -202,9 +202,7 @@ object > > (* Search for vm name. *) > let name > - xpath_to_string "/ovf:Envelope/ovf:VirtualSystem/ovf:Name/text()" "" in > - if name = "" then > - error (f_"could not parse ovf:Name from OVF document"); > + xpath_to_string "/ovf:Envelope/ovf:VirtualSystem/ovf:Name/text()" "default" in > > (* Search for memory. *) > let memory = xpath_to_int "/ovf:Envelope/ovf:VirtualSystem/ovf:VirtualHardwareSection/ovf:Item[rasd:ResourceType/text()=4]/rasd:VirtualQuantity/text()" (1024 * 1024) in > @@ -263,10 +261,10 @@ object > > Xml.xpathctx_set_current_context xpathctx n; > let file_id = xpath_to_string "rasd:HostResource/text()" "" in > - let rex = Str.regexp "^ovf:/disk/\\(.*\\)" in > + let rex = Str.regexp "^\\(ovf:\\)?/disk/\\(.*\\)" in > if Str.string_match rex file_id 0 then ( > (* Chase the references through to the actual file name. *) > - let file_id = Str.matched_group 1 file_id in > + let file_id = Str.matched_group 2 file_id in > let expr = sprintf "/ovf:Envelope/ovf:DiskSection/ovf:Disk[@ovf:diskId='%s']/@ovf:fileRef" file_id in > let file_ref = xpath_to_string expr "" in > if file_ref == "" then error (f_"error parsing disk fileRef");The patch looks generally OK, but you need to post an updated version that applies cleanly to current git head. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html
Shahar Havivi
2016-Sep-06 12:17 UTC
Re: [Libguestfs] [PATCH] virt-v2v: Support for ova exported from AWS
> The patch looks generally OK, but you need to post an updated > version that applies cleanly to current git head.Right!!! Sorry about that, I will send a new patch - please ignore that one. Shahar.> > Rich. > > -- > Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones > Read my programming and virtualization blog: http://rwmj.wordpress.com > virt-builder quickly builds VMs from scratch > http://libguestfs.org/virt-builder.1.html
Maybe Matching Threads
- Re: [PATCH] virt-v2v: Support for ova exported from AWS
- [PATCH] virt-v2v: Support for ova exported from AWS [v2]
- v2v: -i libvirtxml: Map empty network or bridge name to a default (RHBZ#1257895).
- [PATCH] v2v: -i ova: Remove incorrect warning for disks that have no parent controller (RHBZ#1167302).
- GIT: [PATCH 0/5] v2v: Multiple fixes for handling semi-standard OVA files (RHBZ#1152998).