[Libvirt-cim] [PATCH] {#2) Add state transition poll to DestroySystem() call

Kaitlin Rupert kaitlin at linux.vnet.ibm.com
Wed Jul 2 19:49:16 UTC 2008


# HG changeset patch
# User Kaitlin Rupert <karupert at us.ibm.com>
# Date 1215027772 25200
# Node ID 4d99e7ac6e39a1f077b5476fdb3ad01e32c5fe13
# Parent  35d00def6476eb4e21b3a26837682362917f9915
{#2) Add state transition poll to DestroySystem() call.

Updates from 1 to 2:
    -Remove polling loop
    -Move indications trigger to where the status is set (no need to duplicate the call).

Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>

diff -r 35d00def6476 -r 4d99e7ac6e39 src/Virt_VirtualSystemManagementService.c
--- a/src/Virt_VirtualSystemManagementService.c	Wed Jul 02 08:57:04 2008 -0700
+++ b/src/Virt_VirtualSystemManagementService.c	Wed Jul 02 12:42:52 2008 -0700
@@ -858,11 +858,17 @@
         infostore_delete(virConnectGetType(conn), dom_name);
 
         virDomainDestroy(dom); /* Okay for this to fail */
+
+        dom = virDomainLookupByName(conn, dom_name);
+        if (dom == NULL) {
+                CU_DEBUG("Domain successfully destroyed");
+                rc = IM_RC_OK;
+                goto error;
+        }
+
         if (virDomainUndefine(dom) == 0) {
+                CU_DEBUG("Domain successfully destroyed and undefined");
                 rc = IM_RC_OK;
-                trigger_indication(context,
-                                   "ComputerSystemDeletedIndication",
-                                   reference);
         }
 
 error:
@@ -874,8 +880,12 @@
                 cu_statusf(_BROKER, &status,
                            CMPI_RC_ERR_FAILED,
                            "Unable to retrieve domain name.");
-        else if (rc == IM_RC_OK)
+        else if (rc == IM_RC_OK) {
                 status = (CMPIStatus){CMPI_RC_OK, NULL};
+                trigger_indication(context,
+                                   "ComputerSystemDeletedIndication",
+                                   reference);
+        }
 
         virDomainFree(dom);
         virConnectClose(conn);




More information about the Libvirt-cim mailing list