Prevent parallel execution of VBox commands

In theory it should not be a problem.
But It's create issues like this one:

Fix: https://github.com/GNS3/gns3-gui/issues/261
This commit is contained in:
Julien Duponchelle 2015-04-14 15:00:45 +02:00
parent 6ec081c774
commit e51a129216

View File

@ -41,6 +41,7 @@ class VirtualBox(BaseManager):
super().__init__()
self._vboxmanage_path = None
self._execute_lock = asyncio.Lock()
@property
def vboxmanage_path(self):
@ -82,6 +83,10 @@ class VirtualBox(BaseManager):
@asyncio.coroutine
def execute(self, subcommand, args, timeout=60):
# We use a lock prevent parallel execution due to strange errors
# reported by a user and reproduced by us.
# https://github.com/GNS3/gns3-gui/issues/261
with (yield from self._execute_lock):
vboxmanage_path = self.vboxmanage_path
if not vboxmanage_path:
vboxmanage_path = self.find_vboxmanage()