[Libvirt-cim] [PATCH 2 of 2] Add CSI trigger call to VSMS

Jay Gagnon grendel at linux.vnet.ibm.com
Thu Jan 24 19:10:52 UTC 2008


# HG changeset patch
# User Jay Gagnon <grendel at linux.vnet.ibm.com>
# Date 1201201824 18000
# Node ID ba7915ed8b0063dd44766ed0ed596f99412761d0
# Parent  1d9cbc7cfb1f39a08dbf43070d0f1a140faa8fe4
Add CSI trigger call to VSMS

Now that ComputerSystemIndication is at the "maybe just a few tweaks" stage, it's time to get the trigger calls into VSMS.  This way, we can increase the sleep period on CSI's event loop, and when VSMS does something like modify a domain, it can just wake up CSI manually.  This gives us a fast response time without near-constant polling.

Signed-off-by: Jay Gagnon <grendel at linux.vnet.ibm.com>

diff -r 1d9cbc7cfb1f -r ba7915ed8b00 src/Virt_ComputerSystemIndication.c
--- a/src/Virt_ComputerSystemIndication.c	Thu Jan 24 14:07:47 2008 -0500
+++ b/src/Virt_ComputerSystemIndication.c	Thu Jan 24 14:10:24 2008 -0500
@@ -55,7 +55,7 @@ static pthread_mutex_t lifecycle_mutex =
 static pthread_mutex_t lifecycle_mutex = PTHREAD_MUTEX_INITIALIZER;
 static bool lifecycle_enabled = 0;
 
-#define WAIT_TIME 3
+#define WAIT_TIME 180
 #define FAIL_WAIT_TIME 2
 
 #ifdef CMPI_EI_VOID
@@ -469,6 +469,7 @@ static _EI_RTYPE DisableIndications(CMPI
 
 static CMPIStatus trigger_indication(const CMPIContext *context)
 {
+        CU_DEBUG("triggered");
         pthread_cond_signal(&lifecycle_cond);
         return(CMPIStatus){CMPI_RC_OK, NULL};
 }
diff -r 1d9cbc7cfb1f -r ba7915ed8b00 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c	Thu Jan 24 14:07:47 2008 -0500
+++ b/src/Virt_VirtualSystemManagementService.c	Thu Jan 24 14:10:24 2008 -0500
@@ -551,7 +551,8 @@ static CMPIStatus destroy_system(CMPIMet
         return status;
 }
 
-static CMPIStatus update_system_settings(const CMPIObjectPath *ref,
+static CMPIStatus update_system_settings(const CMPIContext *context,
+                                         const CMPIObjectPath *ref,
                                          CMPIInstance *vssd)
 {
         CMPIStatus s;
@@ -599,6 +600,12 @@ static CMPIStatus update_system_settings
                 connect_and_create(xml, ref, &s);
         }
 
+        if (s.rc == CMPI_RC_OK) {
+                trigger_indication(context,
+                                   "ComputerSystemModifiedIndication",
+                                   NAMESPACE(ref));
+        }
+
  out:
         free(xml);
         virDomainFree(dom);
@@ -640,7 +647,7 @@ static CMPIStatus mod_system_settings(CM
                 return s;
         }
 
-        return update_system_settings(reference, inst);
+        return update_system_settings(context, reference, inst);
 }
 
 typedef CMPIStatus (*resmod_fn)(struct domain *,




More information about the Libvirt-cim mailing list