[libvirt] [PATCH 00/12] parallels: use SDK in parallels_driver.c

Dmitry Guryanov dguryanov at parallels.com
Tue Oct 28 12:52:01 UTC 2014


On Thursday 23 October 2014 19:58:04 Dmitry Guryanov wrote:
> This patch series replaces all code, which used prlctl command
> to interact with parallels cloud server with calls to
> parallels sdk functions.
> 
> The model of this driver remain almost the same - in creates a
> list of virDomainObj objects on connect and then functions, which
> returns different information get info from this list.
> 
> But functions, which modify domains (change state, define or undefine
> domain) don't modify this list directly. On connect driver subscribes
> to event from PCS and modify the list from that events handler.

It isn't correct, for example you call first virConnectDefineXML to define a 
new domain and virDomainLookupByName after that. Lookup function may fail, 
because event from PCS appear slightly later.

There are two possible solutions: first is to update privconn->domains in 
parallelsDomainDefineXML, parallelsDomainCreate, parallelsDomainDestroy e.t.c. 
So that this list will be up-to-date after modifications, done from the 
current connections. Disadvantage is that after local modification the list 
will be updated twice.

The second solution is to introduce "dirty" flag in virDomainObj and in the 
whole list. Functions, which change domain state should set this flag 
virDomainObj and lookup functions like virDomainObjListFindByUUID should wait 
until this flag become cleared. It can be done with condition variables. This 
method is more complex and requires modifications in common libvirt code.

So I've implemented the first method.

> 
> So cached list of domains will be always up-to-date either after
> modifications from currect connection or after modifications by
> another tools (like prlctl) or libvirt connections.
> 
> 
> 
> Alexander Burluka (4):
>   parallels: get domain info with SDK
>   parallels: handle events from parallels server
>   parallels: added function virDomainIsActive()
>   parallels: Add domainCreateWithFlags() function.
> 
> Dmitry Guryanov (8):
>   parallels: move IS_CT macro to parallels_utils.h
>   parallels: move parallelsDomNotFoundError to parallels_utils.h
>   parallels: reimplement functions, which change domain state
>   parallels: rewrite parallelsApplyConfig with SDK
>   parallels: create VMs and containers with sdk
>   parallels: fix parallelsDomainDefineXML
>   parallels: add cdroms support
>   parallels: implement domainUndefine and domainUndefineFlags
> 
>  src/parallels/parallels_driver.c | 2448
> +++++++------------------------------ src/parallels/parallels_sdk.c    |
> 2456 ++++++++++++++++++++++++++++++++++++++ src/parallels/parallels_sdk.h  
>  |   19 +
>  src/parallels/parallels_utils.h  |   11 +
>  4 files changed, 2939 insertions(+), 1995 deletions(-)

-- 
Dmitry Guryanov




More information about the libvir-list mailing list