Export to OVA with Host-Only adapter with name

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
Ana06
Posts: 6
Joined: 6. Mar 2024, 09:24

Export to OVA with Host-Only adapter with name

Post by Ana06 »

I want to export a VM with a Host-Only adapter using the VirtualBox API to OVA. I am using the following code (written in Python using https://github.com/sethmlarson/virtualbox-python which is a wrapper for VirtualBox's COM API):

Code: Select all

vbox = virtualbox.VirtualBox()
vm = vbox.find_machine(VM_NAME)

appliance = vbox.create_appliance()
sys_description = vm.export_to(appliance, "name")
appliance.write("ovf-1.0", [], PATH)
The OVA is exported correctly. But if I import the OVA and run it I get the following error: Nonexistent host networking interface, name '' (VERR_INTERNAL_ERROR). I can see in the .vbox file that the reason for that is that the Host-Only adapter is missing the name. It is easy to fix (by opening the network settings and saving with the default name), but it is annoying when sharing the OVA. This also does not happens if I export the VM manually to OVA.

Is is possible to give the Host-Only adapter a name (or make it that it includes the default name) when exporting a VM to OVA using the VirtualBox API? If not, It seems to me like a VirtualBox API bug. How can I report this issue?

For reference, I am running this code in Debian with VirtualBox 7.0.20 and this code is part of the following script: https://github.com/mandiant/flare-vm/bl ... ots.py#L72. I would be interested in any solution or idea that allows me to export the VM to OVA in a script with a Host-Only adapter with name, so that importing the OVA does not requires any extra steps. I am using Python, but a solution in other language would also be appreciated.
Ana06
Posts: 6
Joined: 6. Mar 2024, 09:24

Re: Export to OVA with Host-Only adapter with name

Post by Ana06 »

This is how the VirtualSystemDescription of type NetworkAdapter looks like:

Code: Select all

([VirtualSystemDescriptionType(21)], [''], ['HostOnly'], ['3'], ['type=HostOnly'])
Obtained with the code:

Code: Select all

sys_description.get_description_by_type(DescType.network_adapter)
I have tried modifying the VirtualSystemDescription of type NetworkAdapter in several ways but the error still occurs. I have also tried `ExportOptions.CreateManifest ` in `IAppliance::write` as it is set when I export the VM manually, but it also does not solve the problem.
Ana06
Posts: 6
Joined: 6. Mar 2024, 09:24

Re: Export to OVA with Host-Only adapter with name

Post by Ana06 »

noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Export to OVA with Host-Only adapter with name

Post by noteirak »

Thank you for opening the issue on the bug tracker, it was the advise I would have given you :D
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply