1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-11-24 17:28:08 +00:00

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__() super().__init__()
self._vboxmanage_path = None self._vboxmanage_path = None
self._execute_lock = asyncio.Lock()
@property @property
def vboxmanage_path(self): def vboxmanage_path(self):
@ -82,6 +83,10 @@ class VirtualBox(BaseManager):
@asyncio.coroutine @asyncio.coroutine
def execute(self, subcommand, args, timeout=60): 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 vboxmanage_path = self.vboxmanage_path
if not vboxmanage_path: if not vboxmanage_path:
vboxmanage_path = self.find_vboxmanage() vboxmanage_path = self.find_vboxmanage()