summaryrefslogtreecommitdiffstats
path: root/src/software/openlmi
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2013-04-05 11:44:03 +0200
committerMichal Minar <miminar@redhat.com>2013-04-11 13:54:30 +0200
commit666b177d48852c7954334d7ab0bad0aa4dba065e (patch)
treefbe9590af47ed89ab9b3b2bbfb587a3f55fff84a /src/software/openlmi
parent9971c6427fc81021de16931f342d8a2304ecc935 (diff)
downloadopenlmi-providers-666b177d48852c7954334d7ab0bad0aa4dba065e.tar.gz
openlmi-providers-666b177d48852c7954334d7ab0bad0aa4dba065e.tar.xz
openlmi-providers-666b177d48852c7954334d7ab0bad0aa4dba065e.zip
added support for indications to software providers
Only static indication filters listed in mof/LMI_SoftwareIndicationFilters.mof are supported. They should be installed at rpm package installation, so user can use them for subscriptions.
Diffstat (limited to 'src/software/openlmi')
-rw-r--r--src/software/openlmi/software/LMI_SoftwareInstallationService.py5
-rw-r--r--src/software/openlmi/software/cimom_entry.py38
-rw-r--r--src/software/openlmi/software/yumdb/__init__.py2
-rw-r--r--src/software/openlmi/software/yumdb/errors.py3
-rw-r--r--src/software/openlmi/software/yumdb/process.py3
5 files changed, 46 insertions, 5 deletions
diff --git a/src/software/openlmi/software/LMI_SoftwareInstallationService.py b/src/software/openlmi/software/LMI_SoftwareInstallationService.py
index 84f957a..f1e0ea7 100644
--- a/src/software/openlmi/software/LMI_SoftwareInstallationService.py
+++ b/src/software/openlmi/software/LMI_SoftwareInstallationService.py
@@ -372,7 +372,8 @@ class LMI_SoftwareInstallationService(CIMProvider2):
env, "uri", param_uri,
param_target, None, param_installoptions,
param_installoptionsvalues)
- rval = self.values.InstallFromURI.Job_Completed_with_No_Error
+ rval = self.values.InstallFromURI. \
+ Method_Parameters_Checked___Job_Started
out_params[0].value = InstallationJob.job2model(jobid)
except InstallationService.InstallationError as exc:
cmpi_logging.logger.error(
@@ -658,7 +659,7 @@ class LMI_SoftwareInstallationService(CIMProvider2):
param_target, param_collection, param_installoptions,
param_installoptionsvalues)
rval = self.values.InstallFromSoftwareIdentity. \
- Job_Completed_with_No_Error
+ Method_Parameters_Checked___Job_Started
out_params[0].value = InstallationJob.job2model(jobid)
except InstallationService.InstallationError as exc:
cmpi_logging.logger.error(
diff --git a/src/software/openlmi/software/cimom_entry.py b/src/software/openlmi/software/cimom_entry.py
index 6c37c9a..eaa7b0c 100644
--- a/src/software/openlmi/software/cimom_entry.py
+++ b/src/software/openlmi/software/cimom_entry.py
@@ -21,10 +21,13 @@
#
"""
-Entry module for OpenLMI Software proviers.
+Entry module for OpenLMI Software providers.
"""
+from multiprocessing import Queue
from openlmi.common import cmpi_logging
+from openlmi.common.IndicationManager import IndicationManager
+from openlmi.software.core import InstallationJob
from openlmi.software.LMI_SoftwareIdentity import LMI_SoftwareIdentity
from openlmi.software.LMI_SystemSoftwareCollection import \
LMI_SystemSoftwareCollection
@@ -61,7 +64,7 @@ from openlmi.software.LMI_AssociatedSoftwareJobMethodResult import \
LMI_AssociatedSoftwareJobMethodResult
from openlmi.software.LMI_OwningSoftwareJobElement import \
LMI_OwningSoftwareJobElement
-from openlmi.software.yumdb import YumDB
+from openlmi.software.yumdb import jobmanager, YumDB
def get_providers(env):
"""
@@ -69,6 +72,11 @@ def get_providers(env):
"""
cmpi_logging.LogManager(env)
+ # jobmanager does not understand CIM models, give it a way to transform
+ # job to CIMIndication instance
+ jobmanager.JOB_TO_MODEL = lambda job: \
+ InstallationJob.job2model(job, keys_only=False)
+
providers = {
"LMI_SoftwareIdentity" : LMI_SoftwareIdentity(env),
"LMI_SystemSoftwareCollection" : LMI_SystemSoftwareCollection(env),
@@ -91,6 +99,8 @@ def get_providers(env):
"LMI_SoftwareInstallationServiceAffectsElement" : \
LMI_SoftwareInstallationServiceAffectsElement(env),
"LMI_SoftwareInstallationJob" : LMI_SoftwareInstallationJob(env),
+ "LMI_SoftwareInstCreation" : LMI_SoftwareInstallationJob(env),
+ "LMI_SoftwareInstModification" : LMI_SoftwareInstallationJob(env),
"LMI_SoftwareMethodResult" : LMI_SoftwareMethodResult(env),
"LMI_AffectedSoftwareJobElement" : LMI_AffectedSoftwareJobElement(env),
"LMI_AssociatedSoftwareJobMethodResult" : \
@@ -98,8 +108,32 @@ def get_providers(env):
"LMI_OwningSoftwareJobElement" : LMI_OwningSoftwareJobElement(env)
}
+ # Initialization of indication manager -- running in separate thread as
+ # daemon. That means it does not have to be cleaned up.
+ im = IndicationManager.get_instance(
+ env, "Software", "root/cimv2", queue=Queue())
+ jobmanager.register_filters(im)
+
return providers
+def authorize_filter(env, fltr, ns, classes, owner):
+ IndicationManager.get_instance().authorize_filter(
+ env, fltr, ns, classes, owner)
+
+def activate_filter (env, fltr, ns, classes, first_activation):
+ IndicationManager.get_instance().activate_filter(
+ env, fltr, ns, classes, first_activation)
+
+def deactivate_filter(env, fltr, ns, classes, last_activation):
+ IndicationManager.get_instance().deactivate_filter(
+ env, fltr, ns, classes, last_activation)
+
+def enable_indications(env):
+ IndicationManager.get_instance().enable_indications(env)
+
+def disable_indications(env):
+ IndicationManager.get_instance().disable_indications(env)
+
def can_unload(_env):
"""
Says, whether providers can be unloaded.
diff --git a/src/software/openlmi/software/yumdb/__init__.py b/src/software/openlmi/software/yumdb/__init__.py
index c992608..bbf2364 100644
--- a/src/software/openlmi/software/yumdb/__init__.py
+++ b/src/software/openlmi/software/yumdb/__init__.py
@@ -44,6 +44,7 @@ import threading
import yum
from openlmi.common import cmpi_logging, singletonmixin
+from openlmi.common.IndicationManager import IndicationManager
from openlmi.software.yumdb import jobs
from openlmi.software.yumdb import errors
from openlmi.software.yumdb.packageinfo import PackageInfo
@@ -401,6 +402,7 @@ class YumDB(singletonmixin.Singleton):
uplink = Queue()
downlink = Queue()
self._process = YumWorker(uplink, downlink,
+ indication_manager=IndicationManager.get_instance(),
yum_kwargs=self._yum_kwargs)
#logging_config=YUM_WORKER_DEBUG_LOGGING_CONFIG)
self._process.start()
diff --git a/src/software/openlmi/software/yumdb/errors.py b/src/software/openlmi/software/yumdb/errors.py
index 101c40b..a6824b9 100644
--- a/src/software/openlmi/software/yumdb/errors.py
+++ b/src/software/openlmi/software/yumdb/errors.py
@@ -89,3 +89,6 @@ class JobNotFound(JobControlError):
class InvalidJobState(JobControlError):
pass
+class IndicationError(YumDBError):
+ pass
+
diff --git a/src/software/openlmi/software/yumdb/process.py b/src/software/openlmi/software/yumdb/process.py
index 0b0c4c1..8ae6e46 100644
--- a/src/software/openlmi/software/yumdb/process.py
+++ b/src/software/openlmi/software/yumdb/process.py
@@ -210,10 +210,11 @@ class YumWorker(Process):
def __init__(self,
queue_in,
queue_out,
+ indication_manager,
yum_kwargs=None,
logging_config=None):
Process.__init__(self, name="YumWorker")
- self._jobmgr = JobManager(queue_in, queue_out)
+ self._jobmgr = JobManager(queue_in, queue_out, indication_manager)
self._session_level = 0
self._session_ended = False