Skip to content

Fix handling of Oracle OVA files with normalized paths and SHA checksums - #192

Closed
lotfihamid wants to merge 1 commit into
libguestfs:masterfrom
lotfihamid:master
Closed

lotfihamid wants to merge 1 commit into
libguestfs:masterfrom
lotfihamid:master

Conversation

@lotfihamid

Copy link
Copy Markdown

Fix handling of Oracle OVA files with normalized paths and SHA checksums

This patch addresses two specific issues that prevented virt-v2v from processing OVA files exported from Oracle OLVM (Oracle Linux Virtualization Manager):

  1. Path normalization in TarOptimized mode

    • Oracle OVFs often reference disk files with a "./" prefix (e.g., "ovf:disk/./disk.vmdk" or href="./disk.vmdk").
    • The resolve_href function would construct filenames like "subdir/./disk.vmdk" which did not match the actual tar entry "subdir/disk.vmdk", causing get_tar_offset_and_size to raise Not_found.
    • Added a normalize_path helper to remove "." and ".." components before looking up files in the tarball.
  2. Manifest checksum regex support for SHA-1/SHA-256 with hyphen

    • Oracle manifest files use "SHA-1" and "SHA-256" (with a hyphen) instead of "SHA1" and "SHA256".
    • Updated the regular expression to accept both forms: ^(SHA-?1|SHA-?256)[[:space:]]((.))[[:space:]]*= ([0-9a-fA-F]+)\r?$

These changes make virt-v2v compatible with OVA files generated by Oracle OLVM without requiring external preprocessing.

Fix handling of Oracle OVA files with normalized paths and SHA checksums

This patch addresses two specific issues that prevented virt-v2v from
processing OVA files exported from Oracle OLVM (Oracle Linux Virtualization
Manager):

1. Path normalization in TarOptimized mode
   - Oracle OVFs often reference disk files with a "./" prefix (e.g.,
     "ovf:disk/./disk.vmdk" or href="./disk.vmdk").
   - The resolve_href function would construct filenames like
     "subdir/./disk.vmdk" which did not match the actual tar entry
     "subdir/disk.vmdk", causing get_tar_offset_and_size to raise Not_found.
   - Added a normalize_path helper to remove "." and ".." components before
     looking up files in the tarball.

2. Manifest checksum regex support for SHA-1/SHA-256 with hyphen
   - Oracle manifest files use "SHA-1" and "SHA-256" (with a hyphen)
     instead of "SHA1" and "SHA256".
   - Updated the regular expression to accept both forms:
     ^(SHA-?1|SHA-?256)[[:space:]]*\((.*)\)[[:space:]]*= ([0-9a-fA-F]+)\r?$

These changes make virt-v2v compatible with OVA files generated by
Oracle OLVM without requiring external preprocessing.


Signed-off-by: Hamid Lotfi <hamid.lotfi@gmail.com>
@rwmjones

rwmjones commented Sep 3, 2026

Copy link
Copy Markdown
Member

First thing is: two changes need to be two commits.

@rwmjones

rwmjones commented Sep 3, 2026

Copy link
Copy Markdown
Member

I don't see how the checksum change can possibly work. Did you actually test it?

@rwmjones

rwmjones commented Sep 3, 2026

Copy link
Copy Markdown
Member

Actually it's 3 changes, so should be 3 commits.

@lotfihamid lotfihamid closed this Sep 4, 2026
@lotfihamid

Copy link
Copy Markdown
Author

Please let me to check it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants