Opened 3 months ago
#22158 new defect
VirtualBox API exports Host-Only adapter without name
Reported by: | ana06 | Owned by: | |
---|---|---|---|
Component: | network | Version: | VirtualBox-7.0.20 |
Keywords: | API, Host-Only, HostOnly, | Cc: | ana06 |
Guest type: | all | Host type: | Linux |
Description
When I export an appliance adding a VM with a Host-Only adapter manually (using the GUI), the exported appliance include a name for the HostOnlyInterface and I can import and run the VM correctly:
<HostOnlyInterface name="vboxnet0"/>
But if I use the VirtualBox API to export an appliance adding a VM with a Host-Only adapter, the name of the HostOnlyInterface is missing, causing a "Nonexistent host networking interface, name (VERR_INTERNAL_ERROR)":
<HostOnlyInterface/>
I would expect the VirtualBox API to either export the name of the Host-Only adapter by default or accept a name, for example as part of the extraConfigValues
of the IVirtualSystemDescription
: 'type=HostOnly;name=vboxnet0'
.
I am using the following Python code (using virtualbox-python which is a wrapper for VirtualBox's COM API, but the issue is not Python related) to export the VM:
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)
This code is part of the following script open-sourced as part of the FLARE-VM project: https://github.com/mandiant/flare-vm/blob/main/virtualbox/vbox-export-snapshots.py
I have tested this code in Debian with VirtualBox 7.0.20 and different hosts (Windows 10 and Ubuntu). In addition to this bug report, I have opened the ''Export to OVA with Host-Only adapter with name'' topic in the VirtualBox forum looking for solutions or workarounds to this issue.
Please let me know if there is anything I can do to help fixing the issue.