Data Structures | |
class | Proxy |
Documentation for Proxy class. More... | |
class | SocketEOF |
class | LsmError |
class | ErrorNumber |
class | JobStatus |
class | TestCommon |
Functions | |
def | default_property |
def | common_urllib2_error_handler |
def | sh |
Converts the size into human format. | |
def | size_bytes_2_size_human |
Converts the size into human format. | |
def | size_human_2_size_bytes |
Converts the size into human format. | |
def | uri_parse |
Common method used to parse a URI. | |
def | uri_parameters |
Parses the parameters (Query string) of the URI. | |
def | md5 |
Generates the md5 hex digest of passed in parameter. | |
def | params_to_string |
Converts a list of arguments to string. | |
def | post_msg |
Posts a message to the syslogger. | |
def | error |
def | info |
def | addl_error_data |
def | get_class |
def | type_compare |
def | return_requires |
Variables | |
string | UDS_PATH = '/var/run/lsm/ipc' |
LOG_VERBOSE = True | |
dictionary | SIZE_CONS |
Constant for byte size. | |
list | SIZE_CONS_CHK_LST = ['EiB', 'PiB', 'TiB', 'GiB', 'MiB', 'KiB'] |
def lsm::_common::addl_error_data | ( | domain, | ||
level, | ||||
exception, | ||||
debug = None , |
||||
debug_data = None | ||||
) |
Used for gathering additional information about an error.
Definition at line 388 of file _common.py.
def lsm::_common::common_urllib2_error_handler | ( | exp | ) |
Definition at line 57 of file _common.py.
def lsm::_common::default_property | ( | name, | ||
allow_set = True , |
||||
doc = None | ||||
) |
Creates the get/set properties for the given name. It assumes that the actual attribute is '_' + name TODO: Expand this with domain validation to ensure the values are correct.
Definition at line 33 of file _common.py.
def lsm::_common::error | ( | msg | ) |
Definition at line 348 of file _common.py.
def lsm::_common::get_class | ( | class_name | ) |
Given a class name it returns the class, caller will then need to run the constructor to create.
Definition at line 396 of file _common.py.
def lsm::_common::info | ( | msg | ) |
Definition at line 353 of file _common.py.
def lsm::_common::md5 | ( | t | ) |
Generates the md5 hex digest of passed in parameter.
t | Item to generate signature on. |
Definition at line 315 of file _common.py.
def lsm::_common::params_to_string | ( | args | ) |
Converts a list of arguments to string.
args | Args to join |
Definition at line 324 of file _common.py.
def lsm::_common::post_msg | ( | level, | ||
prg, | ||||
msg | ||||
) |
Posts a message to the syslogger.
level | Logging level | |
prg | Program name | |
msg | Message to log.
If a message includes new lines we will create multiple syslog entries so that the message is readable. Otherwise it isn't very readable. Hopefully we won't be logging much :-) |
Definition at line 337 of file _common.py.
def lsm::_common::return_requires | ( | types | ) |
Decorator function that allows us to ensure that we are getting the correct types back from a function/method call. Note: This is normally frowned upon by the python community, but this API needs to be language agnostic, so making sure we have the correct types is quite important.
Definition at line 528 of file _common.py.
def lsm::_common::sh | ( | size, | ||
human = False | ||||
) |
Converts the size into human format.
size | Size in bytes | |
human | True|False |
Convert size in bytes to human readable size The return string will follow IEC binary prefixes, e.g. '1.9 KiB' For size less than 1024, we do nothing but return the int we get. TODO: Need a expect to handle when size is not a int. int() might do.
Definition at line 165 of file _common.py.
def lsm::_common::size_bytes_2_size_human | ( | size | ) |
Converts the size into human format.
size | Size in bytes |
Convert integer size in bytes to human readable size. We are following rules of IEC binary prefixes on size: http://en.wikipedia.org/wiki/Gibibyte The biggest of unit this function supported is PiB. The precision is 2 which means you will get '1.99 KiB'
Definition at line 190 of file _common.py.
def lsm::_common::size_human_2_size_bytes | ( | size_human | ) |
Converts the size into human format.
size_human | Human readable size string, e.g. '1.9 KiB' |
Convert human readable size string into integer size in bytes. Following rules of IEC binary prefixes on size: http://en.wikipedia.org/wiki/Gibibyte Supported input size_human in these formats: '1.9KiB' # int(1024*1.9) '1 KiB' # 2**10 '1B' # 1 '2K' # 2*(2**10), treated as '2KiB' '2k' # 2*(2**10), treated as '2KiB' '2KB' # 2*(10**3)
Definition at line 204 of file _common.py.
def lsm::_common::type_compare | ( | method_name, | ||
exp_type, | ||||
act_val | ||||
) |
Definition at line 499 of file _common.py.
def lsm::_common::uri_parameters | ( | uri | ) |
Parses the parameters (Query string) of the URI.
uri | Full uri |
Definition at line 291 of file _common.py.
def lsm::_common::uri_parse | ( | uri, | ||
requires = None , |
||||
required_params = None | ||||
) |
Common method used to parse a URI.
uri | The uri to parse | |
requires | Optional list of keys that must be present in output | |
required_params | Optional list of required parameters that must be present. |
Common uri parse method that optionally can check for what is needed before returning successfully.
Definition at line 246 of file _common.py.
LOG_VERBOSE = True |
Definition at line 128 of file _common.py.
dictionary SIZE_CONS |
{ 'B': 1, 'KiB': 2 ** 10, 'KB': 10 ** 3, 'K': 2 ** 10, 'k': 2 ** 10, 'MiB': 2 ** 20, 'MB': 10 ** 6, 'M': 2 ** 20, 'm': 2 ** 20, 'GiB': 2 ** 30, 'GB': 10 ** 9, 'G': 2 ** 30, 'g': 2 ** 30, 'TiB': 2 ** 40, 'TB': 10 ** 12, 'T': 2 ** 40, 't': 2 ** 40, 'PiB': 2 ** 50, 'PB': 10 ** 15, 'P': 2 ** 50, 'p': 2 ** 50, 'EiB': 2 ** 60, 'EB': 10 ** 18, 'E': 2 ** 60, 'e': 2 ** 60, }
Constant for byte size.
Definition at line 131 of file _common.py.
list SIZE_CONS_CHK_LST = ['EiB', 'PiB', 'TiB', 'GiB', 'MiB', 'KiB'] |
Definition at line 158 of file _common.py.
string UDS_PATH = '/var/run/lsm/ipc' |
Definition at line 125 of file _common.py.