On Sun, Apr 24, 2011 at 9:07 AM, Nikolay Igotti <[email protected]> wrote: > > Consider VirtualBoxManager() a singleton, you need to create only once. So > smth like > > g_mgr=None > > def getMgr(): > global g_mgr > if g_mgr is None: > g_mgr = VirtualBoxManager(None, None) > return g_mgr >
This exactly code fails in GNS3. (in 'vboxwrapper.py') This is because they start some 'vboxstarter' class via TCP server (in the same python module) which spawns new thread (instead of process), so if you initialize it twice in new thread it fails. If you use it 'as is', it won't crash but it will refuse to start VMs, complaining they that 'VirtualBoxManager() was marshalled from some other thread' or findMachine() fails with: 'Object is not connected to server'. (depends where I put the code) Plus, doing 'del g_mgr' doesn't uninitialize it fully. It still crashes. -- -Alexey Eromenko "Technologov" _______________________________________________ vbox-dev mailing list [email protected] http://vbox.innotek.de/mailman/listinfo/vbox-dev
