[Libvirt-cim] [PATCH 5 of 9] RAFP: Provider registered per subclass

Heidi Eckhart heidieck at linux.vnet.ibm.com
Wed Dec 5 08:30:14 UTC 2007


# HG changeset patch
# User Heidi Eckhart <heidieck at linux.vnet.ibm.com>
# Date 1196844142 -3600
# Node ID 9751a165ebca953b720faf81c4fdfd5d0748aa6a
# Parent  cf48a55a717b1aa79345e95aff6cfec96cbc2d65
RAFP: Provider registered per subclass

The provider registration approach - registering one provider
per subclass (Xen_<classname>Provider, KVM_<classname>Provider)
caused interoperability issues with Pegasus and sfcb. The same
call returned duplicates with sfcb and worked with Pegasus.
Signed-off-by: Heidi Eckhart <heidieck at linux.vnet.ibm.com>

diff -r cf48a55a717b -r 9751a165ebca schema/ResourceAllocationFromPool.registration
--- a/schema/ResourceAllocationFromPool.registration	Wed Dec 05 09:42:22 2007 +0100
+++ b/schema/ResourceAllocationFromPool.registration	Wed Dec 05 09:42:22 2007 +0100
@@ -1,4 +1,4 @@
 # Copyright IBM Corp. 2007
 # Classname Namespace ProviderName ProviderModule ProviderTypes
-Xen_ResourceAllocationFromPool root/virt Xen_ResourceAllocationFromPoolProvider Virt_ResourceAllocationFromPool association
-KVM_ResourceAllocationFromPool root/virt KVM_ResourceAllocationFromPoolProvider Virt_ResourceAllocationFromPool association
\ No newline at end of file
+Xen_ResourceAllocationFromPool root/virt Virt_ResourceAllocationFromPoolProvider Virt_ResourceAllocationFromPool association
+KVM_ResourceAllocationFromPool root/virt Virt_ResourceAllocationFromPoolProvider Virt_ResourceAllocationFromPool association
\ No newline at end of file
diff -r cf48a55a717b -r 9751a165ebca src/Virt_ResourceAllocationFromPool.c
--- a/src/Virt_ResourceAllocationFromPool.c	Wed Dec 05 09:42:22 2007 +0100
+++ b/src/Virt_ResourceAllocationFromPool.c	Wed Dec 05 09:42:22 2007 +0100
@@ -41,13 +41,16 @@ static CMPIStatus rasd_to_pool(const CMP
                                struct std_assoc_info *info,
                                struct inst_list *list)
 {
-        CMPIStatus s;
+        CMPIStatus s = {CMPI_RC_OK, NULL};
         uint16_t type;
         const char *id = NULL;
         char *poolid = NULL;
         virConnectPtr conn = NULL;
         struct inst_list _list;
         CMPIInstance *pool = NULL;
+
+        if (!match_hypervisor_prefix(ref, info))
+                return s;
 
         inst_list_init(&_list);
 
@@ -177,8 +180,11 @@ static CMPIStatus pool_to_rasd(const CMP
                                struct std_assoc_info *info,
                                struct inst_list *list)
 {
-        CMPIStatus s;
+        CMPIStatus s = {CMPI_RC_OK, NULL};
         const char *poolid;
+
+        if (!match_hypervisor_prefix(ref, info))
+                return s;
 
         if (cu_get_str_path(ref, "InstanceID", &poolid) != CMPI_RC_OK) {
                 cu_statusf(_BROKER, &s,
@@ -305,8 +311,7 @@ static struct std_assoc *handlers[] = {
         NULL
 };
 
-STDA_AssocMIStub(, Xen_ResourceAllocationFromPoolProvider, _BROKER, libvirt_cim_init(), handlers);
-STDA_AssocMIStub(, KVM_ResourceAllocationFromPoolProvider, _BROKER, libvirt_cim_init(), handlers);
+STDA_AssocMIStub(, Virt_ResourceAllocationFromPoolProvider, _BROKER, libvirt_cim_init(), handlers);
 
 /*
  * Local Variables:




More information about the Libvirt-cim mailing list