This script extracts a VMDK file from an OVA file and converts it to QCOW2 format for use with QEMU.
The script performs the following steps:
- Extracts the contents of an OVA file into a specified directory.
- Retrieves the VMDK file from the extracted contents.
- Converts the VMDK file to QCOW2 format.
- Python 3.12
qemu-img
tool installed on your system
Clone the repository and navigate to the project directory:
git clone https://github.com/NossaGTS/convert_ova.git
cd convert_ova
To run the script, use the following command:
./convert_ova.py -n <ova_name> -p <path_to_ova_file>
-n
,--name
: The name of the OVA file (without the.ova
extension).-p
,--path
: The path to the directory containing the OVA file.
./convert_ova.py -n my_ova_file -p /path/to/ova
Unzips an OVA file into a specified directory and retrieves the VMDK file.
Parameters:
ova_path
(str): The path to the OVA file to be unzipped.ova_name
(str): The name of the OVA file, used to create the output directory.
Returns:
str
: The name of the VMDK file extracted from the OVA file.
Raises:
Exception
: If an error occurs during the extraction process.
Converts a VMDK file to QCOW2 format for use with QEMU.
Parameters:
vmdk_file
(str): The path to the VMDK file to be converted.ova_name
(str): The name of the OVA file, used to create the output directory and name the resulting QCOW2 file.
Returns:
None
Raises:
Exception
: If an error occurs during the conversion process.
This project is licensed under the MIT License - see the LICENSE file for details.
- This script utilizes the
qemu-img
tool for converting VMDK files to QCOW2 format.