[Ubuntu14] [pvbox ] How to create Hot only network interface

Discussion about using the VirtualBox API, Tutorials, Samples.
Post Reply
Dmouha
Posts: 11
Joined: 12. Aug 2015, 11:04

[Ubuntu14] [pvbox ] How to create Hot only network interface

Post by Dmouha »

Hello Team,
am unable to create a host only network interface with the python API am getting this error below
OS: Ubntu14
Virtualbox: version 4.3.26_Ubuntur98988
API used : pyhton pyvbox API

Code: Select all

>>> from virtualbox.library import IHost
>>> host =  IHost()
>>> host.create_host_only_network_interface()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualbox/library_ext/host.py", line 11, in create_host_only_network_interface
    progress, host_interface = self._call("createHostOnlyNetworkInterface")
  File "/usr/local/lib/python2.7/dist-packages/virtualbox/library_base.py", line 171, in _call
    method = self._search_attr(name)
  File "/usr/local/lib/python2.7/dist-packages/virtualbox/library_base.py", line 152, in _search_attr
    raise AttributeError("Failed to find attribute %s in %s" % (name, self))
AttributeError: Failed to find attribute createHostOnlyNetworkInterface in <virtualbox.library_ext.host.IHost object at 0x7f513bb6c850>
>>> help(host)
Can some body help on this ?

Thanks lot :D
Last edited by Dmouha on 26. Aug 2015, 16:45, edited 1 time in total.
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: How to create Hot only network interface python api

Post by noteirak »

Please read the posting guidelines and provide the missing information.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Dmouha
Posts: 11
Joined: 12. Aug 2015, 11:04

Re: [Ubuntu14] [pvbox ] How to create Hot only network inter

Post by Dmouha »

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

Re: [Ubuntu14] [pvbox ] How to create Hot only network inter

Post by noteirak »

Dmouha wrote:version 4.3.26_Ubuntur98988
The ubuntu port of VirtualBox is not supported here. Please try again using the official version which you can download on the virtualbox.org website.
If is still fails, provide a standalone test case code to reproduce the problem, not just the error, as explained in the guidelines.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Dmouha
Posts: 11
Joined: 12. Aug 2015, 11:04

Re: [Ubuntu14] [pvbox ] How to create Hot only network inter

Post by Dmouha »

Hello back,
I installed this version : 5.0.2r102096 directly taken from the website

my goal here is to create hostonly networks up to 5 and activate for each the dhcp server. Thats why I used the IHost clas and tried to create a create_host_only_network_interface. And each time I tried it
it fails. The same code simple again below.

Code: Select all

>>> from virtualbox.library import IHost
>>> host =  IHost()
>>> host.create_host_only_network_interface()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/virtualbox/library_ext/host.py", line 11, in create_host_only_network_interface
    progress, host_interface = self._call("createHostOnlyNetworkInterface")
  File "/usr/local/lib/python2.7/dist-packages/virtualbox/library_base.py", line 171, in _call
    method = self._search_attr(name)
  File "/usr/local/lib/python2.7/dist-packages/virtualbox/library_base.py", line 152, in _search_attr
    raise AttributeError("Failed to find attribute %s in %s" % (name, self))
AttributeError: Failed to find attribute createHostOnlyNetworkInterface in <virtualbox.library_ext.host.IHost object at 0x7f513bb6c850>
>>> help(host)
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: [Ubuntu14] [pvbox ] How to create Hot only network inter

Post by noteirak »

You cannot create the IHost object yourself, you need to get it from a IVirtualBox object which in turn you get from VirtualBoxManager.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Dmouha
Posts: 11
Joined: 12. Aug 2015, 11:04

Re: [Ubuntu14] [pvbox ] How to create Hot only network inter

Post by Dmouha »

I only saw createNATNetwork nothing on creating a host only network and IHost is a readonly attrubute here. Anyway idea on creating vboxnet0 with dhcp activated ?
noteirak
Site Moderator
Posts: 5229
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: [Ubuntu14] [pvbox ] How to create Hot only network inter

Post by noteirak »

Seems to me like you need more than just pointers, you don't seem to understand how the whole connection work.
Please read the SDK PDF up to chapter 5, have a look at the webservices python sample code on how to connect to VirtualBox, and you can also have a look at all the Java sample codes which describe the same behaviour.
you will see that you first need to actually connect to VirtualBox using a very specific and orderly set of lines. Only after you can use the various objects.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply