Hi all,
I've written a Python<->C bridge for libaiscf. It provides a few
ways to interact with SMF. I'm looking for some folks to look the code
over for memory management issues, for any potential SMF issues or any
other issues others might see. This code has not be whacked to be c-style
happy, so don't worry about that unless you really want.
I am having issues with the delete section of
AIservice_set_subscript(), if anyone has any suggestions what might be
happening (dbx stack trace included). This is triggered when one tries to
delete a property via:
del(libaiscf.AIservice(libaiscf.AISCF(),"test")['status'])
Thank you,
Clay
Webrev is at:
http://cr.opensolaris.org/~clayb/10740/webrev_prelim1/
How the module works:
---------------------
To load the module, one runs
import libaiscf
Then to create an SMF instance object, one can run
(for svc:/system/install/server:default)
instance=libaiscf.AISCF()
(for svc:/system/install/server:someThingElse)
instance=libaiscf.AISCF("someThingElse")
Further, to create an AI service object, one runs:
service=libaiscf.AIservice(instance,"serviceName")
To see a property key under the service, one can do:
service['status'] (which returns the string value or a KeyError as a
dictionary would if the key doesn't exist)
To set or change a property under the service, one can do:
serivce['status']="off"
All actions query SMF and no data is cached in case something changes
under the consumer. All actions are handed to SMF when executed. Other
functions implemented can be read in the PyDoc output for the module, here
attached.
-------------- next part --------------
Help on module libaiscf:
NAME
libaiscf
FILE
/export/backup/hg_workspaces/slim_source_libpyscf/usr/src/lib/libaiscf_pymod/pics/i386/libaiscf.py
CLASSES
_libaiscf._AISCF(__builtin__.object)
AISCF
_libaiscf._AIservice(__builtin__.object)
AIservice
class AISCF(_libaiscf._AISCF)
| Class representing an AI SMF instance
|
| Method resolution order:
| AISCF
| _libaiscf._AISCF
| __builtin__.object
|
| Methods defined here:
|
| get_services(self)
| Return a dictionary associating service names and AIservice objects
| associated with an SMF instance
|
| ----------------------------------------------------------------------
| Properties defined here:
|
| services
| The services associated with an SMF instance
|
| <get> = get_services(self)
| Return a dictionary associating service names and AIservice
objects
| associated with an SMF instance
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __dict__ = <dictproxy object>
| dictionary for instance variables (if defined)
|
| __weakref__ = <attribute '__weakref__' of 'AISCF' objects>
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Methods inherited from _libaiscf._AISCF:
|
| __init__(...)
| x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
| del_service(...)
| Delete a service
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from _libaiscf._AISCF:
|
| __new__ = <built-in method __new__ of type object>
| T.__new__(S, ...) -> a new object with type S, a subtype of T
|
| instanceName = <member 'instanceName' of '_libaiscf._AISCF' objects>
| AISCF Instance Name
class AIservice(_libaiscf._AIservice)
| Class representing an AI SMF service
|
| Method resolution order:
| AIservice
| _libaiscf._AIservice
| __builtin__.object
|
| Methods defined here:
|
| keys(self)
| Return the properties of an AI service
|
| values(self)
| Return the property values of an AI service
|
| ----------------------------------------------------------------------
| Data and other attributes defined here:
|
| __dict__ = <dictproxy object>
| dictionary for instance variables (if defined)
|
| __weakref__ = <attribute '__weakref__' of 'AIservice' objects>
| list of weak references to the object (if defined)
|
| ----------------------------------------------------------------------
| Methods inherited from _libaiscf._AIservice:
|
| __delitem__(...)
| x.__delitem__(y) <==> del x[y]
|
| __getitem__(...)
| x.__getitem__(y) <==> x[y]
|
| __init__(...)
| x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
| __setitem__(...)
| x.__setitem__(i, y) <==> x[i]=y
|
| __str__(...)
| x.__str__() <==> str(x)
|
| as_dict(...)
| Get a dict of service properties and values
|
| ----------------------------------------------------------------------
| Data and other attributes inherited from _libaiscf._AIservice:
|
| __new__ = <built-in method __new__ of type object>
| T.__new__(S, ...) -> a new object with type S, a subtype of T
|
| serviceName = <member 'serviceName' of '_libaiscf._AIservice' objects>
| AI Service Name
-------------- next part --------------
program terminated by signal SEGV (no mapping at the fault address)
0xfed550fb: mutex_lock_impl+0x0023: movzbl 0x00000004(%eax),%edi
Current function is AIservice_set_subscript
dbx: warning: File `libaiscf_service.c' has been modified more recently than
`_li
baiscf.so'
262 PyString_AsString(subscript));
(dbx) where
[1] mutex_lock_impl(0x0, 0x0, 0xfea3c000, 0x8046df8, 0xfea0f3cf, 0x80d3380),
at
0xfed550fb
[2] mutex_lock(0x0), at 0xfed5530d
[3] scf_entry_destroy(0x81154f8, 0x0), at 0xfea0f5bc
[4] ai_delete_property(0x80a5918, 0x8046e50, 0x80dfa94), at 0xfec11f01
=>[5] AIservice_set_subscript(self = 0x80e666c, subscript = 0x80dfa80, value =
(n
il)), line 262 in "libaiscf_service.c"
[6] PyObject_DelItem(0x80e666c, 0x80dfa80, 0x80e661c, 0x7), at 0xfeea5fdd