Salt: Minion VBoxManage module does not work on Windows Host

Created on 25 Mar 2017  路  5Comments  路  Source: saltstack/salt

Description of Issue/Question

The VBoxManage module does not work on Windows Hosts.

Error given is

The vboxmanaged execution module failed to load: VBoxManage is not installed.'

Setup

(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)
Salt Minion 2016.11.1 - AMD 64 installed on Windows 10 Host. Oracle Virtual Box 5.1.10 is installed

Steps to Reproduce Issue

Attempt to call the vboxmanage.list_nodes function against the minion.

The following error is returned

The vboxmanaged execution module failed to load: VBoxManage is not installed.

The module code seems to be linux-specific when checking for the presence of the vboxmanage kernel module: https://github.com/saltstack/salt/blob/develop/salt/modules/vboxmanage.py#L42

Feature Platform Windows stale

Most helpful comment

From looking at the __virtual__ command, linux is the only os supported for that module.

def __virtual__():
    '''
    Only load the module if VBoxManage is installed
    '''
    if vboxcmd():
        if __opts__.get('autoload_vboxdrv', False) is True:
            if not __salt__['kmod.is_loaded']('vboxdrv'):
                __salt__['kmod.load']('vboxdrv')
        return True
    return (False, 'The vboxmanaged execution module failed to load: VBoxManage is not installed.')

It is checking that the vboxdrv module is loaded in the linux kernel.

We would need to add an extra if statement in this function to check for if windows can be enabled as well.

I am marking this as a feature request.

Thanks,
Daniel

All 5 comments

From looking at the __virtual__ command, linux is the only os supported for that module.

def __virtual__():
    '''
    Only load the module if VBoxManage is installed
    '''
    if vboxcmd():
        if __opts__.get('autoload_vboxdrv', False) is True:
            if not __salt__['kmod.is_loaded']('vboxdrv'):
                __salt__['kmod.load']('vboxdrv')
        return True
    return (False, 'The vboxmanaged execution module failed to load: VBoxManage is not installed.')

It is checking that the vboxdrv module is loaded in the linux kernel.

We would need to add an extra if statement in this function to check for if windows can be enabled as well.

I am marking this as a feature request.

Thanks,
Daniel

@gtmanfred would this be best implemented by a virtual module win_vbox, or extending the existing module to support both platforms?

Of note is the fact that the VirtualBox on Windows may be managed via COM objects which might be better than relying on the VBoxManage binary file.

I'm relatively new to both Python and SALT, but I may take a shot at this.

If it is possible to just add windows to the module already written, I would say do that with the VBoxManage.exe binary. At some point a win_vbox could be added but it would be nice to share code if possible.

Thanks,
Daniel

The VirtualBox svn XPCOM code is kinda crusty (look at them struggle to get Python3 working). It's not well documented, but the same XPCOM interfaces are exposed via a SOAP server 'vboxwebsrv' which might be more elegant than wrapping the CLI 'VBoxmanage' tool.

OTOH, that requires another process in the background, and another component to manage, while there may be additional benefits to fixing the Windows compatibility of this module's __virtual__().

I think it would be nice to refactor the kernel module/driver check into a virtual utility function to abstract __salt__'kmod.is_loaded' maybe populating 'kmod' on Windows with data from something like Windows "driverquery" command?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

Was this page helpful?
0 / 5 - 0 ratings