Find vmrun on Windows.

This commit is contained in:
Jeremy 2015-06-17 17:05:58 -06:00
parent f041697311
commit d779392d7f
3 changed files with 14 additions and 4 deletions

View File

@ -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:

View File

@ -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:

View File

@ -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: