SettingProvider

” Module for SettingProvider class.

SettingProvider

class openlmi.storage.SettingProvider.SettingProvider(*args, **kwargs)[source]

Base of all LMI_*Setting providers. Every setting class can have:

  • number of fixed preconfigured instances
  • number of configurable persistent instances
  • number of configurable in-memory (transient) instances
  • instances associated to managed elements

This class provides all four instance types.

The setting itself is represented by dictionary of key -> value.

Preconfigured instances are stored in /etc/openlmi/storage/settings/<setting_classname>.ini Persistent instances are stored in /var/lib/openlmi-storage/settings/<setting_classname>.ini

__init__(*args, **kwargs)[source]

setting_classname = name of CIM class, which we provide supported_properties = hash property_name -> constructor

constructor is a function which takes string argument and returns CIM value. (i.e. pywbem.Uint16 or bool or string etc).
validate_properties = hash property_name -> validator
validator is a function which takes pywbem (Uint32, bool ...) value as parameter and returns True, if the value is correct for the property. Not all properties do need to have a validator.
ignore_defaults = hash property_name -> default value.
If this value of the property is set, the ModifyInstance won’t complain, but it will silently ignore the value. This is useful when someone tries to set default value of a property and the provider does not implement it.
cim_method_clonesetting(*args, **kwargs)[source]

Implements LMI_DiskPartitionConfigurationSetting.CloneSetting()

Create a copy of this instance. The resulting instance will have the same class and the same properties as the original instance except ChangeableType, which will be set to “Changeable - Transient” in the clone, and InstanceID.

Keyword arguments: env – Provider Environment (pycimmb.ProviderEnvironment) object_name – A pywbem.CIMInstanceName or pywbem.CIMCLassName

specifying the object on which the method CloneSetting() should be invoked.

Returns a two-tuple containing the return value (type pywbem.Uint32) and a list of CIMParameter objects representing the output parameters

Output parameters: Clone – (type REF (pywbem.CIMInstanceName(setting_classname=’CIM_StorageSetting’, ...))

Created copy.

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)

create_setting_id(*args, **kwargs)[source]

InstanceID should have format LMI:<classname>:<ID>. This method returns string LMI:<classname>:<myid>

delete_instance(*args, **kwargs)[source]

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)

enum_instances(*args, **kwargs)[source]

Provider implementation of EnumerateInstances intrinsic method. Subclasses should not override this method, they should override enumerate_configurations only.

enumerate_configurations(*args, **kwargs)[source]

Enumerate all instances of LMI_*Setting, which are attached to managed elements, i.e. are not transient, persistent nor preconfigured.

This method returns iterabe with Setting instances.

Subclasses should override this method.

find_instance(*args, **kwargs)[source]

Find an Setting instance with given InstanceID and return it. Return None if there is no such instance.

get_associated_element_name(*args, **kwargs)[source]

Return CIMInstanceName for ElementSettingData association. Return None if no such element exist. Subclasses should override this method.

get_configuration_for_id(*args, **kwargs)[source]

Return Setting instance for given instance_id. Return None if no such Setting is found.

Subclasses should override this method.

get_instance(*args, **kwargs)[source]

Provider implementation of GetInstance intrinsic method.

parse_setting_id(*args, **kwargs)[source]

InstanceID should have format LMI:<classname>:<myid>. This method checks, that the format is OK and returns the myid. It returns None if the format is not OK. This method can be used in get_configuration_for_id.

set_instance(*args, **kwargs)[source]

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.

modify_existing – True if ModifyInstance, False if CreateInstance

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 modify_existing is False, indicating that the operation was CreateInstance)
CIM_ERR_NOT_FOUND (the CIM Instance does not exist – only valid
if modify_existing is True, indicating that the operation was ModifyInstance)

CIM_ERR_FAILED (some other unspecified error occurred)

static string_to_bool(*args, **kwargs)[source]

Convert a string to boolean value. ‘1’, ‘true’ and ‘True’ are True, the rest is False.

static string_to_string_array(*args, **kwargs)[source]

Convert a string to array of strings. The string must be enclosed in [].

static string_to_uint16_array(*args, **kwargs)[source]

Convert a string to array of integers. The string must be enclosed in [].

static string_to_uint64_array(*args, **kwargs)[source]

Convert a string to array of integers. The string must be enclosed in [].

ElementSettingDataProvider

class openlmi.storage.SettingProvider.ElementSettingDataProvider(*args, **kwargs)[source]

Implementation of CIM_ElementSettingData. It uses functionality provided by SettingProvider.

__init__(*args, **kwargs)[source]
enum_instances(*args, **kwargs)[source]

Provider implementation of EnumerateInstances intrinsic method.

get_instance(*args, **kwargs)[source]

Provider implementation of GetInstance intrinsic method.

SettingHelperProvider

class openlmi.storage.SettingProvider.SettingHelperProvider(*args, **kwargs)[source]

Provider of LMI_*Setting class for managed element classes which implement SettingHelper.

__init__(*args, **kwargs)[source]
enumerate_configurations(*args, **kwargs)[source]

Enumerate all instances of LMI_*Setting, which are attached to managed elements, i.e. are not transient, persistent nor preconfigured. It returns setting_helper.enumerate_settings.

get_associated_element_name(*args, **kwargs)[source]

Return CIMInstanceName for ElementSettingData association. Return None if no such element exist.

get_configuration_for_id(*args, **kwargs)[source]

Return Setting instance for given instance_id. Return None if no such Setting is found.

Table Of Contents

Previous topic

SettingManager

Next topic

StorageConfiguration

This Page