Example #1
0
class VirtualBox(Wrapper):
    # Properties directly inherited from IVirtualMachine
    _passthruProperties = [
        "homeFolder",
        "packageType",
        "revision",
        "settingsFilePath",
        "version",

        # Also allow direct access to these methods. These shouldn't
        # be used directly, buy only by other pyVBox classes.
        "createMachine",
        "findMachine",
        "getMachine",
        "openExistingSession",
        "openMachine",
        "openRemoteSession",
        "openSession",
        "registerMachine",
    ]

    def __init__(self):
        self._manager = VirtualBoxManager()
        self._wrappedInstance = self._manager.getIVirtualBox()

    def getGuestOSType(self, osTypeId):
        """Returns an object describing the specified guest OS type."""
        iosType = self._wrappedInstance.getGuestOSType(osTypeId)
        return GuestOSType(iosType)

    @property
    def guestOSTypes(self):
        """Return an array of all available guest OS Types."""
        return [GuestOSType(t) for t in self._getArray('guestOSTypes')]

    @property
    def machines(self):
        """Return array of machine objects registered within this VirtualBox instance."""
        from VirtualMachine import VirtualMachine
        return [VirtualMachine(vm) for vm in self._getArray('machines')]

    def waitForEvent(self):
        self._manager.waitForEvents()

    def _getArray(self, arrayName):
        """Return the array identified by the given name"""
        return self._manager.getArray(self._wrappedInstance, arrayName)
Example #2
0
class VirtualBox(Wrapper):
    # Properties directly inherited from IVirtualMachine
    _passthruProperties = [
        "homeFolder",
        "packageType",
        "revision",
        "settingsFilePath",
        "version",

        # Also allow direct access to these methods. These shouldn't
        # be used directly, buy only by other pyVBox classes.
        "createMachine",
        "findMachine",
        "getMachine",
        "openExistingSession",
        "openMachine",
        "openRemoteSession",
        "openSession",
        "registerMachine",
        ]

    def __init__(self):
        self._manager = VirtualBoxManager()
        self._wrappedInstance = self._manager.getIVirtualBox()

    def getGuestOSType(self, osTypeId):
        """Returns an object describing the specified guest OS type."""
        iosType = self._wrappedInstance.getGuestOSType(osTypeId)
        return GuestOSType(iosType)

    @property
    def guestOSTypes(self):
        """Return an array of all available guest OS Types."""
        return [GuestOSType(t) for t in self._getArray('guestOSTypes')]

    @property
    def machines(self):
        """Return array of machine objects registered within this VirtualBox instance."""
        from VirtualMachine import VirtualMachine
        return [VirtualMachine(vm) for vm in self._getArray('machines')]

    def waitForEvent(self):
        self._manager.waitForEvents()

    def _getArray(self, arrayName):
        """Return the array identified by the given name"""
        return self._manager.getArray(self._wrappedInstance, arrayName)