[PATCH 0 of 4] Transition to connect_by_classname()

Updated set to not use PN macro, and fix the instance warnings.

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1195487984 28800 # Node ID baa6107cec2c6211c262750c097eb2c552816268 # Parent a8e5699b3e0cb6342837442a184f01083ebdb924 Add function to initialize libvirt Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r a8e5699b3e0c -r baa6107cec2c libxkutil/misc_util.c --- a/libxkutil/misc_util.c Mon Nov 19 06:40:37 2007 -0800 +++ b/libxkutil/misc_util.c Mon Nov 19 07:59:44 2007 -0800 @@ -421,6 +421,11 @@ bool parse_instanceid(const CMPIObjectPa return true; } +bool libvirt_cim_init(void) +{ + return virInitialize == 0; +} + /* * Local Variables: * mode: C diff -r a8e5699b3e0c -r baa6107cec2c libxkutil/misc_util.h --- a/libxkutil/misc_util.h Mon Nov 19 06:40:37 2007 -0800 +++ b/libxkutil/misc_util.h Mon Nov 19 07:59:44 2007 -0800 @@ -92,6 +92,8 @@ int parse_id(char *id, char **pfx, char int parse_id(char *id, char **pfx, char **name); bool parse_instanceid(const CMPIObjectPath *ref, char **pfx, char **name); +bool libvirt_cim_init(void); + #define ASSOC_MATCH(pn, cn) \ if (!match_pn_to_cn((pn), (cn))) { \ return (CMPIStatus){CMPI_RC_OK, NULL}; \

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1195487992 28800 # Node ID b9d3217689a1335a1a1c2eded1f52ad36f91e978 # Parent baa6107cec2c6211c262750c097eb2c552816268 Make providers initialize library at load Also change instance providers to new macro to avoid warnings Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r baa6107cec2c -r b9d3217689a1 src/Virt_AllocationCapabilities.c --- a/src/Virt_AllocationCapabilities.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_AllocationCapabilities.c Mon Nov 19 07:59:52 2007 -0800 @@ -26,6 +26,8 @@ #include <cmpimacs.h> #include "libcmpiutil.h" +#include "std_instance.h" + #include "misc_util.h" #include "Virt_AllocationCapabilities.h" @@ -101,14 +103,8 @@ DEFAULT_EQ(); DEFAULT_EQ(); DEFAULT_INST_CLEANUP(); -/* Avoid a warning in the stub macro below */ -CMPIInstanceMI * -Virt_AllocationCapabilitiesProvider_Create_InstanceMI(const CMPIBroker *, - const CMPIContext *, - CMPIStatus *rc); - -CMInstanceMIStub(, Virt_AllocationCapabilitiesProvider, _BROKER, - CMNoHook); +STD_InstanceMIStub(, Virt_AllocationCapabilitiesProvider, _BROKER, + libvirt_cim_init()); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_ComputerSystem.c --- a/src/Virt_ComputerSystem.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_ComputerSystem.c Mon Nov 19 07:59:52 2007 -0800 @@ -34,6 +34,7 @@ #include "libcmpiutil.h" #include "misc_util.h" #include "std_invokemethod.h" +#include "std_instance.h" #include "Virt_ComputerSystem.h" @@ -682,13 +683,7 @@ static CMPIStatus state_change(CMPIMetho return s; } -/* Avoid a warning in the stub macro below */ -CMPIInstanceMI * -Virt_ComputerSystemProvider_Create_InstanceMI(const CMPIBroker *, - const CMPIContext *, - CMPIStatus *rc); - -CMInstanceMIStub(, Virt_ComputerSystemProvider, _BROKER, CMNoHook); +STD_InstanceMIStub(, Virt_ComputerSystemProvider, _BROKER, libvirt_cim_init()); static struct method_handler RequestStateChange = { .name = "RequestStateChange", @@ -707,7 +702,7 @@ STDIM_MethodMIStub(, STDIM_MethodMIStub(, Virt_ComputerSystemProvider, _BROKER, - CMNoHook, + libvirt_cim_init(), my_handlers); /* diff -r baa6107cec2c -r b9d3217689a1 src/Virt_ComputerSystemIndication.c --- a/src/Virt_ComputerSystemIndication.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_ComputerSystemIndication.c Mon Nov 19 07:59:52 2007 -0800 @@ -301,7 +301,7 @@ DEFAULT_MP(); DEFAULT_MP(); STDI_IndicationMIStub(, Virt_ComputerSystemIndicationProvider, - _BROKER, CMNoHook, &csi); + _BROKER, libvirt_cim_init(), &csi); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_Device.c --- a/src/Virt_Device.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_Device.c Mon Nov 19 07:59:52 2007 -0800 @@ -30,6 +30,7 @@ #include <cmpimacs.h> #include "libcmpiutil.h" +#include "std_instance.h" #include "cs_util.h" #include "misc_util.h" #include "device_parsing.h" @@ -531,13 +532,7 @@ DEFAULT_EQ(); DEFAULT_EQ(); DEFAULT_INST_CLEANUP(); -/* Avoid a warning in the stub macro below */ -CMPIInstanceMI * -Virt_DeviceProvider_Create_InstanceMI(const CMPIBroker *, - const CMPIContext *, - CMPIStatus *rc); - -CMInstanceMIStub(, Virt_DeviceProvider, _BROKER, CMNoHook); +STD_InstanceMIStub(, Virt_DeviceProvider, _BROKER, libvirt_cim_init()); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_DevicePool.c --- a/src/Virt_DevicePool.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_DevicePool.c Mon Nov 19 07:59:52 2007 -0800 @@ -39,6 +39,7 @@ #include "device_parsing.h" #include <libcmpiutil.h> +#include <std_instance.h> #include "Virt_DevicePool.h" #include "svpc_types.h" @@ -718,13 +719,7 @@ DEFAULT_EQ(); DEFAULT_EQ(); DEFAULT_INST_CLEANUP(); -/* Avoid a warning in the stub macro below */ -CMPIInstanceMI * -Virt_DevicePoolProvider_Create_InstanceMI(const CMPIBroker *, - const CMPIContext *, - CMPIStatus *rc); - -CMInstanceMIStub(, Virt_DevicePoolProvider, _BROKER, CMNoHook); +STD_InstanceMIStub(, Virt_DevicePoolProvider, _BROKER, libvirt_cim_init()); /* diff -r baa6107cec2c -r b9d3217689a1 src/Virt_ElementAllocatedFromPool.c --- a/src/Virt_ElementAllocatedFromPool.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_ElementAllocatedFromPool.c Mon Nov 19 07:59:52 2007 -0800 @@ -292,8 +292,8 @@ static struct std_assoc *handlers[] = { NULL }; -STDA_AssocMIStub(, Xen_ElementAllocatedFromPoolProvider, _BROKER, CMNoHook, handlers); -STDA_AssocMIStub(, KVM_ElementAllocatedFromPoolProvider, _BROKER, CMNoHook, handlers); +STDA_AssocMIStub(, Xen_ElementAllocatedFromPoolProvider, _BROKER, libvirt_cim_init(), handlers); +STDA_AssocMIStub(, KVM_ElementAllocatedFromPoolProvider, _BROKER, libvirt_cim_init(), handlers); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_ElementCapabilities.c --- a/src/Virt_ElementCapabilities.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_ElementCapabilities.c Mon Nov 19 07:59:52 2007 -0800 @@ -358,8 +358,8 @@ struct std_assoc *assoc_handlers[] = { }; -STDA_AssocMIStub(, Xen_ElementCapabilitiesProvider, _BROKER, CMNoHook, assoc_handlers); -STDA_AssocMIStub(, KVM_ElementCapabilitiesProvider, _BROKER, CMNoHook, assoc_handlers); +STDA_AssocMIStub(, Xen_ElementCapabilitiesProvider, _BROKER, libvirt_cim_init(), assoc_handlers); +STDA_AssocMIStub(, KVM_ElementCapabilitiesProvider, _BROKER, libvirt_cim_init(), assoc_handlers); /* * Local Variables: * mode: C diff -r baa6107cec2c -r b9d3217689a1 src/Virt_ElementConformsToProfile.c --- a/src/Virt_ElementConformsToProfile.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_ElementConformsToProfile.c Mon Nov 19 07:59:52 2007 -0800 @@ -225,7 +225,7 @@ struct std_assoc *assoc_handlers[] = { }; -STDA_AssocMIStub(, Virt_ElementConformsToProfileProvider, _BROKER, CMNoHook, assoc_handlers); +STDA_AssocMIStub(, Virt_ElementConformsToProfileProvider, _BROKER, libvirt_cim_init(), assoc_handlers); /* * Local Variables: * mode: C diff -r baa6107cec2c -r b9d3217689a1 src/Virt_ElementSettingData.c --- a/src/Virt_ElementSettingData.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_ElementSettingData.c Mon Nov 19 07:59:52 2007 -0800 @@ -147,8 +147,8 @@ static struct std_assoc *handlers[] = { NULL }; -STDA_AssocMIStub(, Xen_ElementSettingDataProvider, _BROKER, CMNoHook, handlers); -STDA_AssocMIStub(, KVM_ElementSettingDataProvider, _BROKER, CMNoHook, handlers); +STDA_AssocMIStub(, Xen_ElementSettingDataProvider, _BROKER, libvirt_cim_init(), handlers); +STDA_AssocMIStub(, KVM_ElementSettingDataProvider, _BROKER, libvirt_cim_init(), handlers); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_EnabledLogicalElementCapabilities.c --- a/src/Virt_EnabledLogicalElementCapabilities.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_EnabledLogicalElementCapabilities.c Mon Nov 19 07:59:52 2007 -0800 @@ -27,6 +27,8 @@ #include <cmpimacs.h> #include "libcmpiutil.h" +#include "std_instance.h" + #include "misc_util.h" #include "device_parsing.h" @@ -201,14 +203,8 @@ DEFAULT_EQ(); DEFAULT_EQ(); DEFAULT_INST_CLEANUP(); -/* Avoid a warning in the stub macro below */ -CMPIInstanceMI * -Virt_EnabledLogicalElementCapabilitiesProvider_Create_InstanceMI(const CMPIBroker *, - const CMPIContext *, - CMPIStatus *rc); - -CMInstanceMIStub(, Virt_EnabledLogicalElementCapabilitiesProvider, _BROKER, - CMNoHook); +STD_InstanceMIStub(, Virt_EnabledLogicalElementCapabilitiesProvider, _BROKER, + libvirt_cim_init()); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_HostSystem.c --- a/src/Virt_HostSystem.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_HostSystem.c Mon Nov 19 07:59:52 2007 -0800 @@ -28,6 +28,8 @@ #include <cmpimacs.h> #include "libcmpiutil.h" +#include "std_instance.h" + #include "misc_util.h" #include "Virt_HostSystem.h" @@ -155,13 +157,7 @@ DEFAULT_EQ(); DEFAULT_EQ(); DEFAULT_INST_CLEANUP(); -/* Avoid a warning in the stub macro below */ -CMPIInstanceMI * -Virt_HostSystemProvider_Create_InstanceMI(const CMPIBroker *, - const CMPIContext *, - CMPIStatus *rc); - -CMInstanceMIStub(, Virt_HostSystemProvider, _BROKER, CMNoHook); +STD_InstanceMIStub(, Virt_HostSystemProvider, _BROKER, libvirt_cim_init()); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_HostedDependency.c --- a/src/Virt_HostedDependency.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_HostedDependency.c Mon Nov 19 07:59:52 2007 -0800 @@ -150,7 +150,7 @@ static struct std_assoc *handlers[] = { NULL }; -STDA_AssocMIStub(, Virt_HostedDependencyProvider, _BROKER, CMNoHook, handlers); +STDA_AssocMIStub(, Virt_HostedDependencyProvider, _BROKER, libvirt_cim_init(), handlers); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_HostedResourcePool.c --- a/src/Virt_HostedResourcePool.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_HostedResourcePool.c Mon Nov 19 07:59:52 2007 -0800 @@ -151,7 +151,7 @@ struct std_assoc *assoc_handlers[] = { }; -STDA_AssocMIStub(, Virt_HostedResourcePoolProvider, _BROKER, CMNoHook, assoc_handlers); +STDA_AssocMIStub(, Virt_HostedResourcePoolProvider, _BROKER, libvirt_cim_init(), assoc_handlers); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_HostedService.c --- a/src/Virt_HostedService.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_HostedService.c Mon Nov 19 07:59:52 2007 -0800 @@ -164,8 +164,8 @@ static struct std_assoc *handlers[] = { NULL }; -STDA_AssocMIStub(, Xen_HostedServiceProvider, _BROKER, CMNoHook, handlers); -STDA_AssocMIStub(, KVM_HostedServiceProvider, _BROKER, CMNoHook, handlers); +STDA_AssocMIStub(, Xen_HostedServiceProvider, _BROKER, libvirt_cim_init(), handlers); +STDA_AssocMIStub(, KVM_HostedServiceProvider, _BROKER, libvirt_cim_init(), handlers); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_RASD.c --- a/src/Virt_RASD.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_RASD.c Mon Nov 19 07:59:52 2007 -0800 @@ -29,6 +29,8 @@ #include <cmpimacs.h> #include <libcmpiutil.h> +#include <std_instance.h> + #include "device_parsing.h" #include "misc_util.h" @@ -313,13 +315,7 @@ DEFAULT_INST_CLEANUP(); DEFAULT_INST_CLEANUP(); DEFAULT_EQ(); -/* Avoid a warning in the stub macro below */ -CMPIInstanceMI * -Virt_RASDProvider_Create_InstanceMI(const CMPIBroker *, - const CMPIContext *, - CMPIStatus *rc); - -CMInstanceMIStub(, Virt_RASDProvider, _BROKER, CMNoHook); +STD_InstanceMIStub(, Virt_RASDProvider, _BROKER, libvirt_cim_init()); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_RegisteredProfile.c --- a/src/Virt_RegisteredProfile.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_RegisteredProfile.c Mon Nov 19 07:59:52 2007 -0800 @@ -29,8 +29,10 @@ #include <cmpift.h> #include <cmpimacs.h> +#include "libcmpiutil.h" +#include "std_instance.h" + #include "cs_util.h" -#include "libcmpiutil.h" #include "misc_util.h" #include "profiles.h" @@ -186,13 +188,8 @@ DEFAULT_EQ(); DEFAULT_EQ(); DEFAULT_INST_CLEANUP(); -/* Avoid a warning in the stub macro below */ -CMPIInstanceMI * -Virt_RegisteredProfileProvider_Create_InstanceMI(const CMPIBroker *, - const CMPIContext *, - CMPIStatus *rc); - -CMInstanceMIStub(, Virt_RegisteredProfileProvider, _BROKER, CMNoHook); +STD_InstanceMIStub(, Virt_RegisteredProfileProvider, _BROKER, + libvirt_cim_init()); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_ResourceAllocationFromPool.c --- a/src/Virt_ResourceAllocationFromPool.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_ResourceAllocationFromPool.c Mon Nov 19 07:59:52 2007 -0800 @@ -277,8 +277,8 @@ static struct std_assoc *handlers[] = { NULL }; -STDA_AssocMIStub(, Xen_ResourceAllocationFromPoolProvider, _BROKER, CMNoHook, handlers); -STDA_AssocMIStub(, KVM_ResourceAllocationFromPoolProvider, _BROKER, CMNoHook, handlers); +STDA_AssocMIStub(, Xen_ResourceAllocationFromPoolProvider, _BROKER, libvirt_cim_init(), handlers); +STDA_AssocMIStub(, KVM_ResourceAllocationFromPoolProvider, _BROKER, libvirt_cim_init(), handlers); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_ResourcePoolConfigurationCapabilities.c --- a/src/Virt_ResourcePoolConfigurationCapabilities.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_ResourcePoolConfigurationCapabilities.c Mon Nov 19 07:59:52 2007 -0800 @@ -27,6 +27,8 @@ #include <cmpimacs.h> #include "libcmpiutil.h" +#include "std_instance.h" + #include "misc_util.h" const static CMPIBroker *_BROKER; @@ -112,14 +114,8 @@ static CMPIStatus GetInstance(CMPIInstan } -/* Avoid a warning in the stub macro below */ -CMPIInstanceMI * -Virt_ResourcePoolConfigurationCapabilitiesProvider_Create_InstanceMI(const CMPIBroker *, - const CMPIContext *, - CMPIStatus *rc); - -CMInstanceMIStub(, Virt_ResourcePoolConfigurationCapabilitiesProvider, _BROKER, - CMNoHook); +STD_InstanceMIStub(, Virt_ResourcePoolConfigurationCapabilitiesProvider, + _BROKER, libvirt_cim_init()); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_ResourcePoolConfigurationService.c --- a/src/Virt_ResourcePoolConfigurationService.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_ResourcePoolConfigurationService.c Mon Nov 19 07:59:52 2007 -0800 @@ -24,6 +24,7 @@ #include <libcmpiutil.h> #include <std_invokemethod.h> +#include <std_instance.h> #include "misc_util.h" @@ -82,7 +83,7 @@ static struct method_handler *my_handler }; STDIM_MethodMIStub(, Virt_ResourcePoolConfigurationServiceProvider, - _BROKER, CMNoHook, my_handlers); + _BROKER, libvirt_cim_init(), my_handlers); DEFAULT_CI(); DEFAULT_MI(); @@ -203,13 +204,8 @@ static CMPIStatus EnumInstances(CMPIInst } -CMPIInstanceMI * -Virt_ResourcePoolConfigurationServiceProvider_Create_InstanceMI(const CMPIBroker *, - const CMPIContext *, - CMPIStatus *rc); - -CMInstanceMIStub(, Virt_ResourcePoolConfigurationServiceProvider, - _BROKER, CMNoHook); +STD_InstanceMIStub(, Virt_ResourcePoolConfigurationServiceProvider, + _BROKER, libvirt_cim_init()); /* diff -r baa6107cec2c -r b9d3217689a1 src/Virt_SettingsDefineCapabilities.c --- a/src/Virt_SettingsDefineCapabilities.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_SettingsDefineCapabilities.c Mon Nov 19 07:59:52 2007 -0800 @@ -872,8 +872,8 @@ struct std_assoc *assoc_handlers[] = { }; -STDA_AssocMIStub(, Xen_SettingsDefineCapabilitiesProvider, _BROKER, CMNoHook, assoc_handlers); -STDA_AssocMIStub(, KVM_SettingsDefineCapabilitiesProvider, _BROKER, CMNoHook, assoc_handlers); +STDA_AssocMIStub(, Xen_SettingsDefineCapabilitiesProvider, _BROKER, libvirt_cim_init(), assoc_handlers); +STDA_AssocMIStub(, KVM_SettingsDefineCapabilitiesProvider, _BROKER, libvirt_cim_init(), assoc_handlers); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_SettingsDefineState.c --- a/src/Virt_SettingsDefineState.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_SettingsDefineState.c Mon Nov 19 07:59:52 2007 -0800 @@ -365,8 +365,8 @@ static struct std_assoc *handlers[] = { NULL }; -STDA_AssocMIStub(, Xen_SettingsDefineStateProvider, _BROKER, CMNoHook, handlers); -STDA_AssocMIStub(, KVM_SettingsDefineStateProvider, _BROKER, CMNoHook, handlers); +STDA_AssocMIStub(, Xen_SettingsDefineStateProvider, _BROKER, libvirt_cim_init(), handlers); +STDA_AssocMIStub(, KVM_SettingsDefineStateProvider, _BROKER, libvirt_cim_init(), handlers); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_SystemDevice.c --- a/src/Virt_SystemDevice.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_SystemDevice.c Mon Nov 19 07:59:52 2007 -0800 @@ -265,8 +265,8 @@ static struct std_assoc *assoc_handlers[ NULL }; -STDA_AssocMIStub(, Xen_SystemDeviceProvider, _BROKER, CMNoHook, assoc_handlers); -STDA_AssocMIStub(, KVM_SystemDeviceProvider, _BROKER, CMNoHook, assoc_handlers); +STDA_AssocMIStub(, Xen_SystemDeviceProvider, _BROKER, libvirt_cim_init(), assoc_handlers); +STDA_AssocMIStub(, KVM_SystemDeviceProvider, _BROKER, libvirt_cim_init(), assoc_handlers); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_VSSD.c --- a/src/Virt_VSSD.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_VSSD.c Mon Nov 19 07:59:52 2007 -0800 @@ -28,6 +28,8 @@ #include <cmpimacs.h> #include "libcmpiutil.h" +#include "std_instance.h" + #include "cs_util.h" #include "misc_util.h" #include "device_parsing.h" @@ -260,13 +262,7 @@ DEFAULT_EQ(); DEFAULT_EQ(); DEFAULT_INST_CLEANUP(); -/* Avoid a warning in the stub macro below */ -CMPIInstanceMI * -Virt_VSSDProvider_Create_InstanceMI(const CMPIBroker *, - const CMPIContext *, - CMPIStatus *rc); - -CMInstanceMIStub(, Virt_VSSDProvider, _BROKER, CMNoHook); +STD_InstanceMIStub(, Virt_VSSDProvider, _BROKER, libvirt_cim_init()); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_VSSDComponent.c --- a/src/Virt_VSSDComponent.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_VSSDComponent.c Mon Nov 19 07:59:52 2007 -0800 @@ -202,8 +202,8 @@ static struct std_assoc *handlers[] = { NULL }; -STDA_AssocMIStub(, Xen_VSSDComponentProvider, _BROKER, CMNoHook, handlers); -STDA_AssocMIStub(, KVM_VSSDComponentProvider, _BROKER, CMNoHook, handlers); +STDA_AssocMIStub(, Xen_VSSDComponentProvider, _BROKER, libvirt_cim_init(), handlers); +STDA_AssocMIStub(, KVM_VSSDComponentProvider, _BROKER, libvirt_cim_init(), handlers); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_VirtualSystemManagementCapabilities.c --- a/src/Virt_VirtualSystemManagementCapabilities.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_VirtualSystemManagementCapabilities.c Mon Nov 19 07:59:52 2007 -0800 @@ -27,6 +27,8 @@ #include <cmpimacs.h> #include "libcmpiutil.h" +#include "std_instance.h" + #include "misc_util.h" #include "device_parsing.h" @@ -188,14 +190,8 @@ DEFAULT_EQ(); DEFAULT_EQ(); DEFAULT_INST_CLEANUP(); -/* Avoid a warning in the stub macro below */ -CMPIInstanceMI * -Virt_VirtualSystemManagementCapabilitiesProvider_Create_InstanceMI(const CMPIBroker *, - const CMPIContext *, - CMPIStatus *rc); - -CMInstanceMIStub(, Virt_VirtualSystemManagementCapabilitiesProvider, _BROKER, - CMNoHook); +STD_InstanceMIStub(, Virt_VirtualSystemManagementCapabilitiesProvider, _BROKER, + libvirt_cim_init()); /* * Local Variables: diff -r baa6107cec2c -r b9d3217689a1 src/Virt_VirtualSystemManagementService.c --- a/src/Virt_VirtualSystemManagementService.c Mon Nov 19 07:59:44 2007 -0800 +++ b/src/Virt_VirtualSystemManagementService.c Mon Nov 19 07:59:52 2007 -0800 @@ -36,9 +36,10 @@ #include "xmlgen.h" #include "libcmpiutil.h" - #include "std_invokemethod.h" #include "std_indication.h" +#include "std_instance.h" + #include "misc_util.h" #include "Virt_VirtualSystemManagementService.h" @@ -1020,7 +1021,7 @@ static struct method_handler *my_handler }; STDIM_MethodMIStub(, Virt_VirtualSystemManagementService, - _BROKER, CMNoHook, my_handlers); + _BROKER, libvirt_cim_init(), my_handlers); CMPIStatus get_vsms(const CMPIObjectPath *reference, CMPIInstance **_inst, @@ -1150,13 +1151,8 @@ DEFAULT_EQ(); DEFAULT_EQ(); DEFAULT_INST_CLEANUP(); -/* Avoid a warning in the stub macro below */ -CMPIInstanceMI * -Virt_VirtualSystemManagementService_Create_InstanceMI(const CMPIBroker *, - const CMPIContext *, - CMPIStatus *rc); - -CMInstanceMIStub(, Virt_VirtualSystemManagementService, _BROKER, CMNoHook); +STD_InstanceMIStub(, Virt_VirtualSystemManagementService, _BROKER, + libvirt_cim_init()); /*

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1195487994 28800 # Node ID ef1552498688b0892f2c8d65c238da1d4a765e9c # Parent b9d3217689a1335a1a1c2eded1f52ad36f91e978 Changes to misc_utils.c for connect_by_classname() Includes Heidi's change to not return an error on failed connect. I chose to leave the failure in place if a proper URI could not be determined because this really means we were called for a prefix we don't support, which /is/ a problem. If we need to iterate over subclasses later down the road for differing CIMOM behavior, we should do it before we get here. Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r b9d3217689a1 -r ef1552498688 libxkutil/misc_util.c --- a/libxkutil/misc_util.c Mon Nov 19 07:59:52 2007 -0800 +++ b/libxkutil/misc_util.c Mon Nov 19 07:59:54 2007 -0800 @@ -56,6 +56,8 @@ virConnectPtr connect_by_classname(const const char *uri; virConnectPtr conn; + CMSetStatus(s, CMPI_RC_OK); + uri = cn_to_uri(classname); if (!uri) { CMSetStatusWithChars(broker, s, @@ -64,11 +66,11 @@ virConnectPtr connect_by_classname(const return NULL; } + CU_DEBUG("Connecting to libvirt with uri `%s'", uri); + conn = virConnectOpen(uri); if (!conn) { - CMSetStatusWithChars(broker, s, - CMPI_RC_ERR_FAILED, - "Unable to connect to hypervisor"); + CU_DEBUG("Unable to connect to `%s'", uri); return NULL; } @@ -334,28 +336,21 @@ bool provider_is_responsible(const CMPIB const CMPIObjectPath *reference, CMPIStatus *status) { - const char *dft_pfx; char *pfx; - bool rc = false; + bool rc = true; CMSetStatus(status, CMPI_RC_OK); pfx = class_prefix_name(CLASSNAME(reference)); - if (STREQC(pfx, "CIM")) + if (STREQC(pfx, "CIM")) { cu_statusf(broker, status, CMPI_RC_ERR_FAILED, "Please exactly specify the class (check CIMOM behavior!): %s", CLASSNAME(reference)); - - dft_pfx = default_prefix(); - if (dft_pfx == NULL) - goto out; - - if (STREQC(pfx, dft_pfx)) - rc = true; - - out: + rc = false; + } + free(pfx); return rc; }

