On Tue, Sep 24, 2013 at 11:24 AM, Doug Goldstein <car...@cardoe.com> wrote:
> Add support for VMware Fusion in the existing VMware driver.  Connect
> via the URI vmwarefusion:///session
> ---
>
> change from v2:
> * Re-add missing hunk that got rebased away in vmwareParseVersionStr()
>
> change from v1:
> * ifdef PATH for Apple machines only
>
> ---
>  docs/drvvmware.html.in     | 15 +++++++++++----
>  src/vmware/vmware_conf.c   | 11 ++++++++++-
>  src/vmware/vmware_conf.h   |  1 +
>  src/vmware/vmware_driver.c |  5 +++++
>  4 files changed, 27 insertions(+), 5 deletions(-)
>
> diff --git a/docs/drvvmware.html.in b/docs/drvvmware.html.in
> index 9ee0ebd..240afd0 100644
> --- a/docs/drvvmware.html.in
> +++ b/docs/drvvmware.html.in
> @@ -2,10 +2,11 @@
>  <!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";>
>      <body>
> -        <h1>VMware Workstation / Player hypervisors driver</h1>
> +        <h1>VMware Workstation / Player / Fusion hypervisors driver</h1>
>          <p>
> -        The libvirt VMware Workstation driver should be able to manage any 
> Workstation and
> -        Player version supported by the VMware VIX API. See the 
> compatibility list
> +        The libvirt VMware driver should be able to manage any Workstation,
> +        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>.
>      </p>
>      <p>
> @@ -21,17 +22,22 @@
>          The <a href="http://www.vmware.com/";>VMware Workstation and
>          Player</a> hypervisors
>        </li>
> +      <li>
> +        The <a href="http://www.vmware.com/fusion";>VMware Fusion</a>
> +        hypervisor
> +      </li>
>      </ul>
>
>      <h2>Connections to VMware driver</h2>
>
>      <p>
>      The libvirt VMware driver provides per-user drivers (the "session" 
> instance).
> -    Two uris are available:
> +    Three uris are available:
>      </p>
>      <ul>
>        <li>"vmwareplayer" for VMware Player</li>
>        <li>"vmwarews" for VMware Workstation</li>
> +      <li>"vmwarefusion" for VMware Fusion</li>
>      </ul>
>      <p>
>      Some example connection URIs for the driver are:
> @@ -40,6 +46,7 @@
>  <pre>
>  vmwareplayer:///session                  (local access to VMware Player 
> 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://u...@example.com/session  (remote access to VMware 
> Workstation, SASl/Kerberos)
>  vmwarews+ssh://u...@example.com/session  (remote access to VMware 
> Workstation, SSH tunnelled)
>  </pre>
> diff --git a/src/vmware/vmware_conf.c b/src/vmware/vmware_conf.c
> index c11c92d..027e245 100644
> --- a/src/vmware/vmware_conf.c
> +++ b/src/vmware/vmware_conf.c
> @@ -37,7 +37,8 @@
>
>  VIR_ENUM_IMPL(vmwareDriver, VMWARE_DRIVER_LAST,
>                "player",
> -              "ws");
> +              "ws",
> +              "fusion");
>
>  /* Free all memory associated with a vmware_driver structure */
>  void
> @@ -231,6 +232,9 @@ vmwareParseVersionStr(int type, const char *verbuf, 
> unsigned long *version)
>          case VMWARE_DRIVER_WORKSTATION:
>              pattern = "VMware Workstation ";
>              break;
> +        case VMWARE_DRIVER_FUSION:
> +            pattern = "\nVMware Fusion Information:\nVMware Fusion ";
> +            break;
>          default:
>              virReportError(VIR_ERR_INTERNAL_ERROR,
>                             _("Invalid driver type: %d"), type);
> @@ -276,6 +280,11 @@ vmwareExtractVersion(struct vmware_driver *driver)
>                  goto cleanup;
>              break;
>
> +        case VMWARE_DRIVER_FUSION:
> +            if (virAsprintf(&bin, "%s/%s", vmwarePath, "vmware-vmx"))
> +                goto cleanup;
> +            break;
> +
>          default:
>              virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
>                         _("invalid driver type for version detection"));
> diff --git a/src/vmware/vmware_conf.h b/src/vmware/vmware_conf.h
> index a4fd855..b9fca6c 100644
> --- a/src/vmware/vmware_conf.h
> +++ b/src/vmware/vmware_conf.h
> @@ -33,6 +33,7 @@
>  enum vmwareDriverType {
>      VMWARE_DRIVER_PLAYER      = 0, /* VMware Player */
>      VMWARE_DRIVER_WORKSTATION = 1, /* VMware Workstation */
> +    VMWARE_DRIVER_FUSION      = 2, /* VMware Fusion */
>
>      VMWARE_DRIVER_LAST,            /* required last item */
>  };
> diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
> index 01d65ed..4db2ad2 100644
> --- a/src/vmware/vmware_driver.c
> +++ b/src/vmware/vmware_driver.c
> @@ -40,6 +40,10 @@
>   */
>  static const char * const vmrun_candidates[] = {
>      "vmrun",
> +#ifdef __APPLE__
> +    "/Applications/VMware Fusion.app/Contents/Library/vmrun",
> +    "/Library/Application Support/VMware Fusion/vmrun",
> +#endif /* __APPLE__ */
>  };
>
>  static void
> @@ -103,6 +107,7 @@ vmwareConnectOpen(virConnectPtr conn,
>      } else {
>          if (conn->uri->scheme == NULL ||
>              (STRNEQ(conn->uri->scheme, "vmwareplayer") &&
> +             STRNEQ(conn->uri->scheme, "vmwarefusion") &&
>               STRNEQ(conn->uri->scheme, "vmwarews")))
>              return VIR_DRV_OPEN_DECLINED;
>
> --
> 1.8.1.5
>

FWIW, this has been tested by Kurt Scholtens
<burnbrigh...@hotmail.com> (kurt on #virt). Via homebrew installed via
brew install http://dev.gentoo.org/~cardoe/files/libvirt.rb which is
1.1.2 + all the VMware related patches I've sent to this list since
1.1.2 and these two patches.

-- 
Doug Goldstein

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to