From 60219d9a453e12c8a3bcf7a1c35b93fb60e873aa Mon Sep 17 00:00:00 2001 From: Vasil Rangelov Date: Fri, 10 Apr 2015 23:26:08 +0300 Subject: [PATCH] Use hex encoding on VirtualBox pipe names This allows arbitrary characters in VirtualBox VM names, while also ensuring all different weird names can coexist. Example of two VMs that previously couldn't both have a serial console - "VM 1" and "VM_1", because the former's pipe name is converted to the latter, while the latter would remain unchanged. --- gns3server/modules/virtualbox/virtualbox_vm.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/gns3server/modules/virtualbox/virtualbox_vm.py b/gns3server/modules/virtualbox/virtualbox_vm.py index f369287b..e7c36600 100644 --- a/gns3server/modules/virtualbox/virtualbox_vm.py +++ b/gns3server/modules/virtualbox/virtualbox_vm.py @@ -583,8 +583,7 @@ class VirtualBoxVM(BaseVM): :returns: pipe path (string) """ - p = re.compile('\s+', re.UNICODE) - pipe_name = p.sub("_", self._vmname) + pipe_name = self._vmname.encode("hex", "strict") if sys.platform.startswith("win"): pipe_name = r"\\.\pipe\VBOX\{}".format(pipe_name) else: