+1
Sharad Mishra
System x Enablement
Linux Technology Center
IBM
Kaitlin Rupert
<kaitlin(a)linux.vn
et.ibm.com> To
Sent by: libvirt-cim(a)redhat.com
libvirt-cim-bounc cc
es(a)redhat.com
Subject.
[Libvirt-cim] [PATCH 2 of 2] Modify
06/26/2009 04:57 _do_instance() so that is takes
PM a previous instance param
Please respond to
List for
discussion and
development of
libvirt CIM
<libvirt-cim@redh
at.com>
# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1246060597 25200
# Node ID 00047bd35641e678e3b7fb0832e5aa8ec4b7a8dd
# Parent 6b1f7181f1633e456bc7e90c09f7943588c28865
Modify _do_instance() so that is takes a previous instance param
This change is needed so that we can pass in an instance that represents
the guest prior to the modification.
Currently, we don't have a way to get the previous state of the guest from
the
event loop. This change is a necessary first step for providing that
functionality.
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 6b1f7181f163 -r 00047bd35641 src/Virt_ComputerSystemIndication.c
--- a/src/Virt_ComputerSystemIndication.c Fri Jun 26 16:56:13 2009
-0700
+++ b/src/Virt_ComputerSystemIndication.c Fri Jun 26 16:56:37 2009
-0700
@@ -222,6 +222,7 @@
static bool _do_indication(const CMPIBroker *broker,
const CMPIContext *ctx,
+ CMPIInstance *prev_inst,
CMPIInstance *affected_inst,
int ind_type,
char *prefix,
@@ -279,7 +280,7 @@
if (ind_type == CS_MODIFIED) {
CMSetProperty(ind, "PreviousInstance",
- (CMPIValue *)&affected_inst, CMPI_instance);
+ (CMPIValue *)&prev_inst, CMPI_instance);
}
CMSetProperty(ind, "SourceInstance",
@@ -340,6 +341,7 @@
char *name = NULL;
char *cn = NULL;
CMPIObjectPath *op;
+ CMPIInstance *prev_inst;
CMPIInstance *affected_inst;
CMPIStatus s = {CMPI_RC_OK, NULL};
@@ -361,19 +363,21 @@
if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op))
goto out;
- /* FIXME: This gets the CS instance after it has been modified. We
also
- need a way to get the instance before it was modified - that
- value is used when setting the PreviousInstance value. */
s = get_domain_by_name(_BROKER, op, name, &affected_inst);
if (s.rc != CMPI_RC_OK)
goto out;
+ /* FIXME: We are unable to get the previous CS instance after it
has
+ been modified. Consider keeping track of the previous
+ state in the place we keep track of the requested state
*/
+ prev_inst = affected_inst;
+
CMSetProperty(affected_inst, "Name",
(CMPIValue *)name, CMPI_chars);
CMSetProperty(affected_inst, "UUID",
(CMPIValue *)prev_dom.uuid, CMPI_chars);
- rc = _do_indication(_BROKER, context, affected_inst,
+ rc = _do_indication(_BROKER, context, prev_inst, affected_inst,
ind_type, prefix, args);
out:
_______________________________________________
Libvirt-cim mailing list
Libvirt-cim(a)redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-cim