Skip to content

Instantly share code, notes, and snippets.

@amkgi
Created December 29, 2023 21:11
Show Gist options
  • Save amkgi/2532b7ced6cbfc8263766e8d95ce099a to your computer and use it in GitHub Desktop.
Save amkgi/2532b7ced6cbfc8263766e8d95ce099a to your computer and use it in GitHub Desktop.
Solving an issue with VirtualBMC running in macOS

How to fix VirtualBMC in macOS

After installing VirtualBMC in macOS, starting the server and adding a BMC for at least one VM, and then trying to start that BMC, you get the following error:

INFO VirtualBMC [-] Started vBMC server on port 50891
ERROR VirtualBMC [-] Control server error: Can't pickle local object 'VirtualBMCManager._sync_vbmc_states..vbmc_runner'

This is because the multiprocessing module needs to specify fork as the startup method, since starting with Python 3.8 for macOS the startup method has been replaced by spawn.

Add a line to the /path/to/python/site-packages/virtualbmc/manager.py file:

                if not instance or not instance.is_alive():
                
                    multiprocessing.set_start_method('fork', force=True) <<--
                    instance = multiprocessing.Process(
                        name='vbmcd-managing-domain-%s' % domain_name,
                        target=vbmc_runner,
                        args=(bmc_config,)
                    )

Now you can start a VBMC server and add BMC to different VMs without error.

vbmc list
+--------------+---------+---------+------+
| Domain name  | Status  | Address | Port |
+--------------+---------+---------+------+
| compute-1    | running | ::      | 6241 |
| compute-2    | running | ::      | 6242 |
| controller-1 | running | ::      | 6233 |
| controller-2 | running | ::      | 6234 |
| controller-3 | running | ::      | 6235 |
+--------------+---------+---------+------+
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment