[Libvirt-cim] [PATCH] Set SourceInstance attribute for ComputerSystem lifecycle indications
Richard Maciel
rmaciel at linux.vnet.ibm.com
Tue Jun 16 01:44:35 UTC 2009
+1
Kaitlin Rupert wrote:
> # HG changeset patch
> # User Kaitlin Rupert <karupert at us.ibm.com>
> # Date 1244844711 25200
> # Node ID 6cef00a4aca53a184b97ff3f87f059cb59beef5c
> # Parent 789961b4cb621eeb0b01115629b0895098f92686
> Set SourceInstance attribute for ComputerSystem lifecycle indications
>
> This can be tested using the indication tester with the --print option to verify
> the SourceInstance attribute is set properly:
>
> python indication_tester.py -U user -P mypass -u localhost:5988 KVM_ComputerSystemCreatedIndication --print
>
> Once you are subscribed to the indication, you will then need to generate an
> indication by defining a guest through the providers.
>
> Signed-off-by: Kaitlin Rupert <karupert at us.ibm.com>
>
> diff -r 789961b4cb62 -r 6cef00a4aca5 src/Virt_ComputerSystemIndication.c
> --- a/src/Virt_ComputerSystemIndication.c Sun Jun 07 14:39:33 2009 -0300
> +++ b/src/Virt_ComputerSystemIndication.c Fri Jun 12 15:11:51 2009 -0700
> @@ -277,6 +277,9 @@
> break;
> }
>
> + CMSetProperty(ind, "SourceInstance",
> + (CMPIValue *)&affected_inst, CMPI_instance);
> +
> set_source_inst_props(broker, ctx, affected_op, ind);
>
> CU_DEBUG("Delivering Indication: %s",
> @@ -328,21 +331,19 @@
> char *prefix,
> struct ind_args *args)
> {
> - bool rc;
> + bool rc = false;
> char *name = NULL;
> char *type_name = NULL;
> + char *cn = NULL;
> + CMPIObjectPath *op;
> CMPIInstance *affected_inst;
> + CMPIStatus s = {CMPI_RC_OK, NULL};
>
> if (!lifecycle_enabled) {
> CU_DEBUG("CSI not enabled, skipping indication delivery");
> return false;
> }
>
> - affected_inst = get_typed_instance(_BROKER,
> - prefix,
> - "ComputerSystem",
> - args->ns);
> -
> name = sys_name_from_xml(prev_dom.xml);
> CU_DEBUG("Name for system: '%s'", name);
> if (name == NULL) {
> @@ -350,6 +351,19 @@
> goto out;
> }
>
> + cn = get_typed_class(prefix, "ComputerSystem");
> +
> + op = CMNewObjectPath(_BROKER, args->ns, cn, &s);
> + 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;
> +
> switch (ind_type) {
> case CS_CREATED:
> type_name = "ComputerSystemCreatedIndication";
> @@ -371,6 +385,7 @@
> ind_type, type_name, prefix, args);
>
> out:
> + free(cn);
> free(name);
> return rc;
> }
>
> _______________________________________________
> Libvirt-cim mailing list
> Libvirt-cim at redhat.com
> https://www.redhat.com/mailman/listinfo/libvirt-cim
--
Richard Maciel, MSc
IBM Linux Technology Center
rmaciel at linux.vnet.ibm.com
More information about the Libvirt-cim
mailing list