summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJan Safranek <jsafrane@redhat.com>2013-08-06 09:23:35 +0200
committerJan Safranek <jsafrane@redhat.com>2013-08-06 09:23:35 +0200
commit064b605b39d56e7ae9c1efb9ea169b89c0a2078b (patch)
treeb325b37663fdbbcb3591886a065b7e66add192f2
parent226fceeaa78adbeef9bbf67fbcf789b93bfb7bf4 (diff)
downloadopenlmi-providers-064b605b39d56e7ae9c1efb9ea169b89c0a2078b.tar.gz
openlmi-providers-064b605b39d56e7ae9c1efb9ea169b89c0a2078b.tar.xz
openlmi-providers-064b605b39d56e7ae9c1efb9ea169b89c0a2078b.zip
Work around Pegasus not being able to handle instances of unknown classes.
This is hopefully temporary workaround, which: - Disables LMI_ConcreteJob.JobInParameters, as they are not that important and can contain arrays of references, which is prohibited by MOF syntax. - Removes input parameters from CIM_IndModifyInstance.MethodParameters from the same reason. - In CIM_IndModifyInstance.MethodParameters and LMI_ConcreteJob.JobOutParameters uses non-standard classname for the embedded object (__MethodParameters_<method name> and __MethodParameters_<method name>_Result), so we can register different class for each asynchronous method with output parameters.
-rw-r--r--src/python/lmi/providers/JobManager.py38
1 files changed, 25 insertions, 13 deletions
diff --git a/src/python/lmi/providers/JobManager.py b/src/python/lmi/providers/JobManager.py
index 24c909c..a0283fb 100644
--- a/src/python/lmi/providers/JobManager.py
+++ b/src/python/lmi/providers/JobManager.py
@@ -489,8 +489,10 @@ class Job(object):
inst['SourceInstance'] = src_instance
inst['SourceInstanceModelPath'] = str(src_instance.path)
inst['MethodName'] = self.method_name
- inst['MethodParameters'] = self.get_method_params(
- '__MethodParameters', True, False)
+ # TODO: uncomment when Pegasus can correctly handle instances
+ # of unregistered classes
+ # inst['MethodParameters'] = self.get_method_params(
+ # '__MethodParameters', True, False)
inst['PreCall'] = True
return inst
@@ -532,8 +534,13 @@ class Job(object):
inst['SourceInstance'] = src_instance
inst['SourceInstanceModelPath'] = str(src_instance.path)
inst['MethodName'] = self.method_name
- inst['MethodParameters'] = self.get_method_params(
- '__MethodParameters', True, True)
+ # TODO: add input parameters too when Pegasus can correctly handle
+ # instances of unregistered classes
+ # TODO: also fix the class name to __MethodParameters
+ params = self.get_method_params(
+ '__MethodParameters_' + self.method_name, False, True)
+ if params:
+ inst['MethodParameters'] = params
inst['PreCall'] = False
if self.return_value_type is not None:
@@ -569,13 +576,10 @@ class Job(object):
included in the returned class
:rtype: CIMInstance of the created class.
"""
- # TODO: this is workaround for bug #920763, use class_name
- # when it's fixed
- clsname = "CIM_ManagedElement"
path = pywbem.CIMInstanceName(
- classname=clsname,
+ classname=class_name,
namespace=self.job_manager.namespace)
- inst = pywbem.CIMInstance(classname=clsname, path=path)
+ inst = pywbem.CIMInstance(classname=class_name, path=path)
if include_input and self.input_arguments:
for (name, value) in self.input_arguments.iteritems():
inst[name] = value
@@ -585,6 +589,7 @@ class Job(object):
inst[name] = value
return inst
+
@cmpi_logging.trace_method
def wait_for_job(self, timeout=None):
"""
@@ -1084,13 +1089,20 @@ class LMI_ConcreteJob(CIMProvider2):
value=None,
type='datetime')
- if job.input_arguments:
- model['JobInParameters'] = job.get_method_params(
- "__JobInParameters", True, False)
+ # TODO: uncomment when Pegasus can correctly handle instances
+ # of unregistered classes
+ # if job.input_arguments:
+ # model['JobInParameters'] = job.get_method_params(
+ # "__JobInParameters", True, False)
if job.job_state in Job.FINAL_STATES:
# assemble output parameters with return value
- outparams = job.get_method_params("__JobOutParameters", False, True)
+ # TODO: use __JobOutParameters when Pegasus can create instances
+ # of unregistered classes
+ outparams = job.get_method_params(
+ "__MethodParameters_" + job.method_name + "_Result",
+ False,
+ True)
if job.return_value is not None:
outparams['__ReturnValue'] = job.return_value
model['JobOutParameters'] = outparams