1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-26 00:38:10 +00:00

Use UUIDs instead of the VM names for VirtualBox pipe paths.

This commit is contained in:
grossmj 2015-04-22 20:29:52 -06:00
parent 9c549b175f
commit 161adb781b

View File

@ -586,12 +586,14 @@ class VirtualBoxVM(BaseVM):
:returns: pipe path (string) :returns: pipe path (string)
""" """
p = re.compile('\s+', re.UNICODE)
pipe_name = p.sub("_", self._vmname)
if sys.platform.startswith("win"): if sys.platform.startswith("win"):
pipe_name = r"\\.\pipe\VBOX\{}".format(pipe_name) pipe_name = r"\\.\pipe\gns3_vbox\{}".format(self.id)
else: else:
pipe_name = os.path.join(tempfile.gettempdir(), "pipe_{}".format(pipe_name)) pipe_name = os.path.join(tempfile.gettempdir(), "gns3_vbox", "{}".format(self.id))
try:
os.makedirs(os.path.dirname(pipe_name), exist_ok=True)
except OSError as e:
raise VirtualBoxError("Could not create the VirtualBox pipe directory: {}".format(e))
return pipe_name return pipe_name
@asyncio.coroutine @asyncio.coroutine