[PATCH] Add SourceInstance{Host,ModelPath} to CSI

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1215014236 25200 # Node ID 5f084775a1757e92dc02eb950a30565c6dbb75a4 # Parent 35d00def6476eb4e21b3a26837682362917f9915 Add SourceInstance{Host,ModelPath} to CSI Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r 35d00def6476 -r 5f084775a175 src/Makefile.am --- a/src/Makefile.am Wed Jul 02 08:57:04 2008 -0700 +++ b/src/Makefile.am Wed Jul 02 08:57:16 2008 -0700 @@ -69,9 +69,9 @@ libVirt_ComputerSystem_la_SOURCES = Virt_ComputerSystem.c libVirt_Device_la_SOURCES = Virt_Device.c -libVirt_ComputerSystemIndication_la_DEPENDENCIES = libVirt_ComputerSystem.la +libVirt_ComputerSystemIndication_la_DEPENDENCIES = libVirt_ComputerSystem.la libVirt_HostSystem.la libVirt_ComputerSystemIndication_la_SOURCES = Virt_ComputerSystemIndication.c -libVirt_ComputerSystemIndication_la_LIBADD = -lVirt_ComputerSystem -lpthread -lrt +libVirt_ComputerSystemIndication_la_LIBADD = -lVirt_ComputerSystem -lVirt_HostSystem -lpthread -lrt libVirt_ComputerSystemMigrationIndication_la_DEPENDENCIES = libVirt_ComputerSystem.la libVirt_ComputerSystemMigrationIndication_la_SOURCES = Virt_ComputerSystemMigrationIndication.c diff -r 35d00def6476 -r 5f084775a175 src/Virt_ComputerSystemIndication.c --- a/src/Virt_ComputerSystemIndication.c Wed Jul 02 08:57:04 2008 -0700 +++ b/src/Virt_ComputerSystemIndication.c Wed Jul 02 08:57:16 2008 -0700 @@ -42,6 +42,7 @@ #include "Virt_ComputerSystem.h" #include "Virt_ComputerSystemIndication.h" +#include "Virt_HostSystem.h" static const CMPIBroker *_BROKER; @@ -184,6 +185,33 @@ return ret; } +static void set_source_inst_props(const CMPIBroker *broker, + CMPIObjectPath *ref, + CMPIInstance *ind) +{ + const char *host; + const char *hostccn; + CMPIStatus s; + CMPIString *str; + + str = CMObjectPathToString(ref, &s); + if ((str == NULL) || (s.rc != CMPI_RC_OK)) { + CU_DEBUG("Unable to get path string"); + } else { + CMSetProperty(ind, "SourceInstanceModelPath", + (CMPIValue *)&str, CMPI_string); + } + + s = get_host_system_properties(&host, &hostccn, ref, broker); + if (s.rc != CMPI_RC_OK) { + CU_DEBUG("Unable to get host properties (%s): %s", + CLASSNAME(ref), CMGetCharPtr(s.msg)); + } else { + CMSetProperty(ind, "SourceInstanceHost", + (CMPIValue *)host, CMPI_chars); + } +} + static bool _do_indication(const CMPIBroker *broker, const CMPIContext *ctx, CMPIInstance *affected_inst, @@ -217,17 +245,21 @@ if (s.rc != CMPI_RC_OK) { CU_DEBUG("Failed to get ind_op. Error: '%s'", s.msg); ret = false; + goto out; } + CMSetNameSpace(ind_op, args->ns); + + affected_op = CMGetObjectPath(affected_inst, &s); + if (s.rc != CMPI_RC_OK) { + ret = false; + CU_DEBUG("problem getting affected_op: '%s'", s.msg); + goto out; + } + CMSetNameSpace(affected_op, args->ns); switch (ind_type) { case CS_CREATED: case CS_DELETED: - affected_op = CMGetObjectPath(affected_inst, &s); - if (s.rc != CMPI_RC_OK) { - ret = false; - CU_DEBUG("problem getting affected_op: '%s'", s.msg); - goto out; - } CMSetProperty(ind, "AffectedSystem", (CMPIValue *)&affected_op, CMPI_ref); break; @@ -236,6 +268,8 @@ (CMPIValue *)&affected_inst, CMPI_instance); break; } + + set_source_inst_props(broker, affected_op, ind); CU_DEBUG("Delivering Indication: %s", CMGetCharPtr(CMObjectPathToString(ind_op, NULL)));
participants (1)
-
Dan Smith