virtualbox – main module

This module is the root module for the pyvbox project. The name ‘virtualbox’ has been chosen to enable explicit naming when using this package. The author suggests that people new to VirtualBox’s extensive COM interface should take a moment to delve into the API’s documentation which will assist in understanding how VirtualBox’s client server module functions.

Code reference

virtualbox.import_vboxapi(*args, **kwds)[source]

This import is designed to help when loading vboxapi inside of alternative Python environments (virtualenvs etc).

Return type:vboxapi module
class virtualbox.VirtualBox([interface, manager])

The VirthalBox class is the primary interface used to interact with a VirtualBox server. It wraps the IVirtualBox interface which “represents the main interface exposed by the product that provides virtual machine management.”

Optionally, this class can be initialised with an already connected COM IVirtualBox interface or by passing in a Manager object which implements a virtualbox.Manager get_virthalbox method.

class virtualbox.Manager(mtype=None, mparams=None)[source]

The Manager maintains a single point of entry into vboxapi.

This object is responsible for the construction of virtualbox.library_ext.ISession and virtualbox.library_ext.IVirtualBox.

Parameters:
  • mtype (str (Default None)) – Type of manager i.e. WEBSERVICE.
  • mparams (tuple|list (Default None)) – The params that the mtype manager object accepts.
manager

Create a default Manager object

Builds a singleton VirtualBoxManager object.

Note: It is not necessary to build this object when defining a Session or VirtualBox object as both of these classes will default to this object’s global singleton during construction.

get_virtualbox()[source]

Return a VirtualBox interface

Return type:library.IVirtualBox
get_session()[source]

Return a Session interface

Return type:library.ISession
cast_object(interface_object, interface_class)[source]

Cast the obj to the interface class

Return type:interface_class(interface_object)
bin_path

return the virtualbox install directory

Return type:str
__weakref__

list of weak references to the object (if defined)

class virtualbox.WebServiceManager(url=’http://localhost/’, user=”, password=”)[source]

The WebServiceManager extends the base Manager to include the ability to build a WEBSERVICE type vboxapi interface.