|
From: <ba...@us...> - 2007-06-12 23:41:56
|
Revision: 472
http://svn.sourceforge.net/omc/?rev=472&view=rev
Author: bartw
Date: 2007-06-12 16:41:55 -0700 (Tue, 12 Jun 2007)
Log Message:
-----------
some fixes, and some build stuff.
Modified Paths:
--------------
pybase/trunk/OMC_InitdService.py
pybase/trunk/OMC_LogicalFile.py
Added Paths:
-----------
pybase/trunk/MANIFEST
pybase/trunk/OMC_Base.mof
pybase/trunk/omc-pybase-providers.spec
pybase/trunk/setup.py
Added: pybase/trunk/MANIFEST
===================================================================
--- pybase/trunk/MANIFEST (rev 0)
+++ pybase/trunk/MANIFEST 2007-06-12 23:41:55 UTC (rev 472)
@@ -0,0 +1,17 @@
+OMC_Base.mof
+OMC_InitdService.py
+OMC_InitdService.mof
+OMC_InitdService.reg
+OMC_LogicalFile.py
+OMC_LogicalFile.mof
+OMC_LogicalFile.reg
+OMC_OperatingSystem.py
+OMC_OperatingSystem.mof
+OMC_OperatingSystem.reg
+OMC_UnitaryComputerSystem.py
+OMC_UnitaryComputerSystem.mof
+OMC_UnitaryComputerSystem.reg
+OMC_UnixProcess.py
+OMC_UnixProcess.mof
+OMC_UnixProcess.reg
+setup.py
Added: pybase/trunk/OMC_Base.mof
===================================================================
--- pybase/trunk/OMC_Base.mof (rev 0)
+++ pybase/trunk/OMC_Base.mof 2007-06-12 23:41:55 UTC (rev 472)
@@ -0,0 +1,5 @@
+#pragma include ("OMC_UnitaryComputerSystem.mof")
+#pragma include ("OMC_OperatingSystem.mof")
+#pragma include ("OMC_LogicalFile.mof")
+#pragma include ("OMC_UnixProcess.mof")
+#pragma include ("OMC_InitdService.mof")
Modified: pybase/trunk/OMC_InitdService.py
===================================================================
--- pybase/trunk/OMC_InitdService.py 2007-06-11 20:07:41 UTC (rev 471)
+++ pybase/trunk/OMC_InitdService.py 2007-06-12 23:41:55 UTC (rev 472)
@@ -136,14 +136,15 @@
logger.log_debug('Entering %s.enum_instances()' \
% self.__class__.__name__)
+ model['SystemName'] = getfqdn()
+ model['SystemCreationClassName'] = 'OMC_UnitaryComputerSystem'
+ model['CreationClassName'] = 'OMC_InitdService'
for file in os.listdir('/etc/init.d'):
fullpath = '/etc/init.d/'+file
if file[0] == '.' or not os.path.isfile(fullpath):
continue
# Key properties
model['Name'] = file
- model['SystemName'] = getfqdn()
- model['SystemCreationClassName'] = 'OMC_UnitaryComputerSystem'
if keys_only:
yield model
else:
Modified: pybase/trunk/OMC_LogicalFile.py
===================================================================
--- pybase/trunk/OMC_LogicalFile.py 2007-06-11 20:07:41 UTC (rev 471)
+++ pybase/trunk/OMC_LogicalFile.py 2007-06-12 23:41:55 UTC (rev 472)
@@ -81,11 +81,12 @@
_scanmounts()
-def get_file_path(fname):
+def get_file_path(fname, ns=None):
keys = {}
get_file_keys(fname, keys)
return pywbem.CIMInstanceName(classname=keys['CreationClassName'],
- keybindings=keys)
+ keybindings=keys,
+ namespace=ns)
def get_file_keys(fname, map, stat=None, linux_file=False):
"""Set the keys on an instance or instance name
Added: pybase/trunk/omc-pybase-providers.spec
===================================================================
--- pybase/trunk/omc-pybase-providers.spec (rev 0)
+++ pybase/trunk/omc-pybase-providers.spec 2007-06-12 23:41:55 UTC (rev 472)
@@ -0,0 +1,69 @@
+#
+# spec file for package python-pywbem (Version 0.5)
+#
+# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# This file and all modifications and additions to the pristine
+# package are under the same license as the package itself.
+#
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
+#
+
+# norootforbuild
+
+Name: omc-pybase-providers
+BuildRequires: python-devel openwbem
+Version: 0.1.0
+Release: 2
+Group: System/Management
+Summary: Base System Providers
+License: BSD
+URL: http://omc-project.org/
+BuildArch: noarch
+Source0: %{name}-%{version}.tar.gz
+PreReq: /usr/bin/loadmof.sh
+Requires: python-pywbem openwbem openwbem-python-providerifc
+BuildRoot: %{_tmppath}/%{name}-%{version}-build
+
+%description
+Base System CIM Providers
+
+
+Authors:
+--------
+ Jon Carey
+ Bart Whiteley
+
+%prep
+%setup
+
+%build
+python setup.py build
+
+%install
+# http://lists.opensuse.org/opensuse-packaging/2007-02/msg00005.html
+%{__rm} -rf $RPM_BUILD_ROOT
+%{__mkdir} $RPM_BUILD_ROOT
+python setup.py install --prefix=%{_prefix} --root $RPM_BUILD_ROOT \
+ --install-lib=/usr/lib/pycim -O1
+%{__mkdir} -p $RPM_BUILD_ROOT/usr/share/mof/%{name}
+install *.{mof,reg} $RPM_BUILD_ROOT/usr/share/mof/%{name}/
+
+# END OF INSTALL
+
+%clean
+%{__rm} -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(-,root,root,-)
+/usr/lib/pycim/*
+/usr/share/mof/%{name}/*.mof
+/usr/share/mof/%{name}/*.reg
+
+%post
+loadmof.sh -n root/cimv2 /usr/share/mof/%{name}/OMC_Base.mof
+loadmof.sh -n Interop /usr/share/mof/%{name}/*.reg
+
+%changelog -n omc-pybase-providers
+* Tue May 15 2007 - bwh...@su...
+- First build
+
Added: pybase/trunk/setup.py
===================================================================
--- pybase/trunk/setup.py (rev 0)
+++ pybase/trunk/setup.py 2007-06-12 23:41:55 UTC (rev 472)
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+# Note, you'll typically want to override where these get installed.
+# For example:
+# python setup.py install --install-lib=/usr/lib/pycim -O1
+
+from distutils.core import setup
+
+setup(name='omc-pybase-providers',
+ author='Jon Carey, Bart Whiteley',
+ author_email='jc...@no..., bwh...@su...',
+ version='0.1.0',
+ description='Base Providers',
+ url='http://pywbem.sf.net/',
+ py_modules=['OMC_InitdService',
+ 'OMC_LogicalFile',
+ 'OMC_OperatingSystem',
+ 'OMC_UnitaryComputerSystem',
+ 'OMC_UnixProcess'],
+ #options={'install':{'--install-lib':'/usr/lib/pycim'}},
+ )
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jc...@us...> - 2007-06-19 22:13:51
|
Revision: 474
http://svn.sourceforge.net/omc/?rev=474&view=rev
Author: jcarey
Date: 2007-06-19 15:13:52 -0700 (Tue, 19 Jun 2007)
Log Message:
-----------
Changes for pycim move to pywbem
Modified Paths:
--------------
pybase/trunk/OMC_InitdService.py
pybase/trunk/OMC_LogicalFile.py
pybase/trunk/OMC_OperatingSystem.py
pybase/trunk/OMC_UnitaryComputerSystem.py
pybase/trunk/OMC_UnixProcess.py
Modified: pybase/trunk/OMC_InitdService.py
===================================================================
--- pybase/trunk/OMC_InitdService.py 2007-06-18 17:54:23 UTC (rev 473)
+++ pybase/trunk/OMC_InitdService.py 2007-06-19 22:13:52 UTC (rev 474)
@@ -36,7 +36,7 @@
"""
import pywbem
-from pycim import CIMProvider
+from pywbem import CIMProvider
import os
from subprocess import call
from socket import getfqdn
Modified: pybase/trunk/OMC_LogicalFile.py
===================================================================
--- pybase/trunk/OMC_LogicalFile.py 2007-06-18 17:54:23 UTC (rev 473)
+++ pybase/trunk/OMC_LogicalFile.py 2007-06-19 22:13:52 UTC (rev 474)
@@ -35,7 +35,7 @@
"""
import pywbem
-from pycim import CIMProvider
+from pywbem import CIMProvider
from stat import *
from statvfs import *
from socket import getfqdn
Modified: pybase/trunk/OMC_OperatingSystem.py
===================================================================
--- pybase/trunk/OMC_OperatingSystem.py 2007-06-18 17:54:23 UTC (rev 473)
+++ pybase/trunk/OMC_OperatingSystem.py 2007-06-19 22:13:52 UTC (rev 474)
@@ -35,7 +35,7 @@
"""
import pywbem
-from pycim import CIMProvider
+from pywbem import CIMProvider
from socket import getfqdn
def get_os_path(ns):
Modified: pybase/trunk/OMC_UnitaryComputerSystem.py
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem.py 2007-06-18 17:54:23 UTC (rev 473)
+++ pybase/trunk/OMC_UnitaryComputerSystem.py 2007-06-19 22:13:52 UTC (rev 474)
@@ -35,7 +35,7 @@
"""
import pywbem
-from pycim import CIMProvider
+from pywbem import CIMProvider
from socket import getfqdn
class OMC_UnitaryComputerSystemProvider(CIMProvider):
Modified: pybase/trunk/OMC_UnixProcess.py
===================================================================
--- pybase/trunk/OMC_UnixProcess.py 2007-06-18 17:54:23 UTC (rev 473)
+++ pybase/trunk/OMC_UnixProcess.py 2007-06-19 22:13:52 UTC (rev 474)
@@ -35,7 +35,6 @@
"""
import pywbem, os, sys, pwd, signal, time
-from pycim import CIMProvider, is_subclass
from socket import getfqdn
provdir = os.path.dirname(__file__)
@@ -451,7 +450,7 @@
kb += 1
return kb
-class OMC_UnixProcessProvider(CIMProvider):
+class OMC_UnixProcessProvider(pywbem.CIMProvider):
"""Instrument the CIM class OMC_UnixProcess
A Unix Process
@@ -719,7 +718,7 @@
## end of class OMC_UnixProcessProvider
-class OMC_OSProcessProvider(CIMProvider):
+class OMC_OSProcessProvider(pywbem.CIMProvider):
"""Instrument the CIM class OMC_OSProcess
The relationship between the OperatingSystem and Process(es) running in the
@@ -767,8 +766,9 @@
if result_role and result_role.lower() != 'partcomponent':
return
if result_class_name:
- if not is_subclass(env.get_cimom_handle(), object_name.namespace,
- sub='omc_unixprocess', super=result_class_name):
+ if not pywbem.is_subclass(env.get_cimom_handle(),
+ object_name.namespace, sub='omc_unixprocess',
+ super=result_class_name):
return
for lp in LinuxProcess.procs():
model['GroupComponent'] = object_name
@@ -785,8 +785,9 @@
if result_role and result_role.lower() != 'groupcomponent':
return
if result_class_name:
- if not is_subclass(env.get_cimom_handle(), object_name.namespace,
- sub='omc_operatingsystem', super=result_class_name):
+ if not pywbem.is_subclass(env.get_cimom_handle(),
+ object_name.namespace, sub='omc_operatingsystem',
+ super=result_class_name):
return
from OMC_OperatingSystem import get_os_path
lp = LinuxProcess.get_proc(object_name['handle'])
@@ -797,7 +798,7 @@
yield model
## end of class OMC_OSProcessProvider
-class OMC_ProcessExecutableProvider(CIMProvider):
+class OMC_ProcessExecutableProvider(pywbem.CIMProvider):
"""Instrument the CIM class OMC_ProcessExecutable
A link between a Process and a DataFile indicating that the File
@@ -855,10 +856,10 @@
if result_role and result_role.lower() != 'antecedent':
return
if result_class_name:
- if is_subclass(env.get_cimom_handle(), object_name.namespace,
+ if pywbem.is_subclass(env.get_cimom_handle(), object_name.namespace,
sub=result_class_name, super='omc_datafile'):
pass
- elif not is_subclass(env.get_cimom_handle(),
+ elif not pywbem.is_subclass(env.get_cimom_handle(),
object_name.namespace, sub='omc_datafile',
super=result_classname):
return
@@ -872,14 +873,14 @@
yield model
return
- if is_subclass(env.get_cimom_handle(), object_name.namespace,
+ if pywbem.is_subclass(env.get_cimom_handle(), object_name.namespace,
sub=object_name.classname, super='omc_datafile'):
if role and role.lower() != 'antecedent':
return
if result_role and result_role.lower() != 'dependent':
return
if result_class_name:
- if not is_subclass(env.get_cimom_handle(), object_name.namespace,
+ if not pywbem.is_subclass(env.get_cimom_handle(), object_name.namespace,
sub='omc_unixprocess', super=result_class_name):
return
model['Antecedent'] = object_name
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2007-06-20 07:10:59
|
Revision: 475
http://svn.sourceforge.net/omc/?rev=475&view=rev
Author: bartw
Date: 2007-06-20 00:11:00 -0700 (Wed, 20 Jun 2007)
Log Message:
-----------
make provider classes call superclass __init__
Modified Paths:
--------------
pybase/trunk/OMC_InitdService.py
pybase/trunk/OMC_LogicalFile.py
pybase/trunk/OMC_OperatingSystem.py
pybase/trunk/OMC_UnitaryComputerSystem.py
pybase/trunk/OMC_UnixProcess.py
Modified: pybase/trunk/OMC_InitdService.py
===================================================================
--- pybase/trunk/OMC_InitdService.py 2007-06-19 22:13:52 UTC (rev 474)
+++ pybase/trunk/OMC_InitdService.py 2007-06-20 07:11:00 UTC (rev 475)
@@ -56,7 +56,7 @@
"""
def __init__ (self):
- pass
+ CIMProvider.__init__(self)
def get_instance(self, env, model, cim_class):
"""Return an instance.
Modified: pybase/trunk/OMC_LogicalFile.py
===================================================================
--- pybase/trunk/OMC_LogicalFile.py 2007-06-19 22:13:52 UTC (rev 474)
+++ pybase/trunk/OMC_LogicalFile.py 2007-06-20 07:11:00 UTC (rev 475)
@@ -35,7 +35,7 @@
"""
import pywbem
-from pywbem import CIMProvider
+#from pywbem import CIMProvider
from stat import *
from statvfs import *
from socket import getfqdn
@@ -138,7 +138,7 @@
-class OMC_LinuxFileProvider(CIMProvider):
+class OMC_LinuxFileProvider(pywbem.CIMProvider):
"""Instrument the CIM class OMC_LinuxFile
The UnixFile class holds properties that are valid for various
@@ -192,7 +192,7 @@
# Vendor_Reserved = 0x8000..
def __init__ (self):
- pass
+ pywbem.CIMProvider.__init__(self)
def get_instance (self, env, model, cim_class, stat=None):
"""Return an instance.
@@ -425,7 +425,7 @@
"""
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED, '')
-class CIM_LogicalFileProvider(CIMProvider):
+class CIM_LogicalFileProvider(pywbem.CIMProvider):
"""Instrument the CIM class CIM_LogicalFile
A LogicalFile is a named collection of data or executable code, or
@@ -435,7 +435,7 @@
"""
def __init__ (self):
- pass
+ pywbem.CIMProvider.__init__(self)
def get_instance (self, env, model, cim_class, stat=None):
"""Return an instance.
@@ -588,7 +588,7 @@
"""
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED, '')
-class OMC_LinuxFileIdentityProvider(CIMProvider):
+class OMC_LinuxFileIdentityProvider(pywbem.CIMProvider):
"""Instrument the CIM class OMC_LinuxFileIdentity
CIM_FileIdentity indicates that a UnixFile describes Unix-specific
@@ -600,7 +600,7 @@
"""
def __init__ (self):
- pass
+ pywbem.CIMProvider.__init__(self)
def get_instance (self, env, model, cim_class):
"""Return an instance.
@@ -722,7 +722,7 @@
yield model
-class OMC_LinuxDirectoryContainsFileProvider(CIMProvider):
+class OMC_LinuxDirectoryContainsFileProvider(pywbem.CIMProvider):
"""Instrument the CIM class OMC_LinuxDirectoryContainsFile
Specifies the hierarchical arrangement of LogicalFiles in a Directory.
@@ -730,7 +730,7 @@
"""
def __init__ (self):
- pass
+ pywbem.CIMProvider.__init__(self)
def get_instance (self, env, model, cim_class):
"""Return an instance.
Modified: pybase/trunk/OMC_OperatingSystem.py
===================================================================
--- pybase/trunk/OMC_OperatingSystem.py 2007-06-19 22:13:52 UTC (rev 474)
+++ pybase/trunk/OMC_OperatingSystem.py 2007-06-20 07:11:00 UTC (rev 475)
@@ -54,7 +54,7 @@
"""
def __init__ (self):
- pass
+ CIMProvider.__init__(self)
def get_instance(self, env, model, cim_class):
"""Return an instance.
@@ -570,7 +570,7 @@
"""
def __init__ (self):
- pass
+ CIMProvider.__init__(self)
def get_instance(self, env, model, cim_class):
"""Return an instance.
Modified: pybase/trunk/OMC_UnitaryComputerSystem.py
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem.py 2007-06-19 22:13:52 UTC (rev 474)
+++ pybase/trunk/OMC_UnitaryComputerSystem.py 2007-06-20 07:11:00 UTC (rev 475)
@@ -46,7 +46,7 @@
"""
def __init__ (self):
- pass
+ CIMProvider.__init__(self)
def get_instance(self, env, model, cim_class):
"""Return an instance.
Modified: pybase/trunk/OMC_UnixProcess.py
===================================================================
--- pybase/trunk/OMC_UnixProcess.py 2007-06-19 22:13:52 UTC (rev 474)
+++ pybase/trunk/OMC_UnixProcess.py 2007-06-20 07:11:00 UTC (rev 475)
@@ -458,7 +458,7 @@
"""
def __init__ (self):
- pass
+ pywbem.CIMProvider.__init__(self)
def fill_instance(self, model, lp, keys_only=False):
model['OSCreationClassName'] = 'OMC_LinuxOperatingSystem'
@@ -726,7 +726,7 @@
"""
def __init__ (self):
- pass
+ pywbem.CIMProvider.__init__(self)
def get_instance(self, env, model, cim_class):
logger = env.get_logger()
@@ -806,7 +806,7 @@
"""
def __init__ (self):
- pass
+ pywbem.CIMProvider.__init__(self)
def get_instance(self, env, model, cim_class):
logger = env.get_logger()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2007-06-20 18:10:14
|
Revision: 476
http://svn.sourceforge.net/omc/?rev=476&view=rev
Author: bartw
Date: 2007-06-20 11:10:17 -0700 (Wed, 20 Jun 2007)
Log Message:
-----------
CIMProvider no longer has an __init__
Modified Paths:
--------------
pybase/trunk/OMC_InitdService.py
pybase/trunk/OMC_LogicalFile.py
pybase/trunk/OMC_OperatingSystem.py
pybase/trunk/OMC_UnitaryComputerSystem.py
pybase/trunk/OMC_UnixProcess.py
Modified: pybase/trunk/OMC_InitdService.py
===================================================================
--- pybase/trunk/OMC_InitdService.py 2007-06-20 07:11:00 UTC (rev 475)
+++ pybase/trunk/OMC_InitdService.py 2007-06-20 18:10:17 UTC (rev 476)
@@ -55,9 +55,6 @@
"""
- def __init__ (self):
- CIMProvider.__init__(self)
-
def get_instance(self, env, model, cim_class):
"""Return an instance.
Modified: pybase/trunk/OMC_LogicalFile.py
===================================================================
--- pybase/trunk/OMC_LogicalFile.py 2007-06-20 07:11:00 UTC (rev 475)
+++ pybase/trunk/OMC_LogicalFile.py 2007-06-20 18:10:17 UTC (rev 476)
@@ -191,9 +191,6 @@
# DMTF_Reserved = ..
# Vendor_Reserved = 0x8000..
- def __init__ (self):
- pywbem.CIMProvider.__init__(self)
-
def get_instance (self, env, model, cim_class, stat=None):
"""Return an instance.
@@ -434,9 +431,6 @@
"""
- def __init__ (self):
- pywbem.CIMProvider.__init__(self)
-
def get_instance (self, env, model, cim_class, stat=None):
"""Return an instance.
@@ -599,9 +593,6 @@
"""
- def __init__ (self):
- pywbem.CIMProvider.__init__(self)
-
def get_instance (self, env, model, cim_class):
"""Return an instance.
@@ -729,9 +720,6 @@
"""
- def __init__ (self):
- pywbem.CIMProvider.__init__(self)
-
def get_instance (self, env, model, cim_class):
"""Return an instance.
Modified: pybase/trunk/OMC_OperatingSystem.py
===================================================================
--- pybase/trunk/OMC_OperatingSystem.py 2007-06-20 07:11:00 UTC (rev 475)
+++ pybase/trunk/OMC_OperatingSystem.py 2007-06-20 18:10:17 UTC (rev 476)
@@ -53,9 +53,6 @@
"""
- def __init__ (self):
- CIMProvider.__init__(self)
-
def get_instance(self, env, model, cim_class):
"""Return an instance.
@@ -569,9 +566,6 @@
"""
- def __init__ (self):
- CIMProvider.__init__(self)
-
def get_instance(self, env, model, cim_class):
"""Return an instance.
Modified: pybase/trunk/OMC_UnitaryComputerSystem.py
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem.py 2007-06-20 07:11:00 UTC (rev 475)
+++ pybase/trunk/OMC_UnitaryComputerSystem.py 2007-06-20 18:10:17 UTC (rev 476)
@@ -45,9 +45,6 @@
"""
- def __init__ (self):
- CIMProvider.__init__(self)
-
def get_instance(self, env, model, cim_class):
"""Return an instance.
Modified: pybase/trunk/OMC_UnixProcess.py
===================================================================
--- pybase/trunk/OMC_UnixProcess.py 2007-06-20 07:11:00 UTC (rev 475)
+++ pybase/trunk/OMC_UnixProcess.py 2007-06-20 18:10:17 UTC (rev 476)
@@ -182,7 +182,6 @@
#####################################
class LinuxProcess(object):
-
def __init__(self, pid):
self.pid = int(pid)
@@ -457,9 +456,6 @@
"""
- def __init__ (self):
- pywbem.CIMProvider.__init__(self)
-
def fill_instance(self, model, lp, keys_only=False):
model['OSCreationClassName'] = 'OMC_LinuxOperatingSystem'
model['CreationClassName'] = 'OMC_UnixProcess'
@@ -725,9 +721,6 @@
context of this OperatingSystem.
"""
- def __init__ (self):
- pywbem.CIMProvider.__init__(self)
-
def get_instance(self, env, model, cim_class):
logger = env.get_logger()
logger.log_debug('Entering %s.get_instance()' \
@@ -805,9 +798,6 @@
participates in the execution of the Process.
"""
- def __init__ (self):
- pywbem.CIMProvider.__init__(self)
-
def get_instance(self, env, model, cim_class):
logger = env.get_logger()
logger.log_debug('Entering %s.get_instance()' \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2007-09-11 16:34:04
|
Revision: 492
http://omc.svn.sourceforge.net/omc/?rev=492&view=rev
Author: bartw
Date: 2007-09-11 09:33:58 -0700 (Tue, 11 Sep 2007)
Log Message:
-----------
some fixes OMC_UnixProcess.py
Modified Paths:
--------------
pybase/trunk/OMC_LogicalFile.py
pybase/trunk/OMC_UnitaryComputerSystem.py
pybase/trunk/OMC_UnixProcess.py
Modified: pybase/trunk/OMC_LogicalFile.py
===================================================================
--- pybase/trunk/OMC_LogicalFile.py 2007-09-10 17:07:42 UTC (rev 491)
+++ pybase/trunk/OMC_LogicalFile.py 2007-09-11 16:33:58 UTC (rev 492)
@@ -836,8 +836,8 @@
get_file_keys(os.path.dirname(objname), kbs)
model['groupcomponent'] = pywbem.CIMInstanceName(
classname=kbs['CreationClassName'],
- namespace=object_name.namespace,
keybindings=kbs)
+ #namespace=object_name.namespace,
yield model
if (not role or role.lower() == 'groupcomponent') \
and object_name.classname.lower() == 'omc_linuxdirectory':
@@ -851,8 +851,8 @@
get_file_keys(fname, kbs)
model['partcomponent'] = pywbem.CIMInstanceName(
classname=kbs['CreationClassName'],
- namespace=object_name.namespace,
keybindings=kbs)
+ #namespace=object_name.namespace,
yield model
except OSError, arg:
if arg.errno == 13:
Modified: pybase/trunk/OMC_UnitaryComputerSystem.py
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem.py 2007-09-10 17:07:42 UTC (rev 491)
+++ pybase/trunk/OMC_UnitaryComputerSystem.py 2007-09-11 16:33:58 UTC (rev 492)
@@ -98,7 +98,7 @@
#model['ElementName'] = # TODO (type = unicode)
#model['Roles'] = # TODO (type = [unicode,])
#model['ResetCapability'] = # TODO (type = pywbem.Uint16 self.Values.ResetCapability)
- #model['NameFormat'] = # TODO (type = unicode self.Values.NameFormat)
+ model['NameFormat'] = self.Values.NameFormat.IP
#model['Caption'] = # TODO (type = unicode)
#model['PowerManagementCapabilities'] = # TODO (type = [pywbem.Uint16,] self.Values.PowerManagementCapabilities)
return model
Modified: pybase/trunk/OMC_UnixProcess.py
===================================================================
--- pybase/trunk/OMC_UnixProcess.py 2007-09-10 17:07:42 UTC (rev 491)
+++ pybase/trunk/OMC_UnixProcess.py 2007-09-11 16:33:58 UTC (rev 492)
@@ -37,11 +37,8 @@
import pywbem, os, sys, pwd, signal, time
from socket import getfqdn
-provdir = os.path.dirname(__file__)
-if provdir not in sys.path:
- sys.path.append(provdir)
-
import OMC_LogicalFile
+from OMC_OperatingSystem import get_os_path
PROC_STATE_DOESNT_EXIST = -1
@@ -738,8 +735,8 @@
% self.__class__.__name__)
for lp in LinuxProcess.procs():
model['PartComponent'] = lp.get_instance_name(
- cim_class.namespace)
- model['GroupComponent'] = get_os_path(cim_class.namespace)
+ model.path.namespace)
+ model['GroupComponent'] = get_os_path(model.path.namespace)
yield model
def set_instance(self, env, instance, previous_instance, cim_class):
@@ -782,7 +779,6 @@
object_name.namespace, sub='omc_operatingsystem',
super=result_class_name):
return
- from OMC_OperatingSystem import get_os_path
lp = LinuxProcess.get_proc(object_name['handle'])
if not lp:
return
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2007-11-27 00:20:54
|
Revision: 503
http://omc.svn.sourceforge.net/omc/?rev=503&view=rev
Author: bartw
Date: 2007-11-26 16:20:59 -0800 (Mon, 26 Nov 2007)
Log Message:
-----------
changes to support Pegasus
Modified Paths:
--------------
pybase/trunk/OMC_InitdService.mof
pybase/trunk/omc-pybase-providers.spec
pybase/trunk/setup.py
Added Paths:
-----------
pybase/trunk/MANIFEST.in
pybase/trunk/OMC_InitdService-ow.reg
pybase/trunk/OMC_InitdService-peg.reg
pybase/trunk/OMC_LogicalFile-ow.reg
pybase/trunk/OMC_LogicalFile-peg.reg
pybase/trunk/OMC_OperatingSystem-ow.reg
pybase/trunk/OMC_OperatingSystem-peg.reg
pybase/trunk/OMC_UnitaryComputerSystem-ow.reg
pybase/trunk/OMC_UnitaryComputerSystem-peg.reg
pybase/trunk/OMC_UnixProcess-ow.reg
pybase/trunk/OMC_UnixProcess-peg.reg
Removed Paths:
-------------
pybase/trunk/MANIFEST
pybase/trunk/OMC_InitdService.reg
pybase/trunk/OMC_LogicalFile.reg
pybase/trunk/OMC_OperatingSystem.reg
pybase/trunk/OMC_UnitaryComputerSystem.reg
pybase/trunk/OMC_UnixProcess.reg
Deleted: pybase/trunk/MANIFEST
===================================================================
--- pybase/trunk/MANIFEST 2007-10-06 17:09:06 UTC (rev 502)
+++ pybase/trunk/MANIFEST 2007-11-27 00:20:59 UTC (rev 503)
@@ -1,17 +0,0 @@
-OMC_Base.mof
-OMC_InitdService.py
-OMC_InitdService.mof
-OMC_InitdService.reg
-OMC_LogicalFile.py
-OMC_LogicalFile.mof
-OMC_LogicalFile.reg
-OMC_OperatingSystem.py
-OMC_OperatingSystem.mof
-OMC_OperatingSystem.reg
-OMC_UnitaryComputerSystem.py
-OMC_UnitaryComputerSystem.mof
-OMC_UnitaryComputerSystem.reg
-OMC_UnixProcess.py
-OMC_UnixProcess.mof
-OMC_UnixProcess.reg
-setup.py
Added: pybase/trunk/MANIFEST.in
===================================================================
--- pybase/trunk/MANIFEST.in (rev 0)
+++ pybase/trunk/MANIFEST.in 2007-11-27 00:20:59 UTC (rev 503)
@@ -0,0 +1,2 @@
+include *.reg
+include *.mof
Added: pybase/trunk/OMC_InitdService-ow.reg
===================================================================
--- pybase/trunk/OMC_InitdService-ow.reg (rev 0)
+++ pybase/trunk/OMC_InitdService-ow.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -0,0 +1,10 @@
+// Provider registration for OMC_InitdService
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_InitdService:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_InitdService";
+ ProviderTypes = {1,6}; // Instance, Method
+ ModulePath = "/usr/lib/pycim/OMC_InitdService.py";
+};
+
Added: pybase/trunk/OMC_InitdService-peg.reg
===================================================================
--- pybase/trunk/OMC_InitdService-peg.reg (rev 0)
+++ pybase/trunk/OMC_InitdService-peg.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -0,0 +1,27 @@
+//////// OMC_InitdService
+instance of PG_ProviderModule
+{
+ Name = "/usr/lib/pycim/OMC_InitdService.py";
+ InterfaceType = "Python";
+ InterfaceVersion = "1.0.0";
+ Location = "/usr/lib/pycim/OMC_InitdService.py";
+ Vendor = "OMC";
+ Version = "0.1.0";
+};
+
+instance of PG_Provider
+{
+ Name = "OMC_InitdService";
+ ProviderModuleName = "/usr/lib/pycim/OMC_InitdService.py";
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_InitdService";
+ ProviderModuleName = "/usr/lib/pycim/OMC_InitdService.py";
+ ProviderName = "OMC_InitdService";
+ ClassName = "OMC_InitdService";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,5}; // Instance, Method
+};
+
Modified: pybase/trunk/OMC_InitdService.mof
===================================================================
--- pybase/trunk/OMC_InitdService.mof 2007-10-06 17:09:06 UTC (rev 502)
+++ pybase/trunk/OMC_InitdService.mof 2007-11-27 00:20:59 UTC (rev 503)
@@ -11,12 +11,10 @@
"for more information.") ]
class OMC_InitdService : CIM_Service
{
- [Key, Propagated ( "OMC_UnitaryComputerSystem.CreationClassName" ),
- Description ("The CreationClassName of the scoping System.")]
+ [Key, Description ("The CreationClassName of the scoping System.")]
string SystemCreationClassName;
- [Key, Propagated ( "OMC_UnitaryComputerSystem.Name" ),
- Description ("The Name of the scoping System.")]
+ [Key, Description ("The Name of the scoping System.")]
string SystemName;
[Key, Override ( "Name" ),
@@ -104,10 +102,10 @@
"init scripts, in this case, a collection of OMC_InitdService objects")]
class OMC_Runlevel : CIM_CollectionOfMSEs
{
- [ Key, Propagated("OMC_UnitaryComputerSystem.CreationClassName") ]
+ [ Key ]
string SystemCreationClassName;
- [ Key, Propagated("OMC_UnitaryComputerSystem.Name") ]
+ [ Key ]
string SystemName;
[ Description("The runlevel of this instance. This is typically a one-character identifier such as "
Deleted: pybase/trunk/OMC_InitdService.reg
===================================================================
--- pybase/trunk/OMC_InitdService.reg 2007-10-06 17:09:06 UTC (rev 502)
+++ pybase/trunk/OMC_InitdService.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -1,10 +0,0 @@
-// Provider registration for OMC_InitdService
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_InitdService:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_InitdService";
- ProviderTypes = {1,6}; // Instance, Method
- ModulePath = "/usr/lib/pycim/OMC_InitdService.py";
-};
-
Added: pybase/trunk/OMC_LogicalFile-ow.reg
===================================================================
--- pybase/trunk/OMC_LogicalFile-ow.reg (rev 0)
+++ pybase/trunk/OMC_LogicalFile-ow.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -0,0 +1,82 @@
+
+// Provider registration for OMC_LinuxDirectoryContainsFile
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_LinuxDirectoryContainsFile:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_LinuxDirectoryContainsFile";
+ ProviderTypes = {1,3}; // Instance, Associator
+ ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
+};
+
+// Provider registration for OMC_LinuxFileIdentity
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_LinuxFileIdentity:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_LinuxFileIdentity";
+ ProviderTypes = {1,3}; // Instance, Associator
+ ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
+};
+
+// Provider registration for OMC_LinuxFile
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_LinuxFile:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_LinuxFile";
+ ProviderTypes = {1}; // Instance
+ ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
+};
+
+// Provider registration for OMC_LinuxDataFile
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_LinuxDataFile:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_LinuxDataFile";
+ ProviderTypes = {1,6}; // Instance, Method
+ ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
+};
+
+// Provider registration for OMC_LinuxDeviceFile
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_LinuxDeviceFile:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_LinuxDeviceFile";
+ ProviderTypes = {1}; // Instance
+ ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
+};
+
+// Provider registration for OMC_LinuxDirectory
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_LinuxDirectory:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_LinuxDirectory";
+ ProviderTypes = {1}; // Instance
+ ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
+};
+
+// Provider registration for OMC_LinuxFIFOPipeFile
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_LinuxFIFOPipeFile:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_LinuxFIFOPipeFile";
+ ProviderTypes = {1}; // Instance
+ ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
+};
+
+// Provider registration for OMC_LinuxSymbolicLink
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_LinuxSymbolicLink:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_LinuxSymbolicLink";
+ ProviderTypes = {1}; // Instance
+ ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
+};
+
+
Added: pybase/trunk/OMC_LogicalFile-peg.reg
===================================================================
--- pybase/trunk/OMC_LogicalFile-peg.reg (rev 0)
+++ pybase/trunk/OMC_LogicalFile-peg.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -0,0 +1,98 @@
+//////// OMC_LogicalFile
+instance of PG_ProviderModule
+{
+ Name = "/usr/lib/pycim/OMC_LogicalFile.py";
+ InterfaceType = "Python";
+ InterfaceVersion = "1.0.0";
+ Location = "/usr/lib/pycim/OMC_LogicalFile.py";
+ Vendor = "OMC";
+ Version = "0.1.0";
+};
+
+instance of PG_Provider
+{
+ Name = "OMC_LogicalFile";
+ ProviderModuleName = "/usr/lib/pycim/OMC_LogicalFile.py";
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_LinuxDirectoryContainsFile";
+ ProviderModuleName = "/usr/lib/pycim/OMC_LogicalFile.py";
+ ProviderName = "OMC_LogicalFile";
+ ClassName = "OMC_LinuxDirectoryContainsFile";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,3}; // Instance, Association
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_LinuxFileIdentity";
+ ProviderModuleName = "/usr/lib/pycim/OMC_LogicalFile.py";
+ ProviderName = "OMC_LogicalFile";
+ ClassName = "OMC_LinuxFileIdentity";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,3}; // Instance, Association
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_LinuxFile";
+ ProviderModuleName = "/usr/lib/pycim/OMC_LogicalFile.py";
+ ProviderName = "OMC_LogicalFile";
+ ClassName = "OMC_LinuxFile";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2}; // Instance
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_LinuxDataFile";
+ ProviderModuleName = "/usr/lib/pycim/OMC_LogicalFile.py";
+ ProviderName = "OMC_LogicalFile";
+ ClassName = "OMC_LinuxDataFile";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,5}; // Instance, Method
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_LinuxDeviceFile";
+ ProviderModuleName = "/usr/lib/pycim/OMC_LogicalFile.py";
+ ProviderName = "OMC_LogicalFile";
+ ClassName = "OMC_LinuxDeviceFile";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2}; // Instance
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_LinuxDirectory";
+ ProviderModuleName = "/usr/lib/pycim/OMC_LogicalFile.py";
+ ProviderName = "OMC_LogicalFile";
+ ClassName = "OMC_LinuxDirectory";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2}; // Instance
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_LinuxFIFOPipeFile";
+ ProviderModuleName = "/usr/lib/pycim/OMC_LogicalFile.py";
+ ProviderName = "OMC_LogicalFile";
+ ClassName = "OMC_LinuxFIFOPipeFile";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2}; // Instance
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_LinuxSymbolicLink";
+ ProviderModuleName = "/usr/lib/pycim/OMC_LogicalFile.py";
+ ProviderName = "OMC_LogicalFile";
+ ClassName = "OMC_LinuxSymbolicLink";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2}; // Instance
+};
+
+
Deleted: pybase/trunk/OMC_LogicalFile.reg
===================================================================
--- pybase/trunk/OMC_LogicalFile.reg 2007-10-06 17:09:06 UTC (rev 502)
+++ pybase/trunk/OMC_LogicalFile.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -1,82 +0,0 @@
-
-// Provider registration for OMC_LinuxDirectoryContainsFile
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_LinuxDirectoryContainsFile:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_LinuxDirectoryContainsFile";
- ProviderTypes = {1,3}; // Instance, Associator
- ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
-};
-
-// Provider registration for OMC_LinuxFileIdentity
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_LinuxFileIdentity:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_LinuxFileIdentity";
- ProviderTypes = {1,3}; // Instance, Associator
- ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
-};
-
-// Provider registration for OMC_LinuxFile
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_LinuxFile:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_LinuxFile";
- ProviderTypes = {1}; // Instance
- ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
-};
-
-// Provider registration for OMC_LinuxDataFile
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_LinuxDataFile:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_LinuxDataFile";
- ProviderTypes = {1,6}; // Instance, Method
- ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
-};
-
-// Provider registration for OMC_LinuxDeviceFile
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_LinuxDeviceFile:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_LinuxDeviceFile";
- ProviderTypes = {1}; // Instance
- ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
-};
-
-// Provider registration for OMC_LinuxDirectory
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_LinuxDirectory:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_LinuxDirectory";
- ProviderTypes = {1}; // Instance
- ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
-};
-
-// Provider registration for OMC_LinuxFIFOPipeFile
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_LinuxFIFOPipeFile:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_LinuxFIFOPipeFile";
- ProviderTypes = {1}; // Instance
- ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
-};
-
-// Provider registration for OMC_LinuxSymbolicLink
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_LinuxSymbolicLink:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_LinuxSymbolicLink";
- ProviderTypes = {1}; // Instance
- ModulePath = "/usr/lib/pycim/OMC_LogicalFile.py";
-};
-
-
Added: pybase/trunk/OMC_OperatingSystem-ow.reg
===================================================================
--- pybase/trunk/OMC_OperatingSystem-ow.reg (rev 0)
+++ pybase/trunk/OMC_OperatingSystem-ow.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -0,0 +1,29 @@
+// Provider registration for OMC_OperatingSystem
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_OperatingSystem:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_OperatingSystem";
+ ProviderTypes = {1,6}; // Instance, Method
+ ModulePath = "/usr/lib/pycim/OMC_OperatingSystem.py";
+};
+
+// Provider registration for OMC_InstalledOS
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_InstalledOS:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_InstalledOS";
+ ProviderTypes = {1,3}; // Instance, Associator
+ ModulePath = "/usr/lib/pycim/OMC_OperatingSystem.py";
+};
+
+// Provider registration for OMC_InstalledOS
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_RunningOS:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_RunningOS";
+ ProviderTypes = {1,3}; // Instance, Associator
+ ModulePath = "/usr/lib/pycim/OMC_OperatingSystem.py";
+};
Added: pybase/trunk/OMC_OperatingSystem-peg.reg
===================================================================
--- pybase/trunk/OMC_OperatingSystem-peg.reg (rev 0)
+++ pybase/trunk/OMC_OperatingSystem-peg.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -0,0 +1,47 @@
+//////// OMC_OperatingSystem
+instance of PG_ProviderModule
+{
+ Name = "/usr/lib/pycim/OMC_OperatingSystem.py";
+ InterfaceType = "Python";
+ InterfaceVersion = "1.0.0";
+ Location = "/usr/lib/pycim/OMC_OperatingSystem.py";
+ Vendor = "OMC";
+ Version = "0.1.0";
+};
+
+instance of PG_Provider
+{
+ Name = "OMC_OperatingSystem";
+ ProviderModuleName = "/usr/lib/pycim/OMC_OperatingSystem.py";
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_OperatingSystem";
+ ProviderModuleName = "/usr/lib/pycim/OMC_OperatingSystem.py";
+ ProviderName = "OMC_OperatingSystem";
+ ClassName = "OMC_OperatingSystem";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,5}; // Instance, Method
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_InstalledOS";
+ ProviderModuleName = "/usr/lib/pycim/OMC_OperatingSystem.py";
+ ProviderName = "OMC_OperatingSystem";
+ ClassName = "OMC_InstalledOS";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,3}; // Instance, Association
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_RunningOS";
+ ProviderModuleName = "/usr/lib/pycim/OMC_OperatingSystem.py";
+ ProviderName = "OMC_OperatingSystem";
+ ClassName = "OMC_RunningOS";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,3}; // Instance, Association
+};
+
Deleted: pybase/trunk/OMC_OperatingSystem.reg
===================================================================
--- pybase/trunk/OMC_OperatingSystem.reg 2007-10-06 17:09:06 UTC (rev 502)
+++ pybase/trunk/OMC_OperatingSystem.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -1,29 +0,0 @@
-// Provider registration for OMC_OperatingSystem
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_OperatingSystem:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_OperatingSystem";
- ProviderTypes = {1,6}; // Instance, Method
- ModulePath = "/usr/lib/pycim/OMC_OperatingSystem.py";
-};
-
-// Provider registration for OMC_InstalledOS
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_InstalledOS:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_InstalledOS";
- ProviderTypes = {1,3}; // Instance, Associator
- ModulePath = "/usr/lib/pycim/OMC_OperatingSystem.py";
-};
-
-// Provider registration for OMC_InstalledOS
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_RunningOS:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_RunningOS";
- ProviderTypes = {1,3}; // Instance, Associator
- ModulePath = "/usr/lib/pycim/OMC_OperatingSystem.py";
-};
Added: pybase/trunk/OMC_UnitaryComputerSystem-ow.reg
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem-ow.reg (rev 0)
+++ pybase/trunk/OMC_UnitaryComputerSystem-ow.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -0,0 +1,9 @@
+// Provider registration for OMC_UnitaryComputerSystem
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_UnitaryComputerSystem:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_UnitaryComputerSystem";
+ ProviderTypes = {1,6}; // Instance, Method
+ ModulePath = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py";
+};
Added: pybase/trunk/OMC_UnitaryComputerSystem-peg.reg
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem-peg.reg (rev 0)
+++ pybase/trunk/OMC_UnitaryComputerSystem-peg.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -0,0 +1,28 @@
+//////// OMC_UnitaryComputerSystem
+instance of PG_ProviderModule
+{
+ Name = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py";
+ InterfaceType = "Python";
+ InterfaceVersion = "1.0.0";
+ Location = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py";
+ Vendor = "OMC";
+ Version = "0.1.0";
+};
+
+instance of PG_Provider
+{
+ Name = "OMC_UnitaryComputerSystem";
+ ProviderModuleName = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py";
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_UnitaryComputerSystem";
+ ProviderModuleName = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py";
+ ProviderName = "OMC_UnitaryComputerSystem";
+ ClassName = "OMC_UnitaryComputerSystem";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,5}; // Instance, Method
+};
+
+
Deleted: pybase/trunk/OMC_UnitaryComputerSystem.reg
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem.reg 2007-10-06 17:09:06 UTC (rev 502)
+++ pybase/trunk/OMC_UnitaryComputerSystem.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -1,9 +0,0 @@
-// Provider registration for OMC_UnitaryComputerSystem
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_UnitaryComputerSystem:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_UnitaryComputerSystem";
- ProviderTypes = {1,6}; // Instance, Method
- ModulePath = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py";
-};
Added: pybase/trunk/OMC_UnixProcess-ow.reg
===================================================================
--- pybase/trunk/OMC_UnixProcess-ow.reg (rev 0)
+++ pybase/trunk/OMC_UnixProcess-ow.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -0,0 +1,30 @@
+// Provider registration for OMC_UnixProcess
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_UnixProcess:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_UnixProcess";
+ ProviderTypes = {1,6}; // Instance, Method
+ ModulePath = "/usr/lib/pycim/OMC_UnixProcess.py";
+};
+
+// Provider registration for OMC_ProcessExecutable
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_ProcessExecutable:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_ProcessExecutable";
+ ProviderTypes = {1,3}; // Instance, Associator
+ ModulePath = "/usr/lib/pycim/OMC_UnixProcess.py";
+};
+
+// Provider registration for OMC_OSProcess
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_OSProcess:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_OSProcess";
+ ProviderTypes = {1,3}; // Instance, Associator
+ ModulePath = "/usr/lib/pycim/OMC_UnixProcess.py";
+};
+
Added: pybase/trunk/OMC_UnixProcess-peg.reg
===================================================================
--- pybase/trunk/OMC_UnixProcess-peg.reg (rev 0)
+++ pybase/trunk/OMC_UnixProcess-peg.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -0,0 +1,48 @@
+//////// OMC_UnixProcess
+instance of PG_ProviderModule
+{
+ Name = "/usr/lib/pycim/OMC_UnixProcess.py";
+ InterfaceType = "Python";
+ InterfaceVersion = "1.0.0";
+ Location = "/usr/lib/pycim/OMC_UnixProcess.py";
+ Vendor = "OMC";
+ Version = "0.1.0";
+};
+
+instance of PG_Provider
+{
+ Name = "OMC_UnixProcess";
+ ProviderModuleName = "/usr/lib/pycim/OMC_UnixProcess.py";
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_UnixProcess";
+ ProviderModuleName = "/usr/lib/pycim/OMC_UnixProcess.py";
+ ProviderName = "OMC_UnixProcess";
+ ClassName = "OMC_UnixProcess";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,5}; // Instance, Method
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_ProcessExecutable";
+ ProviderModuleName = "/usr/lib/pycim/OMC_UnixProcess.py";
+ ProviderName = "OMC_UnixProcess";
+ ClassName = "OMC_ProcessExecutable";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,3}; // Instance, Association
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_OSProcess";
+ ProviderModuleName = "/usr/lib/pycim/OMC_UnixProcess.py";
+ ProviderName = "OMC_UnixProcess";
+ ClassName = "OMC_OSProcess";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,3}; // Instance, Association
+};
+
+
Deleted: pybase/trunk/OMC_UnixProcess.reg
===================================================================
--- pybase/trunk/OMC_UnixProcess.reg 2007-10-06 17:09:06 UTC (rev 502)
+++ pybase/trunk/OMC_UnixProcess.reg 2007-11-27 00:20:59 UTC (rev 503)
@@ -1,30 +0,0 @@
-// Provider registration for OMC_UnixProcess
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_UnixProcess:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_UnixProcess";
- ProviderTypes = {1,6}; // Instance, Method
- ModulePath = "/usr/lib/pycim/OMC_UnixProcess.py";
-};
-
-// Provider registration for OMC_ProcessExecutable
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_ProcessExecutable:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_ProcessExecutable";
- ProviderTypes = {1,3}; // Instance, Associator
- ModulePath = "/usr/lib/pycim/OMC_UnixProcess.py";
-};
-
-// Provider registration for OMC_OSProcess
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC:OMC_OSProcess:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_OSProcess";
- ProviderTypes = {1,3}; // Instance, Associator
- ModulePath = "/usr/lib/pycim/OMC_UnixProcess.py";
-};
-
Modified: pybase/trunk/omc-pybase-providers.spec
===================================================================
--- pybase/trunk/omc-pybase-providers.spec 2007-10-06 17:09:06 UTC (rev 502)
+++ pybase/trunk/omc-pybase-providers.spec 2007-11-27 00:20:59 UTC (rev 503)
@@ -21,7 +21,7 @@
BuildArch: noarch
Source0: %{name}-%{version}.tar.gz
PreReq: /usr/bin/loadmof.sh
-Requires: python-pywbem openwbem openwbem-python-providerifc
+Requires: python-pywbem pyprovifc>=1.0.0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@@ -61,7 +61,12 @@
%post
loadmof.sh -n root/cimv2 /usr/share/mof/%{name}/OMC_Base.mof
-loadmof.sh -n Interop /usr/share/mof/%{name}/*.reg
+if [ -x /usr/bin/peg-loadmof.sh ]; then
+ /usr/bin/peg-loadmof.sh -n root/PG_InterOp /usr/share/mof/%{name}/*-peg.reg
+fi
+if [ -x /usr/bin/ow-loadmof.sh ]; then
+ /usr/bin/ow-loadmof.sh -n Interop /usr/share/mof/%{name}/*-ow.reg
+fi
%changelog -n omc-pybase-providers
* Tue May 15 2007 - bwh...@su...
Modified: pybase/trunk/setup.py
===================================================================
--- pybase/trunk/setup.py 2007-10-06 17:09:06 UTC (rev 502)
+++ pybase/trunk/setup.py 2007-11-27 00:20:59 UTC (rev 503)
@@ -4,8 +4,15 @@
# For example:
# python setup.py install --install-lib=/usr/lib/pycim -O1
+import os
from distutils.core import setup
+manifest = os.path.dirname(os.path.abspath(__file__)) + '/MANIFEST'
+if os.path.exists(manifest):
+ print 'removing existing MANIFEST file'
+ os.unlink(manifest)
+
+
setup(name='omc-pybase-providers',
author='Jon Carey, Bart Whiteley',
author_email='jc...@no..., bwh...@su...',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jc...@us...> - 2007-12-13 22:02:24
|
Revision: 507
http://omc.svn.sourceforge.net/omc/?rev=507&view=rev
Author: jcarey
Date: 2007-12-13 14:02:25 -0800 (Thu, 13 Dec 2007)
Log Message:
-----------
Added files for python OMC_TimeService
Modified Paths:
--------------
pybase/trunk/OMC_Base.mof
Added Paths:
-----------
pybase/trunk/OMC_TimeService-peg.reg
pybase/trunk/OMC_TimeService.mof
pybase/trunk/OMC_TimeService.py
pybase/trunk/OMC_TimeService.reg
Modified: pybase/trunk/OMC_Base.mof
===================================================================
--- pybase/trunk/OMC_Base.mof 2007-12-07 06:02:50 UTC (rev 506)
+++ pybase/trunk/OMC_Base.mof 2007-12-13 22:02:25 UTC (rev 507)
@@ -3,3 +3,5 @@
#pragma include ("OMC_LogicalFile.mof")
#pragma include ("OMC_UnixProcess.mof")
#pragma include ("OMC_InitdService.mof")
+#pragma include ("OMC_InitdService.mof")
+#pragma include ("OMC_TimeService.mof")
Added: pybase/trunk/OMC_TimeService-peg.reg
===================================================================
--- pybase/trunk/OMC_TimeService-peg.reg (rev 0)
+++ pybase/trunk/OMC_TimeService-peg.reg 2007-12-13 22:02:25 UTC (rev 507)
@@ -0,0 +1,95 @@
+instance of PG_ProviderModule
+{
+ Name = "OMC_TimeServiceProvider_Module";
+ InterfaceType = "Python";
+ InterfaceVersion = "1.0.0";
+ Location = "/usr/lib/pycim/OMC_TimeService.py";
+ Vendor = "OMC";
+ Version = "1.0";
+};
+instance of PG_Provider
+{
+ Name = "OMC_TimeService_Provider";
+ ProviderModuleName = "OMC_TimeServiceProvider_Module";
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_TimeService_Capability1";
+ ProviderModuleName = "OMC_TimeServiceProvider_Module";
+ ProviderName = "OMC_TimeService_Provider";
+ ClassName = "OMC_TimeService";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,5}; // Instance, Method
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_TimeService_Capability2";
+ ProviderModuleName = "OMC_TimeServiceProvider_Module";
+ ProviderName = "OMC_TimeService_Provider";
+ ClassName = "OMC_RemoteTimeServicePort";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,5}; // Instance, Method
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_TimeService_Capability3";
+ ProviderModuleName = "OMC_TimeServiceProvider_Module";
+ ProviderName = "OMC_TimeService_Provider";
+ ClassName = "OMC_TimeZoneSettingData";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2}; // Instance
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_TimeService_Capability4";
+ ProviderModuleName = "OMC_TimeServiceProvider_Module";
+ ProviderName = "OMC_TimeService_Provider";
+ ClassName = "OMC_HostedTimeService";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,3}; // Instance, Associator
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_TimeService_Capability5";
+ ProviderModuleName = "OMC_TimeServiceProvider_Module";
+ ProviderName = "OMC_TimeService_Provider";
+ ClassName = "OMC_TimeServiceAccessBySAP";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,3}; // Instance, Associator
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_TimeService_Capability6";
+ ProviderModuleName = "OMC_TimeServiceProvider_Module";
+ ProviderName = "OMC_TimeService_Provider";
+ ClassName = "OMC_TimeServiceTimeZoneSettingData";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,3}; // Instance, Associator
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_TimeService_Capability7";
+ ProviderModuleName = "OMC_TimeServiceProvider_Module";
+ ProviderName = "OMC_TimeService_Provider";
+ ClassName = "OMC_TimeServiceAvailableToElement";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,3}; // Instance, Associator
+};
+
+
+
+
+
+
+
+
+
+
+
Added: pybase/trunk/OMC_TimeService.mof
===================================================================
--- pybase/trunk/OMC_TimeService.mof (rev 0)
+++ pybase/trunk/OMC_TimeService.mof 2007-12-13 22:02:25 UTC (rev 507)
@@ -0,0 +1,219 @@
+#pragma locale ("en_US")
+
+
+//////////////////////////////////////////////////////////////////////////////
+[ Abstract ]
+class OMC_TimeService : CIM_TimeService
+{
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// OMC_SystemTimeService
+[ Description("OMC_SystemTimeService represents the configuration "
+ " and function of the system time") ]
+class OMC_SystemTimeService : OMC_TimeService
+{
+ [ Key, Override("SystemCreationClassName") ]
+ string SystemCreationClassName;
+
+ [ Key, Override("SystemName") ]
+ string SystemName;
+
+ [ Key, Override("CreationClassName") ]
+ string CreationClassName = "OMC_SystemTimeService";
+
+ [ Key, Override("Name") ]
+ string Name = "timeservice";
+
+ [ Static(true),
+ Description (
+ "This method gets or sets the time for the system."),
+ ValueMap { "0", "1", "2", "3", "4", "5", "6..32767",
+ "32768..65535" },
+ Values { "Success", "Not Supported", "Unknown", "Timeout",
+ "Failed", "Invalid Parameter", "DMTF Reserved",
+ "Vendor Specific" } ]
+ uint32 ManageSystemTime (
+ [ IN, DESCRIPTION (
+ "Indicates what type of request this is: "
+ "TRUE - Get time request "
+ "FALSE - Set time request.") ]
+ boolean GetRequest,
+
+ [ IN, OUT, DESCRIPTION (
+ "The current date and time. On input, this is the time "
+ "that is set on the specified element, if the GetRequest "
+ "input parameter is TRUE. Otherwise, the input time is "
+ "ignored. On output, this is the time as known by the "
+ "element.") ]
+ datetime TimeData);
+
+ [ INVISIBLE(true),
+ Description (
+ "NOT IMPLEMENTED - DON'T USE. "
+ "This method is inherited from CIM_TimeService. "
+ "Since this method always pertains to the ComputerSystem, "
+ "The ManagedElement element parameter is not necessary. "
+ "For this reason the ManageSystemTime method should be "
+ "used instead of ManageTime") ]
+ uint32 ManageTime (
+ [ IN ]
+ boolean GetRequest,
+ [ IN, OUT ]
+ datetime TimeData,
+ [ REQUIRED, IN ]
+ CIM_ManagedElement REF ManagedElement);
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// OMC_RemoteTimeServicePort
+[ Description("OMC_RemoteTimeServicePort represent the NTP "
+ "configuration for the time service") ]
+class OMC_RemoteTimeServicePort : CIM_RemotePort
+{
+ [ Override("AccessInfo"), Write(true),
+ Description (
+ "Access and/or addressing information for a remote "
+ "connection. This can be a host name, network address or "
+ "similar information. This is inherited from "
+ "CIM_RemoteServiceAccessPoint"),
+ ModelCorrespondence { "CIM_RemoteServiceAccessPoint.InfoFormat"} ]
+ string AccessInfo;
+
+ [ Override("PortInfo"), Write(true),
+ Description("Address of remote NTP server. This is "
+ " inherited from CIM_RemotePort. This will be in "
+ " the form of a DNS name of an IP address. "
+ " A port may be specified in this field by using "
+ " the ':' character as a delimeter. Example: "
+ " 137.65.1.1:123 or time.server.com:123 "
+ " If not port is specified the NTP well known port "
+ " (123) will be assumed") ]
+ string PortInfo;
+
+ [Description ("An enumerated integer describing the protocol of the port "
+ "addressed by PortInformation."),
+ ValueMap { "1", "2", "3", "32768..65535" },
+ Values { "Other", "TCP", "UDP", "Vendor Specific" },
+ ModelCorrespondence { "CIM_RemotePort.OtherProtocolDescription"}]
+ uint16 PortProtocol = 2;
+
+ [ Description ("The Prefer property Marks the host as a preferred "
+ "time source. This host is not subject to preliminary filtering.") ]
+ boolean Prefer;
+
+ [ Description ("The Key property specifies that all packets sent to "
+ "the time source include authentication fields encrypted using the "
+ "specified key number. The value of Key is the range of an "
+ "unsigned 32 bit integer.") ]
+ uint32 Key;
+
+ [ Description(
+ "The NTPversion property specifies the version number to use for "
+ "outgoing NTP packets. The values for NTPversion can be 1 thru 4."),
+ ValueMap { "1", "2", "3", "4" } ]
+ uint32 NTPversion;
+
+ [ Description(
+ "The MinPoll property specifies the minimum poll interval allowed by "
+ "any peer of the Internet system. The minimum poll interval is "
+ "calculated, in seconds, as 2 to the power of minpoll value. "
+ "The default value of minpoll is 6, i.e. the corresponding poll "
+ "interval is 64 seconds.") ]
+ uint32 MinPoll;
+
+ [ Description(
+ "The MaxPoll property specifies the maximum poll interval allowed by "
+ "any peer of the Internet system. The maximum poll interval is "
+ "calculated, in seconds, as 2 to the power of maxpoll value. "
+ "The default value of maxpoll is 10, therefore the corresponding "
+ "poll interval is ~17 minutes.") ]
+ uint32 MaxPoll;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// OMC_TimeZoneSettingData
+[ Description("OMC_TimeZoneSettingData represents the "
+ "configuration of the system time zone.") ]
+class OMC_TimeZoneSettingData : CIM_SettingData
+{
+ [ Key, Description(
+ "InstanceID is the key field inherited from CIM_SettingData. "
+ "Since there is only one instance of this class, the key "
+ "value is 'OMC:SUSE:TIMEZONE'") ]
+ string InstanceID;
+
+ [ Required(true), Description("The time zone"),
+ Write(true) ]
+ string TimeZone;
+
+ [ Description("If the value of UTCHardwareClock is set to true, "
+ " then the hardware clock is set to UTC. Otherwise the "
+ " hardware clock is set to local time."),
+ Write(true) ]
+ boolean UTCHardwareClock = true;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// OMC_HostedTimeService
+[ Association,
+ Description("OMC_HostedTimeService associates the time service "
+ "to the computer system") ]
+class OMC_HostedTimeService : CIM_HostedService
+{
+ [ Override("Antecedent"), Min(1), Max(1),
+ Description("The hosting computer system") ]
+ OMC_UnitaryComputerSystem REF Antecedent;
+
+ [ Override("Dependent"), Weak,
+ Description("The hosted system time service") ]
+ OMC_SystemTimeService REF Dependent;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// OMC_TimeServiceAccessBySAP
+[ Association,
+ Description("OMC_TimeServiceAccessBySAP is an association "
+ "that identifies the configuration for NTP access for the "
+ "time service") ]
+class OMC_TimeServiceAccessBySAP : CIM_ServiceAccessBySAP
+{
+ [ Override("Antecedent"),
+ Description("The time service") ]
+ OMC_SystemTimeService REF Antecedent;
+
+ [ Override("Dependent"),
+ Description("Access point for the time service") ]
+ OMC_RemoteTimeServicePort REF Dependent;
+};
+
+//////////////////////////////////////////////////////////////////////////////
+// OMC_TimeServiceTimeZoneSettingData
+//
+[ Association,
+ Description("OMC_TimeServiceTimeZoneSettingData associates the time "
+ "service with the time zone configuration") ]
+class OMC_TimeServiceTimeZoneSettingData : CIM_ElementSettingData
+{
+ [ Override("ManagedElement") ]
+ OMC_SystemTimeService REF ManagedElement;
+
+ [ Override("SettingData") ]
+ OMC_TimeZoneSettingData REF SettingData;
+};
+
+
+//////////////////////////////////////////////////////////////////////////////
+// OMC_TimeServiceAvailableToElement
+[ Association,
+ Description("OMC_TimeServiceAvailableToElement indicates that this time "
+ "service is available for the use of the managed element") ]
+class OMC_TimeServiceAvailableToElement : CIM_ServiceAvailableToElement
+{
+ [ Override("ServiceProvided") ]
+ OMC_TimeService REF ServiceProvided;
+
+ [ Override("UserOfService") ]
+ CIM_ManagedElement REF UserOfService;
+};
+
Added: pybase/trunk/OMC_TimeService.py
===================================================================
--- pybase/trunk/OMC_TimeService.py (rev 0)
+++ pybase/trunk/OMC_TimeService.py 2007-12-13 22:02:25 UTC (rev 507)
@@ -0,0 +1,226 @@
+import os
+import socket
+import tempfile
+
+import pywbem
+
+_fqdn = socket.getfqdn()
+
+def _clock_conf_key_value(line):
+ tline = line.strip(' \n\r')
+ if not len(sl) or sl.startswith('#'):
+ return None
+ ndx = tline.find('=')
+ if ndx != -1:
+ key = tline[0:ndx].strip()
+ value = tline[ndx+1:].strip(' "')
+ return (key,value)
+ return None
+
+def _clock_conf_get_time_zone():
+ is_utc = False
+ timezone = ''
+ cnt = 0
+ try:
+ f = open('/etc/sysconfig/clock')
+ except:
+ return None
+
+ try:
+ for line in f:
+ kv = _clock_conf_key_value(line)
+ if kv is not None:
+ if kv[0].lower() == 'hwclock':
+ is_utc = (kv[1].lower() == '-u')
+ cnt += 1
+ elif kv[0].lower() == 'timezone':
+ timezone = kv[1]
+ cnt += 1
+ if cnt > 1:
+ break
+ return (is_utc, timezone)
+ finally:
+ f.close()
+
+def _clock_conf_modify(is_utc, timezone):
+ modified = False
+ tfname = None
+ utc_val = is_utc and '"-u"' or '"--localtime"'
+ tfd,tfname = tempfile.mkstemp(dir='/etc/sysconfig')
+ tfile = os.fdopen(tfd, 'w')
+ cfile = open('/etc/sysconfig/clock')
+ try:
+ for line in cfile:
+ kv = _clock_conf_key_value(line)
+ if kv is None:
+ tfile.write(line)
+ continue
+ if kv[0].lower() == 'hwclock':
+ tfile.write('HWCLOCK=%s\n' % utc_val)
+ modified = True
+ elif kv[0].lower() == 'timezone':
+ tfile.write('TIMEZONE=%s\n' % timezone)
+ modified = True
+ else:
+ tfile.write(line)
+ tfile.close()
+ cfile.close()
+ if not modified:
+ os.unlink(tfname)
+ else:
+ os.unlink('/etc/sysconfig/clock')
+ os.rename(tfname, '/etc/sysconfig/clock')
+ except Exception,einst:
+ tfile.close()
+ cfile.close()
+ if tfname:
+ try:
+ os.unlink(tfname)
+ except:
+ pass
+ raise einst
+
+def _is_service_ref(model):
+ for nm in ['SystemCreationClassName' 'SystemName', 'CreationClassName', 'Name']:
+ if nm not in model:
+ return False
+ if model['SystemCreationClassName'].lower() != 'omc_unitarycomputersystem':
+ return False
+ if model['SystemName'].lower() != _fqdn.lower():
+ return False
+ if model['CreationClassName'].lower() = 'omc_systemtimeservice':
+ return False
+ return model['Name'].lower() == 'timeservice'
+
+def _fill_service_instance(model, keys_only):
+ model['SystemCreationClassName'] = 'OMC_UnitaryComputerSystem'
+ model['SystemName'] = _fqdn
+ model['CreationClassName'] = 'OMC_SystemTimeService'
+ model['Name'] = 'timeservice'
+ if not keys_only:
+ model['EnabledState'] = pywbem.Uint16(2)
+ model['RequestedState'] = pywbem.Uint16(12)
+ model['EnabledDefault'] = pywbem.Uint16(2)
+ model['TimeOfLastStateChange'] = pywbem.CIMDateTime(
+ '00000000000000.000000:000')
+ model['Started'] = True
+ model['InstallDate'] = pywbem.CIMDateTime(
+ '00000000000000.000000:000')
+ model['OperationalStatus'] = [pywbem.Uint16(2)]
+ model['Status'] = 'OK'
+ model['HealthState'] = pywbem.Uint16(5)
+ model['StartMode'] = 'Automatic'
+ return model
+
+class OMC_TimeServiceProvider(pywbem.CIMProvider):
+ """Instrument the CIM class OMC_TimeService"""
+
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+ # If you will be filtering instances yourself according to
+ # property_list, role, result_role, and result_class_name
+ # parameters, set self.filter_results to False
+ # self.filter_results = False
+
+ def get_instance(self, env, model, cim_class):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+ if not _is_service_ref(model):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ return _fill_service_instance(model, false)
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+ yield _fill_service_instance(model, keys_only)
+
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ def delete_instance(self, env, instance_name):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ def cim_method_requeststatechange(self, env, object_name, method,
+ param_requestedstate,
+ param_timeoutperiod):
+ # Not supported
+ return (pywbem.Uint32(1), {})
+
+ def cim_method_startservice(self, env, object_name, method):
+ # Not supported
+ return (pywbem.Uint32(1), {})
+
+ def cim_method_stopservice(self, env, object_name, method):
+ # Not supported
+ return (pywbem.Uint32(1), {})
+
+ def cim_method_managetime(self, env, object_name, method,
+ param_timedata,
+ param_getrequest,
+ param_managedelement):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.cim_method_managetime()' \
+ % self.__class__.__name__)
+ if not _is_service_ref(object_name):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ if param_getrequest: # Is this a 'get' request?
+ return (pywbem.Uint32(0),
+ {'TimeData':pywbem.CIMDateTime.now()})
+
+ # At this point we know it is a 'set' request
+ if os.geteuid() != 0:
+ raise pywbem.CIMError(pywbem.CIM_ERR_ACCESS_DENIED,
+ 'You must have admin privileges on this machine '
+ 'in order to set the time')
+
+ if not param_timedata:
+ raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER,
+ "'TimeData' parameter is required for a set operation")
+ if param_timedata.is_interval:
+ raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER,
+ "'TimeData' parameter must be a timestamp and not an "
+ "interval")
+ new_time = param_timedata.datetime.ctime()
+
+ ccval = _clock_conf_get_time_zone()
+ if ccval is not None:
+ is_utc, timezone = ccval
+ else:
+ is_utc = False
+
+ try:
+ # Set the system time
+ dt = param_timedata.datetime
+ dtstr = '%02d%02d%02d%02d%04d' % \
+ (dt.month, dt.day, dt.hour, dt.minute, dt.year)
+ cc = os.system('/bin/date %s' % dtstr)
+ if cc:
+ raise Exception('Error returned from date command: %d' \
+ % int(cc))
+ except Exception,inst:
+ raise pywbem.CIMError(pywbem.CIM_ERR_FAILED,
+ 'Exception encountered trying to set hardware clock: %s' \
+ % str(inst))
+ try:
+ # Set the hardware clock
+ cmd = '/sbin/hwclock --systohc '
+ cmd += is_utc and '-u' or '--localtime'
+ cc = os.system(cmd)
+ if cc:
+ raise Exception('Error returned from hwclock: %d' \
+ % int(cc))
+ except Exception,inst:
+ raise pywbem.CIMError(pywbem.CIM_ERR_FAILED,
+ 'Exception encountered syncing hardware clock with system ' \
+ 'time' % str(inst))
+ return (pywbem.Uint32(0), {})
+
+## end of class OMC_TimeServiceProvider
+
+def get_providers(env):
+ omc_timeservice_prov = OMC_TimeServiceProvider(env)
+ return {'OMC_TimeService': omc_timeservice_prov}
Added: pybase/trunk/OMC_TimeService.reg
===================================================================
--- pybase/trunk/OMC_TimeService.reg (rev 0)
+++ pybase/trunk/OMC_TimeService.reg 2007-12-13 22:02:25 UTC (rev 507)
@@ -0,0 +1,66 @@
+// OpenWBEM Provider registration for OMC_TimeService
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC_TimeService:0001";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_TimeService";
+ ProviderTypes = {1,6}; // Instance, Method
+ ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
+};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC_TimeService:0002";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_RemoteTimeServicePort";
+ ProviderTypes = {1,6}; // Instance, Method
+ ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
+};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC_TimeService:0003";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_TimeZoneSettingData";
+ ProviderTypes = {1}; // Instance
+ ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
+};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC_TimeService:0004";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_HostedTimeService";
+ ProviderTypes = {1,3}; // Instance, Associator
+ ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
+};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC_TimeService:0005";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_TimeServiceAccessBySAP";
+ ProviderTypes = {1,3}; // Instance, Associator
+ ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
+};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC_TimeService:0006";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_TimeServiceTimeZoneSettingData";
+ ProviderTypes = {1,3}; // Instance, Associator
+ ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
+};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC_TimeService:0007";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_TimeServiceAvailableToElement";
+ ProviderTypes = {1,3}; // Instance, Associator
+ ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
+};
+
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jc...@us...> - 2007-12-14 20:10:07
|
Revision: 510
http://omc.svn.sourceforge.net/omc/?rev=510&view=rev
Author: jcarey
Date: 2007-12-14 12:10:09 -0800 (Fri, 14 Dec 2007)
Log Message:
-----------
Implemented the OMC_HostedTimeService association
Modified Paths:
--------------
pybase/trunk/OMC_TimeService-peg.reg
pybase/trunk/OMC_TimeService.py
pybase/trunk/OMC_TimeService.reg
Modified: pybase/trunk/OMC_TimeService-peg.reg
===================================================================
--- pybase/trunk/OMC_TimeService-peg.reg 2007-12-14 16:24:00 UTC (rev 509)
+++ pybase/trunk/OMC_TimeService-peg.reg 2007-12-14 20:10:09 UTC (rev 510)
@@ -18,39 +18,40 @@
CapabilityID = "OMC_TimeService_Capability1";
ProviderModuleName = "OMC_TimeServiceProvider_Module";
ProviderName = "OMC_TimeService_Provider";
- ClassName = "OMC_TimeService";
+ ClassName = "OMC_SystemTimeService";
Namespaces = {"root/cimv2"};
ProviderType = {2,5}; // Instance, Method
};
instance of PG_ProviderCapabilities
{
- CapabilityID = "OMC_TimeService_Capability2";
+ CapabilityID = "OMC_TimeService_Capability4";
ProviderModuleName = "OMC_TimeServiceProvider_Module";
ProviderName = "OMC_TimeService_Provider";
- ClassName = "OMC_RemoteTimeServicePort";
+ ClassName = "OMC_HostedTimeService";
Namespaces = {"root/cimv2"};
- ProviderType = {2,5}; // Instance, Method
+ ProviderType = {2,3}; // Instance, Associator
};
+/*
instance of PG_ProviderCapabilities
{
- CapabilityID = "OMC_TimeService_Capability3";
+ CapabilityID = "OMC_TimeService_Capability2";
ProviderModuleName = "OMC_TimeServiceProvider_Module";
ProviderName = "OMC_TimeService_Provider";
- ClassName = "OMC_TimeZoneSettingData";
+ ClassName = "OMC_RemoteTimeServicePort";
Namespaces = {"root/cimv2"};
- ProviderType = {2}; // Instance
+ ProviderType = {2,5}; // Instance, Method
};
instance of PG_ProviderCapabilities
{
- CapabilityID = "OMC_TimeService_Capability4";
+ CapabilityID = "OMC_TimeService_Capability3";
ProviderModuleName = "OMC_TimeServiceProvider_Module";
ProviderName = "OMC_TimeService_Provider";
- ClassName = "OMC_HostedTimeService";
+ ClassName = "OMC_TimeZoneSettingData";
Namespaces = {"root/cimv2"};
- ProviderType = {2,3}; // Instance, Associator
+ ProviderType = {2}; // Instance
};
instance of PG_ProviderCapabilities
@@ -83,6 +84,7 @@
ProviderType = {2,3}; // Instance, Associator
};
+*/
@@ -92,4 +94,3 @@
-
Modified: pybase/trunk/OMC_TimeService.py
===================================================================
--- pybase/trunk/OMC_TimeService.py 2007-12-14 16:24:00 UTC (rev 509)
+++ pybase/trunk/OMC_TimeService.py 2007-12-14 20:10:09 UTC (rev 510)
@@ -6,6 +6,7 @@
_fqdn = socket.getfqdn()
+###############################################################################
def _clock_conf_key_value(line):
tline = line.strip(' \n\r')
if not len(tline) or tline.startswith('#'):
@@ -17,6 +18,7 @@
return (key,value)
return None
+###############################################################################
def _clock_conf_get_time_zone():
is_utc = False
timezone = ''
@@ -42,6 +44,7 @@
finally:
f.close()
+###############################################################################
def _clock_conf_modify(is_utc, timezone):
modified = False
tfname = None
@@ -80,6 +83,16 @@
pass
raise einst
+###############################################################################
+def _is_cs_ref(model):
+ if 'CreationClassName' not in model \
+ or 'Name' not in model:
+ return False
+ if model['CreationClassName'].lower() != 'omc_unitarycomputersystem':
+ return False
+ return model['Name'].lower() == _fqdn.lower()
+
+###############################################################################
def _is_service_ref(model):
for nm in ['SystemCreationClassName', 'SystemName', 'CreationClassName', 'Name']:
if nm not in model:
@@ -92,6 +105,7 @@
return False
return model['Name'].lower() == 'timeservice'
+###############################################################################
def _fill_service_instance(model, keys_only):
model['SystemCreationClassName'] = 'OMC_UnitaryComputerSystem'
model['SystemName'] = _fqdn
@@ -112,9 +126,11 @@
model['StartMode'] = 'Automatic'
return model
-class OMC_TimeServiceProvider(pywbem.CIMProvider):
- """Instrument the CIM class OMC_TimeService"""
+###############################################################################
+class OMC_SystemTimeServiceProvider(pywbem.CIMProvider):
+ """Instrument the CIM class OMC_SystemTimeService"""
+ ###########################################################################
def __init__ (self, env):
logger = env.get_logger()
logger.log_debug('Initializing provider %s from %s' \
@@ -124,6 +140,7 @@
# parameters, set self.filter_results to False
# self.filter_results = False
+ ###########################################################################
def get_instance(self, env, model, cim_class):
logger = env.get_logger()
logger.log_debug('Entering %s.get_instance()' \
@@ -132,36 +149,40 @@
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
return _fill_service_instance(model, False)
+ ###########################################################################
def enum_instances(self, env, model, cim_class, keys_only):
logger = env.get_logger()
logger.log_debug('Entering %s.enum_instances()' \
% self.__class__.__name__)
yield _fill_service_instance(model, keys_only)
+ ###########################################################################
def set_instance(self, env, instance, previous_instance, cim_class):
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+ ###########################################################################
def delete_instance(self, env, instance_name):
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+ ###########################################################################
def cim_method_requeststatechange(self, env, object_name, method,
- param_requestedstate,
- param_timeoutperiod):
+ param_requestedstate, param_timeoutperiod):
# Not supported
return (pywbem.Uint32(1), {})
+ ###########################################################################
def cim_method_startservice(self, env, object_name, method):
# Not supported
return (pywbem.Uint32(1), {})
+ ###########################################################################
def cim_method_stopservice(self, env, object_name, method):
# Not supported
return (pywbem.Uint32(1), {})
+ ###########################################################################
def cim_method_managetime(self, env, object_name, method,
- param_timedata,
- param_getrequest,
- param_managedelement):
+ param_timedata, param_getrequest, param_managedelement):
logger = env.get_logger()
logger.log_debug('Entering %s.cim_method_managetime()' \
% self.__class__.__name__)
@@ -219,8 +240,97 @@
'time' % str(inst))
return (pywbem.Uint32(0), {})
-## end of class OMC_TimeServiceProvider
+## end of class OMC_SystemTimeServiceProvider
+###############################################################################
+class OMC_HostedTimeServiceProvider(pywbem.CIMProvider):
+ """Instrument the CIM class OMC_HostedTimeService"""
+
+ ###########################################################################
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+ # If you will be filtering instances yourself according to
+ # property_list, role, result_role, and result_class_name
+ # parameters, set self.filter_results to False
+ # self.filter_results = False
+
+ ###########################################################################
+ def get_instance(self, env, model, cim_class):
+ # TODO
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+ return model
+
+ ###########################################################################
+ def enum_instances(self, env, model, cim_class, keys_only):
+ # TODO
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+ if False:
+ yield None
+
+ ###########################################################################
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ ###########################################################################
+ def delete_instance(self, env, instance_name):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ ###########################################################################
+ def references(self, env, object_name, model, assoc_class,
+ result_class_name, role, result_role, keys_only):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.references()' \
+ % self.__class__.__name__)
+ ch = env.get_cimom_handle()
+ if object_name.classname.lower() == 'omc_systemtimeservice':
+ if not _is_service_ref(object_name):
+ return
+ if role and role.lower() != 'dependent':
+ return
+ if result_role and result_role.lower() != 'antecedent':
+ return
+ if result_class_name:
+ if not pywbem.is_subclass(env.get_cimom_handle(),
+ object_name.namespace, sub='omc_unitarycomputersystem',
+ super=result_class_name):
+ return
+ model['Dependent'] = object_name
+ model['Antecedent'] = pywbem.CIMInstanceName(
+ classname='OMC_UnitaryComputerSystem',
+ namespace=object_name.namespace,
+ keybindings={'CreationClassName':'OMC_UnitaryComputerSystem',
+ 'Name':_fqdn})
+ yield model
+
+ elif object_name.classname.lower() == 'omc_unitarycomputersystem':
+ if not _is_cs_ref(object_name):
+ return
+ if role and role.lower() != 'antecedent':
+ return
+ if result_role and result_role.lower() != 'dependent':
+ return
+ if result_class:
+ if not pywbem.is_subclass(env.get_cimom_handle(),
+ object_name.namespace, sub='omc_systemtimeservice',
+ super=result_class_name):
+ return
+ model['Antecedent'] = object_name
+ ref = pywbem.CIMInstanceName(classname='OMC_SystemTimeService',
+ namespace=object_name.namespace)
+ model['Dependent'] = _fill_service_instance(ref, True)
+ yield model
+
+## end of class OMC_HostedTimeServiceProvider
+
def get_providers(env):
- omc_timeservice_prov = OMC_TimeServiceProvider(env)
- return {'OMC_TimeService': omc_timeservice_prov}
+ omc_systemtimeservice_prov = OMC_SystemTimeServiceProvider(env)
+ omc_hostedtimeservice_prov = OMC_HostedTimeServiceProvider(env)
+ return {'OMC_SystemTimeService': omc_systemtimeservice_prov,
+ 'OMC_HostedTimeService': omc_hostedtimeservice_prov}
+
Modified: pybase/trunk/OMC_TimeService.reg
===================================================================
--- pybase/trunk/OMC_TimeService.reg 2007-12-14 16:24:00 UTC (rev 509)
+++ pybase/trunk/OMC_TimeService.reg 2007-12-14 20:10:09 UTC (rev 510)
@@ -3,7 +3,7 @@
{
InstanceID = "OMC_TimeService:0001";
NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_TimeService";
+ ClassName = "OMC_SystemTimeService";
ProviderTypes = {1,6}; // Instance, Method
ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2007-12-15 06:55:00
|
Revision: 512
http://omc.svn.sourceforge.net/omc/?rev=512&view=rev
Author: bartw
Date: 2007-12-14 22:55:03 -0800 (Fri, 14 Dec 2007)
Log Message:
-----------
instumented SysLogNGRecordLog and SysLogNGLogRecord
Modified Paths:
--------------
pybase/trunk/OMC_Base.mof
Added Paths:
-----------
pybase/trunk/OMC_SyslogNG-peg.reg
pybase/trunk/OMC_SyslogNG.mof
pybase/trunk/OMC_SyslogNG.py
Modified: pybase/trunk/OMC_Base.mof
===================================================================
--- pybase/trunk/OMC_Base.mof 2007-12-14 22:54:45 UTC (rev 511)
+++ pybase/trunk/OMC_Base.mof 2007-12-15 06:55:03 UTC (rev 512)
@@ -5,3 +5,4 @@
#pragma include ("OMC_InitdService.mof")
#pragma include ("OMC_InitdService.mof")
#pragma include ("OMC_TimeService.mof")
+#pragma include ("OMC_SyslogNG.mof")
Added: pybase/trunk/OMC_SyslogNG-peg.reg
===================================================================
--- pybase/trunk/OMC_SyslogNG-peg.reg (rev 0)
+++ pybase/trunk/OMC_SyslogNG-peg.reg 2007-12-15 06:55:03 UTC (rev 512)
@@ -0,0 +1,35 @@
+// Pegasus Provider registration for OMC_SyslogNGRecordLog
+instance of PG_ProviderModule
+{
+ Name = "/usr/lib/pycim/OMC_SyslogNG.py";
+ InterfaceType = "Python";
+ InterfaceVersion = "1.0.0";
+ Location = "/usr/lib/pycim/OMC_SyslogNG.py";
+ Vendor = "OMC";
+ Version = "1.0";
+};
+instance of PG_Provider
+{
+ Name = "OMC_SyslogNG";
+ ProviderModuleName = "/usr/lib/pycim/OMC_SyslogNG.py";
+};
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_SyslogNGRecordLog";
+ ProviderModuleName = "/usr/lib/pycim/OMC_SyslogNG.py";
+ ProviderName = "OMC_SyslogNG";
+ ClassName = "OMC_SyslogNGRecordLog";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,5}; // Instance, Method
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_SyslogNGLogRecord";
+ ProviderModuleName = "/usr/lib/pycim/OMC_SyslogNG.py";
+ ProviderName = "OMC_SyslogNG";
+ ClassName = "OMC_SyslogNGLogRecord";
+ Namespaces = {"root/cimv2"}; // TODO
+ ProviderType = {2}; // Instance
+};
+
Added: pybase/trunk/OMC_SyslogNG.mof
===================================================================
--- pybase/trunk/OMC_SyslogNG.mof (rev 0)
+++ pybase/trunk/OMC_SyslogNG.mof 2007-12-15 06:55:03 UTC (rev 512)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Novell-syslog-ng provider classes
+ *
+ *
+ * Copyright (C) 2004 Novell, Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * - Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Novell, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL Novell, Inc. OR THE CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ ******************************************************************************/
+#pragma locale ("en_US")
+
+[
+ Description ("Class representing a syslog-ng log file")
+]
+class OMC_SyslogNGRecordLog : CIM_RecordLog
+{
+};
+
+
+[
+ Description ("Class representing a record in a log file.")
+]
+class OMC_SyslogNGLogRecord : CIM_LogRecord
+{
+};
+
+
+[
+ Description ("Association that ties ManagedElement (and/or) ComputerSystem to a RecordLog.")
+]
+class OMC_SyslogNGUseOfLog : CIM_UseOfLog
+{
+};
+
+
+[
+ Description ("Association between a RecordLog and its LogRecords.")
+]
+class OMC_SyslogNGLogManagesRecord : CIM_LogManagesRecord
+{
+};
+
+// ==================================================================
+// OMC_SyslogNGRecordLogCapabilities
+// ==================================================================
+[Version ( "0.0.1" ), Description (
+ "EnabledLogicalElementCapabilities for SyslogNGRecordLog. "
+ "This class is here for conformance with the SMASH Record Log Profile. "
+ "For other details, see parent class.")]
+class OMC_SyslogNGRecordLogCapabilities : CIM_EnabledLogicalElementCapabilities
+{
+};
+
+
+// ==================================================================
+// OMC_SyslogNGRecordLogToCapabilities
+// ==================================================================
+[Association, Version ( "0.0.1" ), Description ("Associates OMC_SyslogNGRecordLog to "
+ "OMC_SyslogNGRecordLogCapabilities.")]
+class OMC_SyslogNGRecordLogToCapabilities : CIM_ElementCapabilities
+{
+ [Override ( "ManagedElement" ), Min ( 1 ), Max ( 1 ), Description (
+ "The RecordLog.")]
+ OMC_SyslogNGRecordLog REF ManagedElement;
+
+ [Override ( "Capabilities" ), Description (
+ "The OMC_SyslogNGRecordLogCapabilities.")]
+ OMC_SyslogNGRecordLogCapabilities REF Capabilities;
+};
+
+
+
+
+
Added: pybase/trunk/OMC_SyslogNG.py
===================================================================
--- pybase/trunk/OMC_SyslogNG.py (rev 0)
+++ pybase/trunk/OMC_SyslogNG.py 2007-12-15 06:55:03 UTC (rev 512)
@@ -0,0 +1,774 @@
+"""Python Provider for OMC_SyslogNGRecordLog
+
+Instruments the CIM class OMC_SyslogNGRecordLog
+
+"""
+
+import pywbem
+
+def _get_syslog_list():
+ rval = []
+ fo = open('/etc/syslog-ng/syslog-ng.conf', 'r')
+ state = 'i'
+ for line in fo.readlines():
+ line = line.strip()
+ if line and line[0] == '#':
+ continue
+ if state == 'i' and line.startswith('destination'):
+ state = 'd'
+ line = line[12:]
+ if state == 'd':
+ idx = line.find('file')
+ if idx >= 0:
+ state = 'f'
+ line = line[idx+4:]
+ if state == 'f':
+ idx = line.find('"')
+ if idx >= 0:
+ line = line[idx+1:]
+ idx = line.find('"')
+ if idx >= 0:
+ line = line[:idx]
+ state = 'i'
+ rval.append(line)
+ fo.close()
+ return rval
+
+
+class OMC_SyslogNGRecordLogProvider(pywbem.CIMProvider):
+ """Instrument the CIM class OMC_SyslogNGRecordLog
+
+ Class representing a syslog-ng log file
+
+ """
+
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+ # If you will be filtering instances yourself according to
+ # property_list, role, result_role, and result_class_name
+ # parameters, set self.filter_results to False
+ # self.filter_results = False
+
+ def get_instance(self, env, model, cim_class):
+ """Return an instance.
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ model -- A template of the pywbem.CIMInstance to be returned. The
+ key properties are set on this instance to correspond to the
+ instanceName that was requested. The properties of the model
+ are already filtered according to the PropertyList from the
+ request. Only properties present in the model need to be
+ given values. If you prefer, you can set all of the
+ values, and the instance will be filtered for you.
+ cim_class -- The pywbem.CIMClass
+
+ Possible Errors:
+ CIM_ERR_ACCESS_DENIED
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ or otherwise incorrect parameters)
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ Instance does not exist in the specified namespace)
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+
+ ux = model.update_existing
+
+ try:
+ id = model['InstanceID']
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ if not id.startswith('OMCSyslogNGRecordLog:'):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ file = id[id.index(':')+1:]
+ if file not in _get_syslog_list():
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+
+ ux(ElementName=file)
+ ux(Name=file)
+ ux(MaxNumberOfRecords=pywbem.Uint64(0))
+ try:
+ fo = open(file, 'r')
+ numlines = len(fo.readlines())
+ fo.close()
+ except:
+ numlines = 0
+ ux(CurrentNumberOfRecords=pywbem.Uint64(numlines))
+
+
+ #ux(AvailableRequestedStates=[self.Values.AvailableRequestedStates.<VAL>,]) # TODO
+ #ux(Caption='') # TODO
+ #ux(CommunicationStatus=self.Values.CommunicationStatus.<VAL>) # TODO
+ #ux(Description='') # TODO
+ #ux(DetailedStatus=self.Values.DetailedStatus.<VAL>) # TODO
+ #ux(EnabledDefault=self.Values.EnabledDefault.Enabled) # TODO
+ #ux(EnabledState=self.Values.EnabledState.Not_Applicable) # TODO
+ #ux(HealthState=self.Values.HealthState.<VAL>) # TODO
+ #ux(InstallDate=pywbem.CIMDateTime()) # TODO
+ #ux(LogState=self.Values.LogState.Not_Applicable) # TODO
+ #ux(OperatingStatus=self.Values.OperatingStatus.<VAL>) # TODO
+ #ux(OperationalStatus=[self.Values.OperationalStatus.<VAL>,]) # TODO
+ #ux(OtherEnabledState='') # TODO
+ #ux(OverwritePolicy=self.Values.OverwritePolicy.Unknown) # TODO
+ #ux(PrimaryStatus=self.Values.PrimaryStatus.<VAL>) # TODO
+ #ux(RequestedState=self.Values.RequestedState.Not_Applicable) # TODO
+ #ux(Status=self.Values.Status.<VAL>) # TODO
+ #ux(StatusDescriptions=['',]) # TODO
+ #ux(TimeOfLastStateChange=pywbem.CIMDateTime()) # TODO
+ #ux(TransitioningToState=self.Values.TransitioningToState.Not_Applicable) # TODO
+ return model
+
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+ """Enumerate instances.
+
+ The WBEM operations EnumerateInstances and EnumerateInstanceNames
+ are both mapped to this method.
+ This method is a python generator
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ model -- A template of the pywbem.CIMInstances to be generated.
+ The properties of the model are already filtered according to
+ the PropertyList from the request. Only properties present in
+ the model need to be given values. If you prefer, you can
+ always set all of the values, and the instance will be filtered
+ for you.
+ cim_class -- The pywbem.CIMClass
+ keys_only -- A boolean. True if only the key properties should be
+ set on the generated instances.
+
+ Possible Errors:
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+
+ for fname in _get_syslog_list():
+ model['InstanceID'] = 'OMCSyslogNGRecordLog:' + fname
+ state = 'i'
+ if keys_only:
+ yield model
+ else:
+ try:
+ yield self.get_instance(env, model, cim_class)
+ except pywbem.CIMError, (num, msg):
+ if num not in (pywbem.CIM_ERR_NOT_FOUND,
+ pywbem.CIM_ERR_ACCESS_DENIED):
+ raise
+
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ """Return a newly created or modified instance.
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ instance -- The new pywbem.CIMInstance. If modifying an existing
+ instance, the properties on this instance have been filtered by
+ the PropertyList from the request.
+ previous_instance -- The previous pywbem.CIMInstance if modifying
+ an existing instance. None if creating a new instance.
+ cim_class -- The pywbem.CIMClass
+
+ Return the new instance. The keys must be set on the new instance.
+
+ Possible Errors:
+ CIM_ERR_ACCESS_DENIED
+ CIM_ERR_NOT_SUPPORTED
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ or otherwise incorrect parameters)
+ CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
+ valid if previous_instance is None, indicating that the operation
+ was CreateInstance)
+ CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
+ if previous_instance is not None, indicating that the operation
+ was ModifyInstance)
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.set_instance()' \
+ % self.__class__.__name__)
+ # TODO create or modify the instance
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
+ return instance
+
+ def delete_instance(self, env, instance_name):
+ """Delete an instance.
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ instance_name -- A pywbem.CIMInstanceName specifying the instance
+ to delete.
+
+ Possible Errors:
+ CIM_ERR_ACCESS_DENIED
+ CIM_ERR_NOT_SUPPORTED
+ CIM_ERR_INVALID_NAMESPACE
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ or otherwise incorrect parameters)
+ CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
+ namespace)
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ Instance does not exist in the specified namespace)
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.delete_instance()' \
+ % self.__class__.__name__)
+
+ # TODO delete the resource
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
+
+ def cim_method_requeststatechange(self, env, object_name, method,
+ param_requestedstate,
+ param_timeoutperiod):
+ """Implements OMC_SyslogNGRecordLog.RequestStateChange()
+
+ Requests that the state of the element be changed to the value
+ specified in the RequestedState parameter. When the requested
+ state change takes place, the EnabledState and RequestedState of
+ the element will be the same. Invoking the RequestStateChange
+ method multiple times could result in earlier requests being
+ overwritten or lost. If 0 is returned, then the task completed
+ successfully and the use of ConcreteJob was not required. If 4096
+ (0x1000) is returned, then the task will take some time to
+ complete, ConcreteJob will be created, and its reference returned
+ in the output parameter Job. Any other return code indicates an
+ error condition.
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ specifying the object on which the method RequestStateChange()
+ should be invoked.
+ method -- A pywbem.CIMMethod representing the method meta-data
+ param_requestedstate -- The input parameter RequestedState (type pywbem.Uint16 self.Values.RequestStateChange.RequestedState)
+ The state requested for the element. This information will be
+ placed into the RequestedState property of the instance if the
+ return code of the RequestStateChange method is 0 ('Completed
+ with No Error'), 3 ('Timeout'), or 4096 (0x1000) ('Job
+ Started'). Refer to the description of the EnabledState and
+ RequestedState properties for the detailed explanations of the
+ RequestedState values.
+
+ param_timeoutperiod -- The input parameter TimeoutPeriod (type pywbem.CIMDateTime)
+ A timeout period that specifies the maximum amount of time that
+ the client expects the transition to the new state to take.
+ The interval format must be used to specify the TimeoutPeriod.
+ A value of 0 or a null parameter indicates that the client has
+ no time requirements for the transition. If this property
+ does not contain 0 or null and the implementation does not
+ support this parameter, a return code of 'Use Of Timeout
+ Parameter Not Supported' must be returned.
+
+
+ Returns a two-tuple containing the return value (type pywbem.Uint32 self.Values.RequestStateChange)
+ and a dictionary with the out-parameters
+
+ Output parameters:
+ Job -- (type REF (pywbem.CIMInstanceName(classname='CIM_ConcreteJob', ...))
+ Reference to the job (can be null if the task is completed).
+
+
+ Possible Errors:
+ CIM_ERR_ACCESS_DENIED
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ unrecognized or otherwise incorrect parameters)
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ exist in the specified namespace)
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ the invocation request)
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.cim_method_requeststatechange()' \
+ % self.__class__.__name__)
+
+ # TODO do something
+ raise pywbem.CIMError(pywbem.CIM_ERR_METHOD_NOT_AVAILABLE) # Remove to implemented
+ out_params = {}
+ #out_params['job'] = # TODO (type REF (pywbem.CIMInstanceName(classname='CIM_ConcreteJob', ...))
+ rval = None # TODO (type pywbem.Uint32 self.Values.RequestStateChange)
+ return (rval, out_params)
+
+ def cim_method_clearlog(self, env, object_name, method):
+ """Implements OMC_SyslogNGRecordLog.ClearLog()
+
+ Requests that the Log be cleared of all entries. The return value
+ should be 0 if the request was successfully executed, 1 if the
+ request is not supported, and some other value, as indicated by
+ the ValueMap/Values qualifiers, if an error occurred.
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ object_name -- A pywbem.CIMInstanceName or pywbem.CIMCLassName
+ specifying the object on which the method ClearLog()
+ should be invoked.
+ method -- A pywbem.CIMMethod representing the method meta-data
+
+ Returns a two-tuple containing the return value (type pywbem.Uint32 self.Values.ClearLog)
+ and a dictionary with the out-parameters
+
+ Output parameters: none
+
+ Possible Errors:
+ CIM_ERR_ACCESS_DENIED
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate,
+ unrecognized or otherwise incorrect parameters)
+ CIM_ERR_NOT_FOUND (the target CIM Class or instance does not
+ exist in the specified namespace)
+ CIM_ERR_METHOD_NOT_AVAILABLE (the CIM Server is unable to honor
+ the invocation request)
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.cim_method_clearlog()' \
+ % self.__class__.__name__)
+
+ # TODO do something
+ raise pywbem.CIMError(pywbem.CIM_ERR_METHOD_NOT_AVAILABLE) # Remove to implemented
+ out_params = {}
+ rval = None # TODO (type pywbem.Uint32 self.Values.ClearLog)
+ return (rval, out_params)
+
+ class Values(object):
+ class DetailedStatus(object):
+ Not_Available = pywbem.Uint16(0)
+ No_Additional_Information = pywbem.Uint16(1)
+ Stressed = pywbem.Uint16(2)
+ Predictive_Failure = pywbem.Uint16(3)
+ Non_Recoverable_Error = pywbem.Uint16(4)
+ Supporting_Entity_in_Error = pywbem.Uint16(5)
+ # DMTF_Reserved = ..
+ # Vendor_Reserved = 0x8000..
+
+ class RequestedState(object):
+ Unknown = pywbem.Uint16(0)
+ Enabled = pywbem.Uint16(2)
+ Disabled = pywbem.Uint16(3)
+ Shut_Down = pywbem.Uint16(4)
+ No_Change = pywbem.Uint16(5)
+ Offline = pywbem.Uint16(6)
+ Test = pywbem.Uint16(7)
+ Deferred = pywbem.Uint16(8)
+ Quiesce = pywbem.Uint16(9)
+ Reboot = pywbem.Uint16(10)
+ Reset = pywbem.Uint16(11)
+ Not_Applicable = pywbem.Uint16(12)
+ # DMTF_Reserved = ..
+ # Vendor_Reserved = 32768..65535
+
+ class HealthState(object):
+ Unknown = pywbem.Uint16(0)
+ OK = pywbem.Uint16(5)
+ Degraded_Warning = pywbem.Uint16(10)
+ Minor_failure = pywbem.Uint16(15)
+ Major_failure = pywbem.Uint16(20)
+ Critical_failure = pywbem.Uint16(25)
+ Non_recoverable_error = pywbem.Uint16(30)
+ # DMTF_Reserved = ..
+
+ class LogState(object):
+ Unknown = pywbem.Uint16(0)
+ Normal = pywbem.Uint16(2)
+ Erasing = pywbem.Uint16(3)
+ Not_Applicable = pywbem.Uint16(4)
+ # DMTF_Reserved = ..
+ # Vendor_Reserved = 32768..65535
+
+ class TransitioningToState(object):
+ Unknown = pywbem.Uint16(0)
+ Enabled = pywbem.Uint16(2)
+ Disabled = pywbem.Uint16(3)
+ Shut_Down = pywbem.Uint16(4)
+ No_Change = pywbem.Uint16(5)
+ Offline = pywbem.Uint16(6)
+ Test = pywbem.Uint16(7)
+ Defer = pywbem.Uint16(8)
+ Quiesce = pywbem.Uint16(9)
+ Reboot = pywbem.Uint16(10)
+ Reset = pywbem.Uint16(11)
+ Not_Applicable = pywbem.Uint16(12)
+
+ class EnabledDefault(object):
+ Enabled = pywbem.Uint16(2)
+ Disabled = pywbem.Uint16(3)
+ Not_Applicable = pywbem.Uint16(5)
+ Enabled_but_Offline = pywbem.Uint16(6)
+ No_Default = pywbem.Uint16(7)
+ Quiesce = pywbem.Uint16(9)
+ # DMTF_Reserved = ..
+ # Vendor_Reserved = 32768..65535
+
+ class EnabledState(object):
+ Unknown = pywbem.Uint16(0)
+ Other = pywbem.Uint16(1)
+ Enabled = pywbem.Uint16(2)
+ Disabled = pywbem.Uint16(3)
+ Shutting_Down = pywbem.Uint16(4)
+ Not_Applicable = pywbem.Uint16(5)
+ Enabled_but_Offline = pywbem.Uint16(6)
+ In_Test = pywbem.Uint16(7)
+ Deferred = pywbem.Uint16(8)
+ Quiesce = pywbem.Uint16(9)
+ Starting = pywbem.Uint16(10)
+ # DMTF_Reserved = 11..32767
+ # Vendor_Reserved = 32768..65535
+
+ class ClearLog(object):
+ Completed_with_no_error = pywbem.Uint32(0)
+ Not_Supported = pywbem.Uint32(1)
+ Unspecified_Error = pywbem.Uint32(2)
+ Timeout = pywbem.Uint32(3)
+ Failed = pywbem.Uint32(4)
+ Invalid_Parameter = pywbem.Uint32(5)
+ # DMTF_Reserved = 6..0x0FFF
+ # Method_Reserved = 0x1000..0x7FFF
+ # Vendor_Reserved = 0x8000..
+
+ class AvailableRequestedStates(object):
+ Enabled = pywbem.Uint16(2)
+ Disabled = pywbem.Uint16(3)
+ Shut_Down = pywbem.Uint16(4)
+ Offline = pywbem.Uint16(6)
+ Test = pywbem.Uint16(7)
+ Defer = pywbem.Uint16(8)
+ Quiesce = pywbem.Uint16(9)
+ Reboot = pywbem.Uint16(10)
+ Reset = pywbem.Uint16(11)
+
+ class Status(object):
+ OK = 'OK'
+ Error = 'Error'
+ Degraded = 'Degraded'
+ Unknown = 'Unknown'
+ Pred_Fail = 'Pred Fail'
+ Starting = 'Starting'
+ Stopping = 'Stopping'
+ Service = 'Service'
+ Stressed = 'Stressed'
+ NonRecover = 'NonRecover'
+ No_Contact = 'No Contact'
+ Lost_Comm = 'Lost Comm'
+ Stopped = 'Stopped'
+
+ class CommunicationStatus(object):
+ Unknown = pywbem.Uint16(0)
+ Not_Available = pywbem.Uint16(1)
+ Communication_OK = pywbem.Uint16(2)
+ Lost_Communication = pywbem.Uint16(3)
+ No_Contact = pywbem.Uint16(4)
+ # DMTF_Reserved = ..
+ # Vendor_Reserved = 0x8000..
+
+ class OperationalStatus(object):
+ Unknown = pywbem.Uint16(0)
+ Other = pywbem.Uint16(1)
+ OK = pywbem.Uint16(2)
+ Degraded = pywbem.Uint16(3)
+ Stressed = pywbem.Uint16(4)
+ Predictive_Failure = pywbem.Uint16(5)
+ Error = pywbem.Uint16(6)
+ Non_Recoverable_Error = pywbem.Uint16(7)
+ Starting = pywbem.Uint16(8)
+ Stopping = pywbem.Uint16(9)
+ Stopped = pywbem.Uint16(10)
+ In_Service = pywbem.Uint16(11)
+ No_Contact = pywbem.Uint16(12)
+ Lost_Communication = pywbem.Uint16(13)
+ Aborted = pywbem.Uint16(14)
+ Dormant = pywbem.Uint16(15)
+ Supporting_Entity_in_Error = pywbem.Uint16(16)
+ Completed = pywbem.Uint16(17)
+ Power_Mode = pywbem.Uint16(18)
+ # DMTF_Reserved = ..
+ # Vendor_Reserved = 0x8000..
+
+ class OperatingStatus(object):
+ Unknown = pywbem.Uint16(0)
+ Not_Available = pywbem.Uint16(1)
+ In_Service = pywbem.Uint16(2)
+ Starting = pywbem.Uint16(3)
+ Stopping = pywbem.Uint16(4)
+ Stopped = pywbem.Uint16(5)
+ Aborted = pywbem.Uint16(6)
+ Dormant = pywbem.Uint16(7)
+ Completed = pywbem.Uint16(8)
+ Migrating = pywbem.Uint16(9)
+ Emigrating = pywbem.Uint16(10)
+ Immigrating = pywbem.Uint16(11)
+ Snapshotting = pywbem.Uint16(12)
+ Shutting_Down = pywbem.Uint16(13)
+ In_Test = pywbem.Uint16(14)
+ # DMTF_Reserved = ..
+ # Vendor_Reserved = 0x8000..
+
+ class OverwritePolicy(object):
+ Unknown = pywbem.Uint16(0)
+ Wraps_When_Full = pywbem.Uint16(2)
+ Never_Overwrites = pywbem.Uint16(7)
+ # DMTF_Reserved = ..
+ # Vendor_Reserved = 32768..65535
+
+ class RequestStateChange(object):
+ Completed_with_No_Error = pywbem.Uint32(0)
+ Not_Supported = pywbem.Uint32(1)
+ Unknown_or_Unspecified_Error = pywbem.Uint32(2)
+ Cannot_complete_within_Timeout_Period = pywbem.Uint32(3)
+ Failed = pywbem.Uint32(4)
+ Invalid_Parameter = pywbem.Uint32(5)
+ In_Use = pywbem.Uint32(6)
+ # DMTF_Reserved = ..
+ Method_Parameters_Checked___Job_Started = pywbem.Uint32(4096)
+ Invalid_State_Transition = pywbem.Uint32(4097)
+ Use_of_Timeout_Parameter_Not_Supported = pywbem.Uint32(4098)
+ Busy = pywbem.Uint32(4099)
+ # Method_Reserved = 4100..32767
+ # Vendor_Specific = 32768..65535
+ class RequestedState(object):
+ Enabled = pywbem.Uint16(2)
+ Disabled = pywbem.Uint16(3)
+ Shut_Down = pywbem.Uint16(4)
+ Offline = pywbem.Uint16(6)
+ Test = pywbem.Uint16(7)
+ Defer = pywbem.Uint16(8)
+ Quiesce = pywbem.Uint16(9)
+ Reboot = pywbem.Uint16(10)
+ Reset = pywbem.Uint16(11)
+ # DMTF_Reserved = ..
+ # Vendor_Reserved = 32768..65535
+
+ class PrimaryStatus(object):
+ Unknown = pywbem.Uint16(0)
+ OK = pywbem.Uint16(1)
+ Degraded = pywbem.Uint16(2)
+ Error = pywbem.Uint16(3)
+ # DMTF_Reserved = ..
+ # Vendor_Reserved = 0x8000..
+
+## end of class OMC_SyslogNGRecordLogProvider
+"""Python Provider for OMC_SyslogNGLogRecord
+
+Instruments the CIM class OMC_SyslogNGLogRecord
+
+"""
+
+import pywbem
+
+class OMC_SyslogNGLogRecordProvider(pywbem.CIMProvider):
+ """Instrument the CIM cl...
[truncated message content] |
|
From: <jc...@us...> - 2007-12-17 22:51:20
|
Revision: 514
http://omc.svn.sourceforge.net/omc/?rev=514&view=rev
Author: jcarey
Date: 2007-12-17 14:51:17 -0800 (Mon, 17 Dec 2007)
Log Message:
-----------
Implemented the OMC_RemoteTimeServicePort
Modified Paths:
--------------
pybase/trunk/OMC_TimeService-peg.reg
pybase/trunk/OMC_TimeService.py
Modified: pybase/trunk/OMC_TimeService-peg.reg
===================================================================
--- pybase/trunk/OMC_TimeService-peg.reg 2007-12-17 22:35:21 UTC (rev 513)
+++ pybase/trunk/OMC_TimeService-peg.reg 2007-12-17 22:51:17 UTC (rev 514)
@@ -33,7 +33,6 @@
ProviderType = {2,3}; // Instance, Associator
};
-/*
instance of PG_ProviderCapabilities
{
CapabilityID = "OMC_TimeService_Capability2";
@@ -44,6 +43,7 @@
ProviderType = {2,5}; // Instance, Method
};
+/*
instance of PG_ProviderCapabilities
{
CapabilityID = "OMC_TimeService_Capability3";
Modified: pybase/trunk/OMC_TimeService.py
===================================================================
--- pybase/trunk/OMC_TimeService.py 2007-12-17 22:35:21 UTC (rev 513)
+++ pybase/trunk/OMC_TimeService.py 2007-12-17 22:51:17 UTC (rev 514)
@@ -1,12 +1,32 @@
import os
import socket
import tempfile
+from subprocess import Popen, PIPE
+
import pywbem
_fqdn = socket.getfqdn()
+ntp_inst_date = None
+try:
+ _install_time = Popen(['rpm', '-qf','/etc/ntp.conf',
+ '--queryformat','%{INSTALLTIME}'],
+ stdout=PIPE).communicate()[0]
+ ntp_inst_date = pywbem.CIMDateTime.fromtimestamp(int(_install_time))
+except:
+ ntp_inst_date = None
+ pass
+
###############################################################################
+def _isIPV4Address(addr):
+ try:
+ mm = socket.inet_aton(addr)
+ return True
+ except socket.error:
+ return False
+
+###############################################################################
class NTPServer(object):
###########################################################################
def __init__(self):
@@ -54,6 +74,7 @@
utok = toks[i].lower()
if utok == 'prefer':
server.prefer = True
+ i += 1
continue
if i < (tokslen-1):
if utok == 'key':
@@ -71,7 +92,41 @@
elif utok == 'maxpoll':
i += 1
server.max_poll = int(toks[i])
+ i += 1
+
+
return server
+
+ def fill_cim_instance(self, model, keys_only=False):
+ global ntp_inst_date
+ model['SystemName'] = _fqdn
+ model['SystemCreationClassName'] = 'OMC_UnitaryComputerSystem'
+ model['CreationClassName'] = 'OMC_RemoteTimeServicePort'
+ model['Name'] = self.server_name
+ if keys_only:
+ return model
+ model['AccessInfo'] = self.server_name
+ model['InfoFormat'] = _isIPV4Address(self.server_name) \
+ and pywbem.Uint16(3) or pywbem.Uint16(2)
+ model['PortProtocol'] = pywbem.Uint16(2)
+ model['EnabledState'] = pywbem.Uint16(2)
+ model['RequestedState'] = pywbem.Uint16(12)
+ model['EnabledDefault'] = pywbem.Uint16(2)
+ model['InstallDate'] = ntp_inst_date
+ model['OperationalStatus'] = [pywbem.Uint16(2)]
+ model['Status'] = 'OK'
+ model['HealthState'] = pywbem.Uint16(5)
+ model['StartMode'] = 'Automatic'
+ model['Prefer'] = self.prefer and True or False
+ if self.key:
+ model['Key'] = pywbem.Uint32(self.key)
+ if self.ntp_version:
+ model['ntpversion'] = pywbem.Uint32(self.ntp_version)
+ if self.min_poll:
+ model['minpoll'] = pywbem.Uint32(self.min_poll)
+ if self.max_poll:
+ model['maxpoll'] = pywbem.Uint32(self.max_poll)
+ return model
###########################################################################
@classmethod
@@ -82,7 +137,7 @@
f = open('/etc/ntp.conf')
try:
for line in f:
- server = __server_from_conf_line(line)
+ server = NTPServer.__server_from_conf_line(line)
if server is not None:
servers.append(server)
return servers
@@ -98,7 +153,7 @@
try:
usn = server_name.lower()
for line in f:
- server = __server_from_conf_line(line)
+ server = NTPServer.__server_from_conf_line(line)
if server is not None:
if server.server_name.lower() == usn:
return server
@@ -116,7 +171,7 @@
cfile = open('/etc/ntp.conf')
try:
for line in cfile:
- server = __server_from_conf_line(line)
+ server = NTPServer.__server_from_conf_line(line)
if server is None:
tfile.write(line)
continue
@@ -147,13 +202,13 @@
def set_server(cls, ntpserver):
modified = False
server_written = False
- usname = server_name.lower()
+ usname = ntpserver.server_name.lower()
tfd,tfname = tempfile.mkstemp(dir='/etc')
tfile = os.fdopen(tfd, 'w')
cfile = open('/etc/ntp.conf')
try:
for line in cfile:
- server = __server_from_conf_line(line)
+ server = NTPServer.__server_from_conf_line(line)
if server is None:
tfile.write(line)
elif server.server_name.lower() == usname:
@@ -518,9 +573,134 @@
## end of class OMC_HostedTimeServiceProvider
+###############################################################################
+class OMC_RemoteTimeServicePortProvider(pywbem.CIMProvider):
+ """Instrument the CIM class OMC_RemoteTimeServicePort """
+
+ ###########################################################################
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+
+ ###########################################################################
+ @classmethod
+ def __get_ntp_install_date(cls):
+ try:
+ install_time = Popen(['rpm', '-qf','/etc/ntp.conf',
+ '--queryformat','%{INSTALLTIME}'],
+ stdout=PIPE).communicate()[0]
+ return pywbem.CIMDateTime.fromtimestamp(int(install_time))
+ except:
+ return None
+
+ ###########################################################################
+ def get_instance(self, env, model, cim_class):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+ global ntp_inst_date
+ try:
+ server_name = model['Name']
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ svr = NTPServer.get_server(server_name)
+ if not svr:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ return svr.fill_cim_instance(model, False)
+
+ ###########################################################################
+ def enum_instances(self, env, model, cim_class, keys_only):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+ servers = NTPServer.get_servers()
+ for svr in servers:
+ yield svr.fill_cim_instance(model, keys_only)
+
+ ###########################################################################
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.set_instance()' \
+ % self.__class__.__name__)
+ if os.geteuid() != 0:
+ raise pywbem.CIMError(pywbem.CIM_ERR_ACCESS_DENIED)
+ try:
+ sname = previous_instance and previous_instance['Name'] or instance['Name']
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER,
+ "'Name' is a required property")
+ server = NTPServer.get_server(sname)
+ if previous_instance:
+ if not server:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ for k,v in instance.properties.items():
+ previous_instance[k] = v
+ instance = previous_instance
+ else:
+ if server:
+ raise pywbem.CIMError(pywbem.CIM_ERR_ALREADY_EXISTS)
+ server = NTPServer()
+ server.server_name = sname
+
+ if 'prefer' in instance and instance['prefer']:
+ server.prefer = True
+ else:
+ server.prefer = False
+ if 'key' in instance and instance['key']:
+ server.key = int(instance['key'])
+ else:
+ server.key = 0
+
+ if 'ntpversion' in instance and instance['ntpversion']:
+ v = int(instance['ntpversion'])
+ if v < 0 or v > 4:
+ raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER,
+ 'Invalid NTPVersion specified')
+ server.ntp_version = v
+ else:
+ server.ntp_version = 0
+ if 'minpoll' in instance and instance['minpoll']:
+ server.min_poll = int(instance['minpoll'])
+ else:
+ server.min_poll = 0
+ if 'maxpoll' in instance and instance['maxpoll']:
+ server.max_poll = int(instance['maxpoll'])
+ else:
+ server.max_poll = 0
+ NTPServer.set_server(server)
+ return instance
+
+ ###########################################################################
+ def delete_instance(self, env, instance_name):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.delete_instance()' \
+ % self.__class__.__name__)
+ if os.geteuid() != 0:
+ raise pywbem.CIMError(pywbem.CIM_ERR_ACCESS_DENIED)
+ try:
+ sname = instance_name['Name']
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ server = NTPServer.get_server(sname)
+ if not server:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ NTPServer.delete_server(sname)
+
+ ###########################################################################
+ def cim_method_requeststatechange(self, env, object_name, method,
+ param_requestedstate,
+ param_timeoutperiod):
+ # Not supported
+ return (pywbem.Uint32(1), {})
+
+## end of class OMC_RemoteTimeServicePortProvider
+
def get_providers(env):
+ omc_remotetimeserviceport_prov = OMC_RemoteTimeServicePortProvider(env)
omc_systemtimeservice_prov = OMC_SystemTimeServiceProvider(env)
omc_hostedtimeservice_prov = OMC_HostedTimeServiceProvider(env)
return {'OMC_SystemTimeService': omc_systemtimeservice_prov,
- 'OMC_HostedTimeService': omc_hostedtimeservice_prov}
+ 'OMC_HostedTimeService': omc_hostedtimeservice_prov,
+ 'OMC_RemoteTimeServicePort': omc_remotetimeserviceport_prov}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jc...@us...> - 2007-12-17 23:44:31
|
Revision: 515
http://omc.svn.sourceforge.net/omc/?rev=515&view=rev
Author: jcarey
Date: 2007-12-17 15:44:33 -0800 (Mon, 17 Dec 2007)
Log Message:
-----------
Implemented the OMC_TimeServiceAccessBySAP association
Modified Paths:
--------------
pybase/trunk/OMC_TimeService-peg.reg
pybase/trunk/OMC_TimeService.py
Modified: pybase/trunk/OMC_TimeService-peg.reg
===================================================================
--- pybase/trunk/OMC_TimeService-peg.reg 2007-12-17 22:51:17 UTC (rev 514)
+++ pybase/trunk/OMC_TimeService-peg.reg 2007-12-17 23:44:33 UTC (rev 515)
@@ -43,25 +43,25 @@
ProviderType = {2,5}; // Instance, Method
};
-/*
instance of PG_ProviderCapabilities
{
- CapabilityID = "OMC_TimeService_Capability3";
+ CapabilityID = "OMC_TimeService_Capability5";
ProviderModuleName = "OMC_TimeServiceProvider_Module";
ProviderName = "OMC_TimeService_Provider";
- ClassName = "OMC_TimeZoneSettingData";
+ ClassName = "OMC_TimeServiceAccessBySAP";
Namespaces = {"root/cimv2"};
- ProviderType = {2}; // Instance
+ ProviderType = {2,3}; // Instance, Associator
};
+/*
instance of PG_ProviderCapabilities
{
- CapabilityID = "OMC_TimeService_Capability5";
+ CapabilityID = "OMC_TimeService_Capability3";
ProviderModuleName = "OMC_TimeServiceProvider_Module";
ProviderName = "OMC_TimeService_Provider";
- ClassName = "OMC_TimeServiceAccessBySAP";
+ ClassName = "OMC_TimeZoneSettingData";
Namespaces = {"root/cimv2"};
- ProviderType = {2,3}; // Instance, Associator
+ ProviderType = {2}; // Instance
};
instance of PG_ProviderCapabilities
Modified: pybase/trunk/OMC_TimeService.py
===================================================================
--- pybase/trunk/OMC_TimeService.py 2007-12-17 22:51:17 UTC (rev 514)
+++ pybase/trunk/OMC_TimeService.py 2007-12-17 23:44:33 UTC (rev 515)
@@ -97,7 +97,7 @@
return server
- def fill_cim_instance(self, model, keys_only=False):
+ def fill_cim_obj(self, model, keys_only=False):
global ntp_inst_date
model['SystemName'] = _fqdn
model['SystemCreationClassName'] = 'OMC_UnitaryComputerSystem'
@@ -599,7 +599,6 @@
logger = env.get_logger()
logger.log_debug('Entering %s.get_instance()' \
% self.__class__.__name__)
- global ntp_inst_date
try:
server_name = model['Name']
except KeyError:
@@ -607,7 +606,7 @@
svr = NTPServer.get_server(server_name)
if not svr:
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
- return svr.fill_cim_instance(model, False)
+ return svr.fill_cim_obj(model, False)
###########################################################################
def enum_instances(self, env, model, cim_class, keys_only):
@@ -616,7 +615,7 @@
% self.__class__.__name__)
servers = NTPServer.get_servers()
for svr in servers:
- yield svr.fill_cim_instance(model, keys_only)
+ yield svr.fill_cim_obj(model, keys_only)
###########################################################################
def set_instance(self, env, instance, previous_instance, cim_class):
@@ -696,11 +695,121 @@
## end of class OMC_RemoteTimeServicePortProvider
+class OMC_TimeServiceAccessBySAPProvider(pywbem.CIMProvider):
+ """Instrument the CIM class OMC_TimeServiceAccessBySAP"""
+
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+
+ def get_instance(self, env, model, cim_class):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+ try:
+ antref = model['Antecedent']
+ depref = model['Dependent']
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ # Verify service ref
+ if not _is_service_ref(antref):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+
+ # Verify SAP ref
+ try:
+ server_name = depref['Name']
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ svr = NTPServer.get_server(server_name)
+ if not svr:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ return model
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+ ref = pywbem.CIMInstanceName(
+ classname='OMC_SystemTimeService',
+ namespace=model.path.namespace);
+ model['Antecedent'] = _fill_service_instance(ref, True)
+ ref = pywbem.CIMInstanceName(
+ classname='OMC_RemoteTimeServicePort',
+ namespace=model.path.namespace);
+ servers = NTPServer.get_servers()
+ for svr in servers:
+ model['Dependent'] = svr.fill_cim_obj(ref, True)
+ yield model
+
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ def delete_instance(self, env, instance_name):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ def references(self, env, object_name, model, assoc_class,
+ result_class_name, role, result_role, keys_only):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.references()' \
+ % self.__class__.__name__)
+ ch = env.get_cimom_handle()
+ if object_name.classname.lower() == 'omc_systemtimeservice':
+ if not _is_service_ref(object_name):
+ return
+ if role and role.lower() != 'antecedent':
+ return
+ if result_role and result_role.lower() != 'dependent':
+ return
+ if result_class_name and len(result_class_name):
+ if not pywbem.is_subclass(ch, object_name.namespace,
+ sub='OMC_RemoteTimeServicePort',
+ super=result_class_name):
+ return
+ model['Antecedent'] = object_name
+ ref = pywbem.CIMInstanceName(
+ classname='OMC_RemoteTimeServicePort',
+ namespace=object_name.namespace);
+ servers = NTPServer.get_servers()
+ for svr in servers:
+ model['Dependent'] = svr.fill_cim_obj(ref, True)
+ yield model
+ elif object_name.classname.lower() == 'omc_remotetimeserviceport':
+ if role and role.lower() != 'dependent':
+ return
+ if result_role and result_role.lower() != 'antecedent':
+ return
+ if result_class_name and len(result_class_name):
+ if not pywbem.is_subclass(ch, object_name.namespace,
+ sub='OMC_SystemTimeService',
+ super=result_class_name):
+ return
+ try:
+ server_name = object_name['Name']
+ except KeyError:
+ return
+ svr = NTPServer.get_server(server_name)
+ if not svr:
+ return
+ model['Dependent'] = object_name
+ ref = pywbem.CIMInstanceName(
+ classname='OMC_SystemTimeService',
+ namespace=object_name.namespace);
+ model['Antecedent'] = _fill_service_instance(ref, True)
+ yield model
+
+## end of class OMC_TimeServiceAccessBySAPProvider
+
def get_providers(env):
+ return {'OMC_TimeServiceAccessBySAP': omc_timeserviceaccessbysap_prov}
+
+def get_providers(env):
+ omc_timeserviceaccessbysap_prov = OMC_TimeServiceAccessBySAPProvider(env)
omc_remotetimeserviceport_prov = OMC_RemoteTimeServicePortProvider(env)
omc_systemtimeservice_prov = OMC_SystemTimeServiceProvider(env)
omc_hostedtimeservice_prov = OMC_HostedTimeServiceProvider(env)
return {'OMC_SystemTimeService': omc_systemtimeservice_prov,
'OMC_HostedTimeService': omc_hostedtimeservice_prov,
- 'OMC_RemoteTimeServicePort': omc_remotetimeserviceport_prov}
+ 'OMC_RemoteTimeServicePort': omc_remotetimeserviceport_prov,
+ 'OMC_TimeServiceAccessBySAP': omc_timeserviceaccessbysap_prov}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2007-12-18 03:34:44
|
Revision: 516
http://omc.svn.sourceforge.net/omc/?rev=516&view=rev
Author: bartw
Date: 2007-12-17 19:34:49 -0800 (Mon, 17 Dec 2007)
Log Message:
-----------
added LogManagedRecord association
Modified Paths:
--------------
pybase/trunk/OMC_SyslogNG-peg.reg
pybase/trunk/OMC_SyslogNG.mof
pybase/trunk/OMC_SyslogNG.py
Modified: pybase/trunk/OMC_SyslogNG-peg.reg
===================================================================
--- pybase/trunk/OMC_SyslogNG-peg.reg 2007-12-17 23:44:33 UTC (rev 515)
+++ pybase/trunk/OMC_SyslogNG-peg.reg 2007-12-18 03:34:49 UTC (rev 516)
@@ -33,3 +33,13 @@
ProviderType = {2}; // Instance
};
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_SyslogNGLogManagesRecord";
+ ProviderModuleName = "/usr/lib/pycim/OMC_SyslogNG.py";
+ ProviderName = "OMC_SyslogNG";
+ ClassName = "OMC_SyslogNGLogManagesRecord";
+ Namespaces = {"root/cimv2"}; // TODO
+ ProviderType = {2,3}; // Instance, Associator
+};
+
Modified: pybase/trunk/OMC_SyslogNG.mof
===================================================================
--- pybase/trunk/OMC_SyslogNG.mof 2007-12-17 23:44:33 UTC (rev 515)
+++ pybase/trunk/OMC_SyslogNG.mof 2007-12-18 03:34:49 UTC (rev 516)
@@ -33,6 +33,7 @@
#pragma locale ("en_US")
[
+ Version("0.0.1"),
Description ("Class representing a syslog-ng log file")
]
class OMC_SyslogNGRecordLog : CIM_RecordLog
@@ -41,6 +42,7 @@
[
+ Version("0.0.1"),
Description ("Class representing a record in a log file.")
]
class OMC_SyslogNGLogRecord : CIM_LogRecord
@@ -49,6 +51,7 @@
[
+ Version("0.0.1"),
Description ("Association that ties ManagedElement (and/or) ComputerSystem to a RecordLog.")
]
class OMC_SyslogNGUseOfLog : CIM_UseOfLog
@@ -57,19 +60,27 @@
[
+ Association, Aggregation, Version("0.0.1"), Composition,
Description ("Association between a RecordLog and its LogRecords.")
]
class OMC_SyslogNGLogManagesRecord : CIM_LogManagesRecord
{
+ [ Key, Override("Record"),
+ Description("The record managed by the Log.") ]
+ OMC_SyslogNGLogRecord REF Record;
+
+ [ Key, Override("Log"), Max(1), Min(1),
+ Description("The Log.") ]
+ OMC_SyslogNGRecordLog REF Log;
};
// ==================================================================
// OMC_SyslogNGRecordLogCapabilities
// ==================================================================
[Version ( "0.0.1" ), Description (
- "EnabledLogicalElementCapabilities for SyslogNGRecordLog. "
- "This class is here for conformance with the SMASH Record Log Profile. "
- "For other details, see parent class.")]
+ "EnabledLogicalElementCapabilities for SyslogNGRecordLog. "
+ "This class is here for conformance with the SMASH Record Log Profile. "
+ "For other details, see parent class.")]
class OMC_SyslogNGRecordLogCapabilities : CIM_EnabledLogicalElementCapabilities
{
};
@@ -78,8 +89,10 @@
// ==================================================================
// OMC_SyslogNGRecordLogToCapabilities
// ==================================================================
-[Association, Version ( "0.0.1" ), Description ("Associates OMC_SyslogNGRecordLog to "
- "OMC_SyslogNGRecordLogCapabilities.")]
+[ Association, Version ( "0.0.1" ),
+ Description (
+ "Associates OMC_SyslogNGRecordLog to "
+ "OMC_SyslogNGRecordLogCapabilities.")]
class OMC_SyslogNGRecordLogToCapabilities : CIM_ElementCapabilities
{
[Override ( "ManagedElement" ), Min ( 1 ), Max ( 1 ), Description (
Modified: pybase/trunk/OMC_SyslogNG.py
===================================================================
--- pybase/trunk/OMC_SyslogNG.py 2007-12-17 23:44:33 UTC (rev 515)
+++ pybase/trunk/OMC_SyslogNG.py 2007-12-18 03:34:49 UTC (rev 516)
@@ -10,7 +10,7 @@
rval = []
fo = open('/etc/syslog-ng/syslog-ng.conf', 'r')
state = 'i'
- for line in fo.readlines():
+ for line in fo:
line = line.strip()
if line and line[0] == '#':
continue
@@ -96,7 +96,13 @@
ux(MaxNumberOfRecords=pywbem.Uint64(0))
try:
fo = open(file, 'r')
- numlines = len(fo.readlines())
+ numlines = 0
+ while True:
+ try:
+ fo.next()
+ numlines+= 1
+ except StopIteration:
+ break
fo.close()
except:
numlines = 0
@@ -564,14 +570,7 @@
# Vendor_Reserved = 0x8000..
## end of class OMC_SyslogNGRecordLogProvider
-"""Python Provider for OMC_SyslogNGLogRecord
-Instruments the CIM class OMC_SyslogNGLogRecord
-
-"""
-
-import pywbem
-
class OMC_SyslogNGLogRecordProvider(pywbem.CIMProvider):
"""Instrument the CIM class OMC_SyslogNGLogRecord
@@ -625,7 +624,10 @@
# model['LogName']
# model['CreationClassName']
try:
- fname = model['LogName']
+ id = model['LogName']
+ if not id.startswith('OMCSyslogNGRecordLog:'):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ fname = id[id.index(':')+1:]
lineno = int(model['RecordID'])
except KeyError:
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
@@ -683,10 +685,11 @@
model['CreationClassName'] = 'OMC_SyslogNGLogRecord'
for fname in _get_syslog_list():
fo = open(fname, 'r')
- model['LogName'] = fname
+ model['LogName'] = 'OMCSyslogNGRecordLog:' + fname
lineno = 0
for line in fo:
- model['MessageTimestamp'] = pywbem.CIMDateTime.now()
+ #model['MessageTimestamp'] = pywbem.CIMDateTime.now()
+ model['MessageTimestamp'] = pywbem.CIMDateTime('99990101000000.000000+000')
lineno+= 1
model['RecordID'] = str(lineno)
if keys_only:
@@ -765,10 +768,278 @@
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
## end of class OMC_SyslogNGLogRecordProvider
+class OMC_SyslogNGLogManagesRecordProvider(pywbem.CIMProvider):
+ """Instrument the CIM class OMC_SyslogNGLogManagesRecord
+ Association between a RecordLog and its LogRecords.
+
+ """
+
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+ # If you will be filtering instances yourself according to
+ # property_list, role, result_role, and result_class_name
+ # parameters, set self.filter_results to False
+ # self.filter_results = False
+
+ def get_instance(self, env, model, cim_class):
+ """Return an instance.
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ model -- A template of the pywbem.CIMInstance to be returned. The
+ key properties are set on this instance to correspond to the
+ instanceName that was requested. The properties of the model
+ are already filtered according to the PropertyList from the
+ request. Only properties present in the model need to be
+ given values. If you prefer, you can set all of the
+ values, and the instance will be filtered for you.
+ cim_class -- The pywbem.CIMClass
+
+ Possible Errors:
+ CIM_ERR_ACCESS_DENIED
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ or otherwise incorrect parameters)
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ Instance does not exist in the specified namespace)
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+
+ ux = model.update_existing
+
+ # TODO fetch system resource matching the following keys:
+ # model['Record']
+ # model['Log']
+
+ return model
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+ """Enumerate instances.
+
+ The WBEM operations EnumerateInstances and EnumerateInstanceNames
+ are both mapped to this method.
+ This method is a python generator
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ model -- A template of the pywbem.CIMInstances to be generated.
+ The properties of the model are already filtered according to
+ the PropertyList from the request. Only properties present in
+ the model need to be given values. If you prefer, you can
+ always set all of the values, and the instance will be filtered
+ for you.
+ cim_class -- The pywbem.CIMClass
+ keys_only -- A boolean. True if only the key properties should be
+ set on the generated instances.
+
+ Possible Errors:
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+
+ while False: # TODO more instances?
+ # TODO fetch system resource
+ # Key properties
+ #model['Record'] = # TODO (type = REF (pywbem.CIMInstanceName(classname='OMC_SyslogNGLogRecord', ...))
+ #model['Log'] = # TODO (type = REF (pywbem.CIMInstanceName(classname='OMC_SyslogNGRecordLog', ...))
+ if keys_only:
+ yield model
+ else:
+ try:
+ yield self.get_instance(env, model, cim_class)
+ except pywbem.CIMError, (num, msg):
+ if num not in (pywbem.CIM_ERR_NOT_FOUND,
+ pywbem.CIM_ERR_ACCESS_DENIED):
+ raise
+
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ """Return a newly created or modified instance.
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ instance -- The new pywbem.CIMInstance. If modifying an existing
+ instance, the properties on this instance have been filtered by
+ the PropertyList from the request.
+ previous_instance -- The previous pywbem.CIMInstance if modifying
+ an existing instance. None if creating a new instance.
+ cim_class -- The pywbem.CIMClass
+
+ Return the new instance. The keys must be set on the new instance.
+
+ Possible Errors:
+ CIM_ERR_ACCESS_DENIED
+ CIM_ERR_NOT_SUPPORTED
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ or otherwise incorrect parameters)
+ CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
+ valid if previous_instance is None, indicating that the operation
+ was CreateInstance)
+ CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
+ if previous_instance is not None, indicating that the operation
+ was ModifyInstance)
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.set_instance()' \
+ % self.__class__.__name__)
+ # TODO create or modify the instance
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
+ return instance
+
+ def delete_instance(self, env, instance_name):
+ """Delete an instance.
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ instance_name -- A pywbem.CIMInstanceName specifying the instance
+ to delete.
+
+ Possible Errors:
+ CIM_ERR_ACCESS_DENIED
+ CIM_ERR_NOT_SUPPORTED
+ CIM_ERR_INVALID_NAMESPACE
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ or otherwise incorrect parameters)
+ CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
+ namespace)
+ CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
+ Instance does not exist in the specified namespace)
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.delete_instance()' \
+ % self.__class__.__name__)
+
+ # TODO delete the resource
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
+
+ def references(self, env, object_name, model, assoc_class,
+ result_class_name, role, result_role, keys_only):
+ """Instrument Associations.
+
+ All four association-related operations (Associators, AssociatorNames,
+ References, ReferenceNames) are mapped to this method.
+ This method is a python generator
+
+ Keyword arguments:
+ env -- Provider Environment (pycimmb.ProviderEnvironment)
+ object_name -- A pywbem.CIMInstanceName that defines the source
+ CIM Object whose associated Objects are to be returned.
+ model -- A template pywbem.CIMInstance to serve as a model
+ of the objects to be returned. Only properties present on this
+ model need to be set.
+ assoc_class -- The pywbem.CIMClass.
+ result_class_name -- If not empty, this string acts as a filter on
+ the returned set of Instances by mandating that each returned
+ Instances MUST represent an association between object_name
+ and an Instance of a Class whose name matches this parameter
+ or a subclass.
+ role -- If not empty, MUST be a valid Property name. It acts as a
+ filter on the returned set of Instances by mandating that each
+ returned Instance MUST refer to object_name via a Property
+ whose name matches the value of this parameter.
+ result_role -- If not empty, MUST be a valid Property name. It acts
+ as a filter on the returned set of Instances by mandating that
+ each returned Instance MUST represent associations of
+ object_name to other Instances, where the other Instances play
+ the specified result_role in the association (i.e. the
+ name of the Property in the Association Class that refers to
+ the Object related to object_name MUST match the value of this
+ parameter).
+ keys_only -- A boolean. True if only the key properties should be
+ set on the generated instances.
+
+ The following diagram may be helpful in understanding the role,
+ result_role, and result_class_name parameters.
+ +------------------------+ +-------------------+
+ | object_name.classname | | result_class_name |
+ | ~~~~~~~~~~~~~~~~~~~~~ | | ~~~~~~~~~~~~~~~~~ |
+ +------------------------+ +-------------------+
+ | +-----------------------------------+ |
+ | | [Association] assoc_class | |
+ | object_name | ~~~~~~~~~~~~~~~~~~~~~~~~~ | |
+ +--------------+ object_name.classname REF role | |
+ (CIMInstanceName) | result_class_name REF result_role +------+
+ | |(CIMInstanceName)
+ +-----------------------------------+
+
+ Possible Errors:
+ CIM_ERR_ACCESS_DENIED
+ CIM_ERR_NOT_SUPPORTED
+ CIM_ERR_INVALID_NAMESPACE
+ CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
+ or otherwise incorrect parameters)
+ CIM_ERR_FAILED (some other unspecified error occurred)
+
+ """
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.references()' \
+ % self.__class__.__name__)
+ ch = env.get_cimom_handle()
+ if (not role or role.lower() == 'record') and \
+ pywbem.is_subclass(ch, object_name.namespace,
+ sub=object_name.classname,
+ super='OMC_SyslogNGLogRecord'):
+ model['Record'] = object_name
+ logfilename = object_name['LogName']
+ if logfilename in _get_syslog_list():
+ model['Log'] = pywbem.CIMInstanceName('OMC_SyslogNGRecordLog',
+ keybindings={'InstanceID':'OMCSyslogNGRecordLog:' + \
+ logfilename})
+ yield model
+
+ if (not role or role.lower() == 'log') and \
+ pywbem.is_subclass(ch, object_name.namespace,
+ sub=object_name.classname,
+ super='OMC_SyslogNGRecordLog'):
+ model['Log'] = object_name
+ id = object_name['InstanceID']
+ if not id.startswith('OMCSyslogNGRecordLog:'):
+ return
+ file = id[id.index(':')+1:]
+ try:
+ fo = open(file, 'r')
+ except:
+ return
+ recordname = pywbem.CIMInstanceName('OMC_SyslogNGLogRecord',
+ keybindings={'LogCreationClassName':'OMC_SyslogNGRecordLog',
+ 'MessageTimestamp':pywbem.CIMDateTime('99990101000000.000000+000'),
+ 'LogName':id,
+ 'CreationClassName':'OMC_SyslogNGLogRecord'})
+ cnt = 0
+ model['Record'] = recordname
+ while True:
+ try:
+ fo.next()
+ cnt+= 1
+ recordname['RecordID'] = str(cnt)
+ yield model
+ except StopIteration:
+ break
+ fo.close()
+
+
def get_providers(env):
omc_syslogngrecordlog_prov = OMC_SyslogNGRecordLogProvider(env)
omc_syslognglogrecord_prov = OMC_SyslogNGLogRecordProvider(env)
+ omc_syslognglogmanagesrecord_prov = OMC_SyslogNGLogManagesRecordProvider(env)
return {'OMC_SyslogNGRecordLog': omc_syslogngrecordlog_prov,
- 'OMC_SyslogNGLogRecord': omc_syslognglogrecord_prov}
+ 'OMC_SyslogNGLogRecord': omc_syslognglogrecord_prov,
+ 'OMC_SyslogNGLogManagesRecord': omc_syslognglogmanagesrecord_prov}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jc...@us...> - 2007-12-18 18:14:56
|
Revision: 517
http://omc.svn.sourceforge.net/omc/?rev=517&view=rev
Author: jcarey
Date: 2007-12-18 10:15:00 -0800 (Tue, 18 Dec 2007)
Log Message:
-----------
implemented the time zone setting data and association to service
Modified Paths:
--------------
pybase/trunk/OMC_TimeService-peg.reg
pybase/trunk/OMC_TimeService.py
Modified: pybase/trunk/OMC_TimeService-peg.reg
===================================================================
--- pybase/trunk/OMC_TimeService-peg.reg 2007-12-18 03:34:49 UTC (rev 516)
+++ pybase/trunk/OMC_TimeService-peg.reg 2007-12-18 18:15:00 UTC (rev 517)
@@ -53,7 +53,6 @@
ProviderType = {2,3}; // Instance, Associator
};
-/*
instance of PG_ProviderCapabilities
{
CapabilityID = "OMC_TimeService_Capability3";
@@ -74,6 +73,7 @@
ProviderType = {2,3}; // Instance, Associator
};
+/*
instance of PG_ProviderCapabilities
{
CapabilityID = "OMC_TimeService_Capability7";
Modified: pybase/trunk/OMC_TimeService.py
===================================================================
--- pybase/trunk/OMC_TimeService.py 2007-12-18 03:34:49 UTC (rev 516)
+++ pybase/trunk/OMC_TimeService.py 2007-12-18 18:15:00 UTC (rev 517)
@@ -186,6 +186,7 @@
else:
os.unlink('/etc/ntp.conf')
os.rename(tfname, '/etc/ntp.conf')
+ os.chmod('/etc/ntp.conf', 0644)
return modified
except Exception,einst:
tfile.close()
@@ -232,6 +233,7 @@
else:
os.unlink('/etc/ntp.conf')
os.rename(tfname, '/etc/ntp.conf')
+ os.chmod('/etc/ntp.conf', 0644)
return modified
except Exception,einst:
tfile.close()
@@ -310,6 +312,7 @@
else:
os.unlink('/etc/sysconfig/clock')
os.rename(tfname, '/etc/sysconfig/clock')
+ os.chmod('/etc/sysconfig/clock', 0644)
except Exception,einst:
tfile.close()
cfile.close()
@@ -797,13 +800,194 @@
namespace=object_name.namespace);
model['Antecedent'] = _fill_service_instance(ref, True)
yield model
-
## end of class OMC_TimeServiceAccessBySAPProvider
-def get_providers(env):
- return {'OMC_TimeServiceAccessBySAP': omc_timeserviceaccessbysap_prov}
+class OMC_TimeZoneSettingDataProvider(pywbem.CIMProvider):
+ """Instrument the CIM class OMC_TimeZoneSettingData"""
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+
+ def get_instance(self, env, model, cim_class):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+ try:
+ iid = model['InstanceID']
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ if iid.lower() != 'omc:timezone':
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ tzcc = _clock_conf_get_time_zone()
+ if not tzcc:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ model['ElementName'] = 'omc:timezone'
+ model['UTCHardwareClock'] = tzcc[0]
+ model['TimeZone'] = tzcc[1]
+ model['Caption'] = 'Time Zone Setting'
+ model['Description'] = 'Local time zone for the system'
+ return model
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+ tzcc = _clock_conf_get_time_zone()
+ if not tzcc:
+ return
+ model['InstanceID'] = 'omc:timezone'
+ if not keys_only:
+ model['ElementName'] = 'omc:timezone'
+ model['UTCHardwareClock'] = tzcc[0]
+ model['TimeZone'] = tzcc[1]
+ model['Caption'] = 'Time Zone Setting'
+ model['Description'] = 'Local time zone for the system'
+ yield model
+
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.set_instance()' \
+ % self.__class__.__name__)
+ if os.geteuid() != 0:
+ raise pywbem.CIMError(pywbem.CIM_ERR_ACCESS_DENIED)
+ if previous_instance:
+ for k,v in instance.properties.items():
+ previous_instance[k] = v
+ instance = previous_instance
+ try:
+ iid = instance['InstanceID']
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ if iid.lower() != 'omc:timezone':
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+
+ if 'timezone' not in instance or not instance['timezone']:
+ raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER,
+ "'TimeZone' is a required property")
+ if 'utchardwareclock' not in instance:
+ raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER,
+ "'UTCHardwareClass' is a required property")
+ time_zone = instance['timezone']
+ is_utc = instance['utchardwareclock']
+ tzcc = _clock_conf_get_time_zone()
+ if not tzcc:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ old_time_zone = tzcc[1]
+ # Verify zone info
+ zone_file = '/usr/share/zoneinfo/%s' % time_zone
+ if not os.path.exists(zone_file):
+ raise pywbem.CIMError(pywbem.CIM_ERR_INVALID_PARAMETER,
+ '%s is not a valid time zone specification' % instance['timezone'])
+
+ cmd = '/usr/sbin/zic -l %s' % time_zone
+ cc = os.system(cmd)
+ if cc:
+ try:
+ # Try to revert back to old
+ os.system('/usr/sbin/zic -l %s' % old_time_zone)
+ except:
+ pass
+ raise pywbem.CIMError(pywbem.CIM_ERR_FAILED,
+ 'Failed to execute command %s' % cmd)
+
+ try:
+ _clock_conf_modify(is_utc, time_zone)
+ except Exception,einst:
+ # Try to recover old
+ try:
+ os.system('/usr/sbin/zic -l %s' % old_time_zone)
+ except:
+ pass
+ raise einst
+ return instance
+
+ def delete_instance(self, env, instance_name):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+## end of class OMC_TimeZoneSettingDataProvider
+
+class OMC_TimeServiceTimeZoneSettingDataProvider(pywbem.CIMProvider):
+ """Instrument the CIM class OMC_TimeServiceTimeZoneSettingData"""
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+
+ def get_instance(self, env, model, cim_class):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+ # TODO
+ return model
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+ # TODO
+ if False:
+ yield None
+
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ def delete_instance(self, env, instance_name):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ def references(self, env, object_name, model, assoc_class,
+ result_class_name, role, result_role, keys_only):
+ print '#### my references called'
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.references()' \
+ % self.__class__.__name__)
+ ch = env.get_cimom_handle()
+ if object_name.classname.lower() == 'omc_systemtimeservice':
+ print '#### my references the service!'
+ if role and role.lower() != 'managedelement':
+ return
+ if result_role and result_role.lower() != 'settingdata':
+ return
+ if result_class_name:
+ if not pywbem.is_subclass(ch, object_name.namespace,
+ sub='omc_timezonesettingdata',
+ super=result_class_name):
+ return
+ if not _is_service_ref(object_name):
+ return
+ model['managedelement'] = object_name
+ model['settingdata'] = pywbem.CIMInstanceName(
+ classname='OMC_TimeZoneSettingData',
+ namespace=object_name.namespace,
+ keybindings={'InstanceID':'omc:timezone'})
+ yield model
+ elif object_name.classname.lower() == 'omc_timezonesettingdata':
+ if role and role.lower() != 'settingdata':
+ return
+ if result_role and result_role.lower() != 'managedelement':
+ return
+ if result_class_name:
+ if not pywbem.is_subclass(ch, object_name.namespace,
+ sub='omc_systemtimeservice',
+ super=result_class_name):
+ return
+ try:
+ print '### object_name[instanceid] =',object_name['instanceid']
+ if object_name['InstanceID'].lower() != 'omc:timezone':
+ print '### No match on instance id'
+ return
+ except KeyError:
+ print '### KeyError on instance id'
+ return
+ model['settingdata'] = object_name
+ ref = pywbem.CIMInstanceName(classname='OMC_SystemTimeService',
+ namespace=object_name.namespace)
+ model['managedelement'] = _fill_service_instance(ref, True)
+ yield model
+
+## end of class OMC_TimeServiceTimeZoneSettingDataProvider
+
def get_providers(env):
+ omc_timeservicetimezonesettingdata_prov = OMC_TimeServiceTimeZoneSettingDataProvider(env)
+ omc_timezonesettingdata_prov = OMC_TimeZoneSettingDataProvider(env)
omc_timeserviceaccessbysap_prov = OMC_TimeServiceAccessBySAPProvider(env)
omc_remotetimeserviceport_prov = OMC_RemoteTimeServicePortProvider(env)
omc_systemtimeservice_prov = OMC_SystemTimeServiceProvider(env)
@@ -811,5 +995,7 @@
return {'OMC_SystemTimeService': omc_systemtimeservice_prov,
'OMC_HostedTimeService': omc_hostedtimeservice_prov,
'OMC_RemoteTimeServicePort': omc_remotetimeserviceport_prov,
- 'OMC_TimeServiceAccessBySAP': omc_timeserviceaccessbysap_prov}
+ 'OMC_TimeServiceAccessBySAP': omc_timeserviceaccessbysap_prov,
+ 'OMC_TimeZoneSettingData': omc_timezonesettingdata_prov,
+ 'OMC_TimeServiceTimeZoneSettingData': omc_timeservicetimezonesettingdata_prov}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jc...@us...> - 2007-12-18 18:46:27
|
Revision: 518
http://omc.svn.sourceforge.net/omc/?rev=518&view=rev
Author: jcarey
Date: 2007-12-18 10:46:31 -0800 (Tue, 18 Dec 2007)
Log Message:
-----------
Implemented the time service available to element association. TimeService providers now complete
Modified Paths:
--------------
pybase/trunk/OMC_TimeService-peg.reg
pybase/trunk/OMC_TimeService.py
Modified: pybase/trunk/OMC_TimeService-peg.reg
===================================================================
--- pybase/trunk/OMC_TimeService-peg.reg 2007-12-18 18:15:00 UTC (rev 517)
+++ pybase/trunk/OMC_TimeService-peg.reg 2007-12-18 18:46:31 UTC (rev 518)
@@ -73,7 +73,6 @@
ProviderType = {2,3}; // Instance, Associator
};
-/*
instance of PG_ProviderCapabilities
{
CapabilityID = "OMC_TimeService_Capability7";
@@ -84,7 +83,6 @@
ProviderType = {2,3}; // Instance, Associator
};
-*/
@@ -93,4 +91,3 @@
-
Modified: pybase/trunk/OMC_TimeService.py
===================================================================
--- pybase/trunk/OMC_TimeService.py 2007-12-18 18:15:00 UTC (rev 517)
+++ pybase/trunk/OMC_TimeService.py 2007-12-18 18:46:31 UTC (rev 518)
@@ -563,7 +563,7 @@
return
if result_role and result_role.lower() != 'dependent':
return
- if result_class:
+ if result_class_name:
if not pywbem.is_subclass(env.get_cimom_handle(),
object_name.namespace, sub='omc_systemtimeservice',
super=result_class_name):
@@ -698,14 +698,17 @@
## end of class OMC_RemoteTimeServicePortProvider
+###############################################################################
class OMC_TimeServiceAccessBySAPProvider(pywbem.CIMProvider):
"""Instrument the CIM class OMC_TimeServiceAccessBySAP"""
+ ###########################################################################
def __init__ (self, env):
logger = env.get_logger()
logger.log_debug('Initializing provider %s from %s' \
% (self.__class__.__name__, __file__))
+ ###########################################################################
def get_instance(self, env, model, cim_class):
logger = env.get_logger()
logger.log_debug('Entering %s.get_instance()' \
@@ -729,6 +732,7 @@
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
return model
+ ###########################################################################
def enum_instances(self, env, model, cim_class, keys_only):
logger = env.get_logger()
logger.log_debug('Entering %s.enum_instances()' \
@@ -745,12 +749,15 @@
model['Dependent'] = svr.fill_cim_obj(ref, True)
yield model
+ ###########################################################################
def set_instance(self, env, instance, previous_instance, cim_class):
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+ ###########################################################################
def delete_instance(self, env, instance_name):
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+ ###########################################################################
def references(self, env, object_name, model, assoc_class,
result_class_name, role, result_role, keys_only):
logger = env.get_logger()
@@ -802,14 +809,17 @@
yield model
## end of class OMC_TimeServiceAccessBySAPProvider
+###############################################################################
class OMC_TimeZoneSettingDataProvider(pywbem.CIMProvider):
"""Instrument the CIM class OMC_TimeZoneSettingData"""
+ ###########################################################################
def __init__ (self, env):
logger = env.get_logger()
logger.log_debug('Initializing provider %s from %s' \
% (self.__class__.__name__, __file__))
+ ###########################################################################
def get_instance(self, env, model, cim_class):
logger = env.get_logger()
logger.log_debug('Entering %s.get_instance()' \
@@ -830,6 +840,7 @@
model['Description'] = 'Local time zone for the system'
return model
+ ###########################################################################
def enum_instances(self, env, model, cim_class, keys_only):
logger = env.get_logger()
logger.log_debug('Entering %s.enum_instances()' \
@@ -846,6 +857,7 @@
model['Description'] = 'Local time zone for the system'
yield model
+ ###########################################################################
def set_instance(self, env, instance, previous_instance, cim_class):
logger = env.get_logger()
logger.log_debug('Entering %s.set_instance()' \
@@ -903,45 +915,73 @@
raise einst
return instance
+ ###########################################################################
def delete_instance(self, env, instance_name):
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
## end of class OMC_TimeZoneSettingDataProvider
+###############################################################################
class OMC_TimeServiceTimeZoneSettingDataProvider(pywbem.CIMProvider):
"""Instrument the CIM class OMC_TimeServiceTimeZoneSettingData"""
+
+ ###########################################################################
def __init__ (self, env):
logger = env.get_logger()
logger.log_debug('Initializing provider %s from %s' \
% (self.__class__.__name__, __file__))
+ ###########################################################################
def get_instance(self, env, model, cim_class):
logger = env.get_logger()
logger.log_debug('Entering %s.get_instance()' \
% self.__class__.__name__)
- # TODO
+ try:
+ srvref = model['managedelement']
+ if not _is_service_ref(srvref):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ sdref = model['settingdata']
+ if sdref['InstanceID'].lower() != 'omc:timezone':
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ model['IsDefault'] = pywbem.Uint16(0)
+ model['IsCurrent'] = pywbem.Uint16(1)
return model
+ ###########################################################################
def enum_instances(self, env, model, cim_class, keys_only):
- # TODO
- if False:
- yield None
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+ model['settingdata'] = pywbem.CIMInstanceName(
+ classname='OMC_TimeZoneSettingData',
+ namespace=model.path.namespace,
+ keybindings={'InstanceID':'omc:timezone'})
+ ref = pywbem.CIMInstanceName(classname='OMC_SystemTimeService',
+ namespace=model.path.namespace)
+ model['managedelement'] = _fill_service_instance(ref, True)
+ if not keys_only:
+ model['IsDefault'] = pywbem.Uint16(0)
+ model['IsCurrent'] = pywbem.Uint16(1)
+ yield model
+ ###########################################################################
def set_instance(self, env, instance, previous_instance, cim_class):
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+ ###########################################################################
def delete_instance(self, env, instance_name):
raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+ ###########################################################################
def references(self, env, object_name, model, assoc_class,
result_class_name, role, result_role, keys_only):
- print '#### my references called'
logger = env.get_logger()
logger.log_debug('Entering %s.references()' \
% self.__class__.__name__)
ch = env.get_cimom_handle()
if object_name.classname.lower() == 'omc_systemtimeservice':
- print '#### my references the service!'
if role and role.lower() != 'managedelement':
return
if result_role and result_role.lower() != 'settingdata':
@@ -958,6 +998,8 @@
classname='OMC_TimeZoneSettingData',
namespace=object_name.namespace,
keybindings={'InstanceID':'omc:timezone'})
+ model['IsDefault'] = pywbem.Uint16(0)
+ model['IsCurrent'] = pywbem.Uint16(1)
yield model
elif object_name.classname.lower() == 'omc_timezonesettingdata':
if role and role.lower() != 'settingdata':
@@ -970,22 +1012,119 @@
super=result_class_name):
return
try:
- print '### object_name[instanceid] =',object_name['instanceid']
if object_name['InstanceID'].lower() != 'omc:timezone':
- print '### No match on instance id'
return
except KeyError:
- print '### KeyError on instance id'
return
model['settingdata'] = object_name
ref = pywbem.CIMInstanceName(classname='OMC_SystemTimeService',
namespace=object_name.namespace)
model['managedelement'] = _fill_service_instance(ref, True)
+ model['IsDefault'] = pywbem.Uint16(0)
+ model['IsCurrent'] = pywbem.Uint16(1)
yield model
## end of class OMC_TimeServiceTimeZoneSettingDataProvider
+###############################################################################
+class OMC_TimeServiceAvailableToElementProvider(pywbem.CIMProvider):
+ """Instrument the CIM class OMC_TimeServiceAvailableToElement"""
+
+ ###########################################################################
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+
+ ###########################################################################
+ def get_instance(self, env, model, cim_class):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+ try:
+ tsref = model['serviceprovided']
+ if not _is_service_ref(tsref):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ csref = model['userofservice']
+ if not _is_cs_ref(csref):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ return model
+
+ ###########################################################################
+ def enum_instances(self, env, model, cim_class, keys_only):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+ model['userofservice'] = pywbem.CIMInstanceName(
+ classname='OMC_UnitaryComputerSystem',
+ namespace=model.path.namespace,
+ keybindings={'CreationClassName':'OMC_UnitaryComputerSystem',
+ 'Name':_fqdn})
+ ref = pywbem.CIMInstanceName(classname='OMC_SystemTimeService',
+ namespace=model.path.namespace)
+ model['serviceprovided'] = _fill_service_instance(ref, True)
+ yield model
+
+ ###########################################################################
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ ###########################################################################
+ def delete_instance(self, env, instance_name):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ ###########################################################################
+ def references(self, env, object_name, model, assoc_class,
+ result_class_name, role, result_role, keys_only):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.references()' \
+ % self.__class__.__name__)
+ ch = env.get_cimom_handle()
+ if object_name.classname.lower() == 'omc_systemtimeservice':
+ if role and role.lower() != 'serviceprovided':
+ return
+ if result_role and result_role.lower() != 'userofservice':
+ return
+ if result_class_name:
+ if not pywbem.is_subclass(ch, object_name.namespace,
+ sub='omc_unitarycomputersystem',
+ super=result_class_name):
+ return
+ if not _is_service_ref(object_name):
+ return
+ model['serviceprovided'] = object_name
+ model['userofservice'] = pywbem.CIMInstanceName(
+ classname='OMC_UnitaryComputerSystem',
+ namespace=object_name.namespace,
+ keybindings={'CreationClassName':'OMC_UnitaryComputerSystem',
+ 'Name':_fqdn})
+ yield model
+
+ elif object_name.classname.lower() == 'omc_unitarycomputersystem':
+ if role and role.lower() != 'userofservice':
+ return
+ if result_role and result_role.lower() != 'serviceprovided':
+ return
+ if result_class_name:
+ if not pywbem.is_subclass(ch, object_name.namespace,
+ sub='omc_systemtimeservice',
+ super=result_class_name):
+ return
+ if not _is_cs_ref(object_name):
+ return
+ model['userofservice'] = object_name
+ ref = pywbem.CIMInstanceName(classname='OMC_SystemTimeService',
+ namespace=object_name.namespace)
+ model['serviceprovided'] = _fill_service_instance(ref, True)
+ yield model
+
+## end of class OMC_TimeServiceAvailableToElementProvider
+
+###############################################################################
def get_providers(env):
+ omc_timeserviceavailabletoelement_prov = OMC_TimeServiceAvailableToElementProvider(env)
omc_timeservicetimezonesettingdata_prov = OMC_TimeServiceTimeZoneSettingDataProvider(env)
omc_timezonesettingdata_prov = OMC_TimeZoneSettingDataProvider(env)
omc_timeserviceaccessbysap_prov = OMC_TimeServiceAccessBySAPProvider(env)
@@ -997,5 +1136,6 @@
'OMC_RemoteTimeServicePort': omc_remotetimeserviceport_prov,
'OMC_TimeServiceAccessBySAP': omc_timeserviceaccessbysap_prov,
'OMC_TimeZoneSettingData': omc_timezonesettingdata_prov,
- 'OMC_TimeServiceTimeZoneSettingData': omc_timeservicetimezonesettingdata_prov}
+ 'OMC_TimeServiceTimeZoneSettingData': omc_timeservicetimezonesettingdata_prov,
+ 'OMC_TimeServiceAvailableToElement': omc_timeserviceavailabletoelement_prov}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2007-12-18 18:58:52
|
Revision: 519
http://omc.svn.sourceforge.net/omc/?rev=519&view=rev
Author: bartw
Date: 2007-12-18 10:58:52 -0800 (Tue, 18 Dec 2007)
Log Message:
-----------
finished syslog provider
Modified Paths:
--------------
pybase/trunk/OMC_SyslogNG-peg.reg
pybase/trunk/OMC_SyslogNG.mof
pybase/trunk/OMC_SyslogNG.py
Modified: pybase/trunk/OMC_SyslogNG-peg.reg
===================================================================
--- pybase/trunk/OMC_SyslogNG-peg.reg 2007-12-18 18:46:31 UTC (rev 518)
+++ pybase/trunk/OMC_SyslogNG-peg.reg 2007-12-18 18:58:52 UTC (rev 519)
@@ -43,3 +43,33 @@
ProviderType = {2,3}; // Instance, Associator
};
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_SyslogNGUseOfLog";
+ ProviderModuleName = "/usr/lib/pycim/OMC_SyslogNG.py";
+ ProviderName = "OMC_SyslogNG";
+ ClassName = "OMC_SyslogNGUseOfLog";
+ Namespaces = {"root/cimv2"}; // TODO
+ ProviderType = {2,3}; // Instance, Associator
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_SyslogNGRecordLogCapabilities";
+ ProviderModuleName = "/usr/lib/pycim/OMC_SyslogNG.py";
+ ProviderName = "OMC_SyslogNG";
+ ClassName = "OMC_SyslogNGRecordLogCapabilities";
+ Namespaces = {"root/cimv2"}; // TODO
+ ProviderType = {2}; // Instance
+};
+
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_SyslogNGRecordLogToCapabilities";
+ ProviderModuleName = "/usr/lib/pycim/OMC_SyslogNG.py";
+ ProviderName = "OMC_SyslogNG";
+ ClassName = "OMC_SyslogNGRecordLogToCapabilities";
+ Namespaces = {"root/cimv2"}; // TODO
+ ProviderType = {2,3}; // Instance, Associator
+};
+
Modified: pybase/trunk/OMC_SyslogNG.mof
===================================================================
--- pybase/trunk/OMC_SyslogNG.mof 2007-12-18 18:46:31 UTC (rev 518)
+++ pybase/trunk/OMC_SyslogNG.mof 2007-12-18 18:58:52 UTC (rev 519)
@@ -51,11 +51,13 @@
[
- Version("0.0.1"),
+ Association, Version("0.0.1"),
Description ("Association that ties ManagedElement (and/or) ComputerSystem to a RecordLog.")
]
class OMC_SyslogNGUseOfLog : CIM_UseOfLog
{
+ [ Override("Antecedent"), Key, Description("The Log.") ]
+ OMC_SyslogNGRecordLog REF Antecedent;
};
Modified: pybase/trunk/OMC_SyslogNG.py
===================================================================
--- pybase/trunk/OMC_SyslogNG.py 2007-12-18 18:46:31 UTC (rev 518)
+++ pybase/trunk/OMC_SyslogNG.py 2007-12-18 18:58:52 UTC (rev 519)
@@ -5,6 +5,7 @@
"""
import pywbem
+from socket import getfqdn
def _get_syslog_list():
rval = []
@@ -52,28 +53,6 @@
# self.filter_results = False
def get_instance(self, env, model, cim_class):
- """Return an instance.
-
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
- instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
- request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
- cim_class -- The pywbem.CIMClass
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
- Instance does not exist in the specified namespace)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
logger = env.get_logger()
logger.log_debug('Entering %s.get_instance()' \
@@ -133,29 +112,7 @@
def enum_instances(self, env, model, cim_class, keys_only):
- """Enumerate instances.
- The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
- This method is a python generator
-
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
- cim_class -- The pywbem.CIMClass
- keys_only -- A boolean. True if only the key properties should be
- set on the generated instances.
-
- Possible Errors:
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.enum_instances()' \
% self.__class__.__name__)
@@ -174,34 +131,7 @@
raise
def set_instance(self, env, instance, previous_instance, cim_class):
- """Return a newly created or modified instance.
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
- the PropertyList from the request.
- previous_instance -- The previous pywbem.CIMInstance if modifying
- an existing instance. None if creating a new instance.
- cim_class -- The pywbem.CIMClass
-
- Return the new instance. The keys must be set on the new instance.
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
- valid if previous_instance is None, indicating that the operation
- was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
- if previous_instance is not None, indicating that the operation
- was ModifyInstance)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.set_instance()' \
% self.__class__.__name__)
@@ -210,27 +140,7 @@
return instance
def delete_instance(self, env, instance_name):
- """Delete an instance.
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
- to delete.
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
- namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
- Instance does not exist in the specified namespace)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.delete_instance()' \
% self.__class__.__name__)
@@ -348,10 +258,19 @@
logger.log_debug('Entering %s.cim_method_clearlog()' \
% self.__class__.__name__)
- # TODO do something
- raise pywbem.CIMError(pywbem.CIM_ERR_METHOD_NOT_AVAILABLE) # Remove to implemented
+ try:
+ id = object_name['InstanceID']
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ if not id.startswith('OMCSyslogNGRecordLog:'):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ file = id[id.index(':')+1:]
+ if file not in _get_syslog_list():
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ fo = open(file, 'w')
+ fo.close()
out_params = {}
- rval = None # TODO (type pywbem.Uint32 self.Values.ClearLog)
+ rval = self.Values.ClearLog.Completed_with_no_error
return (rval, out_params)
class Values(object):
@@ -588,28 +507,6 @@
# self.filter_results = False
def get_instance(self, env, model, cim_class, line=None):
- """Return an instance.
-
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
- instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
- request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
- cim_class -- The pywbem.CIMClass
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
- Instance does not exist in the specified namespace)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
logger = env.get_logger()
logger.log_debug('Entering %s.get_instance()' \
@@ -654,29 +551,7 @@
return model
def enum_instances(self, env, model, cim_class, keys_only):
- """Enumerate instances.
- The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
- This method is a python generator
-
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
- cim_class -- The pywbem.CIMClass
- keys_only -- A boolean. True if only the key properties should be
- set on the generated instances.
-
- Possible Errors:
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.enum_instances()' \
% self.__class__.__name__)
@@ -703,34 +578,7 @@
raise
def set_instance(self, env, instance, previous_instance, cim_class):
- """Return a newly created or modified instance.
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
- the PropertyList from the request.
- previous_instance -- The previous pywbem.CIMInstance if modifying
- an existing instance. None if creating a new instance.
- cim_class -- The pywbem.CIMClass
-
- Return the new instance. The keys must be set on the new instance.
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
- valid if previous_instance is None, indicating that the operation
- was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
- if previous_instance is not None, indicating that the operation
- was ModifyInstance)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.set_instance()' \
% self.__class__.__name__)
@@ -739,27 +587,7 @@
return instance
def delete_instance(self, env, instance_name):
- """Delete an instance.
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
- to delete.
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
- namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
- Instance does not exist in the specified namespace)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.delete_instance()' \
% self.__class__.__name__)
@@ -785,28 +613,6 @@
# self.filter_results = False
def get_instance(self, env, model, cim_class):
- """Return an instance.
-
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
- instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
- request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
- cim_class -- The pywbem.CIMClass
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
- Instance does not exist in the specified namespace)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
logger = env.get_logger()
logger.log_debug('Entering %s.get_instance()' \
@@ -821,29 +627,7 @@
return model
def enum_instances(self, env, model, cim_class, keys_only):
- """Enumerate instances.
- The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
- This method is a python generator
-
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
- cim_class -- The pywbem.CIMClass
- keys_only -- A boolean. True if only the key properties should be
- set on the generated instances.
-
- Possible Errors:
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.enum_instances()' \
% self.__class__.__name__)
@@ -864,34 +648,7 @@
raise
def set_instance(self, env, instance, previous_instance, cim_class):
- """Return a newly created or modified instance.
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
- the PropertyList from the request.
- previous_instance -- The previous pywbem.CIMInstance if modifying
- an existing instance. None if creating a new instance.
- cim_class -- The pywbem.CIMClass
-
- Return the new instance. The keys must be set on the new instance.
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
- valid if previous_instance is None, indicating that the operation
- was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
- if previous_instance is not None, indicating that the operation
- was ModifyInstance)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.set_instance()' \
% self.__class__.__name__)
@@ -900,27 +657,7 @@
return instance
def delete_instance(self, env, instance_name):
- """Delete an instance.
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
- to delete.
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
- namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
- Instance does not exist in the specified namespace)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.delete_instance()' \
% self.__class__.__name__)
@@ -930,64 +667,7 @@
def references(self, env, object_name, model, assoc_class,
result_class_name, role, result_role, keys_only):
- """Instrument Associations.
- All four association-related operations (Associators, AssociatorNames,
- References, ReferenceNames) are mapped to this method.
- This method is a python generator
-
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName that defines the source
- CIM Object whose associated Objects are to be returned.
- model -- A template pywbem.CIMInstance to serve as a model
- of the objects to be returned. Only properties present on this
- model need to be set.
- assoc_class -- The pywbem.CIMClass.
- result_class_name -- If not empty, this string acts as a filter on
- the returned set of Instances by mandating that each returned
- Instances MUST represent an association between object_name
- and an Instance of a Class whose name matches this parameter
- or a subclass.
- role -- If not empty, MUST be a valid Property name. It acts as a
- filter on the returned set of Instances by mandating that each
- returned Instance MUST refer to object_name via a Property
- whose name matches the value of this parameter.
- result_role -- If not empty, MUST be a valid Property name. It acts
- as a filter on the returned set of Instances by mandating that
- each returned Instance MUST represent associations of
- object_name to other Instances, where the other Instances play
- the specified result_role in the association (i.e. the
- name of the Property in the Association Class that refers to
- the Object related to object_name MUST match the value of this
- parameter).
- keys_only -- A boolean. True if only the key properties should be
- set on the generated instances.
-
- The following diagram may be helpful in understanding the role,
- result_role, and result_class_name parameters.
- +------------------------+ +-------------------+
- | object_name.classname | | result_class_name |
- | ~~~~~~~~~~~~~~~~~~~~~ | | ~~~~~~~~~~~~~~~~~ |
- +------------------------+ +-------------------+
- | +-----------------------------------+ |
- | | [Association] assoc_class | |
- | object_name | ~~~~~~~~~~~~~~~~~~~~~~~~~ | |
- +--------------+ object_name.classname REF role | |
- (CIMInstanceName) | result_class_name REF result_role +------+
- | |(CIMInstanceName)
- +-----------------------------------+
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.references()' \
% self.__class__.__name__)
@@ -1033,13 +713,318 @@
except StopIteration:
break
fo.close()
+## end of class OMC_SyslogNGLogManagesRecordProvider
+class OMC_SyslogNGUseOfLogProvider(pywbem.CIMProvider):
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+ # If you will be filtering instances yourself according to
+ # property_list, role, result_role, and result_class_name
+ # parameters, set self.filter_results to False
+ # self.filter_results = False
+
+ def get_instance(self, env, model, cim_class):
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+
+ ux = model.update_existing
+
+ # TODO fetch system resource matching the following keys:
+ # model['Dependent']
+ # model['Antecedent']
+
+ #ux(RecordedData='') # TODO
+ return model
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+
+ for log in _get_syslog_list():
+ model['Dependent'] = pywbem.CIMInstanceName('OMC_UnitaryComputerSystem',
+ keybindings={'CreationClassName':'OMC_UnitaryComputerSystem',
+ 'Name':getfqdn()},
+ namespace=model.path.namespace)
+ model['Antecedent'] = pywbem.CIMInstanceName('OMC_SyslogNGRecordLog',
+ keybindings={'InstanceID':'OMCSyslogNGRecordLog:'+log},
+ namespace=model.path.namespace)
+ if keys_only:
+ yield model
+ else:
+ try:
+ yield self.get_instance(env, model, cim_class)
+ except pywbem.CIMError, (num, msg):
+ if num not in (pywbem.CIM_ERR_NOT_FOUND,
+ pywbem.CIM_ERR_ACCESS_DENIED):
+ raise
+
+ def set_instance(self, env, instance, previous_instance, cim_class):
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.set_instance()' \
+ % self.__class__.__name__)
+ # TODO create or modify the instance
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
+ return instance
+
+ def delete_instance(self, env, instance_name):
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.delete_instance()' \
+ % self.__class__.__name__)
+
+ # TODO delete the resource
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
+
+ def references(self, env, object_name, model, assoc_class,
+ result_class_name, role, result_role, keys_only):
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.references()' \
+ % self.__class__.__name__)
+ ch = env.get_cimom_handle()
+ if (not role or role.lower() == 'dependent') and \
+ object_name.classname.lower() == 'omc_unitarycomputersystem':
+ model['Dependent'] = object_name
+ for log in _get_syslog_list():
+ model['Antecedent'] = pywbem.CIMInstanceName('OMC_SyslogNGRecordLog',
+ keybindings={'InstanceID':'OMCSyslogNGRecordLog:'+log},
+ namespace=object_name.namespace)
+ yield model
+
+ if (not role or role.lower() == 'antecedent') and \
+ object_name.classname.lower() == 'omc_syslogngrecordlog':
+ model['Antecedent'] = object_name
+ model['Dependent'] = pywbem.CIMInstanceName('OMC_UnitaryComputerSystem',
+ keybindings={'CreationClassName':'OMC_UnitaryComputerSystem',
+ 'Name':getfqdn()},
+ namespace=object_name.namespace)
+ yield model
+
+## end of class OMC_SyslogNGUseOfLogProvider
+class OMC_SyslogNGRecordLogCapabilitiesProvider(pywbem.CIMProvider):
+ """Instrument the CIM class OMC_SyslogNGRecordLogCapabilities
+
+ EnabledLogicalElementCapabilities for SyslogNGRecordLog. This class is
+ here for conformance with the SMASH Record Log Profile. For other
+ details, see parent class.
+
+ """
+
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+ # If you will be filtering instances yourself according to
+ # property_list, role, result_role, and result_class_name
+ # parameters, set self.filter_results to False
+ # self.filter_results = False
+
+ def get_instance(self, env, model, cim_class):
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+
+ ux = model.update_existing
+
+ try:
+ id = model['InstanceID']
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ if not id.startswith('OMCSyslogNGRecordLog:'):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ file = id[id.index(':')+1:]
+ if file not in _get_syslog_list():
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+
+ ux(ElementNameEditSupported=False)
+ ux(ElementName=file)
+ #ux(Caption='') # TODO
+ #ux(Description='') # TODO
+ #ux(MaxElementNameLen=pywbem.Uint16()) # TODO
+ #ux(RequestedStatesSupported=[self.Values.RequestedStatesSupported.<VAL>,]) # TODO
+ return model
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+
+ for log in _get_syslog_list():
+ model['InstanceID'] = 'OMCSyslogNGRecordLog:'+log
+ if keys_only:
+ yield model
+ else:
+ try:
+ yield self.get_instance(env, model, cim_class)
+ except pywbem.CIMError, (num, msg):
+ if num not in (pywbem.CIM_ERR_NOT_FOUND,
+ pywbem.CIM_ERR_ACCESS_DENIED):
+ raise
+
+ def set_instance(self, env, instance, previous_instance, cim_class):
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.set_instance()' \
+ % self.__class__.__name__)
+ # TODO create or modify the instance
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
+ return instance
+
+ def delete_instance(self, env, instance_name):
+
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.delete_instance()' \
+ % self.__class__.__name__)
+
+ # TODO delete the resource
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
+
+ class Values(object):
+ class RequestedStatesSupported(object):
+ Enabled = pywbem.Uint16(2)
+ Disabled = pywbem.Uint16(3)
+ Shut_Down = pywbem.Uint16(4)
+ Offline = pywbem.Uint16(6)
+ Test = pywbem.Uint16(7)
+ Defer = pywbem.Uint16(8)
+ Quiesce = pywbem.Uint16(9)
+ Reboot = pywbem.Uint16(10)
+ Reset = pywbem.Uint16(11)
+
+## end of class OMC_SyslogNGRecordLogCapabilitiesProvider
+class OMC_SyslogNGRecordLogToCapabilitiesProvider(pywbem.C...
[truncated message content] |
|
From: <jc...@us...> - 2007-12-18 20:40:44
|
Revision: 520
http://omc.svn.sourceforge.net/omc/?rev=520&view=rev
Author: jcarey
Date: 2007-12-18 12:40:49 -0800 (Tue, 18 Dec 2007)
Log Message:
-----------
Added version quals to classes
Modified Paths:
--------------
pybase/trunk/OMC_InitdService.mof
pybase/trunk/OMC_LogicalFile.mof
pybase/trunk/OMC_OperatingSystem.mof
pybase/trunk/OMC_TimeService.mof
pybase/trunk/OMC_UnitaryComputerSystem.mof
pybase/trunk/OMC_UnixProcess.mof
Modified: pybase/trunk/OMC_InitdService.mof
===================================================================
--- pybase/trunk/OMC_InitdService.mof 2007-12-18 18:58:52 UTC (rev 519)
+++ pybase/trunk/OMC_InitdService.mof 2007-12-18 20:40:49 UTC (rev 520)
@@ -1,6 +1,6 @@
#pragma locale ("en_US")
-[ Description (
+[ Version("0.0.1"), Description (
"OMC_InitdService represents the function of a system init script "
"found in the /etc/init.d directory. The Name field in this class will "
"be the name of the script. The provider of this class knows nothing "
@@ -98,7 +98,7 @@
};
-[ Description("OMC_Runlevel represents a runlevel on a system, which is a collection of "
+[ Version("0.0.1"), Description("OMC_Runlevel represents a runlevel on a system, which is a collection of "
"init scripts, in this case, a collection of OMC_InitdService objects")]
class OMC_Runlevel : CIM_CollectionOfMSEs
{
@@ -143,7 +143,7 @@
-[ Association,
+[ Association, Version("0.0.1"),
Description(
"OMC_HostedInitdService associates the init.d service to the computer system.") ]
class OMC_HostedInitdService : CIM_HostedService
@@ -158,7 +158,7 @@
};
-[ Association,
+[ Association, Version("0.0.1"),
Description(
"OMC_RunlevelInComputerSystem associates a OMC_Runlevel to its computer system.") ]
class OMC_RunlevelInComputerSystem : CIM_HostedDependency
@@ -173,7 +173,7 @@
};
-[ Association,
+[ Association, Version("0.0.1"),
Description(
"OMC_InitdServiceRunlevel associates a OMC_Runlevel to its services.") ]
class OMC_InitdServiceRunlevel : CIM_CollectedMSEs
Modified: pybase/trunk/OMC_LogicalFile.mof
===================================================================
--- pybase/trunk/OMC_LogicalFile.mof 2007-12-18 18:58:52 UTC (rev 519)
+++ pybase/trunk/OMC_LogicalFile.mof 2007-12-18 20:40:49 UTC (rev 520)
@@ -30,7 +30,7 @@
#pragma locale ("en_US")
//////////////////////////////////////////////////////////////////////////////
-[ Abstract ]
+[ Abstract, Version("0.0.1") ]
class OMC_DataFile : CIM_DataFile
{
sint32 append([IN(true), OUT(false), REQUIRED(true)] string newtext);
@@ -39,37 +39,37 @@
};
//////////////////////////////////////////////////////////////////////////////
-[ Abstract ]
+[ Abstract, Version("0.0.1") ]
class OMC_UnixDeviceFile : CIM_UnixDeviceFile
{
};
//////////////////////////////////////////////////////////////////////////////
-[ Abstract ]
+[ Abstract, Version("0.0.1") ]
class OMC_SymbolicLink : CIM_SymbolicLink
{
};
//////////////////////////////////////////////////////////////////////////////
-[ Abstract ]
+[ Abstract, Version("0.0.1") ]
class OMC_UnixDirectory : CIM_UnixDirectory
{
};
//////////////////////////////////////////////////////////////////////////////
-[ Abstract ]
+[ Abstract, Version("0.0.1") ]
class OMC_UnixSocketFile : CIM_LogicalFile
{
};
//////////////////////////////////////////////////////////////////////////////
-[ Abstract ]
+[ Abstract, Version("0.0.1") ]
class OMC_FIFOPipeFile : CIM_FIFOPipeFile
{
};
//////////////////////////////////////////////////////////////////////////////
-[ Abstract ]
+[ Abstract, Version("0.0.1") ]
class OMC_UnixFile : CIM_UnixFile
{
boolean UserReadable;
@@ -84,7 +84,7 @@
};
//////////////////////////////////////////////////////////////////////////////
-[ Association, Aggregation, Composition, Abstract,
+[ Association, Aggregation, Composition, Abstrac, Version("0.0.1"),
Description("Specifies the hierarchical arrangement of LogicalFiles in a "
"Directory.")]
class OMC_DirectoryContainsFile : CIM_DirectoryContainsFile
@@ -99,7 +99,7 @@
};
//////////////////////////////////////////////////////////////////////////////
-[ Association, Abstract, Description (
+[ Association, Abstract, Version("0.0.1"), Description (
"CIM_FileIdentity indicates that a UnixFile describes Unix-"
"specific aspects of the various subclasses of LogicalFile. "
"The association exists since it forces UnixFile to be "
@@ -119,42 +119,49 @@
};
//////////////////////////////////////////////////////////////////////////////
+[ Version("0.0.1") ]
class OMC_LinuxDataFile : OMC_DataFile
{
};
//////////////////////////////////////////////////////////////////////////////
+[ Version("0.0.1") ]
class OMC_LinuxDeviceFile : OMC_UnixDeviceFile
{
};
//////////////////////////////////////////////////////////////////////////////
+[ Version("0.0.1") ]
class OMC_LinuxSymbolicLink : OMC_SymbolicLink
{
};
//////////////////////////////////////////////////////////////////////////////
+[ Version("0.0.1") ]
class OMC_LinuxDirectory : OMC_UnixDirectory
{
};
//////////////////////////////////////////////////////////////////////////////
+[ Version("0.0.1") ]
class OMC_LinuxFIFOPipeFile : OMC_FIFOPipeFile
{
};
//////////////////////////////////////////////////////////////////////////////
+[ Version("0.0.1") ]
class OMC_LinuxSocketFile : OMC_UnixSocketFile
{
};
//////////////////////////////////////////////////////////////////////////////
+[ Version("0.0.1") ]
class OMC_LinuxFile : OMC_UnixFile
{
};
//////////////////////////////////////////////////////////////////////////////
-[Association, Aggregation, Composition,
+[Association, Aggregation, Composition, Version("0.0.1"),
Description("Specifies the hierarchical arrangement of LogicalFiles in a "
"Directory.")
]
@@ -170,7 +177,7 @@
};
//////////////////////////////////////////////////////////////////////////////
-[Association, Description (
+[Association, Version("0.0.1"), Description (
"CIM_FileIdentity indicates that a UnixFile describes Unix-"
"specific aspects of the various subclasses of LogicalFile. "
"The association exists since it forces UnixFile to be "
Modified: pybase/trunk/OMC_OperatingSystem.mof
===================================================================
--- pybase/trunk/OMC_OperatingSystem.mof 2007-12-18 18:58:52 UTC (rev 519)
+++ pybase/trunk/OMC_OperatingSystem.mof 2007-12-18 20:40:49 UTC (rev 520)
@@ -1,13 +1,13 @@
#pragma locale ("en_US")
//////////////////////////////////////////////////////////////////////////////
-[ Description("OMC Operating System") ]
+[ Description("OMC Operating System"), Version("0.0.1") ]
class OMC_OperatingSystem : CIM_OperatingSystem
{
};
//////////////////////////////////////////////////////////////////////////////
-[ Description("Kernel statistics for the running os kernel") ]
+[ Description("Kernel statistics for the running os kernel"), Version("0.0.1") ]
class OMC_OSStatisticalInformation : CIM_StatisticalInformation
{
};
@@ -16,7 +16,7 @@
[ Association,
Description("OMC_OSStatistics relates "
"OMC_OSStatisticalInformation with "
- "OMC_OperatingSystem") ]
+ "OMC_OperatingSystem"), Version("0.0.1") ]
class OMC_OSStatistics : CIM_Statistics
{
[ Override("Stats"), Weak,
@@ -34,7 +34,7 @@
"At most one OperatingSystem can execute at any time on a "
"ComputerSystem. 'At most one' is specified, since the Computer "
"System may not be currently booted, or its OperatingSystem may "
- "be unknown.")]
+ "be unknown.", Version("0.0.1") ]
class OMC_RunningOS : CIM_RunningOS
{
[Override ( "Antecedent" ), Max ( 1 ), Description (
@@ -57,7 +57,7 @@
"on a ComputerSystem, when placed on one of its StorageExtents "
"- for example, copied to a disk drive or downloaded to Memory. "
"Using this definition, an OperatingSystem is 'installed' on a "
- "NetPC when downloaded via the network.")]
+ "NetPC when downloaded via the network.", Version("0.0.1") ]
class OMC_InstalledOS : CIM_InstalledOS
{
[Aggregate, Override ( "GroupComponent" ), Min ( 1 ), Max ( 1 ),
Modified: pybase/trunk/OMC_TimeService.mof
===================================================================
--- pybase/trunk/OMC_TimeService.mof 2007-12-18 18:58:52 UTC (rev 519)
+++ pybase/trunk/OMC_TimeService.mof 2007-12-18 20:40:49 UTC (rev 520)
@@ -2,7 +2,7 @@
//////////////////////////////////////////////////////////////////////////////
-[ Abstract ]
+[ Abstract, Version("0.0.1") ]
class OMC_TimeService : CIM_TimeService
{
};
@@ -10,7 +10,7 @@
//////////////////////////////////////////////////////////////////////////////
// OMC_SystemTimeService
[ Description("OMC_SystemTimeService represents the configuration "
- " and function of the system time") ]
+ " and function of the system time"), Version("0.0.1") ]
class OMC_SystemTimeService : OMC_TimeService
{
[ Key, Override("SystemCreationClassName") ]
@@ -68,7 +68,7 @@
//////////////////////////////////////////////////////////////////////////////
// OMC_RemoteTimeServicePort
[ Description("OMC_RemoteTimeServicePort represent the NTP "
- "configuration for the time service") ]
+ "configuration for the time service"), Version("0.0.1") ]
class OMC_RemoteTimeServicePort : CIM_RemotePort
{
[ Override("AccessInfo"), Write(true),
@@ -134,7 +134,7 @@
//////////////////////////////////////////////////////////////////////////////
// OMC_TimeZoneSettingData
[ Description("OMC_TimeZoneSettingData represents the "
- "configuration of the system time zone.") ]
+ "configuration of the system time zone."), Version("0.0.1") ]
class OMC_TimeZoneSettingData : CIM_SettingData
{
[ Key, Description(
@@ -158,7 +158,7 @@
// OMC_HostedTimeService
[ Association,
Description("OMC_HostedTimeService associates the time service "
- "to the computer system") ]
+ "to the computer system"), Version("0.0.1") ]
class OMC_HostedTimeService : CIM_HostedService
{
[ Override("Antecedent"), Min(1), Max(1),
@@ -175,7 +175,7 @@
[ Association,
Description("OMC_TimeServiceAccessBySAP is an association "
"that identifies the configuration for NTP access for the "
- "time service") ]
+ "time service"), Version("0.0.1") ]
class OMC_TimeServiceAccessBySAP : CIM_ServiceAccessBySAP
{
[ Override("Antecedent"),
@@ -192,7 +192,7 @@
//
[ Association,
Description("OMC_TimeServiceTimeZoneSettingData associates the time "
- "service with the time zone configuration") ]
+ "service with the time zone configuration"), Version("0.0.1") ]
class OMC_TimeServiceTimeZoneSettingData : CIM_ElementSettingData
{
[ Override("ManagedElement") ]
@@ -207,7 +207,7 @@
// OMC_TimeServiceAvailableToElement
[ Association,
Description("OMC_TimeServiceAvailableToElement indicates that this time "
- "service is available for the use of the managed element") ]
+ "service is available for the use of the managed element"), Version("0.0.1") ]
class OMC_TimeServiceAvailableToElement : CIM_ServiceAvailableToElement
{
[ Override("ServiceProvided") ]
Modified: pybase/trunk/OMC_UnitaryComputerSystem.mof
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem.mof 2007-12-18 18:58:52 UTC (rev 519)
+++ pybase/trunk/OMC_UnitaryComputerSystem.mof 2007-12-18 20:40:49 UTC (rev 520)
@@ -2,13 +2,13 @@
//////////////////////////////////////////////////////////////////////////////
-[ Description("OMC Unitary Computer System") ]
+[ Description("OMC Unitary Computer System"), Version("0.0.1") ]
class OMC_UnitaryComputerSystem : CIM_UnitaryComputerSystem
{
};
//////////////////////////////////////////////////////////////////////////////
-[ Description("OMC Host Name Setting Data") ]
+[ Description("OMC Host Name Setting Data"), Version("0.0.1") ]
class OMC_HostNameSettingData : CIM_SettingData
{
[Description ("The name of this computer"),
@@ -19,7 +19,7 @@
//////////////////////////////////////////////////////////////////////////////
[ Association, Version ( "2.7.0" ),
Description ("OMC_ComputerSystemSettingData is associates "
- " the computer name setting with the computer system") ]
+ " the computer name setting with the computer system"), Version("0.0.1") ]
class OMC_ComputerSystemHostNameSettingData : CIM_ElementSettingData
{
[ Override("ManagedElement"), Key,
Modified: pybase/trunk/OMC_UnixProcess.mof
===================================================================
--- pybase/trunk/OMC_UnixProcess.mof 2007-12-18 18:58:52 UTC (rev 519)
+++ pybase/trunk/OMC_UnixProcess.mof 2007-12-18 20:40:49 UTC (rev 520)
@@ -1,7 +1,7 @@
#pragma locale ("en_US")
//////////////////////////////////////////////////////////////////////////////
-[ Description ("A Unix Process") ]
+[ Description ("A Unix Process"), Version("0.0.1") ]
class OMC_UnixProcess : CIM_UnixProcess
{
[ Description("Send a signal to some running processes. Only the "
@@ -21,7 +21,7 @@
//////////////////////////////////////////////////////////////////////////////
[ Association, Aggregation, Composition, Version ( "2.7.0" ),
Description ("A link between the OperatingSystem and Process(es) "
- "running in the context of this OperatingSystem.") ]
+ "running in the context of this OperatingSystem."), Version("0.0.1") ]
class OMC_OSProcess : CIM_OSProcess
{
[Aggregate, Override ( "GroupComponent" ), Min ( 1 ), Max ( 1 ),
@@ -38,7 +38,7 @@
//////////////////////////////////////////////////////////////////////////////
[ Association,
Description("A link between a Process and a DataFile indicating "
- "that the File participates in the execution of the Process.") ]
+ "that the File participates in the execution of the Process."), Version("0.0.1") ]
class OMC_ProcessExecutable : CIM_ProcessExecutable
{
[ Override("Antecedent"),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jc...@us...> - 2007-12-18 23:35:02
|
Revision: 521
http://omc.svn.sourceforge.net/omc/?rev=521&view=rev
Author: jcarey
Date: 2007-12-18 15:35:00 -0800 (Tue, 18 Dec 2007)
Log Message:
-----------
Filled remaining properties of the Operating system class and implemented the extrinsic methods
Modified Paths:
--------------
pybase/trunk/OMC_OperatingSystem.py
pybase/trunk/OMC_TimeService.mof
Modified: pybase/trunk/OMC_OperatingSystem.py
===================================================================
--- pybase/trunk/OMC_OperatingSystem.py 2007-12-18 20:40:49 UTC (rev 520)
+++ pybase/trunk/OMC_OperatingSystem.py 2007-12-18 23:35:00 UTC (rev 521)
@@ -37,10 +37,21 @@
import pywbem
from pywbem import CIMProvider
from socket import getfqdn
-import os
+import resource
+import os,sys
import time
from subprocess import Popen, PIPE
+import traceback
+def _get_max_number_of_processes():
+ cc = 0
+ try:
+ f = open('/proc/sys/fs/file-max')
+ cc = int(f.readline())
+ except:
+ pass
+ return cc
+
def get_os_path(ns):
return pywbem.CIMInstanceName(classname='OMC_OperatingSystem',
namespace=ns,
@@ -53,33 +64,9 @@
"""Instrument the CIM class OMC_OperatingSystem
OMC Operating System
-
"""
def get_instance(self, env, model, cim_class):
- """Return an instance.
-
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
- instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
- request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
- cim_class -- The pywbem.CIMClass
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
- Instance does not exist in the specified namespace)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.get_instance()' \
% self.__class__.__name__)
@@ -100,11 +87,14 @@
uex(TotalVisibleMemorySize = pywbem.Uint64(meminfo['MemTotal']))
uex(TotalVirtualMemorySize = pywbem.Uint64(meminfo['MemTotal'] +
meminfo['SwapTotal']))
+ uex(FreeSpaceInPagingFiles = pywbem.Uint64(int(meminfo['SwapFree']) / 1024))
+ uex(SizeStoredInPagingFiles = pywbem.Uint64(meminfo['SwapTotal']/1024))
fnames = os.listdir('/proc')
numprocs = len([x for x in fnames if x.isdigit()])
uex(NumberOfProcesses = pywbem.Uint32(numprocs))
- uex(CurrentTimeZone = pywbem.Sint16(time.timezone / 60))
+ uex(CurrentTimeZone = pywbem.Sint16(
+ (time.mktime(time.localtime()) - time.mktime(time.gmtime())) / 60))
uex(LocalDateTime = pywbem.CIMDateTime.now())
fo = open('/proc/uptime', 'r')
@@ -128,48 +118,37 @@
uex(Distributed = True)
#model['EnabledDefault'] = # TODO (type = pywbem.Uint16 self.Values.EnabledDefault) (default=2L)
uex(EnabledState = self.Values.EnabledState.Enabled)
- #model['FreeSpaceInPagingFiles'] = # TODO (type = pywbem.Uint64)
uex(HealthState = self.Values.HealthState.OK)
- #model['MaxNumberOfProcesses'] = # TODO (type = pywbem.Uint32)
- #model['MaxProcessesPerUser'] = # TODO (type = pywbem.Uint32)
- #model['MaxProcessMemorySize'] = # TODO (type = pywbem.Uint64)
- #model['NumberOfLicensedUsers'] = # TODO (type = pywbem.Uint32)
- #model['NumberOfUsers'] = # TODO (type = pywbem.Uint32)
+ model['MaxNumberOfProcesses'] = pywbem.Uint32(_get_max_number_of_processes())
+
+ wk = resource.getrlimit(resource.RLIMIT_DATA)[1]
+ if int(wk) < 0:
+ wk = 0
+ uex(MaxProcessMemorySize = pywbem.Uint64(int(wk)/1024))
+
+ wk = resource.getrlimit(resource.RLIMIT_NPROC)[1]
+ if int(wk) < 0:
+ wk = 0
+ uex(MaxProcessesPerUser = pywbem.Uint32(wk))
+ uex(NumberOfLicensedUsers = pywbem.Uint32(0))
+
+ try:
+ l = Popen([r'/usr/bin/who','-u'], stdout=PIPE).communicate()[0]
+ uex(NumberOfUsers = pywbem.Uint32(len(l.split('\n'))))
+ except:
+ uex(NumberOfUsers = pywbem.Uint32(0))
+
uex(OperationalStatus = [self.Values.OperationalStatus.OK])
uex(OSType = self.Values.OSType.LINUX)
#model['OtherEnabledState'] = # TODO (type = unicode)
#model['OtherTypeDescription'] = # TODO (type = unicode)
#model['RequestedState'] = # TODO (type = pywbem.Uint16 self.Values.RequestedState) (default=12L)
- #model['SizeStoredInPagingFiles'] = # TODO (type = pywbem.Uint64)
#model['Status'] = # TODO (type = unicode self.Values.Status)
#model['StatusDescriptions'] = # TODO (type = [unicode,])
#model['TimeOfLastStateChange'] = # TODO (type = pywbem.CIMDateTime)
return model
def enum_instances(self, env, model, cim_class, keys_only):
- """Enumerate instances.
-
- The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
- This method is a python generator
-
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
- cim_class -- The pywbem.CIMClass
- keys_only -- A boolean. True if only the key properties should be
- set on the generated instances.
-
- Possible Errors:
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.enum_instances()' \
% self.__class__.__name__)
@@ -190,69 +169,10 @@
raise
def set_instance(self, env, instance, previous_instance, cim_class):
- """Return a newly created or modified instance.
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
- the PropertyList from the request.
- previous_instance -- The previous pywbem.CIMInstance if modifying
- an existing instance. None if creating a new instance.
- cim_class -- The pywbem.CIMClass
-
- Return the new instance. The keys must be set on the new instance.
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
- valid if previous_instance is None, indicating that the operation
- was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
- if previous_instance is not None, indicating that the operation
- was ModifyInstance)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
- logger = env.get_logger()
- logger.log_debug('Entering %s.set_instance()' \
- % self.__class__.__name__)
- # TODO create or modify the instance
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
- return instance
-
def delete_instance(self, env, instance_name):
- """Delete an instance.
-
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
- to delete.
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
- namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
- Instance does not exist in the specified namespace)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
- logger = env.get_logger()
- logger.log_debug('Entering %s.delete_instance()' \
- % self.__class__.__name__)
-
- # TODO delete the resource
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
def cim_method_requeststatechange(self, env, object_name, method,
param_requestedstate,
@@ -311,12 +231,34 @@
logger.log_debug('Entering %s.cim_method_requeststatechange()' \
% self.__class__.__name__)
- # TODO do something
- raise pywbem.CIMError(pywbem.CIM_ERR_METHOD_NOT_AVAILABLE) # Remove to implemented
- out_params = {}
- #out_params['job'] = # TODO (type REF (pywbem.CIMInstanceName(classname='CIM_ConcreteJob', ...))
- rval = None # TODO (type pywbem.Uint32 self.Values.RequestStateChange)
- return (rval, out_params)
+ rstate = int(param_requestedstate)
+ if rstate == 3: # Disable
+ logger.log_info('OS Disabled State Requested. Shutting Down now...')
+ if os.system('/sbin/shutdown -h now'):
+ return (pywbem.Uint32(4), {})
+ return (pywbem.Uint32(0), {})
+ elif rstate == 4: # Shutdown
+ logger.log_info('OS Shutdown State Requested. Shutting Down now...')
+ if os.system('/sbin/shutdown -h now'):
+ return (pywbem.Uint32(4), {})
+ return (pywbem.Uint32(0), {})
+ elif rstate == 6: # Offline
+ logger.log_info('OS Offline State Requested. Shutting Down now...')
+ if os.system('/sbin/shutdown -h now'):
+ return (pywbem.Uint32(4), {})
+ return (pywbem.Uint32(0), {})
+ elif rstate == 10: # Reboot
+ logger.log_info('OS Reboot State Requested. Rebooting now...')
+ if os.system('/sbin/shutdown -r now'):
+ return (pywbem.Uint32(4), {})
+ return (pywbem.Uint32(0), {})
+ elif rstate == 11: # Reset
+ logger.log_info('OS Reset State Requested. Rebooting now...')
+ if os.system('/sbin/shutdown -r now'):
+ return (pywbem.Uint32(4), {})
+ return (pywbem.Uint32(0), {})
+ # Return 'not supported'
+ return (pywbem.Uint32(1), {})
def cim_method_reboot(self, env, object_name, method):
"""Implements OMC_OperatingSystem.Reboot()
@@ -342,16 +284,14 @@
Output parameters: none
"""
-
logger = env.get_logger()
logger.log_debug('Entering %s.cim_method_reboot()' \
% self.__class__.__name__)
-
- # TODO do something
- raise pywbem.CIMError(pywbem.CIM_ERR_METHOD_NOT_AVAILABLE) # Remove to implemented
- out_params = {}
- rval = None # TODO (type pywbem.Uint32)
- return (rval, out_params)
+ logger.log_info('OMC_OperatingSystem.reboot called. '
+ 'Rebooting system now')
+ if os.system('/sbin/shutdown -r now'):
+ return ('Fail', {})
+ return ('Success', {})
def cim_method_shutdown(self, env, object_name, method):
"""Implements OMC_OperatingSystem.Shutdown()
@@ -386,11 +326,11 @@
logger.log_debug('Entering %s.cim_method_shutdown()' \
% self.__class__.__name__)
- # TODO do something
- raise pywbem.CIMError(pywbem.CIM_ERR_METHOD_NOT_AVAILABLE) # Remove to implemented
- out_params = {}
- rval = None # TODO (type pywbem.Uint32)
- return (rval, out_params)
+ logger.log_info('OMC_OperatingSystem.shutdown called. '
+ 'shutdown system now')
+ if os.system('/sbin/shutdown -h now'):
+ return ('Fail', {})
+ return ('Success', {})
class Values(object):
class Status(object):
Modified: pybase/trunk/OMC_TimeService.mof
===================================================================
--- pybase/trunk/OMC_TimeService.mof 2007-12-18 20:40:49 UTC (rev 520)
+++ pybase/trunk/OMC_TimeService.mof 2007-12-18 23:35:00 UTC (rev 521)
@@ -140,7 +140,7 @@
[ Key, Description(
"InstanceID is the key field inherited from CIM_SettingData. "
"Since there is only one instance of this class, the key "
- "value is 'OMC:SUSE:TIMEZONE'") ]
+ "value is 'omc:timezone'") ]
string InstanceID;
[ Required(true), Description("The time zone"),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jc...@us...> - 2007-12-19 00:03:15
|
Revision: 523
http://omc.svn.sourceforge.net/omc/?rev=523&view=rev
Author: jcarey
Date: 2007-12-18 16:03:20 -0800 (Tue, 18 Dec 2007)
Log Message:
-----------
Operating System finished
Modified Paths:
--------------
pybase/trunk/OMC_OperatingSystem.mof
pybase/trunk/OMC_OperatingSystem.py
pybase/trunk/OMC_UnitaryComputerSystem.mof
pybase/trunk/OMC_UnixProcess.mof
Modified: pybase/trunk/OMC_OperatingSystem.mof
===================================================================
--- pybase/trunk/OMC_OperatingSystem.mof 2007-12-18 23:37:41 UTC (rev 522)
+++ pybase/trunk/OMC_OperatingSystem.mof 2007-12-19 00:03:20 UTC (rev 523)
@@ -34,7 +34,7 @@
"At most one OperatingSystem can execute at any time on a "
"ComputerSystem. 'At most one' is specified, since the Computer "
"System may not be currently booted, or its OperatingSystem may "
- "be unknown.", Version("0.0.1") ]
+ "be unknown."), Version("0.0.1") ]
class OMC_RunningOS : CIM_RunningOS
{
[Override ( "Antecedent" ), Max ( 1 ), Description (
@@ -44,26 +44,26 @@
[Override ( "Dependent" ), Max ( 1 ), Description (
"The ComputerSystem.")]
- CIM_ComputerSystem REF Dependent;
+ OMC_UnitaryComputerSystem REF Dependent;
};
// ===================================================================
// InstalledOS
// ===================================================================
- [Association, Aggregation, Composition, Version ( "2.7.0" ),
+ [Association, Aggregation, Composition, Version ( "0.0.2" ),
Description (
"A link between the ComputerSystem and the OperatingSystem(s) "
"installed or loaded on it. An OperatingSystem is 'installed' "
"on a ComputerSystem, when placed on one of its StorageExtents "
"- for example, copied to a disk drive or downloaded to Memory. "
"Using this definition, an OperatingSystem is 'installed' on a "
- "NetPC when downloaded via the network.", Version("0.0.1") ]
+ "NetPC when downloaded via the network.")]
class OMC_InstalledOS : CIM_InstalledOS
{
[Aggregate, Override ( "GroupComponent" ), Min ( 1 ), Max ( 1 ),
Description (
"The ComputerSystem.")]
- CIM_ComputerSystem REF GroupComponent;
+ OMC_UnitaryComputerSystem REF GroupComponent;
[Override ( "PartComponent" ), Weak, Description (
"The OperatingSystem installed on the ComputerSystem.")]
Modified: pybase/trunk/OMC_OperatingSystem.py
===================================================================
--- pybase/trunk/OMC_OperatingSystem.py 2007-12-18 23:37:41 UTC (rev 522)
+++ pybase/trunk/OMC_OperatingSystem.py 2007-12-19 00:03:20 UTC (rev 523)
@@ -440,29 +440,6 @@
"""
def get_instance(self, env, model, cim_class):
- """Return an instance.
-
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstance to be returned. The
- key properties are set on this instance to correspond to the
- instanceName that was requested. The properties of the model
- are already filtered according to the PropertyList from the
- request. Only properties present in the model need to be
- given values. If you prefer, you can set all of the
- values, and the instance will be filtered for you.
- cim_class -- The pywbem.CIMClass
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
- Instance does not exist in the specified namespace)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.get_instance()' \
% self.__class__.__name__)
@@ -471,29 +448,6 @@
return model
def enum_instances(self, env, model, cim_class, keys_only):
- """Enumerate instances.
-
- The WBEM operations EnumerateInstances and EnumerateInstanceNames
- are both mapped to this method.
- This method is a python generator
-
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- model -- A template of the pywbem.CIMInstances to be generated.
- The properties of the model are already filtered according to
- the PropertyList from the request. Only properties present in
- the model need to be given values. If you prefer, you can
- always set all of the values, and the instance will be filtered
- for you.
- cim_class -- The pywbem.CIMClass
- keys_only -- A boolean. True if only the key properties should be
- set on the generated instances.
-
- Possible Errors:
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.enum_instances()' \
% self.__class__.__name__)
@@ -514,115 +468,13 @@
raise
def set_instance(self, env, instance, previous_instance, cim_class):
- """Return a newly created or modified instance.
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance -- The new pywbem.CIMInstance. If modifying an existing
- instance, the properties on this instance have been filtered by
- the PropertyList from the request.
- previous_instance -- The previous pywbem.CIMInstance if modifying
- an existing instance. None if creating a new instance.
- cim_class -- The pywbem.CIMClass
-
- Return the new instance. The keys must be set on the new instance.
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_ALREADY_EXISTS (the CIM Instance already exists -- only
- valid if previous_instance is None, indicating that the operation
- was CreateInstance)
- CIM_ERR_NOT_FOUND (the CIM Instance does not exist -- only valid
- if previous_instance is not None, indicating that the operation
- was ModifyInstance)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
- logger = env.get_logger()
- logger.log_debug('Entering %s.set_instance()' \
- % self.__class__.__name__)
- # TODO create or modify the instance
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
- return instance
-
def delete_instance(self, env, instance_name):
- """Delete an instance.
-
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- instance_name -- A pywbem.CIMInstanceName specifying the instance
- to delete.
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_INVALID_CLASS (the CIM Class does not exist in the specified
- namespace)
- CIM_ERR_NOT_FOUND (the CIM Class does exist, but the requested CIM
- Instance does not exist in the specified namespace)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
- logger = env.get_logger()
- logger.log_debug('Entering %s.delete_instance()' \
- % self.__class__.__name__)
-
- # TODO delete the resource
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
def references(self, env, object_name, model, assoc_class,
result_class_name, role, result_role, keys_only):
- """Instrument Associations.
-
- All four association-related operations (Associators, AssociatorNames,
- References, ReferenceNames) are mapped to this method.
- This method is a python generator
-
- Keyword arguments:
- env -- Provider Environment (pycimmb.ProviderEnvironment)
- object_name -- A pywbem.CIMInstanceName that defines the source
- CIM Object whose associated Objects are to be returned.
- model -- A template pywbem.CIMInstance to serve as a model
- of the objects to be returned. Only properties present on this
- model need to be set.
- assoc_class -- The pywbem.CIMClass.
- result_class_name -- If not None, this string acts as a filter on
- the returned set of Objects by mandating that each returned
- Object MUST be either an Instance of this Class (or one of its
- subclasses) or be this Class (or one of its subclasses).
- role -- If not None, this string acts as a filter on the returned
- set of Objects by mandating that each returned Object MUST be
- associated to the source Object via an Association in which the
- source Object plays the specified role (i.e. the name of the
- Property in the Association Class that refers to the source
- Object MUST match the value of this parameter).
- result_role -- If not None this string acts as a filter on the
- returned set of Objects by mandating that each returned Object
- MUST be associated to the source Object via an Association in
- which the returned Object plays the specified role (i.e. the
- name of the Property in the Association Class that refers to
- the returned Object MUST match the value of this parameter).
- keys_only -- A boolean. True if only the key properties should be
- set on the generated instances.
-
- Possible Errors:
- CIM_ERR_ACCESS_DENIED
- CIM_ERR_NOT_SUPPORTED
- CIM_ERR_INVALID_NAMESPACE
- CIM_ERR_INVALID_PARAMETER (including missing, duplicate, unrecognized
- or otherwise incorrect parameters)
- CIM_ERR_FAILED (some other unspecified error occurred)
-
- """
-
logger = env.get_logger()
logger.log_debug('Entering %s.references()' \
% self.__class__.__name__)
Modified: pybase/trunk/OMC_UnitaryComputerSystem.mof
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem.mof 2007-12-18 23:37:41 UTC (rev 522)
+++ pybase/trunk/OMC_UnitaryComputerSystem.mof 2007-12-19 00:03:20 UTC (rev 523)
@@ -17,9 +17,9 @@
};
//////////////////////////////////////////////////////////////////////////////
-[ Association, Version ( "2.7.0" ),
+[ Association, Version ( "0.0.1" ),
Description ("OMC_ComputerSystemSettingData is associates "
- " the computer name setting with the computer system"), Version("0.0.1") ]
+ " the computer name setting with the computer system")]
class OMC_ComputerSystemHostNameSettingData : CIM_ElementSettingData
{
[ Override("ManagedElement"), Key,
Modified: pybase/trunk/OMC_UnixProcess.mof
===================================================================
--- pybase/trunk/OMC_UnixProcess.mof 2007-12-18 23:37:41 UTC (rev 522)
+++ pybase/trunk/OMC_UnixProcess.mof 2007-12-19 00:03:20 UTC (rev 523)
@@ -21,7 +21,7 @@
//////////////////////////////////////////////////////////////////////////////
[ Association, Aggregation, Composition, Version ( "2.7.0" ),
Description ("A link between the OperatingSystem and Process(es) "
- "running in the context of this OperatingSystem."), Version("0.0.1") ]
+ "running in the context of this OperatingSystem.")]
class OMC_OSProcess : CIM_OSProcess
{
[Aggregate, Override ( "GroupComponent" ), Min ( 1 ), Max ( 1 ),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2007-12-21 20:37:03
|
Revision: 524
http://omc.svn.sourceforge.net/omc/?rev=524&view=rev
Author: bartw
Date: 2007-12-21 12:37:06 -0800 (Fri, 21 Dec 2007)
Log Message:
-----------
some fixes
Modified Paths:
--------------
pybase/trunk/OMC_OperatingSystem.py
pybase/trunk/OMC_UnixProcess.py
pybase/trunk/omc-pybase-providers.spec
Modified: pybase/trunk/OMC_OperatingSystem.py
===================================================================
--- pybase/trunk/OMC_OperatingSystem.py 2007-12-19 00:03:20 UTC (rev 523)
+++ pybase/trunk/OMC_OperatingSystem.py 2007-12-21 20:37:06 UTC (rev 524)
@@ -109,7 +109,7 @@
uex(Description = version)
uex(Caption = version)
fo.close()
- install_time = Popen(['rpm', '-qf','/etc/SuSE-release',
+ install_time = Popen(['/bin/rpm', '-qf','/etc/SuSE-release',
'--queryformat','%{INSTALLTIME}'],
stdout=PIPE).communicate()[0]
uex(InstallDate = pywbem.CIMDateTime.fromtimestamp(int(install_time)))
Modified: pybase/trunk/OMC_UnixProcess.py
===================================================================
--- pybase/trunk/OMC_UnixProcess.py 2007-12-19 00:03:20 UTC (rev 523)
+++ pybase/trunk/OMC_UnixProcess.py 2007-12-21 20:37:06 UTC (rev 524)
@@ -306,7 +306,7 @@
try:
s = os.readlink('/proc/%d/exe' % self.pid)
except:
- return ''
+ return None
return s
def get_exec_name(self):
@@ -479,9 +479,8 @@
model['PercentCPU'] = pywbem.Real32(ps['percent_cpu'])
model['KernelModeTime'] = pywbem.Uint64(ps['kernel_mode_time'])
model['UserModeTime'] = pywbem.Uint64(ps['user_mode_time'])
- modpath = lp.get_module_path();
- if modpath:
- model['ModulePath'] = modpath
+ modpath = lp.get_module_path()
+ model['ModulePath'] = lp.get_module_path()
model['SharedMemorySize'] = pywbem.Uint64(_bytes2KB(ps['shared_mem_size']))
model['ResidentSetSize'] = pywbem.Uint64(_bytes2KB(ps['resident_set_size']))
cl = lp.get_command_line()
@@ -813,7 +812,7 @@
logger.log_debug('Entering %s.enum_instances()' \
% self.__class__.__name__)
for lp in LinuxProcess.procs():
- model['Dependent'] = lp.get_instance_name(cim_class.namespace)
+ model['Dependent'] = lp.get_instance_name(model.path.namespace)
fname = lp.get_module_path()
if fname:
model['Antecedent'] = OMC_LogicalFile.get_file_path(fname)
Modified: pybase/trunk/omc-pybase-providers.spec
===================================================================
--- pybase/trunk/omc-pybase-providers.spec 2007-12-19 00:03:20 UTC (rev 523)
+++ pybase/trunk/omc-pybase-providers.spec 2007-12-21 20:37:06 UTC (rev 524)
@@ -19,9 +19,9 @@
License: BSD
URL: http://omc-project.org/
BuildArch: noarch
-Source0: %{name}-%{version}.tar.gz
-PreReq: /usr/bin/loadmof.sh
-Requires: python-pywbem pyprovifc>=1.0.0
+Source0: %{name}-%{version}.tar.gz
+PreReq: /usr/bin/loadmof.sh
+Requires: python-pywbem, pyprovifc >= 1.0.0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2007-12-24 23:38:26
|
Revision: 526
http://omc.svn.sourceforge.net/omc/?rev=526&view=rev
Author: bartw
Date: 2007-12-24 15:38:11 -0800 (Mon, 24 Dec 2007)
Log Message:
-----------
added UserContext to pegasus registration
Modified Paths:
--------------
pybase/trunk/OMC_InitdService-peg.reg
pybase/trunk/OMC_LogicalFile-peg.reg
pybase/trunk/OMC_OperatingSystem-peg.reg
pybase/trunk/OMC_SyslogNG-peg.reg
pybase/trunk/OMC_TimeService-peg.reg
pybase/trunk/OMC_UnitaryComputerSystem-peg.reg
pybase/trunk/OMC_UnixProcess-peg.reg
Modified: pybase/trunk/OMC_InitdService-peg.reg
===================================================================
--- pybase/trunk/OMC_InitdService-peg.reg 2007-12-21 20:56:40 UTC (rev 525)
+++ pybase/trunk/OMC_InitdService-peg.reg 2007-12-24 23:38:11 UTC (rev 526)
@@ -5,6 +5,7 @@
InterfaceType = "Python";
InterfaceVersion = "1.0.0";
Location = "/usr/lib/pycim/OMC_InitdService.py";
+ UserContext = 2; // Requestor
Vendor = "OMC";
Version = "0.1.0";
};
Modified: pybase/trunk/OMC_LogicalFile-peg.reg
===================================================================
--- pybase/trunk/OMC_LogicalFile-peg.reg 2007-12-21 20:56:40 UTC (rev 525)
+++ pybase/trunk/OMC_LogicalFile-peg.reg 2007-12-24 23:38:11 UTC (rev 526)
@@ -5,6 +5,7 @@
InterfaceType = "Python";
InterfaceVersion = "1.0.0";
Location = "/usr/lib/pycim/OMC_LogicalFile.py";
+ UserContext = 2; // Requestor
Vendor = "OMC";
Version = "0.1.0";
};
@@ -57,6 +58,16 @@
instance of PG_ProviderCapabilities
{
+ CapabilityID = "OMC_LinuxSocketFile";
+ ProviderModuleName = "/usr/lib/pycim/OMC_LogicalFile.py";
+ ProviderName = "OMC_LogicalFile";
+ ClassName = "OMC_LinuxSocketFile";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2}; // Instance
+};
+
+instance of PG_ProviderCapabilities
+{
CapabilityID = "OMC_LinuxDeviceFile";
ProviderModuleName = "/usr/lib/pycim/OMC_LogicalFile.py";
ProviderName = "OMC_LogicalFile";
Modified: pybase/trunk/OMC_OperatingSystem-peg.reg
===================================================================
--- pybase/trunk/OMC_OperatingSystem-peg.reg 2007-12-21 20:56:40 UTC (rev 525)
+++ pybase/trunk/OMC_OperatingSystem-peg.reg 2007-12-24 23:38:11 UTC (rev 526)
@@ -5,6 +5,7 @@
InterfaceType = "Python";
InterfaceVersion = "1.0.0";
Location = "/usr/lib/pycim/OMC_OperatingSystem.py";
+ UserContext = 2; // Requestor
Vendor = "OMC";
Version = "0.1.0";
};
Modified: pybase/trunk/OMC_SyslogNG-peg.reg
===================================================================
--- pybase/trunk/OMC_SyslogNG-peg.reg 2007-12-21 20:56:40 UTC (rev 525)
+++ pybase/trunk/OMC_SyslogNG-peg.reg 2007-12-24 23:38:11 UTC (rev 526)
@@ -5,6 +5,7 @@
InterfaceType = "Python";
InterfaceVersion = "1.0.0";
Location = "/usr/lib/pycim/OMC_SyslogNG.py";
+ UserContext = 2; // Requestor
Vendor = "OMC";
Version = "1.0";
};
Modified: pybase/trunk/OMC_TimeService-peg.reg
===================================================================
--- pybase/trunk/OMC_TimeService-peg.reg 2007-12-21 20:56:40 UTC (rev 525)
+++ pybase/trunk/OMC_TimeService-peg.reg 2007-12-24 23:38:11 UTC (rev 526)
@@ -4,6 +4,7 @@
InterfaceType = "Python";
InterfaceVersion = "1.0.0";
Location = "/usr/lib/pycim/OMC_TimeService.py";
+ UserContext = 2; // Requestor
Vendor = "OMC";
Version = "1.0";
};
Modified: pybase/trunk/OMC_UnitaryComputerSystem-peg.reg
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem-peg.reg 2007-12-21 20:56:40 UTC (rev 525)
+++ pybase/trunk/OMC_UnitaryComputerSystem-peg.reg 2007-12-24 23:38:11 UTC (rev 526)
@@ -5,6 +5,7 @@
InterfaceType = "Python";
InterfaceVersion = "1.0.0";
Location = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py";
+ UserContext = 2; // Requestor
Vendor = "OMC";
Version = "0.1.0";
};
Modified: pybase/trunk/OMC_UnixProcess-peg.reg
===================================================================
--- pybase/trunk/OMC_UnixProcess-peg.reg 2007-12-21 20:56:40 UTC (rev 525)
+++ pybase/trunk/OMC_UnixProcess-peg.reg 2007-12-24 23:38:11 UTC (rev 526)
@@ -5,6 +5,7 @@
InterfaceType = "Python";
InterfaceVersion = "1.0.0";
Location = "/usr/lib/pycim/OMC_UnixProcess.py";
+ UserContext = 2; // Requestor
Vendor = "OMC";
Version = "0.1.0";
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jc...@us...> - 2008-01-07 16:01:10
|
Revision: 533
http://omc.svn.sourceforge.net/omc/?rev=533&view=rev
Author: jcarey
Date: 2008-01-07 08:01:10 -0800 (Mon, 07 Jan 2008)
Log Message:
-----------
Registration adjustements
Modified Paths:
--------------
pybase/trunk/OMC_UnixProcess-peg.reg
Added Paths:
-----------
pybase/trunk/OMC_TimeService-ow.reg
Removed Paths:
-------------
pybase/trunk/OMC_TimeService.reg
Added: pybase/trunk/OMC_TimeService-ow.reg
===================================================================
--- pybase/trunk/OMC_TimeService-ow.reg (rev 0)
+++ pybase/trunk/OMC_TimeService-ow.reg 2008-01-07 16:01:10 UTC (rev 533)
@@ -0,0 +1,66 @@
+// OpenWBEM Provider registration for OMC_TimeService
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC_TimeService:0001";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_SystemTimeService";
+ ProviderTypes = {1,6}; // Instance, Method
+ ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
+};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC_TimeService:0002";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_RemoteTimeServicePort";
+ ProviderTypes = {1,6}; // Instance, Method
+ ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
+};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC_TimeService:0003";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_TimeZoneSettingData";
+ ProviderTypes = {1}; // Instance
+ ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
+};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC_TimeService:0004";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_HostedTimeService";
+ ProviderTypes = {1,3}; // Instance, Associator
+ ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
+};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC_TimeService:0005";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_TimeServiceAccessBySAP";
+ ProviderTypes = {1,3}; // Instance, Associator
+ ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
+};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC_TimeService:0006";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_TimeServiceTimeZoneSettingData";
+ ProviderTypes = {1,3}; // Instance, Associator
+ ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
+};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC_TimeService:0007";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_TimeServiceAvailableToElement";
+ ProviderTypes = {1,3}; // Instance, Associator
+ ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
+};
+
+
+
Deleted: pybase/trunk/OMC_TimeService.reg
===================================================================
--- pybase/trunk/OMC_TimeService.reg 2007-12-31 23:22:18 UTC (rev 532)
+++ pybase/trunk/OMC_TimeService.reg 2008-01-07 16:01:10 UTC (rev 533)
@@ -1,66 +0,0 @@
-// OpenWBEM Provider registration for OMC_TimeService
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC_TimeService:0001";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_SystemTimeService";
- ProviderTypes = {1,6}; // Instance, Method
- ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
-};
-
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC_TimeService:0002";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_RemoteTimeServicePort";
- ProviderTypes = {1,6}; // Instance, Method
- ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
-};
-
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC_TimeService:0003";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_TimeZoneSettingData";
- ProviderTypes = {1}; // Instance
- ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
-};
-
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC_TimeService:0004";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_HostedTimeService";
- ProviderTypes = {1,3}; // Instance, Associator
- ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
-};
-
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC_TimeService:0005";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_TimeServiceAccessBySAP";
- ProviderTypes = {1,3}; // Instance, Associator
- ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
-};
-
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC_TimeService:0006";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_TimeServiceTimeZoneSettingData";
- ProviderTypes = {1,3}; // Instance, Associator
- ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
-};
-
-instance of OpenWBEM_PyProviderRegistration
-{
- InstanceID = "OMC_TimeService:0007";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_TimeServiceAvailableToElement";
- ProviderTypes = {1,3}; // Instance, Associator
- ModulePath = "/usr/lib/pycim/OMC_TimeService.py";
-};
-
-
-
Modified: pybase/trunk/OMC_UnixProcess-peg.reg
===================================================================
--- pybase/trunk/OMC_UnixProcess-peg.reg 2007-12-31 23:22:18 UTC (rev 532)
+++ pybase/trunk/OMC_UnixProcess-peg.reg 2008-01-07 16:01:10 UTC (rev 533)
@@ -1,25 +1,24 @@
-//////// OMC_UnixProcess
instance of PG_ProviderModule
{
- Name = "/usr/lib/pycim/OMC_UnixProcess.py";
+ Name = "OMC_UnixProcessProvider_Module";
InterfaceType = "Python";
InterfaceVersion = "1.0.0";
Location = "/usr/lib/pycim/OMC_UnixProcess.py";
UserContext = 2; // Requestor
Vendor = "OMC";
- Version = "0.1.0";
+ Version = "1.0";
};
instance of PG_Provider
{
Name = "OMC_UnixProcess";
- ProviderModuleName = "/usr/lib/pycim/OMC_UnixProcess.py";
+ ProviderModuleName = "OMC_UnixProcessProvider_Module";
};
instance of PG_ProviderCapabilities
{
CapabilityID = "OMC_UnixProcess";
- ProviderModuleName = "/usr/lib/pycim/OMC_UnixProcess.py";
+ ProviderModuleName = "OMC_UnixProcessProvider_Module";
ProviderName = "OMC_UnixProcess";
ClassName = "OMC_UnixProcess";
Namespaces = {"root/cimv2"};
@@ -29,7 +28,7 @@
instance of PG_ProviderCapabilities
{
CapabilityID = "OMC_ProcessExecutable";
- ProviderModuleName = "/usr/lib/pycim/OMC_UnixProcess.py";
+ ProviderModuleName = "OMC_UnixProcessProvider_Module";
ProviderName = "OMC_UnixProcess";
ClassName = "OMC_ProcessExecutable";
Namespaces = {"root/cimv2"};
@@ -39,7 +38,7 @@
instance of PG_ProviderCapabilities
{
CapabilityID = "OMC_OSProcess";
- ProviderModuleName = "/usr/lib/pycim/OMC_UnixProcess.py";
+ ProviderModuleName = "OMC_UnixProcessProvider_Module";
ProviderName = "OMC_UnixProcess";
ClassName = "OMC_OSProcess";
Namespaces = {"root/cimv2"};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jc...@us...> - 2008-01-07 17:49:31
|
Revision: 534
http://omc.svn.sourceforge.net/omc/?rev=534&view=rev
Author: jcarey
Date: 2008-01-07 09:49:30 -0800 (Mon, 07 Jan 2008)
Log Message:
-----------
Implemented Enum instances/get instance for OMC_HostNameSettingData. Still need to take care of set_instance
Modified Paths:
--------------
pybase/trunk/OMC_UnitaryComputerSystem-ow.reg
pybase/trunk/OMC_UnitaryComputerSystem-peg.reg
pybase/trunk/OMC_UnitaryComputerSystem.py
Modified: pybase/trunk/OMC_UnitaryComputerSystem-ow.reg
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem-ow.reg 2008-01-07 16:01:10 UTC (rev 533)
+++ pybase/trunk/OMC_UnitaryComputerSystem-ow.reg 2008-01-07 17:49:30 UTC (rev 534)
@@ -1,9 +1,18 @@
// Provider registration for OMC_UnitaryComputerSystem
instance of OpenWBEM_PyProviderRegistration
{
- InstanceID = "OMC:OMC_UnitaryComputerSystem:01";
- NamespaceNames = {"root/cimv2"};
- ClassName = "OMC_UnitaryComputerSystem";
- ProviderTypes = {1,6}; // Instance, Method
- ModulePath = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py";
+ InstanceID = "OMC:OMC_UnitaryComputerSystem:01";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_UnitaryComputerSystem";
+ ProviderTypes = {1,6}; // Instance, Method
+ ModulePath = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py";
};
+
+instance of OpenWBEM_PyProviderRegistration
+{
+ InstanceID = "OMC:OMC_UnitaryComputerSystem:02";
+ NamespaceNames = {"root/cimv2"};
+ ClassName = "OMC_HostNameSettingData";
+ ProviderTypes = {1}; // Instance
+ ModulePath = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py";
+};
Modified: pybase/trunk/OMC_UnitaryComputerSystem-peg.reg
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem-peg.reg 2008-01-07 16:01:10 UTC (rev 533)
+++ pybase/trunk/OMC_UnitaryComputerSystem-peg.reg 2008-01-07 17:49:30 UTC (rev 534)
@@ -26,4 +26,15 @@
ProviderType = {2,5}; // Instance, Method
};
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_HostNameSettingData";
+ ProviderModuleName = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py";
+ ProviderName = "OMC_UnitaryComputerSystem";
+ ClassName = "OMC_HostNameSettingData";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2}; // Instance
+};
+
+
Modified: pybase/trunk/OMC_UnitaryComputerSystem.py
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem.py 2008-01-07 16:01:10 UTC (rev 533)
+++ pybase/trunk/OMC_UnitaryComputerSystem.py 2008-01-07 17:49:30 UTC (rev 534)
@@ -536,7 +536,72 @@
## end of class OMC_UnitaryComputerSystemProvider
+class OMC_HostNameSettingDataProvider(pywbem.CIMProvider):
+ """Instrument the CIM class OMC_HostNameSettingData"""
+
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+ # If you will be filtering instances yourself according to
+ # property_list, role, result_role, and result_class_name
+ # parameters, set self.filter_results to False
+ # self.filter_results = False
+
+ def get_instance(self, env, model, cim_class):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+ try:
+ iid = model['InstanceID']
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ if iid.lower() != 'omc:computername':
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ model['ComputerName'] = getfqdn()
+ return model
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+ model['InstanceID'] = 'omc:computername'
+ if not keys_only:
+ model['ComputerName'] = getfqdn()
+ yield model
+
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.set_instance()' \
+ % self.__class__.__name__)
+ if not previous_instance:
+ ci = instance
+ else:
+ for k,v in instance.properties.items():
+ previous_instance[k] = v
+ ci = previous_instance
+ try:
+ iid = ci['InstanceID']
+ except KeyError:
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+ if iid.lower() != 'omc:computername':
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
+
+ # TODO: Modify computer name
+ # Modify /etc/hosts
+ # Modify /etc/HOSTNAME
+ # Excecute /bin/hostname ....
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
+ return instance
+
+ def delete_instance(self, env, instance_name):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+## end of class OMC_HostNameSettingDataProvider
+
def get_providers(env): # register provider
- _omc_unitarycomputersystem_prov = OMC_UnitaryComputerSystemProvider()
- return {'OMC_UnitaryComputerSystem': _omc_unitarycomputersystem_prov}
+ omc_hostnamesettingdata_prov = OMC_HostNameSettingDataProvider(env)
+ omc_unitarycomputersystem_prov = OMC_UnitaryComputerSystemProvider()
+ return {'OMC_UnitaryComputerSystem': omc_unitarycomputersystem_prov,
+ 'OMC_HostNameSettingData': omc_hostnamesettingdata_prov}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <np...@us...> - 2008-03-26 19:44:48
|
Revision: 537
http://omc.svn.sourceforge.net/omc/?rev=537&view=rev
Author: npaxton
Date: 2008-03-26 12:44:45 -0700 (Wed, 26 Mar 2008)
Log Message:
-----------
Add ComputerSystemHostNameSettingData association class instrumentation
Modified Paths:
--------------
pybase/trunk/OMC_UnitaryComputerSystem-peg.reg
pybase/trunk/OMC_UnitaryComputerSystem.py
Modified: pybase/trunk/OMC_UnitaryComputerSystem-peg.reg
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem-peg.reg 2008-02-14 03:50:09 UTC (rev 536)
+++ pybase/trunk/OMC_UnitaryComputerSystem-peg.reg 2008-03-26 19:44:45 UTC (rev 537)
@@ -36,5 +36,13 @@
ProviderType = {2}; // Instance
};
+instance of PG_ProviderCapabilities
+{
+ CapabilityID = "OMC_ComputerSystemHostNameSettingData";
+ ProviderModuleName = "/usr/lib/pycim/OMC_UnitaryComputerSystem.py";
+ ProviderName = "OMC_UnitaryComputerSystem";
+ ClassName = "OMC_ComputerSystemHostNameSettingData";
+ Namespaces = {"root/cimv2"};
+ ProviderType = {2,3}; // Instance, Associator
+};
-
Modified: pybase/trunk/OMC_UnitaryComputerSystem.py
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem.py 2008-02-14 03:50:09 UTC (rev 536)
+++ pybase/trunk/OMC_UnitaryComputerSystem.py 2008-03-26 19:44:45 UTC (rev 537)
@@ -1,5 +1,5 @@
#*******************************************************************************
-# Copyright (C) 2007 Novell, Inc. All rights reserved.
+# Copyright (C) 2007,2008 Novell, Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
@@ -599,9 +599,138 @@
## end of class OMC_HostNameSettingDataProvider
+
+class OMC_ComputerSystemHostNameSettingDataProvider(pywbem.CIMProvider):
+ """Instrument the CIM class OMC_ComputerSystemHostNameSettingData
+
+ OMC_ComputerSystemSettingData is associates the computer name setting
+ with the computer system
+
+ """
+ def get_hnsd_path(self, ns):
+ hnsd = pywbem.CIMInstanceName(classname = 'OMC_HostNameSettingData', \
+ namespace=ns, \
+ keybindings={'InstanceID':'omc:computername'})
+ return hnsd
+
+ def get_cs_path(self, ns):
+ cs_path = pywbem.CIMInstanceName(classname='OMC_UnitaryComputerSystem', \
+ namespace=ns, \
+ keybindings={'CreationClassName':'OMC_UnitaryComputerSystem', \
+ 'Name': getfqdn() })
+ return cs_path
+
+ def __init__ (self, env):
+ logger = env.get_logger()
+ logger.log_debug('Initializing provider %s from %s' \
+ % (self.__class__.__name__, __file__))
+ # If you will be filtering instances yourself according to
+ # property_list, role, result_role, and result_class_name
+ # parameters, set self.filter_results to False
+ # self.filter_results = False
+
+ def get_instance(self, env, model, cim_class):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.get_instance()' \
+ % self.__class__.__name__)
+
+ if model['SettingData']['InstanceID'] == 'omc:computername' and \
+ model['ManagedElement']['Name'] == getfqdn() and \
+ model['ManagedElement']['CreationClassName'] == 'OMC_UnitaryComputerSystem':
+
+ ux = model.update_existing
+
+ # SettingData has additional fields on it
+ # These are not applicable for HostNameSettingData
+ # We'll set the IsCurrent and isDefault to TRUE, but ignore others
+ ux(IsCurrent=self.Values.IsCurrent.Is_Current)
+ ux(IsDefault=self.Values.IsDefault.Is_Default)
+ return model
+
+ def enum_instances(self, env, model, cim_class, keys_only):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.enum_instances()' \
+ % self.__class__.__name__)
+
+ #one and only one instance?
+
+ model['SettingData'] = self.get_hnsd_path(model.path.namespace)
+ model['ManagedElement'] = self.get_cs_path(model.path.namespace)
+ yield model
+
+ def set_instance(self, env, instance, previous_instance, cim_class):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ def delete_instance(self, env, instance_name):
+ raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
+
+ def references(self, env, object_name, model, assoc_class,
+ result_class_name, role, result_role, keys_only):
+ logger = env.get_logger()
+ logger.log_debug('Entering %s.references()' \
+ % self.__class__.__name__)
+ ch = env.get_cimom_handle()
+ # This is a common pattern. YMMV
+ if (not role or role.lower() == 'settingdata') and \
+ pywbem.is_subclass(ch, object_name.namespace,
+ sub=object_name.classname,
+ super='OMC_HostNameSettingData'):
+ if object_name['InstanceID'] == 'omc:computername':
+ model['SettingData'] = object_name
+ model['ManagedElement']= self.get_cs_path(model.path.namespace)
+ yield model
+
+ if (not role or role.lower() == 'managedelement') and \
+ pywbem.is_subclass(ch, object_name.namespace,
+ sub=object_name.classname,
+ super='OMC_UnitaryComputerSystem'):
+ if object_name['Name'] == getfqdn() and \
+ object_name['CreationClassName'] == 'OMC_UnitaryComputerSystem':
+ model['ManagedElement'] = object_name
+ model['SettingData'] = self.get_hnsd_path(model.path.namespace)
+ yield model
+
+ class Values(object):
+ class IsDefault(object):
+ Unknown = pywbem.Uint16(0)
+ Is_Default = pywbem.Uint16(1)
+ Is_Not_Default = pywbem.Uint16(2)
+
+ class IsMaximum(object):
+ Unknown = pywbem.Uint16(0)
+ Not_Applicable = pywbem.Uint16(1)
+ Is_Maximum = pywbem.Uint16(2)
+ Is_Not_Maximum = pywbem.Uint16(3)
+
+ class IsMinimum(object):
+ Unknown = pywbem.Uint16(0)
+ Not_Applicable = pywbem.Uint16(1)
+ Is_Minimum = pywbem.Uint16(2)
+ Is_Not_Minimum = pywbem.Uint16(3)
+
+ class IsCurrent(object):
+ Unknown = pywbem.Uint16(0)
+ Is_Current = pywbem.Uint16(1)
+ Is_Not_Current = pywbem.Uint16(2)
+
+ class IsNext(object):
+ Unknown = pywbem.Uint16(0)
+ Is_Next = pywbem.Uint16(1)
+ Is_Not_Next = pywbem.Uint16(2)
+ Is_Next_For_Single_Use = pywbem.Uint16(3)
+
+## end of class OMC_ComputerSystemHostNameSettingDataProvider
+
+
+
def get_providers(env): # register provider
omc_hostnamesettingdata_prov = OMC_HostNameSettingDataProvider(env)
omc_unitarycomputersystem_prov = OMC_UnitaryComputerSystemProvider()
+ omc_computersystemhostnamesettingdata_prov = OMC_ComputerSystemHostNameSettingDataProvider(env)
return {'OMC_UnitaryComputerSystem': omc_unitarycomputersystem_prov,
- 'OMC_HostNameSettingData': omc_hostnamesettingdata_prov}
+ 'OMC_HostNameSettingData': omc_hostnamesettingdata_prov,
+ 'OMC_ComputerSystemHostNameSettingData': omc_computersystemhostnamesettingdata_prov}
+
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-04-04 05:06:54
|
Revision: 542
http://omc.svn.sourceforge.net/omc/?rev=542&view=rev
Author: bartw
Date: 2008-04-03 22:06:58 -0700 (Thu, 03 Apr 2008)
Log Message:
-----------
working on base providers
Modified Paths:
--------------
pybase/trunk/OMC_SyslogNG.py
pybase/trunk/OMC_UnixProcess.mof
pybase/trunk/OMC_UnixProcess.py
pybase/trunk/omc-pybase-providers.spec
Modified: pybase/trunk/OMC_SyslogNG.py
===================================================================
--- pybase/trunk/OMC_SyslogNG.py 2008-04-03 19:57:16 UTC (rev 541)
+++ pybase/trunk/OMC_SyslogNG.py 2008-04-04 05:06:58 UTC (rev 542)
@@ -6,10 +6,37 @@
import pywbem
from socket import getfqdn
+import os
+_sl_list = None
+_sl_mtime = None
+
def _get_syslog_list():
- rval = []
- fo = open('/etc/syslog-ng/syslog-ng.conf', 'r')
+ global _sl_list
+ global _sl_mtime
+ def partition(s, seq):
+ """ S.partition(sep) -> (head, sep, tail)
+
+ Searches for the separator sep in S, and returns the part before it,
+ the separator itself, and the part after it. If the separator is not
+ found, returns S and two empty strings.
+ """
+ try:
+ return s.partition(seq)
+ except AttributeError:
+ try:
+ idx = s.index(seq)
+ except ValueError:
+ return (s, '', '')
+ return (s[:idx], seq, s[idx+len(seq):])
+
+ sl_config_file = '/etc/syslog-ng/syslog-ng.conf'
+ st = os.stat(sl_config_file)
+ if _sl_list and _sl_mtime == st.st_mtime:
+ return _sl_list
+ _sl_mtime = st.st_mtime
+ _sl_list = []
+ fo = open(sl_config_file, 'r')
state = 'i'
for line in fo:
line = line.strip()
@@ -17,25 +44,27 @@
continue
if state == 'i' and line.startswith('destination'):
state = 'd'
- line = line[12:]
if state == 'd':
- idx = line.find('file')
- if idx >= 0:
+ head, sep, tail = partition(line, 'file')
+ if sep:
state = 'f'
- line = line[idx+4:]
+ line = tail
if state == 'f':
- idx = line.find('"')
- if idx >= 0:
- line = line[idx+1:]
- idx = line.find('"')
- if idx >= 0:
- line = line[:idx]
+ head, sep, tail = partition(line, '"')
+ if sep:
+ line = tail
+ head, sep, tail = partition(line, '"')
+ if sep:
+ line = head
state = 'i'
- rval.append(line)
+ if line.startswith('/dev'):
+ continue # skip /dev/tty10 and /dev/xconsole
+ _sl_list.append(line)
fo.close()
- return rval
+ return _sl_list
+
class OMC_SyslogNGRecordLogProvider(pywbem.CIMProvider):
"""Instrument the CIM class OMC_SyslogNGRecordLog
@@ -559,7 +588,10 @@
model['LogCreationClassName'] = 'OMC_SyslogNGRecordLog'
model['CreationClassName'] = 'OMC_SyslogNGLogRecord'
for fname in _get_syslog_list():
- fo = open(fname, 'r')
+ try:
+ fo = open(fname, 'r')
+ except IOError:
+ continue
model['LogName'] = 'OMCSyslogNGRecordLog:' + fname
lineno = 0
for line in fo:
Modified: pybase/trunk/OMC_UnixProcess.mof
===================================================================
--- pybase/trunk/OMC_UnixProcess.mof 2008-04-03 19:57:16 UTC (rev 541)
+++ pybase/trunk/OMC_UnixProcess.mof 2008-04-04 05:06:58 UTC (rev 542)
@@ -12,10 +12,35 @@
string SendSignal([IN] sint32 signal);
[Description ("Virtual memory size in KBytes") ]
- uint32 VirtualMemorySize;
+ uint64 VirtualMemorySize;
[Description ("Percentage of CPU used by process") ]
real32 PercentCPU;
+
+ [Description ("The amount of shared memory in KBytes that is "
+ "allowed for the process") ]
+ uint64 SharedMemorySize;
+
+ [Description ("The number of KBytes the process has in "
+ "real memory, minus 3 pages for administrative purposes. This "
+ "is just the pages which count towards text, data, or "
+ "stack space. This does not include pages which have not "
+ "been demand-loaded in, or which are swapped out.") ]
+ uint64 ResidentSetSize;
+
+ [Description (
+ "The process\'s \'nice\' value. A process \'nice\' value "
+ "of 0 reflects high priority, while increasing values "
+ "reflect lower priorities. Note that a value of 0 might "
+ "be misleading. Use SignedProcessNiceValue instead." ),
+ Override("ProcessNiceValue") ]
+ uint32 ProcessNiceValue;
+
+ [Description ("ProcessNiceValue is a uint32, but nice values on "
+ "Linux and BSD range from -20 to 19. The SignedProcessNiceValue "
+ "holds the true nice value on these platforms, while the "
+ "ProcessNiceValue may not be accurate.") ]
+ sint16 SignedProcessNiceValue;
};
//////////////////////////////////////////////////////////////////////////////
Modified: pybase/trunk/OMC_UnixProcess.py
===================================================================
--- pybase/trunk/OMC_UnixProcess.py 2008-04-03 19:57:16 UTC (rev 541)
+++ pybase/trunk/OMC_UnixProcess.py 2008-04-04 05:06:58 UTC (rev 542)
@@ -40,7 +40,10 @@
import OMC_LogicalFile
from OMC_OperatingSystem import get_os_path
+from resource import getpagesize
+_pagesize = getpagesize()
+
PROC_STATE_DOESNT_EXIST = -1
PROC_STATE_UNKNOWN = 0
PROC_STATE_OTHER = 1
@@ -171,8 +174,8 @@
f = open('/proc/%d/statm' % pid)
fields = f.readline().split()
f.close()
- sd['resident_set_size'] = long(fields[1]) * 4096
- sd['shared_mem_size'] = long(fields[2]) * 4096
+ sd['resident_set_size'] = pywbem.Uint64(fields[1]) * _pagesize
+ sd['shared_mem_size'] = pywbem.Uint64(fields[2]) * _pagesize
except:
pass
return sd
@@ -413,7 +416,7 @@
l = f.readline()
f.close()
fields = l.split()
- resident_set_size = long(fields[1]) * 4096
+ resident_set_size = pywbem.Uint64(fields[1]) * _pagesize
except:
pass
return resident_set_size
@@ -425,7 +428,7 @@
l = f.readline()
f.close()
fields = l.split()
- shared_mem_size = long(fields[2]) * 4096
+ shared_mem_size = pywbem.Uint64(fields[2]) * _pagesize
except:
pass
return shared_mem_size
@@ -454,46 +457,54 @@
"""
def fill_instance(self, model, lp, keys_only=False):
- model['OSCreationClassName'] = 'OMC_OperatingSystem'
- model['CreationClassName'] = 'OMC_UnixProcess'
- model['Handle'] = str(lp.pid)
- model['CSCreationClassName'] = 'OMC_UnitaryComputerSystem'
- model['OSName'] = 'Linux'
- model['CSName'] = getfqdn()
+ ux = model.update_existing
+ ux(OSCreationClassName= 'OMC_OperatingSystem')
+ ux(CreationClassName= 'OMC_UnixProcess')
+ ux(Handle= str(lp.pid))
+ ux(CSCreationClassName= 'OMC_UnitaryComputerSystem')
+ ux(OSName= 'Linux')
+ ux(CSName= getfqdn())
if keys_only:
return model
pname = lp.get_exec_name()
- model['Name'] = pname
- model['Caption'] = 'Linux Process. Name:%s PID:%d' % (pname, lp.pid)
- model['Description'] = 'Linux Process. Name:%s PID:%d' % (pname, lp.pid)
+ ux(Name= pname)
+ ux(Caption= 'Linux Process. Name:%s PID:%d' % (pname, lp.pid))
+ ux(Description= 'Linux Process. Name:%s PID:%d' % (pname, lp.pid))
ps = lp.get_proc_stats()
- model['ExecutionState'] = pywbem.Uint16(ps['state'])
- model['ParentProcessID'] = str(ps['parent_process_id'])
- model['ProcessGroupID'] = pywbem.Uint64(ps['process_group'])
- model['ProcessSessionID'] = pywbem.Uint64(ps['session_id'])
- model['ProcessTTY'] = str(ps['tty_number'])
- model['Priority'] = pywbem.Uint32(ps['priority'])
- model['ProcessNiceValue'] = pywbem.Uint32(ps['nice_value'])
- model['CreationDate'] = ps['start_time']
- model['VirtualMemorySize'] = pywbem.Uint32(_bytes2KB(ps['virtual_mem_size']))
- model['PercentCPU'] = pywbem.Real32(ps['percent_cpu'])
- model['KernelModeTime'] = pywbem.Uint64(ps['kernel_mode_time'])
- model['UserModeTime'] = pywbem.Uint64(ps['user_mode_time'])
- model.update_existing(ModulePath=lp.get_module_path())
- model['SharedMemorySize'] = pywbem.Uint64(_bytes2KB(ps['shared_mem_size']))
- model['ResidentSetSize'] = pywbem.Uint64(_bytes2KB(ps['resident_set_size']))
+ ux(ExecutionState= pywbem.Uint16(ps['state']))
+ ux(ParentProcessID= str(ps['parent_process_id']))
+ ux(ProcessGroupID= pywbem.Uint64(ps['process_group']))
+ ux(ProcessSessionID= pywbem.Uint64(ps['session_id']))
+ ux(ProcessTTY= str(ps['tty_number']))
+ pri = ps['priority']
+ if pri < 0:
+ pri = 0
+ ux(Priority= pywbem.Uint32(pri))
+ nv = ps['nice_value']
+ ux(SignedProcessNiceValue= pywbem.Sint16(nv))
+ if nv < 0:
+ nv = 0
+ ux(ProcessNiceValue= pywbem.Uint32(nv))
+ ux(CreationDate= ps['start_time'])
+ ux(VirtualMemorySize= pywbem.Uint64(_bytes2KB(ps['virtual_mem_size'])))
+ ux(PercentCPU= pywbem.Real32(ps['percent_cpu']))
+ ux(KernelModeTime= pywbem.Uint64(ps['kernel_mode_time']))
+ ux(UserModeTime= pywbem.Uint64(ps['user_mode_time']))
+ ux(ModulePath=lp.get_module_path())
+ ux(SharedMemorySize= pywbem.Uint64(_bytes2KB(ps['shared_mem_size'])))
+ ux(ResidentSetSize= pywbem.Uint64(_bytes2KB(ps['resident_set_size'])))
cl = lp.get_command_line()
if cl:
- model['Parameters'] = cl
+ ux(Parameters= cl)
ruid = lp.get_real_uid()
- model['RealUserID'] = pywbem.Uint64(ruid)
+ ux(RealUserID= pywbem.Uint64(ruid))
try:
- model['UserName'] = pwd.getpwuid(ruid)[0]
+ ux(UserName= pwd.getpwuid(ruid)[0])
except:
pass
- model['ElementName'] = model['Name']
- model['HealthState'] = pywbem.Uint16(0)
- model['OperationalStatus'] = [pywbem.Uint16(0)]
+ ux(ElementName= model['Name'])
+ ux(HealthState= pywbem.Uint16(0))
+ ux(OperationalStatus= [pywbem.Uint16(0)])
return model
def get_instance(self, env, model, cim_class):
Modified: pybase/trunk/omc-pybase-providers.spec
===================================================================
--- pybase/trunk/omc-pybase-providers.spec 2008-04-03 19:57:16 UTC (rev 541)
+++ pybase/trunk/omc-pybase-providers.spec 2008-04-04 05:06:58 UTC (rev 542)
@@ -11,7 +11,7 @@
# norootforbuild
Name: omc-pybase-providers
-BuildRequires: python-devel openwbem
+BuildRequires: python-devel tog-pegasus
Version: 0.1.0
Release: 2
Group: System/Management
@@ -20,8 +20,8 @@
URL: http://omc-project.org/
BuildArch: noarch
Source0: %{name}-%{version}.tar.gz
-PreReq: /usr/bin/loadmof.sh
-Requires: python-pywbem, pyprovifc >= 1.0.0
+PreReq: /usr/bin/peg-loadmof.sh
+Requires: python-pywbem, pyprovifc >= 1.0.0, tog-pegasus
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
@@ -59,14 +59,22 @@
/usr/share/mof/%{name}/*.mof
/usr/share/mof/%{name}/*.reg
+%pre
+if [ $1 -gt 1 ]; then
+ peg-loadmof.sh -r -n root/cimv2 /usr/share/mof/%{name}/OMC_Base.mof
+ peg-loadmof.sh -r -n root/PG_InterOp /usr/share/mof/%{name}/*-peg.reg
+fi
+
%post
-loadmof.sh -n root/cimv2 /usr/share/mof/%{name}/OMC_Base.mof
-if [ -x /usr/bin/peg-loadmof.sh ]; then
- /usr/bin/peg-loadmof.sh -n root/PG_InterOp /usr/share/mof/%{name}/*-peg.reg
+peg-loadmof.sh -n root/PG_InterOp /usr/share/mof/%{name}/*-peg.reg
+peg-loadmof.sh -n root/cimv2 /usr/share/mof/%{name}/OMC_Base.mof
+
+%preun
+if [ "$1" = "0" -a -x /usr/bin/peg-loadmof.sh ] ; then
+ # last uninstall, not upgrade
+ peg-loadmof.sh -r -n root/PG_InterOp /usr/share/mof/%{name}/*-peg.reg
+ peg-loadmof.sh -r -n root/cimv2 /usr/share/mof/%{name}/OMC_Base.mof
fi
-if [ -x /usr/bin/ow-loadmof.sh ]; then
- /usr/bin/ow-loadmof.sh -n Interop /usr/share/mof/%{name}/*-ow.reg
-fi
%changelog -n omc-pybase-providers
* Tue May 15 2007 - bwh...@su...
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ba...@us...> - 2008-04-09 19:48:44
|
Revision: 557
http://omc.svn.sourceforge.net/omc/?rev=557&view=rev
Author: bartw
Date: 2008-04-09 12:48:11 -0700 (Wed, 09 Apr 2008)
Log Message:
-----------
removed hostnamesettingdata
Modified Paths:
--------------
pybase/trunk/OMC_UnitaryComputerSystem.mof
pybase/trunk/OMC_UnitaryComputerSystem.py
Modified: pybase/trunk/OMC_UnitaryComputerSystem.mof
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem.mof 2008-04-09 19:30:53 UTC (rev 556)
+++ pybase/trunk/OMC_UnitaryComputerSystem.mof 2008-04-09 19:48:11 UTC (rev 557)
@@ -7,27 +7,3 @@
{
};
-//////////////////////////////////////////////////////////////////////////////
-[ Description("OMC Host Name Setting Data"), Version("0.0.1") ]
-class OMC_HostNameSettingData : CIM_SettingData
-{
- [Description ("The name of this computer"),
- Required ]
- string ComputerName;
-};
-
-//////////////////////////////////////////////////////////////////////////////
-[ Association, Version ( "0.0.1" ),
- Description ("OMC_ComputerSystemSettingData is associates "
- " the computer name setting with the computer system")]
-class OMC_ComputerSystemHostNameSettingData : CIM_ElementSettingData
-{
- [ Override("ManagedElement"), Key,
- Description ("The computer system.")]
- OMC_UnitaryComputerSystem REF ManagedElement;
-
- [ Override("SettingData"), Key,
- Description ("The computer name setting the computer.")]
- OMC_HostNameSettingData REF SettingData;
-};
-
Modified: pybase/trunk/OMC_UnitaryComputerSystem.py
===================================================================
--- pybase/trunk/OMC_UnitaryComputerSystem.py 2008-04-09 19:30:53 UTC (rev 556)
+++ pybase/trunk/OMC_UnitaryComputerSystem.py 2008-04-09 19:48:11 UTC (rev 557)
@@ -536,200 +536,11 @@
## end of class OMC_UnitaryComputerSystemProvider
-class OMC_HostNameSettingDataProvider(pywbem.CIMProvider):
- """Instrument the CIM class OMC_HostNameSettingData"""
- def __init__ (self, env):
- logger = env.get_logger()
- logger.log_debug('Initializing provider %s from %s' \
- % (self.__class__.__name__, __file__))
- # If you will be filtering instances yourself according to
- # property_list, role, result_role, and result_class_name
- # parameters, set self.filter_results to False
- # self.filter_results = False
- def get_instance(self, env, model, cim_class):
- logger = env.get_logger()
- logger.log_debug('Entering %s.get_instance()' \
- % self.__class__.__name__)
- try:
- iid = model['InstanceID']
- except KeyError:
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
- if iid.lower() != 'omc:computername':
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
- model['ComputerName'] = getfqdn()
- return model
-
- def enum_instances(self, env, model, cim_class, keys_only):
- logger = env.get_logger()
- logger.log_debug('Entering %s.enum_instances()' \
- % self.__class__.__name__)
- model['InstanceID'] = 'omc:computername'
- if not keys_only:
- model['ComputerName'] = getfqdn()
- yield model
-
- def set_instance(self, env, instance, previous_instance, cim_class):
- logger = env.get_logger()
- logger.log_debug('Entering %s.set_instance()' \
- % self.__class__.__name__)
- if not previous_instance:
- ci = instance
- else:
- for k,v in instance.properties.items():
- previous_instance[k] = v
- ci = previous_instance
- try:
- iid = ci['InstanceID']
- except KeyError:
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
- if iid.lower() != 'omc:computername':
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_FOUND)
-
- # TODO: Modify computer name
- # Modify /etc/hosts
- # Modify /etc/HOSTNAME
- # Excecute /bin/hostname ....
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED) # Remove to implement
- return instance
-
- def delete_instance(self, env, instance_name):
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
-
-## end of class OMC_HostNameSettingDataProvider
-
-
-class OMC_ComputerSystemHostNameSettingDataProvider(pywbem.CIMProvider):
- """Instrument the CIM class OMC_ComputerSystemHostNameSettingData
-
- OMC_ComputerSystemSettingData is associates the computer name setting
- with the computer system
-
- """
- def get_hnsd_path(self, ns):
- hnsd = pywbem.CIMInstanceName(classname = 'OMC_HostNameSettingData', \
- namespace=ns, \
- keybindings={'InstanceID':'omc:computername'})
- return hnsd
-
- def get_cs_path(self, ns):
- cs_path = pywbem.CIMInstanceName(classname='OMC_UnitaryComputerSystem', \
- namespace=ns, \
- keybindings={'CreationClassName':'OMC_UnitaryComputerSystem', \
- 'Name': getfqdn() })
- return cs_path
-
- def __init__ (self, env):
- logger = env.get_logger()
- logger.log_debug('Initializing provider %s from %s' \
- % (self.__class__.__name__, __file__))
- # If you will be filtering instances yourself according to
- # property_list, role, result_role, and result_class_name
- # parameters, set self.filter_results to False
- # self.filter_results = False
-
- def get_instance(self, env, model, cim_class):
- logger = env.get_logger()
- logger.log_debug('Entering %s.get_instance()' \
- % self.__class__.__name__)
-
- if model['SettingData']['InstanceID'] == 'omc:computername' and \
- model['ManagedElement']['Name'] == getfqdn() and \
- model['ManagedElement']['CreationClassName'] == 'OMC_UnitaryComputerSystem':
-
- ux = model.update_existing
-
- # SettingData has additional fields on it
- # These are not applicable for HostNameSettingData
- # We'll set the IsCurrent and isDefault to TRUE, but ignore others
- ux(IsCurrent=self.Values.IsCurrent.Is_Current)
- ux(IsDefault=self.Values.IsDefault.Is_Default)
- return model
-
- def enum_instances(self, env, model, cim_class, keys_only):
- logger = env.get_logger()
- logger.log_debug('Entering %s.enum_instances()' \
- % self.__class__.__name__)
-
- #one and only one instance?
-
- model['SettingData'] = self.get_hnsd_path(model.path.namespace)
- model['ManagedElement'] = self.get_cs_path(model.path.namespace)
- yield model
-
- def set_instance(self, env, instance, previous_instance, cim_class):
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
-
- def delete_instance(self, env, instance_name):
- raise pywbem.CIMError(pywbem.CIM_ERR_NOT_SUPPORTED)
-
- def references(self, env, object_name, model, assoc_class,
- result_class_name, role, result_role, keys_only):
- logger = env.get_logger()
- logger.log_debug('Entering %s.references()' \
- % self.__class__.__name__)
- ch = env.get_cimom_handle()
- # This is a common pattern. YMMV
- if (not role or role.lower() == 'settingdata') and \
- pywbem.is_subclass(ch, object_name.namespace,
- sub=object_name.classname,
- super='OMC_HostNameSettingData'):
- if object_name['InstanceID'] == 'omc:computername':
- model['SettingData'] = object_name
- model['ManagedElement']= self.get_cs_path(model.path.namespace)
- yield model
-
- if (not role or role.lower() == 'managedelement') and \
- pywbem.is_subclass(ch, object_name.namespace,
- sub=object_name.classname,
- super='OMC_UnitaryComputerSystem'):
- if object_name['Name'] == getfqdn() and \
- object_name['CreationClassName'] == 'OMC_UnitaryComputerSystem':
- model['ManagedElement'] = object_name
- model['SettingData'] = self.get_hnsd_path(model.path.namespace)
- yield model
-
- class Values(object):
- class IsDefault(object):
- Unknown = pywbem.Uint16(0)
- Is_Default = pywbem.Uint16(1)
- Is_Not_Default = pywbem.Uint16(2)
-
- class IsMaximum(object):
- Unknown = pywbem.Uint16(0)
- Not_Applicable = pywbem.Uint16(1)
- Is_Maximum = pywbem.Uint16(2)
- Is_Not_Maximum = pywbem.Uint16(3)
-
- class IsMinimum(object):
- Unknown = pywbem.Uint16(0)
- Not_Applicable = pywbem.Uint16(1)
- Is_Minimum = pywbem.Uint16(2)
- Is_Not_Minimum = pywbem.Uint16(3)
-
- class IsCurrent(object):
- Unknown = pywbem.Uint16(0)
- Is_Current = pywbem.Uint16(1)
- Is_Not_Current = pywbem.Uint16(2)
-
- class IsNext(object):
- Unknown = pywbem.Uint16(0)
- Is_Next = pywbem.Uint16(1)
- Is_Not_Next = pywbem.Uint16(2)
- Is_Next_For_Single_Use = pywbem.Uint16(3)
-
-## end of class OMC_ComputerSystemHostNameSettingDataProvider
-
-
-
def get_providers(env): # register provider
- omc_hostnamesettingdata_prov = OMC_HostNameSettingDataProvider(env)
omc_unitarycomputersystem_prov = OMC_UnitaryComputerSystemProvider()
- omc_computersystemhostnamesettingdata_prov = OMC_ComputerSystemHostNameSettingDataProvider(env)
- return {'OMC_UnitaryComputerSystem': omc_unitarycomputersystem_prov,
- 'OMC_HostNameSettingData': omc_hostnamesettingdata_prov,
- 'OMC_ComputerSystemHostNameSettingData': omc_computersystemhostnamesettingdata_prov}
+ return {'OMC_UnitaryComputerSystem': omc_unitarycomputersystem_prov}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|