mirror of
https://github.com/GNS3/gns3-server.git
synced 2025-01-30 21:03:49 +02:00
Find vmrun on Windows.
This commit is contained in:
parent
f041697311
commit
d779392d7f
@ -698,8 +698,9 @@ class QemuVM(BaseVM):
|
|||||||
raise QemuError("Could not find free port for the Qemu monitor: {}".format(e))
|
raise QemuError("Could not find free port for the Qemu monitor: {}".format(e))
|
||||||
|
|
||||||
self._command = yield from self._build_command()
|
self._command = yield from self._build_command()
|
||||||
|
command_string = " ".join(self._command)
|
||||||
try:
|
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")
|
self._stdout_file = os.path.join(self.working_dir, "qemu.log")
|
||||||
log.info("logging to {}".format(self._stdout_file))
|
log.info("logging to {}".format(self._stdout_file))
|
||||||
with open(self._stdout_file, "w", encoding="utf-8") as fd:
|
with open(self._stdout_file, "w", encoding="utf-8") as fd:
|
||||||
|
@ -92,7 +92,8 @@ class VirtualBox(BaseManager):
|
|||||||
vboxmanage_path = self.find_vboxmanage()
|
vboxmanage_path = self.find_vboxmanage()
|
||||||
command = [vboxmanage_path, "--nologo", subcommand]
|
command = [vboxmanage_path, "--nologo", subcommand]
|
||||||
command.extend(args)
|
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:
|
try:
|
||||||
vbox_user = self.config.get_section_config("VirtualBox").get("vbox_user")
|
vbox_user = self.config.get_section_config("VirtualBox").get("vbox_user")
|
||||||
if vbox_user:
|
if vbox_user:
|
||||||
|
@ -74,7 +74,14 @@ class VMware(BaseManager):
|
|||||||
vmrun_path = self.config.get_section_config("VMware").get("vmrun_path")
|
vmrun_path = self.config.get_section_config("VMware").get("vmrun_path")
|
||||||
if not vmrun_path:
|
if not vmrun_path:
|
||||||
if sys.platform.startswith("win"):
|
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"):
|
elif sys.platform.startswith("darwin"):
|
||||||
vmrun_path = "/Applications/VMware Fusion.app/Contents/Library/vmrun"
|
vmrun_path = "/Applications/VMware Fusion.app/Contents/Library/vmrun"
|
||||||
else:
|
else:
|
||||||
@ -177,7 +184,8 @@ class VMware(BaseManager):
|
|||||||
|
|
||||||
command = [vmrun_path, "-T", host_type, subcommand]
|
command = [vmrun_path, "-T", host_type, subcommand]
|
||||||
command.extend(args)
|
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:
|
try:
|
||||||
process = yield from asyncio.create_subprocess_exec(*command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
|
process = yield from asyncio.create_subprocess_exec(*command, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE)
|
||||||
except (OSError, subprocess.SubprocessError) as e:
|
except (OSError, subprocess.SubprocessError) as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user