
# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1195493224 28800 # Node ID 00deec21b241f4f29207138456f3623b7867d04f # Parent cfc79d123d0a9760c8c6c1e3d81ef4683e93b988 Make RASD use connect_by_classname() Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r cfc79d123d0a -r 00deec21b241 src/Virt_RASD.c --- a/src/Virt_RASD.c Mon Nov 19 09:12:49 2007 -0800 +++ b/src/Virt_RASD.c Mon Nov 19 09:27:04 2007 -0800 @@ -175,7 +175,7 @@ static CMPIInstance *rasd_from_vdev(cons } static CMPIInstance *get_rasd_instance(const CMPIContext *context, - const CMPIObjectPath *ns, + const CMPIObjectPath *ref, const char *id, const uint16_t type) { @@ -191,13 +191,13 @@ static CMPIInstance *get_rasd_instance(c if (!ret) return NULL; - conn = lv_connect(_BROKER, &s); + conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); if (conn == NULL) goto out; dev = find_dev(conn, type, host, devid); if (dev) - inst = rasd_from_vdev(_BROKER, dev, host, NAMESPACE(ns)); + inst = rasd_from_vdev(_BROKER, dev, host, NAMESPACE(ref)); out: virConnectClose(conn); @@ -276,7 +276,7 @@ int rasds_for_domain(const CMPIBroker *b int rasds_for_domain(const CMPIBroker *broker, const char *name, const uint16_t type, - const char *ns, + const CMPIObjectPath *ref, struct inst_list *_list) { struct virt_device *list; @@ -284,8 +284,10 @@ int rasds_for_domain(const CMPIBroker *b int i; virConnectPtr conn; CMPIStatus s; - - conn = lv_connect(_BROKER, &s); + const char *ns = NAMESPACE(ref); + const char *cn = CLASSNAME(ref); + + conn = connect_by_classname(broker, cn, &s); if (conn == NULL) return 0; diff -r cfc79d123d0a -r 00deec21b241 src/Virt_RASD.h --- a/src/Virt_RASD.h Mon Nov 19 09:12:49 2007 -0800 +++ b/src/Virt_RASD.h Mon Nov 19 09:27:04 2007 -0800 @@ -22,11 +22,23 @@ #define __VIRT_RASD_H char *rasd_to_xml(CMPIInstance *rasd); + +/** + * Get a list of RASDs for a given domain + * + * @param broker The current broker + * @param name The name of the domain in question + * @param type The ResourceType of the desired RASDs + * @param ref A reference used for hypervisor connection and namespace + * setting of the resulting instances + * @param _list The list of instances to populate + */ int rasds_for_domain(const CMPIBroker *broker, const char *name, const uint16_t type, - const char *ns, + const CMPIObjectPath *ref, struct inst_list *_list); + CMPIrc rasd_type_from_classname(const char *cn, uint16_t *type); #endif diff -r cfc79d123d0a -r 00deec21b241 src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Mon Nov 19 09:12:49 2007 -0800 +++ b/src/Virt_ResourceAllocationFromPool.c Mon Nov 19 09:27:04 2007 -0800 @@ -134,7 +134,7 @@ static int filter_by_pool(struct inst_li } static int rasds_from_pool(uint16_t type, - const char *ns, + const CMPIObjectPath *ref, const char *poolid, struct inst_list *list) { @@ -161,7 +161,7 @@ static int rasds_from_pool(uint16_t type rasds_for_domain(_BROKER, name, type, - ns, + ref, &tmp); filter_by_pool(list, &tmp, poolid); @@ -194,22 +194,22 @@ static CMPIStatus pool_to_rasd(const CMP if (STARTS_WITH(poolid, "ProcessorPool")) rasds_from_pool(CIM_RASD_TYPE_PROC, - NAMESPACE(ref), + ref, poolid, list); else if (STARTS_WITH(poolid, "MemoryPool")) rasds_from_pool(CIM_RASD_TYPE_MEM, - NAMESPACE(ref), + ref, poolid, list); else if (STARTS_WITH(poolid, "NetworkPool")) rasds_from_pool(CIM_RASD_TYPE_NET, - NAMESPACE(ref), + ref, poolid, list); else if (STARTS_WITH(poolid, "DiskPool")) rasds_from_pool(CIM_RASD_TYPE_DISK, - NAMESPACE(ref), + ref, poolid, list); else { diff -r cfc79d123d0a -r 00deec21b241 src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Mon Nov 19 09:12:49 2007 -0800 +++ b/src/Virt_SettingsDefineState.c Mon Nov 19 09:27:04 2007 -0800 @@ -99,7 +99,7 @@ static CMPIStatus dev_to_rasd(const CMPI ret = rasds_for_domain(_BROKER, name, device_type_from_classname(CLASSNAME(ref)), - NAMESPACE(ref), + ref, &rasds); rasd = find_rasd(&rasds, id); diff -r cfc79d123d0a -r 00deec21b241 src/Virt_VSSDComponent.c --- a/src/Virt_VSSDComponent.c Mon Nov 19 09:12:49 2007 -0800 +++ b/src/Virt_VSSDComponent.c Mon Nov 19 09:27:04 2007 -0800 @@ -64,7 +64,7 @@ static CMPIStatus vssd_to_rasd(const CMP rasds_for_domain(_BROKER, name, types[i], - NAMESPACE(ref), + ref, list); }