# HG changeset patch # User Dan Smith <danms@us.ibm.com> # Date 1195488003 28800 # Node ID 66f0dde5f3fd81a495a1597033e180e251817054 # Parent ef1552498688b0892f2c8d65c238da1d4a765e9c Transition back to connect_by_classname() This patch contains the previously-discussed changes to ComputerSystem and SystemDevice (including Heidi's change to remove provider_is_responsible()). If this looks okay to people, then I'll start in on provider-by-provider conversions. Previously, we used the incoming reference for all operations to determine the URI to pass to libvirt during a connect operation. For some reason, we transitioned away from that to a detection-based mechanism, which would not support multiple technologies to be managed from the provider simultaneously. I think that we have enough other infrastructure in place now that this is no longer a problem. As a test, I offer this patch with a few key instances of lv_connect() replaced with connect_by_classname() for discussion. I have tested that enumeration of Xen_ComputerSystem, KVM_ComputerSystem, and CIM_ComputerSystem are exclusive, and do not return any duplicate results. Further, I have confirmed that resolving Xen_SystemDevice against a KVM_ComputerSystem instance does not work, and that no duplicate results are returned in the case of CIM_SystemDevice. Signed-off-by: Dan Smith <danms@us.ibm.com> diff -r ef1552498688 -r 66f0dde5f3fd src/Virt_ComputerSystem.c --- a/src/Virt_ComputerSystem.c Mon Nov 19 07:59:54 2007 -0800 +++ b/src/Virt_ComputerSystem.c Mon Nov 19 08:00:03 2007 -0800 @@ -344,10 +344,7 @@ static CMPIStatus return_enum_domains(co virConnectPtr conn = NULL; int ret; - if (!provider_is_responsible(_BROKER, reference, &s)) - return s; - - conn = lv_connect(_BROKER, &s); + conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s); if (conn == NULL) return s; @@ -387,7 +384,7 @@ static CMPIStatus get_domain(const CMPIO return s; } - conn = lv_connect(_BROKER, &s); + conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s); if (conn == NULL) return s; @@ -610,7 +607,7 @@ static CMPIStatus __state_change(char *n virDomainPtr dom = NULL; virDomainInfo info; - conn = lv_connect(_BROKER, &s); + conn = connect_by_classname(_BROKER, CLASSNAME(ref), &s); if (conn == NULL) goto out; diff -r ef1552498688 -r 66f0dde5f3fd src/Virt_SystemDevice.c --- a/src/Virt_SystemDevice.c Mon Nov 19 07:59:54 2007 -0800 +++ b/src/Virt_SystemDevice.c Mon Nov 19 08:00:03 2007 -0800 @@ -61,6 +61,7 @@ static int get_dom_devices(const char *n static int get_dom_devices(const char *name, struct inst_list *list, int type, + const char *host_cn, const char *ns) { virConnectPtr conn = NULL; @@ -68,7 +69,7 @@ static int get_dom_devices(const char *n CMPIStatus s; int ret = 0; - conn = lv_connect(_BROKER, &s); + conn = connect_by_classname(_BROKER, host_cn, &s); if (conn == NULL) goto out; @@ -87,17 +88,19 @@ static int get_dom_devices(const char *n static int get_all_devices(const char *name, struct inst_list *list, - char *ns) + const char *host_cn, + const char *ns) { int i; for (i = 0; i < DEV_TYPE_COUNT; i++) - get_dom_devices(name, list, device_types[i], ns); + get_dom_devices(name, list, device_types[i], host_cn, ns); return i; } static CMPIInstance *host_instance(char *name, + const char *host_cn, const char *ns) { CMPIInstance *inst = NULL; @@ -114,7 +117,7 @@ static CMPIInstance *host_instance(char if ((s.rc != CMPI_RC_OK) || CMIsNullObject(op)) goto out; - conn = lv_connect(_BROKER, &s); + conn = connect_by_classname(_BROKER, host_cn, &s); if (conn == NULL) goto out; @@ -173,9 +176,16 @@ static CMPIStatus sys_to_dev(const CMPIO type = device_type_from_classname(info->result_class); - ret = get_dom_devices(host, list, type, NAMESPACE(ref)); + ret = get_dom_devices(host, + list, + type, + CLASSNAME(ref), + NAMESPACE(ref)); } else { - ret = get_all_devices(host, list, NAMESPACE(ref)); + ret = get_all_devices(host, + list, + CLASSNAME(ref), + NAMESPACE(ref)); } if (ret >= 0) { @@ -218,6 +228,7 @@ static CMPIStatus dev_to_sys(const CMPIO } sys = host_instance(host, + CLASSNAME(ref), NAMESPACE(ref)); if (sys == NULL)

Dan Smith wrote:
Updated set to not use PN macro, and fix the instance warnings.
_______________________________________________ Libvirt-cim mailing list Libvirt-cim@redhat.com https://www.redhat.com/mailman/listinfo/libvirt-cim
This looks good. I also applied the patch set to my tree. Was able to compile and test just fine. +1 -- Kaitlin Rupert IBM Linux Technology Center karupert@us.ibm.com
participants (2)
-
Dan Smith
-
Kaitlin Rupert