[PATCH] Fix enum_domains() to generate a correct ObjectPath for returned Instances
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1194024510 25200
# Node ID d48584b1c90c499dea3940c1718ef0e97ae5ef9e
# Parent 854d848bae0b56420e483ac7522775b6b3080aaa
Fix enum_domains() to generate a correct ObjectPath for returned Instances
This fixes the fact that HostedDependency is returning ComputerSystem
instances with the wrong class name.
- Modified enum_domains() to take a namespace instead of an object path and
actually create the correct OP for the instances
- Removed an unnecessary parameter from instance_from_dom()
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r 854d848bae0b -r d48584b1c90c src/Virt_ComputerSystem.c
--- a/src/Virt_ComputerSystem.c Fri Nov 02 07:03:04 2007 -0700
+++ b/src/Virt_ComputerSystem.c Fri Nov 02 10:28:30 2007 -0700
@@ -239,8 +239,7 @@ static int set_creation_class(CMPIInstan
/* Populate an instance with information from a domain */
static int instance_from_dom(const CMPIBroker *broker,
virDomainPtr dom,
- CMPIInstance *instance,
- const CMPIObjectPath *reference)
+ CMPIInstance *instance)
{
if (!set_name_from_dom(dom, instance)) {
/* Print trace error */
@@ -291,7 +290,7 @@ CMPIInstance *instance_from_name(const C
if (instance == NULL)
goto out;
- if (!instance_from_dom(broker, dom, instance, op))
+ if (!instance_from_dom(broker, dom, instance))
instance = NULL;
out:
@@ -303,7 +302,7 @@ CMPIInstance *instance_from_name(const C
/* Enumerate domains on the given connection, return results */
int enum_domains(const CMPIBroker *broker,
virConnectPtr conn,
- const CMPIObjectPath *op,
+ const char *ns,
struct inst_list *instlist)
{
virDomainPtr *list = NULL;
@@ -315,14 +314,13 @@ int enum_domains(const CMPIBroker *broke
goto out;
for (i = 0; i < count; i++) {
- CMPIStatus s;
CMPIInstance *inst;
- inst = CMNewInstance(broker, op, &s);
- if ((s.rc != CMPI_RC_OK) || (CMIsNullObject(inst)))
+ inst = get_typed_instance(broker, "ComputerSystem", ns);
+ if (inst == NULL)
goto end;
- if (instance_from_dom(broker, list[i], inst, op))
+ if (instance_from_dom(broker, list[i], inst))
inst_list_add(instlist, inst);
end:
@@ -351,7 +349,7 @@ static CMPIStatus return_enum_domains(co
return s;
inst_list_init(&list);
- ret = enum_domains(_BROKER, conn, reference, &list);
+ ret = enum_domains(_BROKER, conn, NAMESPACE(reference), &list);
if (!ret) {
CMSetStatus(&s, CMPI_RC_ERR_FAILED);
goto out;
diff -r 854d848bae0b -r d48584b1c90c src/Virt_ComputerSystem.h
--- a/src/Virt_ComputerSystem.h Fri Nov 02 07:03:04 2007 -0700
+++ b/src/Virt_ComputerSystem.h Fri Nov 02 10:28:30 2007 -0700
@@ -49,7 +49,7 @@ CMPIInstance *instance_from_name(const C
*/
int enum_domains(const CMPIBroker *broker,
virConnectPtr conn,
- const CMPIObjectPath *op,
+ const char *ns,
struct inst_list *instlist);
diff -r 854d848bae0b -r d48584b1c90c src/Virt_HostedDependency.c
--- a/src/Virt_HostedDependency.c Fri Nov 02 07:03:04 2007 -0700
+++ b/src/Virt_HostedDependency.c Fri Nov 02 10:28:30 2007 -0700
@@ -62,7 +62,7 @@ static CMPIStatus host_to_vs(const CMPIO
if (conn == NULL)
return s;
- ret = enum_domains(_BROKER, conn, ref, list);
+ ret = enum_domains(_BROKER, conn, NAMESPACE(ref), list);
if (ret) {
CMSetStatus(&s, CMPI_RC_OK);
} else {
17 years, 1 month
[PATCH] Fix externally-visible name of type_from_classname()
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1424173382 28800
# Node ID f922cb6a051d0d4bf0186bb755627e5df981997f
# Parent e385d591fa6f8bbe135434117a16039d5693f5b4
Fix externally-visible name of type_from_classname()
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r e385d591fa6f -r f922cb6a051d src/Virt_Device.c
--- a/src/Virt_Device.c Tue Oct 30 09:39:29 2007 -0700
+++ b/src/Virt_Device.c Tue Feb 17 03:43:02 2015 -0800
@@ -247,7 +247,7 @@ static CMPIInstance *device_instance(con
return instance;
}
-int type_from_classname(const char *classname)
+int device_type_from_classname(const char *classname)
{
if (strstr(classname, "NetworkPort"))
return VIRT_DEV_NET;
@@ -321,7 +321,7 @@ static int dom_list_devices(virConnectPt
int i;
int type;
- type = type_from_classname(CLASSNAME(ref));
+ type = device_type_from_classname(CLASSNAME(ref));
ndom = get_domain_list(conn, &doms);
if (ndom == 0)
@@ -458,8 +458,11 @@ static CMPIStatus get_device(const CMPIO
CMPIStatus s;
virConnectPtr conn;
CMPIInstance *inst;
+ const char *cn;
- conn = connect_by_classname(_BROKER, CLASSNAME(reference), &s);
+ cn = CLASSNAME(reference);
+
+ conn = connect_by_classname(_BROKER, cn, &s);
if (!conn)
return s;
@@ -467,7 +470,7 @@ static CMPIStatus get_device(const CMPIO
conn,
devid,
NAMESPACE(reference),
- type_from_classname(CLASSNAME(reference)));
+ device_type_from_classname(cn));
if (inst) {
CMReturnInstance(results, inst);
CMSetStatus(&s, CMPI_RC_OK);
diff -r e385d591fa6f -r f922cb6a051d src/Virt_Device.h
--- a/src/Virt_Device.h Tue Oct 30 09:39:29 2007 -0700
+++ b/src/Virt_Device.h Tue Feb 17 03:43:02 2015 -0800
@@ -56,7 +56,7 @@ CMPIInstance *instance_from_devid(const
const char *ns,
int type);
-int type_from_classname(const char *classname);
+int device_type_from_classname(const char *classname);
#endif
diff -r e385d591fa6f -r f922cb6a051d src/Virt_SettingsDefineState.c
--- a/src/Virt_SettingsDefineState.c Tue Oct 30 09:39:29 2007 -0700
+++ b/src/Virt_SettingsDefineState.c Tue Feb 17 03:43:02 2015 -0800
@@ -148,7 +148,7 @@ static CMPIInstance *_get_typed_device(c
conn,
id,
ns,
- type_from_classname(typestr));
+ device_type_from_classname(typestr));
out:
virConnectClose(conn);
diff -r e385d591fa6f -r f922cb6a051d src/Virt_SystemDevice.c
--- a/src/Virt_SystemDevice.c Tue Oct 30 09:39:29 2007 -0700
+++ b/src/Virt_SystemDevice.c Tue Feb 17 03:43:02 2015 -0800
@@ -171,7 +171,7 @@ static CMPIStatus sys_to_dev(const CMPIO
if (info->result_class) {
int type;
- type = type_from_classname(info->result_class);
+ type = device_type_from_classname(info->result_class);
ret = get_dom_devices(host, list, type, NAMESPACE(ref));
} else {
17 years, 1 month
[PATCH] Consolidation of ResourceAllocationSettingData
by Heidi Eckhart
# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1193994073 -3600
# Node ID 233f09c15c1194a9814cb339f5cd70b5b1e27932
# Parent d0a5fd9a1b73ed456ee179ce54b51d57fad1adeb
Consolidation of ResourceAllocationSettingData
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r d0a5fd9a1b73 -r 233f09c15c11 Makefile.am
--- a/Makefile.am Thu Nov 01 12:15:08 2007 +0100
+++ b/Makefile.am Fri Nov 02 10:01:13 2007 +0100
@@ -71,12 +71,8 @@ INTEROP_REGS = \
schema/RegisteredProfile.registration \
schema/ElementConformsToProfile.registration
-EXTRA_BASE_MOFS = \
- schema/Xen_ResourceAllocationSettingData.mof \
- schema/KVM_ResourceAllocationSettingData.mof
-
pkgdata_DATA = $(MOFS) $(REGS)
-pkgdata_SCRIPTS = provider-register.sh register_base.sh
+pkgdata_SCRIPTS = provider-register.sh
EXTRA_DIST = schema $(pkgdata_DATA) $(pkgdata_SCRIPTS) \
libvirt-cim.spec.in libvirt-cim.spec \
@@ -85,7 +81,6 @@ EXTRA_DIST = schema $(pkgdata_DATA) $(pk
# Un/Register the providers and class definitions from/to the current CIMOM.
# @CIMSERVER@ is set by the configure script
postinstall:
- sh register_base.sh @CIMSERVER@ $(EXTRA_BASE_MOFS)
sh provider-register.sh -v -t @CIMSERVER@ -n /root/ibmsd -r $(REGS) -m $(MOFS)
sh provider-register.sh -v -t @CIMSERVER@ -n /root/interop -r $(INTEROP_REGS) -m $(INTEROP_MOFS)
diff -r d0a5fd9a1b73 -r 233f09c15c11 register_base.sh
--- a/register_base.sh Thu Nov 01 12:15:08 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-#!/bin/bash
-#
-# A script to register base classes with the CIMOM
-#
-# Copyright IBM Corp. 2007
-# Author: Dan Smith <danms(a)us.ibm.com>
-#
-# Usage:
-#
-# $ register_base.sh (sfcb|pegasus) [MOF...]
-#
-# FIXME: Need to make pegasus location and namespace variable
-
-CIMOM=$1
-
-if [ -z "$CIMOM" ]; then
- echo "Usage: $0 (pegasus|sfcb)"
- exit 1
-fi
-
-shift
-
-if [ "$CIMOM" = "pegasus" ]; then
- for i in $*; do
- cimmofl -W -uc -aEV -R/var/lib/Pegasus -n /root/ibmsd $i
- done
-elif [ "$CIMOM" = "sfcb" ]; then
- for i in $*; do
- sfcbstage -n /root/ibmsd $i
- done
-else
- echo "Unknown CIMOM type: $CIMOM"
-fi
diff -r d0a5fd9a1b73 -r 233f09c15c11 schema/KVM_ResourceAllocationSettingData.mof
--- a/schema/KVM_ResourceAllocationSettingData.mof Thu Nov 01 12:15:08 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-// Copyright IBM Corp. 2007
-class KVM_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData {
-
-};
diff -r d0a5fd9a1b73 -r 233f09c15c11 schema/ResourceAllocationSettingData.mof
--- a/schema/ResourceAllocationSettingData.mof Thu Nov 01 12:15:08 2007 +0100
+++ b/schema/ResourceAllocationSettingData.mof Fri Nov 02 10:01:13 2007 +0100
@@ -1,4 +1,12 @@
// Copyright IBM Corp. 2007
+class Xen_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData {
+
+};
+
+class KVM_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData {
+
+};
+
[Description ("Xen virtual disk configuration")]
class Xen_DiskResourceAllocationSettingData : Xen_ResourceAllocationSettingData{
diff -r d0a5fd9a1b73 -r 233f09c15c11 schema/Xen_ResourceAllocationSettingData.mof
--- a/schema/Xen_ResourceAllocationSettingData.mof Thu Nov 01 12:15:08 2007 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,4 +0,0 @@
-// Copyright IBM Corp. 2007
-class Xen_ResourceAllocationSettingData : CIM_ResourceAllocationSettingData {
-
-};
17 years, 1 month
[PATCH] Fix incorrect use of InstanceID instead of DeviceID in SDS
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1424173566 28800
# Node ID e1cc2a3bbeffbb0b6ec390c68a0b0cb3d39a6f22
# Parent a292dd2d0e1fc7e0e5d7d85afe67aae5fa7fa6ed
Fix incorrect use of InstanceID instead of DeviceID in SDS
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r a292dd2d0e1f -r e1cc2a3bbeff src/Virt_SettingsDefineState.c
--- a/src/Virt_SettingsDefineState.c Tue Feb 17 03:44:43 2015 -0800
+++ b/src/Virt_SettingsDefineState.c Tue Feb 17 03:46:06 2015 -0800
@@ -80,11 +80,11 @@ static CMPIStatus dev_to_rasd(const CMPI
inst_list_init(&rasds);
- id = cu_get_str_path(ref, "InstanceID");
+ id = cu_get_str_path(ref, "DeviceID");
if (id == NULL) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
- "Missing InstanceID");
+ "Missing DeviceID");
goto out;
}
@@ -92,7 +92,7 @@ static CMPIStatus dev_to_rasd(const CMPI
if (!ret) {
cu_statusf(_BROKER, &s,
CMPI_RC_ERR_FAILED,
- "Invalid InstanceID");
+ "Invalid DeviceID");
goto out;
}
17 years, 1 month
[PATCH] Update SettingsDefineState for disks
by Dan Smith
# HG changeset patch
# User Dan Smith <danms(a)us.ibm.com>
# Date 1424173483 28800
# Node ID a292dd2d0e1fc7e0e5d7d85afe67aae5fa7fa6ed
# Parent f922cb6a051d0d4bf0186bb755627e5df981997f
Update SettingsDefineState for disks
Signed-off-by: Dan Smith <danms(a)us.ibm.com>
diff -r f922cb6a051d -r a292dd2d0e1f src/Virt_SettingsDefineState.c
--- a/src/Virt_SettingsDefineState.c Tue Feb 17 03:43:02 2015 -0800
+++ b/src/Virt_SettingsDefineState.c Tue Feb 17 03:44:43 2015 -0800
@@ -98,7 +98,7 @@ static CMPIStatus dev_to_rasd(const CMPI
ret = rasds_for_domain(_BROKER,
name,
- CIM_RASD_TYPE_DISK,
+ device_type_from_classname(CLASSNAME(ref)),
NAMESPACE(ref),
&rasds);
17 years, 1 month
[PATCH] Provider registration script does not uninstall classes correctly for Pegasus
by Heidi Eckhart
# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1193911654 -3600
# Node ID 1d63d3271f9037ec0699808fec54bd5083aea849
# Parent a44ff1bcb3942783ac939d843dfbe04efe677166
Provider registration script does not uninstall classes correctly for Pegasus
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r a44ff1bcb394 -r 1d63d3271f90 Makefile.am
--- a/Makefile.am Thu Nov 01 11:06:09 2007 +0100
+++ b/Makefile.am Thu Nov 01 11:07:34 2007 +0100
@@ -86,12 +86,12 @@ EXTRA_DIST = schema $(pkgdata_DATA) $(pk
# @CIMSERVER@ is set by the configure script
postinstall:
sh register_base.sh @CIMSERVER@ $(EXTRA_BASE_MOFS)
- sh provider-register.sh -t @CIMSERVER@ -n /root/ibmsd -r $(REGS) -m $(MOFS)
- sh provider-register.sh -t @CIMSERVER@ -n /root/interop -r $(INTEROP_REGS) -m $(INTEROP_MOFS)
+ sh provider-register.sh -v -t @CIMSERVER@ -n /root/ibmsd -r $(REGS) -m $(MOFS)
+ sh provider-register.sh -v -t @CIMSERVER@ -n /root/interop -r $(INTEROP_REGS) -m $(INTEROP_MOFS)
preuninstall:
- sh provider-register.sh -d -t @CIMSERVER@ -n /root/ibmsd -r $(REGS) -m $(MOFS)
- sh provider-register.sh -d -t @CIMSERVER@ -n /root/interop -r $(INTEROP_REGS) -m $(INTEROP_MOFS)
+ sh provider-register.sh -v -d -t @CIMSERVER@ -n /root/ibmsd -r $(REGS) -m $(MOFS)
+ sh provider-register.sh -v -d -t @CIMSERVER@ -n /root/interop -r $(INTEROP_REGS) -m $(INTEROP_MOFS)
rpm: clean
@(unset CDPATH ; $(MAKE) dist && rpmbuild -ta $(distdir).tar.gz)
diff -r a44ff1bcb394 -r 1d63d3271f90 provider-register.sh
--- a/provider-register.sh Thu Nov 01 11:06:09 2007 +0100
+++ b/provider-register.sh Thu Nov 01 11:07:34 2007 +0100
@@ -262,7 +262,7 @@ pegasus_uninstall()
echo "Error: wbemexec not found" >&2
return 1
fi
- CLASSES=`cat $myregs 2> /dev/null | grep -v '^[[:space:]]*#.*' | cut -d ' ' -f 1 | grep -v '^CIM_'`
+ CLASSES=`cat $mymofs 2> /dev/null | grep '^class'| cut -d ' ' -f 2 | uniq`
for _TEMPDIR in /var/tmp /tmp
do
17 years, 1 month
[PATCH] Registration of ElementConformsToProfile for two namespaces causes errors with Pegasus
by Heidi Eckhart
# HG changeset patch
# User Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
# Date 1193911569 -3600
# Node ID a44ff1bcb3942783ac939d843dfbe04efe677166
# Parent bf5ad6924b99903d68d019a7c5faaa2f5a5d1ef9
Registration of ElementConformsToProfile for two namespaces causes errors with Pegasus
Signed-off-by: Heidi Eckhart <heidieck(a)linux.vnet.ibm.com>
diff -r bf5ad6924b99 -r a44ff1bcb394 schema/ElementConformsToProfile.registration
--- a/schema/ElementConformsToProfile.registration Mon Oct 29 15:39:52 2007 -0400
+++ b/schema/ElementConformsToProfile.registration Thu Nov 01 11:06:09 2007 +0100
@@ -1,7 +1,7 @@
# Copyright IBM Corp. 2007
# Classname Namespace ProviderName ProviderModule ProviderTypes ...
-Xen_ElementConformsToProfile root/ibmsd Virt_ElementConformsToProfileProvider Virt_ElementConformsToProfile association
+#Xen_ElementConformsToProfile root/ibmsd Virt_ElementConformsToProfileProvider Virt_ElementConformsToProfile association
Xen_ElementConformsToProfile root/interop Virt_ElementConformsToProfileProvider Virt_ElementConformsToProfile association
# Classname Namespace ProviderName ProviderModule ProviderTypes ...
-KVM_ElementConformsToProfile root/ibmsd Virt_ElementConformsToProfileProvider Virt_ElementConformsToProfile association
+#KVM_ElementConformsToProfile root/ibmsd Virt_ElementConformsToProfileProvider Virt_ElementConformsToProfile association
KVM_ElementConformsToProfile root/interop Virt_ElementConformsToProfileProvider Virt_ElementConformsToProfile association
17 years, 1 month
[PATCH] Fix qualifier warning in ComputerSystemIndication
by lizg@cn.ibm.com
# HG changeset patch
# User Zhengang Li <lizg(a)cn.ibm.com>
# Date 1193917483 -28800
# Node ID 2ccfeb1d4b8636a445ac2b834c8be152cb1e20de
# Parent d349e62b888f0dda3577ff0e55f4dbe7681a5d57
Fix qualifier warning in ComputerSystemIndication
The "char *" cast for "type" param of _lifecycle_indication() is unnecessary,
because get_typed_instance()'s 2nd param is also "const char *", and no other
reference for "type" in this function.
Signed-off-by: Zhengang Li <lizg(a)cn.ibm.com>
diff -r d349e62b888f -r 2ccfeb1d4b86 src/Virt_ComputerSystemIndication.c
--- a/src/Virt_ComputerSystemIndication.c Wed Oct 31 17:04:17 2007 -0700
+++ b/src/Virt_ComputerSystemIndication.c Thu Nov 01 19:44:43 2007 +0800
@@ -65,7 +65,7 @@ static bool _lifecycle_indication(const
static bool _lifecycle_indication(const CMPIBroker *broker,
const CMPIContext *ctx,
const CMPIObjectPath *newsystem,
- char *type)
+ const char *type)
{
CMPIObjectPath *ind_op;
CMPIInstance *ind;
@@ -171,7 +171,7 @@ static bool async_ind(CMPIContext *conte
free(type_cn);
- return _lifecycle_indication(_BROKER, context, op, (char *)type_name);
+ return _lifecycle_indication(_BROKER, context, op, type_name);
}
static CMPI_THREAD_RETURN lifecycle_thread(void *params)
17 years, 1 month