From d779392d7fae7ecc0c51164fda4a413e9b4827e6 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Wed, 17 Jun 2015 17:05:58 -0600 Subject: [PATCH] Find vmrun on Windows. --- gns3server/modules/qemu/qemu_vm.py | 3 ++- gns3server/modules/virtualbox/__init__.py | 3 ++- gns3server/modules/vmware/__init__.py | 12 ++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gns3server/modules/qemu/qemu_vm.py b/gns3server/modules/qemu/qemu_vm.py index 84be4d8b..9aa3a6b0 100644 --- a/gns3server/modules/qemu/qemu_vm.py +++ b/gns3server/modules/qemu/qemu_vm.py @@ -698,8 +698,9 @@ class QemuVM(BaseVM): raise QemuError("Could not find free port for the Qemu monitor: {}".format(e)) self._command = yield from self._build_command() + command_string = " ".join(self._command) try: - log.info("Starting QEMU: {}".format(self._command)) + log.info("Starting QEMU with: {}".format(command_string)) self._stdout_file = os.path.join(self.working_dir, "qemu.log") log.info("logging to {}".format(self._stdout_file)) with open(self._stdout_file, "w", encoding="utf-8") as fd: diff --git a/gns3server/modules/virtualbox/__init__.py b/gns3server/modules/virtualbox/__init__.py index 8c03fa1f..5b17c5a2 100644 --- a/gns3server/modules/virtualbox/__init__.py +++ b/gns3server/modules/virtualbox/__init__.py @@ -92,7 +92,8 @@ class VirtualBox(BaseManager): vboxmanage_path = self.find_vboxmanage() command = [vboxmanage_path, "--nologo", subcommand] command.extend(args) - log.debug("Executing VBoxManage with command: {}".format(command)) + command_string = " ".join(command) + log.info("Executing VBoxManage with command: {}".format(command_string)) try: vbox_user = self.config.get_section_config("VirtualBox").get("vbox_user") if vbox_user: diff --git a/gns3server/modules/vmware/__init__.py b/gns3server/modules/vmware/__init__.py index f808561e..aed9bd83 100644 --- a/gns3server/modules/vmware/__init__.py +++ b/gns3server/modules/vmware/__init__.py @@ -74,7 +74,14 @@ class VMware(BaseManager): vmrun_path = self.config.get_section_config("VMware").get("vmrun_path") if not vmrun_path: if sys.platform.startswith("win"): - pass # TODO: use registry to find vmrun or search for default location + vmrun_path = shutil.which("vmrun") + if vmrun_path is None: + vmrun_ws = os.path.expandvars(r"%PROGRAMFILES(X86)%\VMware\VMware Workstation\vmrun.exe") + vmrun_vix = os.path.expandvars(r"%PROGRAMFILES(X86)%\VMware\VMware VIX\vmrun.exe") + if os.path.exists(vmrun_ws): + vmrun_path = vmrun_ws + elif os.path.exist(vmrun_vix): + vmrun_path = vmrun_vix elif sys.platform.startswith("darwin"): vmrun_path = "/Applications/VMware Fusion.app/Contents/Library/vmrun" else: @@ -177,7 +184,8 @@ class VMware(BaseManager): command = [vmrun_path, "-T", host_type, subcommand] command.extend(args) - log.debug("Executing vmrun with command: {}".format(command)) + command_string = " ".join(command) + log.info("Executing vmrun with command: {}".format(command_string)) try: process = yield from asyncio.create_subprocess_exec(*command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE) except (OSError, subprocess.SubprocessError) as e: