[libvirt] [PATCH v3] parallels: add block device statistics to driver

Nikolay Shirokovskiy nshirokovskiy at parallels.com
Fri Jun 5 14:14:16 UTC 2015


Will resend this patch as i discover double freeing of event handle.
Next patch will be rebased on "[PATCH] parallels: return only success from PCS event handler"
as this make fix of described problem easier.

On 04.06.2015 15:11, Nikolay Shirokovskiy wrote:
> Statistics provided through PCS SDK. As we have only async interface in SDK we
> need to be subscribed to statistics in order to get it. Trivial solution on
> every stat request to subscribe, wait event and then unsubscribe will lead to
> significant delays in case of a number of successive requests, as the event
> will be delivered on next PCS server notify cycle. On the other hand we don't
> want to keep unnesessary subscribtion. So we take an hibrid solution to
> subcsribe on first request and then keep a subscription while requests are
> active. We populate cache of statistics on subscribtion events and use this
> cache to serve libvirts requests.
> 
>  * Cache details.
> Cache is just handle to last arrived event, we call this cache
> as if this handle is valid it is used to serve synchronous
> statistics requests. We use number of successive events count
> to detect that user lost interest to statistics. We reset this
> count to 0 on every request. If more than PARALLELS_STATISTICS_DROP_COUNT
> successive events arrive we unsubscribe. Special value of -1
> of this counter is used to differentiate between subscribed/unsubscribed state
> to protect from delayed events.
> 
> Values of PARALLELS_STATISTICS_DROP_COUNT and PARALLELS_STATISTICS_TIMEOUT are
> just drop-ins, choosen without special consideration.
> 
>  * Thread safety issues
> Use parallelsDomObjFromDomainRef in parallelsDomainBlockStats as
> we could wait on domain lock down on stack in prlsdkGetStatsParam
> and if we won't keep reference we could get dangling pointer
> on return from wait.
> 
> Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy at parallels.com>
> ---
>  src/parallels/parallels_driver.c |  106 +++++++++++++++++++++
>  src/parallels/parallels_sdk.c    |  189 ++++++++++++++++++++++++++++++++++++++
>  src/parallels/parallels_sdk.h    |    2 +
>  src/parallels/parallels_utils.c  |   28 ++++++
>  src/parallels/parallels_utils.h  |   18 ++++
>  5 files changed, 343 insertions(+), 0 deletions(-)




More information about the libvir-list mailing list