Upgrade to 1.6.2

Signed-off-by: Gris Ge <fge@redhat.com>
This commit is contained in:
Gris Ge 2018-05-18 16:38:03 +08:00
parent 9b31b84727
commit 1279709f92
5 changed files with 44 additions and 517 deletions

1
.gitignore vendored
View File

@ -24,3 +24,4 @@
/libstoragemgmt-1.5.0.tar.gz
/libstoragemgmt-1.6.0.tar.gz
/libstoragemgmt-1.6.1.tar.gz
/libstoragemgmt-1.6.2.tar.gz

View File

@ -1,271 +0,0 @@
From edbd5fed3cb5f4f48dcc7ee97f601d2ea3537911 Mon Sep 17 00:00:00 2001
From: Gris Ge <fge@redhat.com>
Date: Fri, 23 Mar 2018 20:38:55 +0800
Subject: [PATCH 1/3] Fix GCC 8 compile warnings.
* Fix '-Werror=format-truncation' warning by increase the buffer size.
* Fix '-Werror=cast-function-type' warning by disable it for Python c
extension, reason:
https://stackoverflow.com/questions/10264080/python-c-extension-why-are-methods-that-use-keyword-arguments-cast-to-pycfunct
Signed-off-by: Gris Ge <fge@redhat.com>
---
c_binding/libsg.c | 45 ++++++++++++++++++++++++---------------------
c_binding/utils.h | 2 +-
plugin/simc/db.c | 2 +-
plugin/simc/nfs_ops.c | 2 +-
plugin/simc/san_ops.c | 2 +-
plugin/simc/utils.h | 6 +++---
python_binding/Makefile.am | 3 ++-
7 files changed, 33 insertions(+), 29 deletions(-)
diff --git a/c_binding/libsg.c b/c_binding/libsg.c
index 75ee39d3..46893695 100644
--- a/c_binding/libsg.c
+++ b/c_binding/libsg.c
@@ -367,8 +367,9 @@ static int _sg_io_open(char *err_msg, const char *disk_path, int *fd,
* The 'sense_key' is the output pointer.
* Return 0 if sense_key is _T10_SPC_SENSE_KEY_NO_SENSE or
* _T10_SPC_SENSE_KEY_RECOVERED_ERROR, return -1 otherwise.
+ * sense_err_msg should be char[_LSM_ERR_MSG_LEN / 2]
*/
-static int _check_sense_data(char *err_msg, uint8_t *sense_data,
+static int _check_sense_data(char *sense_err_msg, uint8_t *sense_data,
uint8_t *sense_key);
static int _extract_ata_sense_data(char *err_msg, uint8_t *sense_data,
@@ -485,14 +486,14 @@ int _sg_io_vpd(char *err_msg, int fd, uint8_t page_code, uint8_t *data)
int rc_vpd_00 = 0;
char strerr_buff[_LSM_ERR_MSG_LEN];
uint8_t sense_key = _T10_SPC_SENSE_KEY_NO_SENSE;
- char sense_err_msg[_LSM_ERR_MSG_LEN];
+ char sense_err_msg[_LSM_ERR_MSG_LEN / 2];
ssize_t data_len = 0;
assert(err_msg != NULL);
assert(fd >= 0);
assert(data != NULL);
- memset(sense_err_msg, 0, _LSM_ERR_MSG_LEN);
+ memset(sense_err_msg, 0, sizeof(sense_err_msg));
switch(page_code) {
case _SG_T10_SPC_VPD_ATA_INFO:
@@ -812,7 +813,7 @@ static int _sg_io_open(char *err_msg, const char *disk_path, int *fd, int oflag)
return rc;
}
-static int _check_sense_data(char *err_msg, uint8_t *sense_data,
+static int _check_sense_data(char *sense_err_msg, uint8_t *sense_data,
uint8_t *sense_key)
{
int rc = -1;
@@ -856,8 +857,9 @@ static int _check_sense_data(char *err_msg, uint8_t *sense_data,
rc = 0;
goto out;
default:
- _lsm_err_msg_set(err_msg, "Got unknown sense data response code %02x",
- sense_hdr->response_code);
+ snprintf(sense_err_msg, _LSM_ERR_MSG_LEN / 2,
+ "Got unknown sense data response code %02x",
+ sense_hdr->response_code);
goto out;
}
/* TODO(Gris Ge): Handle ADDITIONAL SENSE CODE field and ADDITIONAL SENSE
@@ -879,11 +881,12 @@ static int _check_sense_data(char *err_msg, uint8_t *sense_data,
/* As sense_key is 4 bytes and we covered all 16 values in
* _T10_SPC_SENSE_KEY_STR, there will be no out of index error.
*/
- _lsm_err_msg_set(err_msg, "Got SCSI sense data, key %s(0x%02x), "
- "ADDITIONAL SENSE CODE 0x%02x, ADDITIONAL SENSE CODE "
- "QUALIFIER 0x%02x, all sense data in hex: %s",
- _T10_SPC_SENSE_KEY_STR[*sense_key], *sense_key,
- asc, ascq, sense_data_str);
+ snprintf(sense_err_msg, _LSM_ERR_MSG_LEN / 2 ,
+ "Got SCSI sense data, key %s(0x%02x), "
+ "ADDITIONAL SENSE CODE 0x%02x, ADDITIONAL SENSE CODE "
+ "QUALIFIER 0x%02x, all sense data in hex: %s",
+ _T10_SPC_SENSE_KEY_STR[*sense_key], *sense_key,
+ asc, ascq, sense_data_str);
}
out:
@@ -921,13 +924,13 @@ int _sg_io_recv_diag(char *err_msg, int fd, uint8_t page_code, uint8_t *data)
char strerr_buff[_LSM_ERR_MSG_LEN];
uint8_t sense_data[_T10_SPC_SENSE_DATA_MAX_LENGTH];
uint8_t sense_key = _T10_SPC_SENSE_KEY_NO_SENSE;
- char sense_err_msg[_LSM_ERR_MSG_LEN];
+ char sense_err_msg[_LSM_ERR_MSG_LEN / 2];
assert(err_msg != NULL);
assert(fd >= 0);
assert(data != NULL);
- memset(sense_err_msg, 0, _LSM_ERR_MSG_LEN);
+ memset(sense_err_msg, 0, sizeof(sense_err_msg));
/* SPC-5 rev 07, Table 219 - RECEIVE DIAGNOSTIC RESULTS command */
cdb[0] = RECEIVE_DIAGNOSTIC; /* OPERATION CODE */
@@ -975,14 +978,14 @@ int _sg_io_send_diag(char *err_msg, int fd, uint8_t *data, uint16_t data_len)
char strerr_buff[_LSM_ERR_MSG_LEN];
uint8_t sense_data[_T10_SPC_SENSE_DATA_MAX_LENGTH];
uint8_t sense_key = _T10_SPC_SENSE_KEY_NO_SENSE;
- char sense_err_msg[_LSM_ERR_MSG_LEN];
+ char sense_err_msg[_LSM_ERR_MSG_LEN / 2];
assert(err_msg != NULL);
assert(fd >= 0);
assert(data != NULL);
assert(data_len > 0);
- memset(sense_err_msg, 0, _LSM_ERR_MSG_LEN);
+ memset(sense_err_msg, 0, sizeof(sense_err_msg));
/* SPC-5 rev 07, Table 219 - RECEIVE DIAGNOSTIC RESULTS command */
cdb[0] = SEND_DIAGNOSTIC; /* OPERATION CODE */
@@ -1078,7 +1081,7 @@ int _sg_io_mode_sense(char *err_msg, int fd, uint8_t page_code,
int ioctl_errno = 0;
char strerr_buff[_LSM_ERR_MSG_LEN];
uint8_t sense_key = _T10_SPC_SENSE_KEY_NO_SENSE;
- char sense_err_msg[_LSM_ERR_MSG_LEN];
+ char sense_err_msg[_LSM_ERR_MSG_LEN / 2];
struct _sg_t10_mode_para_hdr *mode_hdr = NULL;
uint16_t block_dp_len = 0;
uint16_t mode_data_len = 0;
@@ -1087,7 +1090,7 @@ int _sg_io_mode_sense(char *err_msg, int fd, uint8_t page_code,
assert(fd >= 0);
assert(data != NULL);
- memset(sense_err_msg, 0, _LSM_ERR_MSG_LEN);
+ memset(sense_err_msg, 0, sizeof(sense_err_msg));
memset(data, 0, _SG_T10_SPC_MODE_SENSE_MAX_LEN);
/* SPC-5 Table 171 - MODE SENSE(10) command */
@@ -1257,7 +1260,7 @@ static int _sg_log_sense(char *err_msg, int fd, uint8_t page_code,
int ioctl_errno = 0;
char strerr_buff[_LSM_ERR_MSG_LEN];
uint8_t sense_key = _T10_SPC_SENSE_KEY_NO_SENSE;
- char sense_err_msg[_LSM_ERR_MSG_LEN];
+ char sense_err_msg[_LSM_ERR_MSG_LEN / 2];
struct _sg_t10_log_para_hdr *log_hdr = NULL;
uint16_t log_data_len = 0;
@@ -1265,7 +1268,7 @@ static int _sg_log_sense(char *err_msg, int fd, uint8_t page_code,
assert(fd >= 0);
assert(data != NULL);
- memset(sense_err_msg, 0, _LSM_ERR_MSG_LEN);
+ memset(sense_err_msg, 0, sizeof(sense_err_msg));
memset(cdb, 0, _T10_SPC_LOG_SENSE_CMD_LEN);
cdb[0] = LOG_SENSE;
@@ -1320,14 +1323,14 @@ int _sg_request_sense(char *err_msg, int fd, uint8_t *returned_sense_data)
uint8_t sense_data[_T10_SPC_SENSE_DATA_MAX_LENGTH];
int ioctl_errno = 0;
uint8_t sense_key = _T10_SPC_SENSE_KEY_NO_SENSE;
- char sense_err_msg[_LSM_ERR_MSG_LEN];
+ char sense_err_msg[_LSM_ERR_MSG_LEN / 2];
char strerr_buff[_LSM_ERR_MSG_LEN];
assert(err_msg != NULL);
assert(fd >= 0);
assert(returned_sense_data != NULL);
- memset(sense_err_msg, 0, _LSM_ERR_MSG_LEN);
+ memset(sense_err_msg, 0, sizeof(sense_err_msg));
memset(cdb, 0, _T10_SPC_REQUEST_SENSE_CMD_LEN);
cdb[0] = REQUEST_SENSE;
diff --git a/c_binding/utils.h b/c_binding/utils.h
index 15d0c970..f63b6e3d 100644
--- a/c_binding/utils.h
+++ b/c_binding/utils.h
@@ -23,7 +23,7 @@
#include <stdio.h>
#include <stdbool.h>
-#define _LSM_ERR_MSG_LEN 1024
+#define _LSM_ERR_MSG_LEN 4096
#define _good(rc, rc_val, out) \
do { \
diff --git a/plugin/simc/db.c b/plugin/simc/db.c
index 7b3613e6..aad9f308 100644
--- a/plugin/simc/db.c
+++ b/plugin/simc/db.c
@@ -768,7 +768,7 @@ void _db_sql_trans_rollback(sqlite3 *db)
int _db_data_add(char *err_msg, sqlite3 *db, const char *table_name, ...)
{
int rc = LSM_ERR_OK;
- char sql_cmd[_BUFF_SIZE];
+ char sql_cmd[_BUFF_SIZE * 4];
char keys_str[_BUFF_SIZE];
char values_str[_BUFF_SIZE];
const char *key_str = NULL;
diff --git a/plugin/simc/nfs_ops.c b/plugin/simc/nfs_ops.c
index 4d7235dc..b8bcde59 100644
--- a/plugin/simc/nfs_ops.c
+++ b/plugin/simc/nfs_ops.c
@@ -159,7 +159,7 @@ int nfs_export_fs(lsm_plugin_ptr c, const char *fs_id, const char *export_path,
uint64_t sim_fs_id = 0;
uint64_t sim_exp_id = 0;
char tmp_export_path[_BUFF_SIZE];
- char vpd83[_BUFF_SIZE];
+ char vpd83[_VPD_83_LEN];
_UNUSED(flags);
_lsm_err_msg_clear(err_msg);
diff --git a/plugin/simc/san_ops.c b/plugin/simc/san_ops.c
index 57161adf..2c9fbde6 100644
--- a/plugin/simc/san_ops.c
+++ b/plugin/simc/san_ops.c
@@ -1111,7 +1111,7 @@ int volume_unmask(lsm_plugin_ptr c, lsm_access_group *group, lsm_volume *volume,
char err_msg[_LSM_ERR_MSG_LEN];
char condition[_BUFF_SIZE];
struct _vector *vec = NULL;
- char sql_cmd_check_mask[_BUFF_SIZE];
+ char sql_cmd_check_mask[_BUFF_SIZE * 4];
_UNUSED(flags);
_lsm_err_msg_clear(err_msg);
diff --git a/plugin/simc/utils.h b/plugin/simc/utils.h
index 6914e594..90bb54a2 100644
--- a/plugin/simc/utils.h
+++ b/plugin/simc/utils.h
@@ -36,7 +36,7 @@ struct _simc_private_data {
#define _UNUSED(x) (void)(x)
#define _MD5_HASH_STR_LEN MD5_DIGEST_LENGTH * 2 + 1
-#define _LSM_ERR_MSG_LEN 1024
+#define _LSM_ERR_MSG_LEN 4096
#define _VPD_83_LEN 17
/* ^ 6h IEEE Registered ID which it 16 bits hex string. */
@@ -63,8 +63,8 @@ struct _simc_private_data {
#define _snprintf_buff(err_msg, rc, out, buff, format, ...) \
do { \
if (buff != NULL) \
- snprintf(buff, _BUFF_SIZE, format, ##__VA_ARGS__); \
- if (strlen(buff) == _BUFF_SIZE - 1 ) { \
+ snprintf(buff, sizeof(buff)/sizeof(char), format, ##__VA_ARGS__); \
+ if (strlen(buff) == sizeof(buff)/sizeof(char) - 1 ) { \
rc = LSM_ERR_PLUGIN_BUG; \
_lsm_err_msg_set(err_msg, "Buff too small"); \
goto out; \
diff --git a/python_binding/Makefile.am b/python_binding/Makefile.am
index 56a4710f..cacb6a0b 100644
--- a/python_binding/Makefile.am
+++ b/python_binding/Makefile.am
@@ -21,7 +21,8 @@ endif
pyexec_LTLIBRARIES = lsm/_clib.la
pyexecdir = $(pythondir)/lsm
-lsm__clib_la_CFLAGS = $(PYTHON_CFLAGS) -I$(top_srcdir)/c_binding/include
+lsm__clib_la_CFLAGS = $(PYTHON_CFLAGS) -I$(top_srcdir)/c_binding/include \
+ -Wno-cast-function-type
lsm__clib_la_SOURCES = lsm/_clib.c
lsm__clib_la_LDFLAGS = $(PYTHON_LIBS) \
-module -avoid-version -export-symbols-regex \
--
2.16.2

View File

@ -1,207 +0,0 @@
From 8bbfe53b464c652a0bdeb8b9790e787276d1a2d6 Mon Sep 17 00:00:00 2001
From: Gris Ge <fge@redhat.com>
Date: Thu, 22 Mar 2018 22:56:37 +0800
Subject: [PATCH 2/3] lsmd: Fix crash when plugin named as _lsmplugin.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Issue:
When plugin search folder has a file named as `_lsmplugin`, the lsmd
will crash with error:
Error on binding socket /tmp/lsm/ipc//: Address already in use
Root cause:
setup_socket() does not check the file name length.
Fix:
* Remove all the string checking from `setup_socket()` and
`chk_pconf_root_pri()`.
* Perform the checks at `process_plugin()`.
Misc:
This also fix the gcc 8 compile warning:
strncpy specified bound depends on the length of the source argument.
Signed-off-by: Gris Ge <fge@redhat.com>
---
daemon/lsm_daemon.c | 124 ++++++++++++++++++++++++++--------------------------
1 file changed, 61 insertions(+), 63 deletions(-)
diff --git a/daemon/lsm_daemon.c b/daemon/lsm_daemon.c
index cbd40b49..dc4df3b7 100644
--- a/daemon/lsm_daemon.c
+++ b/daemon/lsm_daemon.c
@@ -54,11 +54,6 @@
#define LSM_CONF_ALLOW_ROOT_OPT_NAME "allow-plugin-root-privilege"
#define LSM_CONF_REQUIRE_ROOT_OPT_NAME "require-root-privilege"
-#define min(a,b) \
- ({ __typeof__ (a) _a = (a); \
- __typeof__ (b) _b = (b); \
- _a < _b ? _a : _b; })
-
#define max(a,b) \
({ __typeof__ (a) _a = (a); \
__typeof__ (b) _b = (b); \
@@ -343,23 +338,13 @@ void clean_sockets(void)
/**
- * Given a fully qualified path and name to a plug-in, create the IPC socket.
- * @param full_name Full name and path for plug-in
+ * Given a socket file name, create the IPC socket.
+ * @param name socket file name for plug-in
* @return listening socket descriptor for IPC
*/
-int setup_socket(char *full_name)
+int setup_socket(char *name)
{
int err = 0;
- char name[128];
-
- /* Strip off _lsmplugin from the file name, not sure
- * why I chose to do this */
- memset(name, 0, sizeof(name));
-
- char *base_nm = basename(full_name);
- strncpy(name, base_nm,
- min((size_t) abs(strlen(base_nm) - strlen(plugin_extension)),
- (sizeof(name) - 1)));
char *socket_file = path_form(socket_dir, name);
delete_socket(NULL, socket_file);
@@ -467,26 +452,21 @@ void parse_conf_bool(const char *conf_path, const char *key_name, int *value)
/**
* Load plugin config for root privilege setting.
* If config not found, return 0 for no root privilege required.
- * @param plugin_path Full path of plugin
+ * @param plugin_name plugin name.
* @return 1 for require root privilege, 0 or not.
*/
-int chk_pconf_root_pri(char *plugin_path)
+int chk_pconf_root_pri(char *plugin_name)
{
int require_root = 0;
- char *base_name = basename(plugin_path);
- ssize_t plugin_name_len = strlen(base_name) - strlen(plugin_extension);
- if (plugin_name_len <= 0) {
- log_and_exit("Got invalid plugin full path %s\n", plugin_path);
- }
- ssize_t conf_file_name_len = plugin_name_len +
- strlen(plugin_conf_extension) + 1;
+ size_t plugin_name_len = strlen(plugin_name);
+ size_t conf_ext_len = strlen(plugin_conf_extension);
+ ssize_t conf_file_name_len = plugin_name_len + conf_ext_len + 1;
char *plugin_conf_filename = (char *) malloc(conf_file_name_len);
+
if (plugin_conf_filename) {
- strncpy(plugin_conf_filename, base_name, plugin_name_len);
- strncpy(plugin_conf_filename + plugin_name_len,
- plugin_conf_extension, strlen(plugin_conf_extension));
- plugin_conf_filename[conf_file_name_len - 1] = '\0';
+ snprintf(plugin_conf_filename, conf_file_name_len, "%s%s", plugin_name,
+ plugin_conf_extension);
char *plugin_conf_dir_path = path_form(conf_dir,
LSM_PLUGIN_CONF_DIR_NAME);
@@ -498,7 +478,7 @@ int chk_pconf_root_pri(char *plugin_path)
if (require_root == 1 && allow_root_plugin == 0) {
warn("Plugin %s require root privilege while %s disable globally\n",
- base_name, LSMD_CONF_FILE);
+ plugin_name, LSMD_CONF_FILE);
}
free(plugin_conf_dir_path);
free(plugin_conf_filename);
@@ -518,37 +498,55 @@ int chk_pconf_root_pri(char *plugin_path)
*/
int process_plugin(void *p, char *full_name)
{
- if (full_name) {
- size_t ext_len = strlen(plugin_extension);
- size_t full_len = strlen(full_name);
-
- if (full_len > ext_len) {
- if (strncmp
- (full_name + full_len - ext_len, plugin_extension,
- ext_len) == 0) {
- struct plugin *item = calloc(1, sizeof(struct plugin));
- if (item) {
- item->file_path = strdup(full_name);
- item->fd = setup_socket(full_name);
- item->require_root = chk_pconf_root_pri(full_name);
- has_root_plugin |= item->require_root;
-
- if (item->file_path && item->fd >= 0) {
- LIST_INSERT_HEAD((struct plugin_list *) p, item,
- pointers);
- info("Plugin %s added\n", full_name);
- } else {
- /* The only real way to get here is failed strdup as
- setup_socket will exit on error. */
- free(item);
- item = NULL;
- log_and_exit("strdup failed %s\n", full_name);
- }
- } else {
- log_and_exit("Memory allocation failure!\n");
- }
- }
- }
+ char * base_nm = NULL;
+ size_t base_nm_len = 0;
+ size_t no_ext_len = 0;
+ char plugin_name[128];
+ size_t ext_len = strlen(plugin_extension);
+ size_t plugin_name_max_len = sizeof(plugin_name)/sizeof(char);
+
+ if (full_name == NULL)
+ return 0;
+
+ base_nm = basename(full_name);
+ base_nm_len = strlen(base_nm);
+
+ if (base_nm_len <= ext_len)
+ return 0;
+
+ if (strncmp(base_nm + base_nm_len - ext_len, plugin_extension, ext_len))
+ return 0;
+
+ struct plugin *item = calloc(1, sizeof(struct plugin));
+ if (item == NULL) {
+ log_and_exit("Memory allocation failure!\n");
+ return 0; // no use, just trick covscan;
+ }
+
+ /* Strip off _lsmplugin from the file name, not sure
+ * why I chose to do this */
+ memset(plugin_name, 0, plugin_name_max_len);
+ strncpy(plugin_name, base_nm, plugin_name_max_len - 1);
+ no_ext_len = base_nm_len - ext_len;
+ // Already check, no_ext_len is bigger than 0 here.
+ if (no_ext_len < plugin_name_max_len - 1)
+ plugin_name[no_ext_len] = '\0';
+
+ item->file_path = strdup(full_name);
+ item->fd = setup_socket(plugin_name);
+ item->require_root = chk_pconf_root_pri(plugin_name);
+ has_root_plugin |= item->require_root;
+
+ if (item->file_path && item->fd >= 0) {
+ LIST_INSERT_HEAD((struct plugin_list *) p, item,
+ pointers);
+ info("Plugin %s added\n", full_name);
+ } else {
+ /* The only real way to get here is failed strdup as
+ setup_socket will exit on error. */
+ free(item);
+ item = NULL;
+ log_and_exit("strdup failed %s\n", full_name);
}
return 0;
}
--
2.16.2

View File

@ -1,16 +1,20 @@
%bcond_with test
%global py3_build_dir %{_builddir}/%{name}-%{version}-%{release}-python3
%global py2_build_dir %{_builddir}/%{name}-%{version}-%{release}-python2
%if 0%{?rhel} > 7 || 0%{?fedora} > 28
%bcond_with python2
%else
%bcond_without python2
%endif
Name: libstoragemgmt
Version: 1.6.1
Release: 7%{?dist}
Version: 1.6.2
Release: 1%{?dist}
Summary: Storage array management library
Group: System Environment/Libraries
License: LGPLv2+
URL: https://github.com/libstorage/libstoragemgmt
Source0: https://github.com/libstorage/libstoragemgmt/releases/download/%{version}/%{name}-%{version}.tar.gz
Patch0: 0001-Fix-GCC-8-compile-warnings.patch
Patch1: 0002-lsmd-Fix-crash-when-plugin-named-as-_lsmplugin.patch
Requires: python3-%{name}
BuildRequires: autoconf automake libtool yajl-devel libxml2-devel check-devel perl-interpreter
BuildRequires: openssl-devel
@ -19,8 +23,10 @@ BuildRequires: systemd
BuildRequires: bash-completion
BuildRequires: libconfig-devel
BuildRequires: systemd-devel
%if %{with python2}
BuildRequires: python2-six
BuildRequires: python2-devel
%endif
BuildRequires: procps
BuildRequires: sqlite-devel
BuildRequires: python3-six
@ -33,7 +39,6 @@ Requires(postun): systemd
BuildRequires: chrpath
BuildRequires: valgrind
BuildRequires: python2-pyudev
%description
The libStorageMgmt library will provide a vendor agnostic open source storage
@ -51,6 +56,8 @@ Requires: %{name}%{?_isa} = %{version}-%{release}
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.
%if %{with python2}
%package -n python2-%{name}
Summary: Python2 client libraries and plug-in support for %{name}
Group: System Environment/Libraries
@ -79,6 +86,7 @@ Obsoletes: %{name}-python-clibs < %{version}-%{release}
%description -n python2-%{name}-clibs
This package contains python2 client C extension libraries.
%endif
%package -n python3-%{name}
Summary: Python 3 client libraries and plug-in support for %{name}
@ -104,7 +112,6 @@ This package contains python 3 client C extension libraries.
%package smis-plugin
Summary: Files for SMI-S generic array support for %{name}
Group: System Environment/Libraries
BuildRequires: pywbem
BuildRequires: python3-pywbem
Requires: python3-pywbem
BuildArch: noarch
@ -183,8 +190,6 @@ MegaRAID storage management via storcli.
Summary: Files for HP SmartArray support for %{name}
Group: System Environment/Libraries
Requires: python3-%{name} = %{version}
Requires: python3-pyudev
BuildRequires: python3-pyudev
Requires(post): python3-%{name} = %{version}
Requires(postun): python3-%{name} = %{version}
BuildArch: noarch
@ -245,48 +250,37 @@ without caring which real plugin(s) should be used.
%build
./autogen.sh
# Copy the whole directory to Python3 build
rm -fr %{py3_build_dir}
cp -a . %{py3_build_dir}
%configure --disable-static
%if %{with python2}
# Copy the whole directory to Python2 build
rm -fr %{py2_build_dir}
cp -a . %{py2_build_dir}
%endif
pushd %{py3_build_dir}
%configure --with-python3 --disable-static
popd
V=1 make %{?_smp_mflags}
V=1 make %{?_smp_mflags}
pushd %{py3_build_dir}
%if %{with python2}
pushd %{py2_build_dir}
%configure --disable-static
V=1 make %{?_smp_mflags}
popd
%endif
%install
rm -rf %{buildroot}
%if %{with python2}
pushd %{py2_build_dir}
make install DESTDIR=%{buildroot}
# If python3 enabled, all plugins and CLI tools will be use python3 as
# 'Fedora Packaging Guidelines for Python' suggested.
# https://fedoraproject.org/wiki/Packaging:Python#Executables_in_.2Fusr.2Fbin
# Quote:
# If the executables provide the same functionality independent of whether
# they are run on top of Python 2 or Python 3, then only the Python 3 version
# of the executable should be packaged.
rm -rf %{buildroot}/%{python_sitelib}/lsm/plugin
rm -rf %{buildroot}/%{_bindir}/lsmcli
pushd %{py3_build_dir}
make install DESTDIR=%{buildroot}
popd
%endif
make install DESTDIR=%{buildroot}
find %{buildroot} -name '*.la' -exec rm -f {} ';'
install -d -m755 %{buildroot}/%{_unitdir}
install -m644 packaging/daemon/%{name}.service \
%{buildroot}/%{_unitdir}/%{name}.service
#tempfiles.d configuration for /run
mkdir -p %{buildroot}/%{_tmpfilesdir}
install -m 0644 packaging/daemon/lsm-tmpfiles.conf \
%{buildroot}/%{_tmpfilesdir}/%{name}.conf
#Files for udev handling
mkdir -p %{buildroot}/%{_udevrulesdir}
install -m 644 tools/udev/90-scsi-ua.rules \
@ -302,7 +296,8 @@ then
exit 1
fi
pushd %{py3_build_dir}
%if %{with python2}
pushd %{py2_build_dir}
if ! make check
then
cat test-suite.log || true
@ -310,6 +305,7 @@ then
fi
popd
%endif
%endif
%pre
getent group libstoragemgmt >/dev/null || groupadd -r libstoragemgmt
@ -473,6 +469,7 @@ fi
%{_mandir}/man3/lsm_*
%{_mandir}/man3/libstoragemgmt*
%if %{with python2}
%files -n python2-%{name}
%defattr(-,root,root,-)
#Python library files
@ -496,6 +493,7 @@ fi
# Compiled C files for python library
%files -n python2-%{name}-clibs
%{python_sitelib}/lsm/_clib.*
%endif
%files -n python3-%{name}
%dir %{python3_sitelib}/lsm
@ -525,6 +523,9 @@ fi
%{python3_sitelib}/lsm/lsmcli/data_display.*
%{python3_sitelib}/lsm/lsmcli/cmdline.*
%{_bindir}/sim_lsmplugin
%dir %{_bindir}/lsm.d
%{_bindir}/lsm.d/find_unused_lun.py
%{_bindir}/lsm.d/local_sanity_check.py
%{_sysconfdir}/lsm/pluginconf.d/sim.conf
%{_mandir}/man1/sim_lsmplugin.1*
@ -648,6 +649,9 @@ fi
%{_mandir}/man1/local_lsmplugin.1*
%changelog
* Fri May 18 2018 Gris Ge <fge@redhat.com> - 1.6.2-1
- Upgrade to 1.6.2.
* Fri Mar 23 2018 Gris Ge <fge@redhat.com> - 1.6.1-7
- Fix incorect memset size.

View File

@ -1 +1 @@
SHA512 (libstoragemgmt-1.6.1.tar.gz) = 9296e01b9f46feab004e3243af800d5123589ec4262d5be1cb220375977fe60a0e943d6ad8f2575796c7718d99bbf2d2a320ac4bfad666b27fecdc224ef00939
SHA512 (libstoragemgmt-1.6.2.tar.gz) = 5ac20bf7c6e9ceb14634b8bebce0c3bb0655d6e7536859103938a269369a451e3e3234f0f4c91460ae273b3171d549842d9219edc8ec8dd83ef91d124cc95b73