sethmlarson / virtualbox-python

Complete implementation of VirtualBox's COM API with a Pythonic interface.
https://pypi.org/project/virtualbox
Apache License 2.0
354 stars 75 forks source link

Fix created host-only not being returned #22

Closed wndhydrnt closed 10 years ago

wndhydrnt commented 10 years ago

The call to "createHostOnlyNetworkInterface" in IHost.create_host_only_network_interface() returned progress and host_interface objects in a different order than expected. I tested this fix with VirtualBox 4.3.14.

mjdorma commented 10 years ago

Hi @wndhydrnt, thanks for the PR. To solve this what we will need is a IHost extension class created under the machine_ext submodule which extends this specific function and implements the behaviour that you have observed as being correct.

The library.py file is automatically generated from the VirtualBox.xidl file which describes the Virtualbox API in great detail. Sometimes the functions defined in the VirtualBox.xidl have been incorrect. As a workaround to this, the library_ext submodule exists so we can easily subclass, override and extend the auto generated classes in library.py. library_ext/init.py is responsible for swapping out the classes defined under library_ext with the auto generated classes in library.

If you want to have a go at it, please do! simply create a host.py module under library_ext, look at how the other extension modules have been written, then extend your IHost class and correct the default behaviour.

wndhydrnt commented 10 years ago

Hey @mjdorma thank you for making this clear. I'll follow your advice and check the code in library_ext. Will update this PR as soon as I've figured out the fix.

wndhydrnt commented 10 years ago

@mjdorma I created host.py and fixed the bug there. The fix works on my local machine. I also discovered a typo while browsing through the code and fixed that too. I committed this one separately. Hope that's fine.