提交 84095e1e 编写于 作者: R Rainer Müller 提交者: John Ferlan

vmware: Fix initialization of VMware Fusion

The vmware driver wants to execute vmware-vmx from the same directory in
which vmrun was found. However, on VMware Fusion 10 vmrun at
/Applications/VMware Fusion.app/Contents/Public/vmrun is a symlink
pointing to ../Library/vmrun. vmware-vmx cannot be found, as
it is not in PATH, but only in this Library directory.

Therefore, follow the vmrun symlink and use the resulting path. Then the
assumption that vmware-vmx is right next to it will still work.
Signed-off-by: NRainer Müller <raimue@codingfarm.de>
上级 d8f17e60
...@@ -127,6 +127,7 @@ vmwareConnectOpen(virConnectPtr conn, ...@@ -127,6 +127,7 @@ vmwareConnectOpen(virConnectPtr conn,
struct vmware_driver *driver; struct vmware_driver *driver;
size_t i; size_t i;
char *tmp; char *tmp;
char *vmrun = NULL;
virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR); virCheckFlags(VIR_CONNECT_RO, VIR_DRV_OPEN_ERROR);
...@@ -149,7 +150,14 @@ vmwareConnectOpen(virConnectPtr conn, ...@@ -149,7 +150,14 @@ vmwareConnectOpen(virConnectPtr conn,
* for auto detection of the backend * for auto detection of the backend
*/ */
for (i = 0; i < ARRAY_CARDINALITY(vmrun_candidates); i++) { for (i = 0; i < ARRAY_CARDINALITY(vmrun_candidates); i++) {
driver->vmrun = virFindFileInPath(vmrun_candidates[i]); vmrun = virFindFileInPath(vmrun_candidates[i]);
if (vmrun == NULL)
continue;
if (virFileResolveLink(vmrun, &driver->vmrun) < 0) {
virReportSystemError(errno, _("unable to resolve symlink '%s'"), vmrun);
goto cleanup;
}
VIR_FREE(vmrun);
/* If we found one, we can stop looking */ /* If we found one, we can stop looking */
if (driver->vmrun) if (driver->vmrun)
break; break;
...@@ -200,6 +208,7 @@ vmwareConnectOpen(virConnectPtr conn, ...@@ -200,6 +208,7 @@ vmwareConnectOpen(virConnectPtr conn,
cleanup: cleanup:
vmwareFreeDriver(driver); vmwareFreeDriver(driver);
VIR_FREE(vmrun);
return VIR_DRV_OPEN_ERROR; return VIR_DRV_OPEN_ERROR;
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册