VMware: Initial VMware Fusion support

Add support for VMware Fusion in the existing VMware driver.  Connect
via the URI vmwarefusion:///session
This commit is contained in:
Doug Goldstein 2013-09-24 11:24:31 -05:00 committed by Daniel Veillard
parent ca91e55407
commit 45cd9aa2d4
4 changed files with 29 additions and 7 deletions

View File

@ -2,10 +2,11 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
<body> <body>
<h1>VMware Workstation / Player hypervisors driver</h1> <h1>VMware Workstation / Player / Fusion hypervisors driver</h1>
<p> <p>
The libvirt VMware Workstation driver should be able to manage any Workstation and The libvirt VMware driver should be able to manage any Workstation,
Player version supported by the VMware VIX API. See the compatibility list Player, Fusion version supported by the VMware VIX API. See the
compatibility list
<a href="http://www.vmware.com/support/developer/vix-api/vix110_reference/">here</a>. <a href="http://www.vmware.com/support/developer/vix-api/vix110_reference/">here</a>.
</p> </p>
<p> <p>
@ -21,17 +22,22 @@
The <a href="http://www.vmware.com/">VMware Workstation and The <a href="http://www.vmware.com/">VMware Workstation and
Player</a> hypervisors Player</a> hypervisors
</li> </li>
<li>
The <a href="http://www.vmware.com/fusion">VMware Fusion</a>
hypervisor
</li>
</ul> </ul>
<h2>Connections to VMware driver</h2> <h2>Connections to VMware driver</h2>
<p> <p>
The libvirt VMware driver provides per-user drivers (the "session" instance). The libvirt VMware driver provides per-user drivers (the "session" instance).
Two uris are available: Three uris are available:
</p> </p>
<ul> <ul>
<li>"vmwareplayer" for VMware Player</li> <li>"vmwareplayer" for VMware Player</li>
<li>"vmwarews" for VMware Workstation</li> <li>"vmwarews" for VMware Workstation</li>
<li>"vmwarefusion" for VMware Fusion</li>
</ul> </ul>
<p> <p>
Some example connection URIs for the driver are: Some example connection URIs for the driver are:
@ -40,6 +46,7 @@
<pre> <pre>
vmwareplayer:///session (local access to VMware Player per-user instance) vmwareplayer:///session (local access to VMware Player per-user instance)
vmwarews:///session (local access to VMware Workstation per-user instance) vmwarews:///session (local access to VMware Workstation per-user instance)
vmwarefusion:///session (local access to VMware Fusion per-user instance)
vmwarews+tcp://user@example.com/session (remote access to VMware Workstation, SASl/Kerberos) vmwarews+tcp://user@example.com/session (remote access to VMware Workstation, SASl/Kerberos)
vmwarews+ssh://user@example.com/session (remote access to VMware Workstation, SSH tunnelled) vmwarews+ssh://user@example.com/session (remote access to VMware Workstation, SSH tunnelled)
</pre> </pre>

View File

@ -37,7 +37,8 @@
VIR_ENUM_IMPL(vmwareDriver, VMWARE_DRIVER_LAST, VIR_ENUM_IMPL(vmwareDriver, VMWARE_DRIVER_LAST,
"player", "player",
"ws"); "ws",
"fusion");
/* Free all memory associated with a vmware_driver structure */ /* Free all memory associated with a vmware_driver structure */
void void
@ -231,6 +232,9 @@ vmwareParseVersionStr(int type, const char *verbuf, unsigned long *version)
case VMWARE_DRIVER_WORKSTATION: case VMWARE_DRIVER_WORKSTATION:
pattern = "VMware Workstation "; pattern = "VMware Workstation ";
break; break;
case VMWARE_DRIVER_FUSION:
pattern = "\nVMware Fusion Information:\nVMware Fusion ";
break;
default: default:
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid driver type: %d"), type); _("Invalid driver type: %d"), type);
@ -276,6 +280,11 @@ vmwareExtractVersion(struct vmware_driver *driver)
goto cleanup; goto cleanup;
break; break;
case VMWARE_DRIVER_FUSION:
if (virAsprintf(&bin, "%s/%s", vmwarePath, "vmware-vmx"))
goto cleanup;
break;
default: default:
virReportError(VIR_ERR_INTERNAL_ERROR, "%s", virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
_("invalid driver type for version detection")); _("invalid driver type for version detection"));

View File

@ -33,6 +33,7 @@
enum vmwareDriverType { enum vmwareDriverType {
VMWARE_DRIVER_PLAYER = 0, /* VMware Player */ VMWARE_DRIVER_PLAYER = 0, /* VMware Player */
VMWARE_DRIVER_WORKSTATION = 1, /* VMware Workstation */ VMWARE_DRIVER_WORKSTATION = 1, /* VMware Workstation */
VMWARE_DRIVER_FUSION = 2, /* VMware Fusion */
VMWARE_DRIVER_LAST, /* required last item */ VMWARE_DRIVER_LAST, /* required last item */
}; };

View File

@ -40,6 +40,10 @@
*/ */
static const char * const vmrun_candidates[] = { static const char * const vmrun_candidates[] = {
"vmrun", "vmrun",
#ifdef __APPLE__
"/Applications/VMware Fusion.app/Contents/Library/vmrun",
"/Library/Application Support/VMware Fusion/vmrun",
#endif /* __APPLE__ */
}; };
static void static void
@ -103,7 +107,8 @@ vmwareConnectOpen(virConnectPtr conn,
} else { } else {
if (conn->uri->scheme == NULL || if (conn->uri->scheme == NULL ||
(STRNEQ(conn->uri->scheme, "vmwareplayer") && (STRNEQ(conn->uri->scheme, "vmwareplayer") &&
STRNEQ(conn->uri->scheme, "vmwarews"))) STRNEQ(conn->uri->scheme, "vmwarews") &&
STRNEQ(conn->uri->scheme, "vmwarefusion")))
return VIR_DRV_OPEN_DECLINED; return VIR_DRV_OPEN_DECLINED;
/* If server name is given, its for remote driver */ /* If server name is given, its for remote driver */
@ -113,7 +118,7 @@ vmwareConnectOpen(virConnectPtr conn,
/* If path isn't /session, then they typoed, so tell them correct path */ /* If path isn't /session, then they typoed, so tell them correct path */
if (conn->uri->path == NULL || STRNEQ(conn->uri->path, "/session")) { if (conn->uri->path == NULL || STRNEQ(conn->uri->path, "/session")) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unexpected VMware URI path '%s', try vmwareplayer:///session or vmwarews:///session"), _("unexpected VMware URI path '%s', try vmwareplayer:///session, vmwarews:///session or vmwarefusion:///session"),
NULLSTR(conn->uri->path)); NULLSTR(conn->uri->path));
return VIR_DRV_OPEN_ERROR; return VIR_DRV_OPEN_ERROR;
} }