[PATCH 0 of 2] Some misc ComputerSystemIndication related changes

This is some cleanup that needs to be done in order to properly set the PreviousInstance attribute. Right now, the same value is being used for SourceInstance as well as PreviousInstance, which isn't valid. This issue will be addressed in a follow-up set of patches.

# HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1246060573 25200 # Node ID 6b1f7181f1633e456bc7e90c09f7943588c28865 # Parent f1f435da7db3230365969a7abdbeeff9ef154676 Remove type_name param from _do_indication in CSIndication No reason to pass the indication name if we're already passing the indication type. Also, remove the call to set the AffectedSystem property. This property doesn't exist in any of the Indications classes in the 2.21 schema - also doesn't exist in our own local schema. Not sure why this value was being set, doesn't appear to be a property in the 2.16 schema either. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r f1f435da7db3 -r 6b1f7181f163 src/Virt_ComputerSystemIndication.c --- a/src/Virt_ComputerSystemIndication.c Wed Jun 24 10:27:16 2009 -0700 +++ b/src/Virt_ComputerSystemIndication.c Fri Jun 26 16:56:13 2009 -0700 @@ -224,16 +224,28 @@ const CMPIContext *ctx, CMPIInstance *affected_inst, int ind_type, - const char *ind_type_name, char *prefix, struct ind_args *args) { + const char *ind_type_name = NULL; CMPIObjectPath *affected_op; CMPIObjectPath *ind_op; CMPIInstance *ind; CMPIStatus s; bool ret = true; + switch (ind_type) { + case CS_CREATED: + ind_type_name = "ComputerSystemCreatedIndication"; + break; + case CS_DELETED: + ind_type_name = "ComputerSystemDeletedIndication"; + break; + case CS_MODIFIED: + ind_type_name = "ComputerSystemModifiedIndication"; + break; + } + ind = get_typed_instance(broker, prefix, ind_type_name, @@ -265,16 +277,9 @@ } CMSetNameSpace(affected_op, args->ns); - switch (ind_type) { - case CS_CREATED: - case CS_DELETED: - CMSetProperty(ind, "AffectedSystem", - (CMPIValue *)&affected_op, CMPI_ref); - break; - case CS_MODIFIED: + if (ind_type == CS_MODIFIED) { CMSetProperty(ind, "PreviousInstance", (CMPIValue *)&affected_inst, CMPI_instance); - break; } CMSetProperty(ind, "SourceInstance", @@ -333,7 +338,6 @@ { bool rc = false; char *name = NULL; - char *type_name = NULL; char *cn = NULL; CMPIObjectPath *op; CMPIInstance *affected_inst; @@ -364,25 +368,13 @@ if (s.rc != CMPI_RC_OK) goto out; - switch (ind_type) { - case CS_CREATED: - type_name = "ComputerSystemCreatedIndication"; - break; - case CS_DELETED: - type_name = "ComputerSystemDeletedIndication"; - break; - case CS_MODIFIED: - type_name = "ComputerSystemModifiedIndication"; - break; - } - 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, - ind_type, type_name, prefix, args); + ind_type, prefix, args); out: free(cn);

+1 Sharad Mishra System x Enablement Linux Technology Center IBM Kaitlin Rupert <kaitlin@linux.vn et.ibm.com> To Sent by: libvirt-cim@redhat.com libvirt-cim-bounc cc es@redhat.com Subject [Libvirt-cim] [PATCH 1 of 2] Remove 06/26/2009 04:57 type_name param from PM _do_indication in CSIndication Please respond to List for discussion and development of libvirt CIM <libvirt-cim@redh at.com> # HG changeset patch # User Kaitlin Rupert <karupert@us.ibm.com> # Date 1246060573 25200 # Node ID 6b1f7181f1633e456bc7e90c09f7943588c28865 # Parent f1f435da7db3230365969a7abdbeeff9ef154676 Remove type_name param from _do_indication in CSIndication No reason to pass the indication name if we're already passing the indication type. Also, remove the call to set the AffectedSystem property. This property doesn't exist in any of the Indications classes in the 2.21 schema - also doesn't exist in our own local schema. Not sure why this value was being set, doesn't appear to be a property in the 2.16 schema either. Signed-off-by: Kaitlin Rupert <karupert@us.ibm.com> diff -r f1f435da7db3 -r 6b1f7181f163 src/Virt_ComputerSystemIndication.c --- a/src/Virt_ComputerSystemIndication.c Wed Jun 24 10:27:16 2009 -0700 +++ b/src/Virt_ComputerSystemIndication.c Fri Jun 26 16:56:13 2009 -0700 @@ -224,16 +224,28 @@ const CMPIContext *ctx, CMPIInstance *affected_inst, int ind_type, - const char *ind_type_name, char *prefix, struct ind_args *args) { + const char *ind_type_name = NULL; CMPIObjectPath *affected_op; CMPIObjectPath *ind_op; CMPIInstance *ind; CMPIStatus s; bool ret = true; + switch (ind_type) { + case CS_CREATED: + ind_type_name = "ComputerSystemCreatedIndication"; + break; + case CS_DELETED: + ind_type_name = "ComputerSystemDeletedIndication"; + break; + case CS_MODIFIED: + ind_type_name = "ComputerSystemModifiedIndication"; + break; + } + ind = get_typed_instance(broker, prefix, ind_type_name, @@ -265,16 +277,9 @@ } CMSetNameSpace(affected_op, args->ns); - switch (ind_type) { - case CS_CREATED: - case CS_DELETED: - CMSetProperty(ind, "AffectedSystem", - (CMPIValue *)&affected_op, CMPI_ref); - break; - case CS_MODIFIED: + if (ind_type == CS_MODIFIED) { CMSetProperty(ind, "PreviousInstance", (CMPIValue *)&affected_inst, CMPI_instance); - break; } CMSetProperty(ind, "SourceInstance", @@ -333,7 +338,6 @@ { bool rc = false; char *name = NULL; - char *type_name = NULL; char *cn = NULL; CMPIObjectPath *op; CMPIInstance *affected_inst; @@ -364,25 +368,13 @@ if (s.rc != CMPI_RC_OK) goto out; - switch (ind_type) { - case CS_CREATED: - type_name = "ComputerSystemCreatedIndication"; - break; - case CS_DELETED: - type_name = "ComputerSystemDeletedIndication"; - break; - case CS_MODIFIED: - type_name = "ComputerSystemModifiedIndication"; - break; - } - 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, - ind_type, type_name, prefix, args); + ind_type, prefix, args); out: free(cn); _______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

# HG changeset patch # User Kaitlin Rupert <karupert@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@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:

+1 Sharad Mishra System x Enablement Linux Technology Center IBM Kaitlin Rupert <kaitlin@linux.vn et.ibm.com> To Sent by: libvirt-cim@redhat.com libvirt-cim-bounc cc es@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@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@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@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim

+1 Sharad Mishra System x Enablement Linux Technology Center IBM Kaitlin Rupert <kaitlin@linux.vn et.ibm.com> To Sent by: libvirt-cim@redhat.com libvirt-cim-bounc cc es@redhat.com Subject [Libvirt-cim] [PATCH 0 of 2] Some 06/26/2009 04:57 misc ComputerSystemIndication PM related changes Please respond to List for discussion and development of libvirt CIM <libvirt-cim@redh at.com> This is some cleanup that needs to be done in order to properly set the PreviousInstance attribute. Right now, the same value is being used for SourceInstance as well as PreviousInstance, which isn't valid. This issue will be addressed in a follow-up set of patches. _______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
participants (2)
-
Kaitlin Rupert
-
Sharad Mishra