Re: [PATCH v3 04/12] parallels: handle events from parallels server

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



27.11.2014 17:51, Dmitry Guryanov пишет:
On Tuesday 25 November 2014 15:31:19 Maxim Nestratov wrote:
18.11.2014 16:16, Dmitry Guryanov пишет:
From: Alexander Burluka <aburluka@xxxxxxxxxxxxx>

Subscribe to events from parallels server. It's
needed for 2 things: to update cached domains list
and to send corresponding libvirt events.

Parallels server sends a lot of different events, in
this patch we handle only some of them. In the future
we can handle for example, changes in a host network
configuration or devices states.

Signed-off-by: Dmitry Guryanov <dguryanov@xxxxxxxxxxxxx>
....
+ error:
+    return -1;
+}
+
+void prlsdkUnsubscribeFromPCSEvents(parallelsConnPtr privconn)
+{
+    PRL_RESULT ret = PRL_ERR_UNINITIALIZED;
+    ret = PrlSrv_UnregEventHandler(privconn->server,
+                                 prlsdkEventsHandler,
+                                 privconn);
+    if (PRL_FAILED(ret))
+        logPrlError(ret);
+}
diff --git a/src/parallels/parallels_sdk.h b/src/parallels/parallels_sdk.h
index d9461ca..5ffbf53 100644
--- a/src/parallels/parallels_sdk.h
+++ b/src/parallels/parallels_sdk.h
@@ -32,3 +32,5 @@ int

   prlsdkLoadDomains(parallelsConnPtr privconn);
   virDomainObjPtr
   prlsdkAddDomain(parallelsConnPtr privconn, const unsigned char *uuid);

+int prlsdkSubscribeToPCSEvents(parallelsConnPtr privconn);
+void prlsdkUnsubscribeFromPCSEvents(parallelsConnPtr privconn);
I would protect all event processing functions
(prlsdkHandleVmStateEvent, prlsdkHandleVmConfigEvent,
prlsdkHandleVmAddedEvent, prlsdkHandleVmRemovedEvent) with
parallelsDriverLock/parallelsDriverUnlock calls to prevent possible
races triggered by simultaneous operations on the same domain.
Otherwise, ack.
Functions virDomainObjListAdd and virDomainObjListRemove lock domains list, so
no need to protect the privconn->domains list twice.

Function virDomainObjListFindByUUID returns locked virDomainObj. So all
affected objects are already protected.




Hm. Argeed. I missed the point that  virDomainObjListFindByUUID takes mutex.
Then calling parallelsDriverLock/parallelsDriverUnlock in parallelsDomainDefineXML looks unnecessary.

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





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]