summaryrefslogtreecommitdiff
path: root/pyeclib
diff options
context:
space:
mode:
authorKota Tsuyuzaki <tsuyuzaki.kota@lab.ntt.co.jp>2016-11-16 20:42:27 -0800
committerKota Tsuyuzaki <tsuyuzaki.kota@lab.ntt.co.jp>2016-11-28 20:22:57 -0800
commitd163972bb04faf192d0ba65451dcc388b5bb19f0 (patch)
tree8da7dc2ab9ce53c6a67b243ab650daacad209f67 /pyeclib
parentab26abf78c5be0dc72dc4a6c91a13536cd049223 (diff)
downloadpyeclib-d163972bb04faf192d0ba65451dcc388b5bb19f0.tar.gz
Add soft warning log line when using liberasurecode <1.3.1
To apply the fix for a liberasurecode issue [1], we need hard depencency of liberasurecode requires >=1.3.1. However current binary dependency maintainance tool "bindep" works only for packagers' repository. (i.e. it refers the version of apt/yum/etc...) And nothing is cared for the binary built from source. This patch provides a way to detect incompatible liberasurecode and makes a warning log line to syslog which suggest "you're using older liberasurecode which will be deprecated, please upgrade it". NOTE: - This dependency managemnet depends on erasurecode_version.h header file in liberasurecode. i.e. it cannot care of overwritten .so library after PyECLib built once. Partial-Bug: #1639691 1: Icee788a0931fe692fe0de31fabc4ba450e338a87 Change-Id: Ice5e96f0a59096cc9067823f0d62d6c7065ed62f
Diffstat (limited to 'pyeclib')
-rw-r--r--pyeclib/ec_iface.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/pyeclib/ec_iface.py b/pyeclib/ec_iface.py
index 1b429cf..1830744 100644
--- a/pyeclib/ec_iface.py
+++ b/pyeclib/ec_iface.py
@@ -28,6 +28,12 @@ from .utils import create_instance
from .utils import positive_int_value
from pyeclib_c import get_liberasurecode_version
+import logging
+from logging.handlers import SysLogHandler
+logger = logging.getLogger('pyeclib')
+syslog_handler = SysLogHandler()
+logger.addHandler(syslog_handler)
+
def check_backend_available(backend_name):
try:
@@ -527,6 +533,18 @@ def _liberasurecode_version():
minor = str(int(version_hex_str[-4:-2]))
rev = str(int(version_hex_str[-2:]))
version_str = '.'.join([major, minor, rev])
+
+ # liberasurecode < 1.3.1 should be incompatible but
+ # just warn until packagers build the required version
+ # See https://bugs.launchpad.net/swift/+bug/1639691 in detail
+ required_version = ((1 << 16) + (3 << 8) + 1)
+ if version_int < required_version:
+ logger.warning(
+ 'DEPRECATED WARNING: your liberasurecode '
+ '%s will be deprecated in the near future because of the issue '
+ 'https://bugs.launchpad.net/swift/+bug/1639691; '
+ 'Please upgrade to >=1.3.1 and rebuild pyeclib to suppress '
+ 'this message' % version_str)
return version_str
LIBERASURECODE_VERSION = _liberasurecode_version()