Kaitlin Rupert <kaitlin@linux.vnet.ibm.com>
Sent by: libvirt-cim-bounces@redhat.com
06/29/2009 05:05 PM
Please respond to
List for discussion and development of libvirt CIM <libvirt-cim@redhat.com>
To
libvirt-cim@redhat.com
cc
Subject
[Libvirt-cim] [PATCH 3 of 3] When a guest is modified, raise an indication and set the PreviousInstance prop
# HG changeset patch
# User Kaitlin Rupert <karupert@us.ibm.com>
# Date 1245869168 25200
# Node ID 7e1613aaff99b7ff536a9bd0277345bf2d62f4f1
# Parent ca56533192e5a5715c66a8d9ebe0d0fedfe02bd3
When a guest is modified, raise an indication and set the PreviousInstance prop
Be sure to get the instance of the guest to modifying the guest. This value is
needed when we generate an indication.
To test this:
Modify a guest and make sure the SourceInstance and PreviousInstance
values differ and are correctly set.
ret = cu_get_u16_arg(argsin, "RequestedState", &state);
if (ret != CMPI_RC_OK) {
@@ -1088,22 +1123,24 @@
goto out;
}
+ /* Retain original instance of the guest to use for the PreviousInstance attribute when generating an indication. */
+ s = get_domain_by_name(_BROKER, reference, name, &prev_inst);
+ if (s.rc != CMPI_RC_OK || prev_inst == NULL) {
+ cu_statusf(_BROKER, &s,
+ CMPI_RC_ERR_INVALID_PARAMETER,
+ "Unable to get instance for guest '%s'",
+ name);
+ goto out;
+ }
+
s = __state_change(name, state, reference);
if (s.rc == CMPI_RC_OK) {
- char *type = NULL;
-
- type = get_typed_class(CLASSNAME(reference),
- "ComputerSystemModifiedIndication");
-
- /* Failure to raise the indication is okay */
- stdi_trigger_indication(_BROKER,
- context,
- type,
- NAMESPACE(reference));
+ ind_rc= trigger_mod_indication(context, prev_inst, reference);
+ if (!ind_rc)
+ CU_DEBUG("Unable to trigger indication");
+
rc = 0;
-
- free(type);
}
out:
CMReturnData(results, &rc, CMPI_uint32);