On Friday 12 September 2014 10:11:52 Daniel P. Berrange wrote:
On Thu, Sep 11, 2014 at 06:19:23PM +0400, Dmitry Guryanov wrote:
> On Thursday 11 September 2014 12:09:20 Daniel P. Berrange wrote:
> > On Sat, Sep 06, 2014 at 08:28:10PM +0400, Dmitry Guryanov wrote:
> > > Add files parallels_sdk.c and parallels_sdk.h for code
> > > which works with SDK, so libvirt's code will not mix with
> > > dealing with parallels SDK.
> > >
> > > To use Parallels SDK you must first call PrlApi_InitEx function,
> > > and then you will be able to connect to a server with
> > > PrlSrv_LoginLocalEx function. When you've done you must call
> > > PrlApi_Deinit. So let's call PrlApi_InitEx on first .connectOpen,
> > > count number of connections and deinitialize, when this counter
> > > becomes zero.
> >
> > As a general rule, even if we count the open/close calls
> > it isn't safe to run deinit functions in libvirt. eg consider
> > if libvirt is linked against another program or library that
> > also uses the paralllels SDK. Libvirt does not know if the
> > other code has stopped using the SDK. So either the reference
> > counting must be done in PrlApi_{InitEx,Deinit} functions
> > directly, or libvirt should simply not call PrlApi_Deinit
> > at all. I'd probably just go with the latter, as I doubt there
> > is any real harm to skipping deinit.
>
> I can move reference counting to parallels SDK,
Ok cool.
In the configure.ac pkg-config check be sure to add a version number
comparison, so that we guarantee a new enough library to include the
ref counting you add.
We haven't released opensource version of parallels sdk yet, there is only git
available,
I've committed patch already. So the first released version will have ability to run
init
and deinit several times.
Regards,
Daniel
--
Dmitry Guryanov