From 1f984aba9af3cc57134b26b391a6063737f7862e Mon Sep 17 00:00:00 2001 From: CentOS Buildsys Date: Mar 03 2014 19:37:48 +0000 Subject: import libstoragemgmt-0.0.24-4.el7.src.rpm --- diff --git a/.libstoragemgmt.metadata b/.libstoragemgmt.metadata index e2ca59c..3271478 100644 --- a/.libstoragemgmt.metadata +++ b/.libstoragemgmt.metadata @@ -1 +1 @@ -7b7aba468d745f489951f2245217a2db2e5c1c75 SOURCES/libstoragemgmt-0.0.22.tar.gz +d3ce509a05f68357891fc018c2330a692c0b0880 SOURCES/libstoragemgmt-0.0.24.tar.gz diff --git a/SOURCES/libstoragemgmt-0.0.22-auto-warnings.patch b/SOURCES/libstoragemgmt-0.0.22-auto-warnings.patch deleted file mode 100644 index d11d3c6..0000000 --- a/SOURCES/libstoragemgmt-0.0.22-auto-warnings.patch +++ /dev/null @@ -1,54 +0,0 @@ -diff --git configure.ac configure.ac -index a1696a9..69aba69 100644 ---- configure.ac -+++ configure.ac -@@ -50,7 +50,8 @@ AM_PROG_LD - AC_CHECK_HEADERS([stdint.h stdlib.h string.h sys/socket.h syslog.h unistd.h]) - - AC_LANG_PUSH([C++]) --AC_COMPILE_IFELSE([[int i;]], [], [AC_MSG_ERROR([C++ compiler missing or inoperational])]) -+AC_COMPILE_IFELSE([AC_LANG_SOURCE([int i;])], -+ [], [AC_MSG_ERROR([C++ compiler missing or inoperational])]) - AC_LANG_POP([C++]) - - #Make sure all types are covered -diff --git plugin/Makefile.am plugin/Makefile.am -index 26e07b3..113c156 100644 ---- plugin/Makefile.am -+++ plugin/Makefile.am -@@ -1,4 +1,4 @@ --INCLUDES = -I$(top_srcdir)/include -I@srcdir@/include \ -+AM_CPPFLAGS= -I$(top_srcdir)/include -I@srcdir@/include \ - $(LIBXML_CFLAGS) $(DEFS) $(LIBGLIB_CFLAGS) - - bin_PROGRAMS = simc_lsmplugin -diff --git src/Makefile.am src/Makefile.am -index 14c8263..837bc13 100644 ---- src/Makefile.am -+++ src/Makefile.am -@@ -1,4 +1,4 @@ --INCLUDES = -I$(top_srcdir)/include -I$(top_builddir)/include -I@srcdir@/include $(LIBXML_CFLAGS) $(LIBGLIB_CFLAGS) -+AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_builddir)/include -I@srcdir@/include $(LIBXML_CFLAGS) $(LIBGLIB_CFLAGS) - - lib_LTLIBRARIES = libstoragemgmt.la - -diff --git test/Makefile.am test/Makefile.am -index e5b8817..e164964 100644 ---- test/Makefile.am -+++ test/Makefile.am -@@ -1,4 +1,4 @@ --INCLUDES = -I$(top_srcdir)/include -I@srcdir@/include -+AM_CPPFLAGS = -I$(top_srcdir)/include -I@srcdir@/include - - EXTRA_DIST=cmdtest.py runtests.sh - -diff --git tools/lsmcli/Makefile.am tools/lsmcli/Makefile.am -index fdff639..d383737 100644 ---- tools/lsmcli/Makefile.am -+++ tools/lsmcli/Makefile.am -@@ -1,4 +1,4 @@ --INCLUDES = -I$(top_srcdir)/include -I@srcdir@/include -+AM_CPPFLAGS = -I$(top_srcdir)/include -I@srcdir@/include - - noinst_PROGRAMS = lsmcli - #bin_PROGRAMS = lsmcli diff --git a/SOURCES/libstoragemgmt-0.0.22-autogen.patch b/SOURCES/libstoragemgmt-0.0.22-autogen.patch deleted file mode 100644 index 1846d74..0000000 --- a/SOURCES/libstoragemgmt-0.0.22-autogen.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git Makefile.am Makefile.am -index be8b4b7..265d6f6 100644 ---- Makefile.am -+++ Makefile.am -@@ -14,7 +14,8 @@ EXTRA_DIST = \ - libstoragemgmt.pc.in \ - libstoragemgmt.pc \ - libstoragemgmt.spec.in \ -- libstoragemgmt.spec -+ libstoragemgmt.spec \ -+ autogen.sh - - pkgconfigdir = $(libdir)/pkgconfig - pkgconfig_DATA = libstoragemgmt.pc -diff --git autogen.sh autogen.sh -new file mode 100755 -index 0000000..318362c ---- /dev/null -+++ autogen.sh -@@ -0,0 +1,9 @@ -+#!/bin/bash -+ -+#Clean stuff up to ensure a clean autobuild -+rm -rf autom4te.cache/* -+rm -rf build-aux/* -+rm -f m4/l* -+rm -f aclocal.m4 -+ -+autoreconf -f -i diff --git a/SOURCES/libstoragemgmt-0.0.22-ontap_ssl.patch b/SOURCES/libstoragemgmt-0.0.22-ontap_ssl.patch deleted file mode 100644 index 9f4c11c..0000000 --- a/SOURCES/libstoragemgmt-0.0.22-ontap_ssl.patch +++ /dev/null @@ -1,51 +0,0 @@ -diff --git lsm/lsm/na.py lsm/lsm/na.py -index 06c74bc..44ceccc 100644 ---- lsm/lsm/na.py -+++ lsm/lsm/na.py -@@ -22,6 +22,7 @@ import time - from binascii import hexlify - - from M2Crypto import RC4 -+from _ssl import SSLError - - from external.xmltodict import ConvertXmlToDict - -@@ -112,6 +113,16 @@ def netapp_filer(host, username, password, timeout, command, parameters=None, - raise e - except socket.timeout: - raise FilerError(Filer.ETIMEOUT, "Connection timeout") -+ except SSLError as sse: -+ # The ssl library doesn't give a good way to find specific reason. -+ # We are doing a string contains which is not ideal, but other than -+ # throwing a generic error in this case there isn't much we can do -+ # to be more specific. -+ if "timed out" in str(sse).lower(): -+ raise FilerError(Filer.ETIMEOUT, "Connection timeout (SSL)") -+ else: -+ raise FilerError(Filer.EUNKNOWN, -+ "SSL error occurred (%s)", str(sse)) - finally: - if handler: - handler.close() -@@ -148,6 +159,7 @@ class Filer(object): - Class to handle NetApp API calls. - Note: These are using lsm terminology. - """ -+ EUNKNOWN = 10 # Non-specific error - ENOSPC = 28 # Out of space - ETIMEOUT = 60 # Time-out - EINVALID_ISCSI_NAME = 9006 # Invalid ISCSI IQN -diff --git lsm/lsm/ontap.py lsm/lsm/ontap.py -index b742a36..060fc4b 100644 ---- lsm/lsm/ontap.py -+++ lsm/lsm/ontap.py -@@ -45,7 +45,8 @@ e_map = { - na.Filer.ECLONE_LICENSE_EXPIRED: ErrorNumber.NOT_LICENSED, - na.Filer.ECLONE_NOT_LICENSED: ErrorNumber.NOT_LICENSED, - na.Filer.EINVALID_ISCSI_NAME: ErrorNumber.INVALID_IQN, -- na.Filer.ETIMEOUT: ErrorNumber.PLUGIN_TIMEOUT -+ na.Filer.ETIMEOUT: ErrorNumber.PLUGIN_TIMEOUT, -+ na.Filer.EUNKNOWN: ErrorNumber.PLUGIN_ERROR - } - - diff --git a/SOURCES/libstoragemgmt-0.0.22-python_env.patch b/SOURCES/libstoragemgmt-0.0.22-python_env.patch deleted file mode 100644 index 829589c..0000000 --- a/SOURCES/libstoragemgmt-0.0.22-python_env.patch +++ /dev/null @@ -1,80 +0,0 @@ -diff --git lsm/nstor_lsmplugin lsm/nstor_lsmplugin -index f183c86..9886181 100755 ---- lsm/nstor_lsmplugin -+++ lsm/nstor_lsmplugin -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python2.7 - - # - # Copyright (C) 2012 Nexenta Systems, Inc. -diff --git lsm/ontap_lsmplugin lsm/ontap_lsmplugin -index 2695fa7..4f14516 100755 ---- lsm/ontap_lsmplugin -+++ lsm/ontap_lsmplugin -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python2.7 - - # Copyright (C) 2011-2013 Red Hat, Inc. - # This library is free software; you can redistribute it and/or -diff --git lsm/sim_lsmplugin lsm/sim_lsmplugin -index e05dce5..fc19d13 100755 ---- lsm/sim_lsmplugin -+++ lsm/sim_lsmplugin -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python2.7 - - # Copyright (C) 2011-2013 Red Hat, Inc. - # This library is free software; you can redistribute it and/or -diff --git lsm/smispy_lsmplugin lsm/smispy_lsmplugin -index 015cb34..ae93bba 100755 ---- lsm/smispy_lsmplugin -+++ lsm/smispy_lsmplugin -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python2.7 - - # Copyright (C) 2011-2013 Red Hat, Inc. - # This library is free software; you can redistribute it and/or -diff --git lsm/targetd_lsmplugin lsm/targetd_lsmplugin -index f8e65bd..b3fa5bd 100755 ---- lsm/targetd_lsmplugin -+++ lsm/targetd_lsmplugin -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python2.7 - - # Copyright (C) 2011-2013 Red Hat, Inc. - # This library is free software; you can redistribute it and/or -diff --git lsm/v7k_lsmplugin lsm/v7k_lsmplugin -index b772c59..7c41850 100755 ---- lsm/v7k_lsmplugin -+++ lsm/v7k_lsmplugin -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python2.7 - - # Copyright (C) 2013 IBM Corporation - # This library is free software; you can redistribute it and/or -diff --git test/cmdtest.py test/cmdtest.py -index 0a545aa..c915bc8 100755 ---- test/cmdtest.py -+++ test/cmdtest.py -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python2.7 - - # Copyright (C) 2011-2013 Red Hat, Inc. - # -diff --git tools/lsmclipy/lsmcli tools/lsmclipy/lsmcli -index c115e61..2d2541e 100755 ---- tools/lsmclipy/lsmcli -+++ tools/lsmclipy/lsmcli -@@ -1,4 +1,4 @@ --#!/usr/bin/env python -+#!/usr/bin/env python2.7 - - # Copyright (C) 2012 Red Hat, Inc. - # This library is free software; you can redistribute it and/or diff --git a/SOURCES/libstoragemgmt-0.0.22-relro-pie.patch b/SOURCES/libstoragemgmt-0.0.22-relro-pie.patch deleted file mode 100644 index 9f81733..0000000 --- a/SOURCES/libstoragemgmt-0.0.22-relro-pie.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff --git src/Makefile.am src/Makefile.am -index 582c51b..14c8263 100644 ---- src/Makefile.am -+++ src/Makefile.am -@@ -12,5 +12,9 @@ libstoragemgmt_la_SOURCES=lsm_mgmt.cpp lsm_datatypes.hpp lsm_datatypes.cpp \ - - DEPS = $(top_builddir)/src/libstoragemgmt.la - -+ -+lsmd_LDFLAGS=-Wl,-z,relro,-z,now -pie -+lsmd_CFLAGS=-fPIE -DPIE -+ - lsmd_SOURCES = lsm_daemon.c - diff --git a/SOURCES/libstoragemgmt-0.0.22-setgroups.patch b/SOURCES/libstoragemgmt-0.0.22-setgroups.patch deleted file mode 100644 index fb187ef..0000000 --- a/SOURCES/libstoragemgmt-0.0.22-setgroups.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git src/lsm_daemon.c src/lsm_daemon.c -index 6bc7a70..670fb17 100644 ---- src/lsm_daemon.c -+++ src/lsm_daemon.c -@@ -41,6 +41,7 @@ - #include - #include - #include -+#include - - #define BASE_DIR "/var/run/lsm" - #define SOCKET_DIR BASE_DIR"/ipc" -@@ -155,6 +156,11 @@ void drop_privileges(void) - loud("Unexpected error on setgid(errno %d)\n", err); - } - -+ if( -1 == setgroups(1, &pw->pw_gid) ) { -+ err = errno; -+ loud("Unexpected error on setgroups(errno %d)\n", err); -+ } -+ - if( -1 == setuid(pw->pw_uid) ) { - err = errno; - loud("Unexpected error on setuid(errno %d)\n", err); diff --git a/SOURCES/libstoragemgmt-0.0.24-comment_out_ua_udev_rules.patch b/SOURCES/libstoragemgmt-0.0.24-comment_out_ua_udev_rules.patch new file mode 100644 index 0000000..0ed63a2 --- /dev/null +++ b/SOURCES/libstoragemgmt-0.0.24-comment_out_ua_udev_rules.patch @@ -0,0 +1,14 @@ +diff --git tools/udev/90-scsi-ua.rules tools/udev/90-scsi-ua.rules +index 694e29f..193e22c 100644 +--- tools/udev/90-scsi-ua.rules ++++ tools/udev/90-scsi-ua.rules +@@ -1,5 +1,5 @@ +-ACTION=="change", SUBSYSTEM=="scsi", ENV{SDEV_UA}=="INQUIRY_DATA_HAS_CHANGED", TEST=="rescan", ATTR{rescan}="x" +-ACTION=="change", SUBSYSTEM=="scsi", ENV{SDEV_UA}=="CAPACITY_DATA_HAS_CHANGED", TEST=="rescan", ATTR{rescan}="x" +-ACTION=="change", SUBSYSTEM=="scsi", ENV{SDEV_UA}=="THIN_PROVISIONING_SOFT_THRESHOLD_REACHED", TEST=="rescan", ATTR{rescan}="x" +-ACTION=="change", SUBSYSTEM=="scsi", ENV{SDEV_UA}=="MODE_PARAMETERS_CHANGED", TEST=="rescan", ATTR{rescan}="x" ++#ACTION=="change", SUBSYSTEM=="scsi", ENV{SDEV_UA}=="INQUIRY_DATA_HAS_CHANGED", TEST=="rescan", ATTR{rescan}="x" ++#ACTION=="change", SUBSYSTEM=="scsi", ENV{SDEV_UA}=="CAPACITY_DATA_HAS_CHANGED", TEST=="rescan", ATTR{rescan}="x" ++#ACTION=="change", SUBSYSTEM=="scsi", ENV{SDEV_UA}=="THIN_PROVISIONING_SOFT_THRESHOLD_REACHED", TEST=="rescan", ATTR{rescan}="x" ++#ACTION=="change", SUBSYSTEM=="scsi", ENV{SDEV_UA}=="MODE_PARAMETERS_CHANGED", TEST=="rescan", ATTR{rescan}="x" + ACTION=="change", SUBSYSTEM=="scsi", ENV{SDEV_UA}=="REPORTED_LUNS_DATA_HAS_CHANGED", RUN+="scan-scsi-target $env{DEVPATH}" diff --git a/SOURCES/libstoragemgmt-0.0.24-coverity-fix.patch b/SOURCES/libstoragemgmt-0.0.24-coverity-fix.patch new file mode 100644 index 0000000..287a5aa --- /dev/null +++ b/SOURCES/libstoragemgmt-0.0.24-coverity-fix.patch @@ -0,0 +1,1571 @@ +diff --git include/libstoragemgmt/libstoragemgmt_plug_interface.h include/libstoragemgmt/libstoragemgmt_plug_interface.h +index 24c84d0..c0e29a3 100644 +--- include/libstoragemgmt/libstoragemgmt_plug_interface.h ++++ include/libstoragemgmt/libstoragemgmt_plug_interface.h +@@ -1016,6 +1016,7 @@ lsmDisk LSM_DLL_EXPORT **lsmDiskRecordAllocArray( uint32_t size ); + * @param block_count Number of blocks for disk + * @param disk_status Status + * @param op OptionalData can be NULL if not available ++ * NOTE: op gets copied internally + * @param system_id System id this disk resides in + * @return Pointer to allocated disk record or NULL on memory error. + */ +diff --git plugin/simc_lsmplugin.c plugin/simc_lsmplugin.c +index f9c4530..e12c630 100644 +--- plugin/simc_lsmplugin.c ++++ plugin/simc_lsmplugin.c +@@ -567,7 +567,8 @@ static int _list_initiators(lsmPluginPtr c, lsmInitiator **initArray[], + if( init_key && init_val ) { + g_hash_table_insert(tmp_inits, init_key, init_val); + } else { +- g_hash_table_destroy(tmp_inits); ++ free(init_key); ++ lsmInitiatorRecordFree(init_val); + rc = LSM_ERR_NO_MEMORY; + } + } +@@ -652,12 +653,12 @@ static int list_disks(lsmPluginPtr c, lsmDisk **disks[], uint32_t *count, + { + int i; + int rc = LSM_ERR_OK; +- struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c); + char name[17]; + char sn[32]; ++ struct plugin_data *pd = (struct plugin_data*)lsmGetPrivateData(c); + lsmOptionalData *od = lsmOptionalDataRecordAlloc(); + +- if(pd) { ++ if(pd && od) { + // For now we are going to make up some disks to return. Later we will + // try to make a simulated array that makes sense. + *count = 10; +@@ -672,11 +673,12 @@ static int list_disks(lsmPluginPtr c, lsmDisk **disks[], uint32_t *count, + (*disks)[i] = lsmDiskRecordAlloc(md5(name), name, LSM_DISK_TYPE_SOP, 512, + 0x8000000000000, LSM_DISK_STATUS_OK, od, sys_id); + } +- lsmOptionalDataRecordFree(od); ++ + } else { + rc = LSM_ERR_INVALID_PLUGIN; + } + ++ lsmOptionalDataRecordFree(od); + return rc; + } + +@@ -1593,6 +1595,7 @@ static int vol_accessible_by_init(lsmPluginPtr c, + lsmVolumeRecordFreeArray(*volumes, alloc_count); + *count = 0; + *volumes = NULL; ++ break; + } else { + alloc_count += 1; + } +@@ -2220,8 +2223,25 @@ int load( lsmPluginPtr c, xmlURIPtr uri, const char *password, + + if( !data->system[0] || !data->pool[0] || !data->pool[1] || + !data->pool[2] || !data->pool[3] || !data->access_groups || +- !data->group_grant || !data->fs) { +- rc = LSM_ERR_NO_MEMORY; ++ !data->group_grant || !data->fs || !data->jobs ) { ++ rc = LSM_ERR_NO_MEMORY; /* We need to free data and everything else */ ++ ++ if( data->jobs ) ++ g_hash_table_destroy(data->jobs); ++ if( data->fs ) ++ g_hash_table_destroy(data->fs); ++ if( data->group_grant ) ++ g_hash_table_destroy(data->group_grant); ++ if( data->access_groups ) ++ g_hash_table_destroy(data->access_groups); ++ lsmPoolRecordFree(data->pool[3]); ++ lsmPoolRecordFree(data->pool[2]); ++ lsmPoolRecordFree(data->pool[1]); ++ lsmPoolRecordFree(data->pool[0]); ++ lsmSystemRecordFree(data->system[0]); ++ memset(data, 0xAA, sizeof(struct plugin_data)); ++ free(data); ++ data = NULL; + } else { + rc = lsmRegisterPluginV1( c, data, &mgmOps, + &sanOps, &fsOps, &nfsOps); +diff --git src/lsm_convert.cpp src/lsm_convert.cpp +index 54100a5..242efe9 100644 +--- src/lsm_convert.cpp ++++ src/lsm_convert.cpp +@@ -95,6 +95,9 @@ lsmDisk *valueToDisk(Value &disk) + op, + d["system_id"].asString().c_str() + ); ++ ++ /* Optional data gets copied in lsmDiskRecordAlloc */ ++ lsmOptionalDataRecordFree(op); + } + return rc; + } +diff --git src/lsm_daemon.c src/lsm_daemon.c +index 670fb17..04eed85 100644 +--- src/lsm_daemon.c ++++ src/lsm_daemon.c +@@ -42,6 +42,7 @@ + #include + #include + #include ++#include + + #define BASE_DIR "/var/run/lsm" + #define SOCKET_DIR BASE_DIR"/ipc" +@@ -379,7 +380,7 @@ void empty_plugin_list(struct plugin_list *list) + + free(item->file_path); + item->file_path = NULL; +- item->fd = -1; ++ item->fd = INT_MAX; + free(item); + } + } +diff --git src/lsm_datatypes.cpp src/lsm_datatypes.cpp +index d989c32..7e6415d 100644 +--- src/lsm_datatypes.cpp ++++ src/lsm_datatypes.cpp +@@ -1560,7 +1560,12 @@ static uint8_t *stringToBytes(const char *hex_string, uint32_t *l) + *l = len; + + for( i = 0; i < len; ++i ) { +- sscanf(t, "%02hhx", &rc[i]); ++ if( 1 != sscanf(t, "%02hhx", &rc[i])) { ++ free(rc); ++ rc = NULL; ++ *l = 0; ++ break; ++ } + t += 2; + } + } +diff --git src/lsm_ipc.cpp src/lsm_ipc.cpp +index 355abee..4a2d07d 100644 +--- src/lsm_ipc.cpp ++++ src/lsm_ipc.cpp +@@ -121,9 +121,13 @@ std::string Transport::recvMsg(int &error_code) + { + std::string msg; + error_code = 0; ++ unsigned long int payload_len = 0; + std::string len = readString(s, HDR_LEN, error_code); //Read the length + if (len.size() && error_code == 0) { +- msg = readString(s, strtoul(len.c_str(), NULL, 10), error_code); ++ payload_len = strtoul(len.c_str(), NULL, 10); ++ if( payload_len < 0x80000000 ) { /* Should be big enough */ ++ msg = readString(s, payload_len, error_code); ++ } + //fprintf(stderr, "<<< %s\n", msg.c_str()); + } + return msg; +@@ -147,6 +151,7 @@ int Transport::getSocket(const std::string& path, int &error_code) + if (rc != 0) { + error_code = errno; + rc = -1; //Redundant, connect should set to -1 on error ++ ::close(sfd); + } else { + rc = sfd; //We are good to go. + } +diff --git src/lsm_mgmt.cpp src/lsm_mgmt.cpp +index f5c96a1..694e10a 100644 +--- src/lsm_mgmt.cpp ++++ src/lsm_mgmt.cpp +@@ -37,6 +37,7 @@ + return LSM_ERR_INVALID_CONN; \ + } \ + lsmErrorFree(c->error); \ ++ c->error = NULL; \ + } while (0) + + /** +@@ -118,7 +119,7 @@ static lsmErrorNumber logException(lsmConnect *c, lsmErrorNumber error, + LSM_ERR_LEVEL_ERROR, message, + exception_msg, NULL, + NULL, 0); +- if( err && c ) { ++ if( err ) { + lsmErrorLog(c, err); + } + return error; +@@ -135,7 +136,7 @@ static int rpc(lsmConnect *c, const char *method, const Value ¶meters, + } catch ( const LsmException &le ) { + return logException(c, (lsmErrorNumber)le.error_code, le.what(), + NULL); +- } catch ( EOFException &eof ) { ++ } catch ( const EOFException &eof ) { + return logException(c, LSM_ERR_TRANSPORT_COMMUNICATION, "Plug-in died", + "Check syslog"); + } catch (...) { +@@ -145,30 +146,40 @@ static int rpc(lsmConnect *c, const char *method, const Value ¶meters, + return LSM_ERR_OK; + } + +-static int jobCheck( int rc, Value &response, char **job ) ++static int jobCheck( lsmConnect *c, int rc, Value &response, char **job ) + { +- if( LSM_ERR_OK == rc ) { +- //We get a value back, either null or job id. +- if( Value::string_t == response.valueType() ) { +- *job = strdup(response.asString().c_str()); +- +- if( *job ) { +- rc = LSM_ERR_JOB_STARTED; ++ try { ++ if( LSM_ERR_OK == rc ) { ++ //We get a value back, either null or job id. ++ if( Value::string_t == response.valueType() ) { ++ *job = strdup(response.asString().c_str()); ++ ++ if( *job ) { ++ rc = LSM_ERR_JOB_STARTED; ++ } else { ++ rc = LSM_ERR_NO_MEMORY; ++ } + } else { +- rc = LSM_ERR_NO_MEMORY; ++ *job = NULL; + } +- } else { +- *job = NULL; + } ++ } catch (const ValueException &ve) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Wrong type", ++ ve.what()); + } + return rc; + } + +-static int getAccessGroups( int rc, Value &response, lsmAccessGroup **groups[], +- uint32_t *count) ++static int getAccessGroups( lsmConnect *c, int rc, Value &response, ++ lsmAccessGroup **groups[], uint32_t *count) + { +- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { +- *groups = valueToAccessGroupList(response, count); ++ try { ++ if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { ++ *groups = valueToAccessGroupList(response, count); ++ } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); + } + return rc; + } +@@ -197,6 +208,7 @@ int lsmConnectClose(lsmConnect *c, lsmFlag_t flags) + int LSM_DLL_EXPORT lsmPluginGetInfo(lsmConnect *c, char **desc, + char **version, lsmFlag_t flags) + { ++ int rc = LSM_ERR_OK; + CONN_SETUP(c); + + if( LSM_FLAG_UNUSED_CHECK(flags) ) { +@@ -207,23 +219,32 @@ int LSM_DLL_EXPORT lsmPluginGetInfo(lsmConnect *c, char **desc, + return LSM_ERR_INVALID_ARGUMENT; + } + +- std::map p; +- p["flags"] = Value(flags); +- Value parameters(p); +- Value response; ++ try { ++ std::map p; ++ p["flags"] = Value(flags); ++ Value parameters(p); ++ Value response; + +- int rc = rpc(c, "plugin_info", parameters, response); ++ rc = rpc(c, "plugin_info", parameters, response); + +- if( rc == LSM_ERR_OK ) { +- std::vector j = response.asArray(); +- *desc = strdup(j[0].asC_str()); +- *version = strdup(j[1].asC_str()); ++ if( rc == LSM_ERR_OK ) { ++ std::vector j = response.asArray(); ++ *desc = strdup(j[0].asC_str()); ++ *version = strdup(j[1].asC_str()); + +- if( !*desc || !*version ) { +- rc = LSM_ERR_NO_MEMORY; +- free(*desc); +- free(*version); ++ if( !*desc || !*version ) { ++ rc = LSM_ERR_NO_MEMORY; ++ free(*desc); ++ free(*version); ++ } + } ++ } catch (const ValueException &ve) { ++ free(*desc); ++ *desc = NULL; ++ free(*version); ++ *version = NULL; ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); + } + + return rc; +@@ -242,16 +263,17 @@ int LSM_DLL_EXPORT lsmGetAvailablePlugins(const char *sep, + char *version = NULL; + char *s = NULL; + const char *uds_dir = uds_path(); +- lsmStringList *plugin_list = lsmStringListAlloc(0); +- +- if( !plugin_list ) { +- return LSM_ERR_NO_MEMORY; +- } ++ lsmStringList *plugin_list = NULL; + + if( CHECK_STR(sep) || CHECK_RP(plugins) || LSM_FLAG_UNUSED_CHECK(flags)) { + return LSM_ERR_INVALID_ARGUMENT; + } + ++ plugin_list = lsmStringListAlloc(0); ++ if( !plugin_list ) { ++ return LSM_ERR_NO_MEMORY; ++ } ++ + dirp = opendir(uds_dir); + if( dirp ) { + for(;;) { +@@ -277,28 +299,32 @@ int LSM_DLL_EXPORT lsmGetAvailablePlugins(const char *sep, + + if( -1 == format ) { + rc = LSM_ERR_NO_MEMORY; +- goto bail; ++ break; + } + + rc = lsmStringListAppend(plugin_list, s); + free(s); + s = NULL; + if( LSM_ERR_OK != rc ) { +- goto bail; ++ break; + } + + } + } else { +- goto bail; ++ break; + } + + freeConnection(c); + c = NULL; + } + } ++ } /* for(;;) */ ++ ++ if( e ) { ++ lsmErrorFree(e); ++ e = NULL; + } + +- bail: + if( c ) { + freeConnection(c); + c = NULL; +@@ -309,7 +335,8 @@ int LSM_DLL_EXPORT lsmGetAvailablePlugins(const char *sep, + //log the error + rc = LSM_ERR_INTERNAL_ERROR; + } +- } else { ++ ++ } else { /* If dirp == NULL */ + //Log the error + rc = LSM_ERR_INTERNAL_ERROR; + } +@@ -318,6 +345,7 @@ int LSM_DLL_EXPORT lsmGetAvailablePlugins(const char *sep, + *plugins = plugin_list; + } else { + lsmStringListFree(plugin_list); ++ plugin_list = NULL; + } + + return rc; +@@ -343,20 +371,27 @@ int lsmConnectSetTimeout(lsmConnect *c, uint32_t timeout, lsmFlag_t flags) + + int lsmConnectGetTimeout(lsmConnect *c, uint32_t *timeout, lsmFlag_t flags) + { ++ int rc = 0; + CONN_SETUP(c); + + if( LSM_FLAG_UNUSED_CHECK(flags) ) { + return LSM_ERR_INVALID_ARGUMENT; + } + +- std::map p; +- p["flags"] = Value(flags); +- Value parameters(p); +- Value response; +- +- int rc = rpc(c, "get_time_out", parameters, response); +- if( rc == LSM_ERR_OK ) { +- *timeout = response.asUint32_t(); ++ try { ++ std::map p; ++ p["flags"] = Value(flags); ++ Value parameters(p); ++ Value response; ++ ++ rc = rpc(c, "get_time_out", parameters, response); ++ if( rc == LSM_ERR_OK ) { ++ *timeout = response.asUint32_t(); ++ } ++ } ++ catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); + } + return rc; + } +@@ -365,26 +400,32 @@ static int jobStatus( lsmConnect *c, const char *job, + lsmJobStatus *status, uint8_t *percentComplete, + Value &returned_value, lsmFlag_t flags) + { ++ int rc = 0; + CONN_SETUP(c); + + if( !job || !status || !percentComplete ) { + return LSM_ERR_INVALID_ARGUMENT; + } + +- std::map p; +- p["job_id"] = Value(job); +- p["flags"] = Value(flags); +- Value parameters(p); +- Value response; +- +- int rc = rpc(c, "job_status", parameters, response); +- if( LSM_ERR_OK == rc ) { +- //We get back an array [status, percent, volume] +- std::vector j = response.asArray(); +- *status = (lsmJobStatus)j[0].asInt32_t(); +- *percentComplete = (uint8_t)j[1].asUint32_t(); +- +- returned_value = j[2]; ++ try { ++ std::map p; ++ p["job_id"] = Value(job); ++ p["flags"] = Value(flags); ++ Value parameters(p); ++ Value response; ++ ++ rc = rpc(c, "job_status", parameters, response); ++ if( LSM_ERR_OK == rc ) { ++ //We get back an array [status, percent, volume] ++ std::vector j = response.asArray(); ++ *status = (lsmJobStatus)j[0].asInt32_t(); ++ *percentComplete = (uint8_t)j[1].asUint32_t(); ++ ++ returned_value = j[2]; ++ } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); + } + return rc; + } +@@ -408,6 +449,7 @@ int lsmJobStatusVolumeGet( lsmConnect *c, const char *job, + lsmVolume **vol, lsmFlag_t flags) + { + Value rv; ++ int rc = 0; + + CONN_SETUP(c); + +@@ -415,14 +457,20 @@ int lsmJobStatusVolumeGet( lsmConnect *c, const char *job, + return LSM_ERR_INVALID_ARGUMENT; + } + +- int rc = jobStatus(c, job, status, percentComplete, rv, flags); ++ try { + +- if( LSM_ERR_OK == rc ) { +- if( Value::object_t == rv.valueType() ) { +- *vol = valueToVolume(rv); +- } else { +- *vol = NULL; ++ rc = jobStatus(c, job, status, percentComplete, rv, flags); ++ ++ if( LSM_ERR_OK == rc ) { ++ if( Value::object_t == rv.valueType() ) { ++ *vol = valueToVolume(rv); ++ } else { ++ *vol = NULL; ++ } + } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); + } + return rc; + } +@@ -431,20 +479,27 @@ int lsmJobStatusFsGet(lsmConnect *c, const char *job, + lsmJobStatus *status, uint8_t *percentComplete, + lsmFs **fs, lsmFlag_t flags) + { ++ int rc = 0; + Value rv; + + if( CHECK_RP(fs) || LSM_FLAG_UNUSED_CHECK(flags) ) { + return LSM_ERR_INVALID_ARGUMENT; + } + +- int rc = jobStatus(c, job, status, percentComplete, rv, flags); ++ try { + +- if( LSM_ERR_OK == rc ) { +- if( Value::object_t == rv.valueType() ) { +- *fs = valueToFs(rv); +- } else { +- *fs = NULL; ++ rc = jobStatus(c, job, status, percentComplete, rv, flags); ++ ++ if( LSM_ERR_OK == rc ) { ++ if( Value::object_t == rv.valueType() ) { ++ *fs = valueToFs(rv); ++ } else { ++ *fs = NULL; ++ } + } ++ } catch( const ValueException &ve) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); + } + return rc; + } +@@ -453,20 +508,27 @@ int lsmJobStatusSsGet(lsmConnect *c, const char *job, + lsmJobStatus *status, uint8_t *percentComplete, + lsmSs **ss, lsmFlag_t flags) + { ++ int rc = 0; + Value rv; + + if( CHECK_RP(ss) || LSM_FLAG_UNUSED_CHECK(flags) ) { + return LSM_ERR_INVALID_ARGUMENT; + } + +- int rc = jobStatus(c, job, status, percentComplete, rv, flags); ++ try { + +- if( LSM_ERR_OK == rc ) { +- if( Value::object_t == rv.valueType() ) { +- *ss = valueToSs(rv); +- } else { +- *ss = NULL; ++ rc = jobStatus(c, job, status, percentComplete, rv, flags); ++ ++ if( LSM_ERR_OK == rc ) { ++ if( Value::object_t == rv.valueType() ) { ++ *ss = valueToSs(rv); ++ } else { ++ *ss = NULL; ++ } + } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); + } + return rc; + } +@@ -498,6 +560,7 @@ int lsmJobFree(lsmConnect *c, char **job, lsmFlag_t flags) + int lsmCapabilities(lsmConnect *c, lsmSystem *system, + lsmStorageCapabilities **cap, lsmFlag_t flags) + { ++ int rc = 0; + CONN_SETUP(c); + + if( !LSM_IS_SYSTEM(system) ) { +@@ -516,10 +579,15 @@ int lsmCapabilities(lsmConnect *c, lsmSystem *system, + Value parameters(p); + Value response; + +- int rc = rpc(c, "capabilities", parameters, response); ++ try { ++ rc = rpc(c, "capabilities", parameters, response); + +- if( LSM_ERR_OK == rc && Value::object_t == response.valueType() ) { +- *cap = valueToCapabilities(response); ++ if( LSM_ERR_OK == rc && Value::object_t == response.valueType() ) { ++ *cap = valueToCapabilities(response); ++ } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); + } + + return rc; +@@ -528,56 +596,76 @@ int lsmCapabilities(lsmConnect *c, lsmSystem *system, + int lsmPoolList(lsmConnect *c, lsmPool **poolArray[], + uint32_t *count, lsmFlag_t flags) + { ++ int rc = 0; + CONN_SETUP(c); + + if( !poolArray || !count || CHECK_RP(poolArray) || LSM_FLAG_UNUSED_CHECK(flags) ) { + return LSM_ERR_INVALID_ARGUMENT; + } + +- std::map p; +- p["flags"] = Value(flags); +- Value parameters(p); +- Value response; ++ try { ++ std::map p; ++ p["flags"] = Value(flags); ++ Value parameters(p); ++ Value response; + +- int rc = rpc(c, "pools", parameters, response); +- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { +- std::vector pools = response.asArray(); ++ rc = rpc(c, "pools", parameters, response); ++ if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { ++ std::vector pools = response.asArray(); + +- *count = pools.size(); ++ *count = pools.size(); + +- if( pools.size() ) { +- *poolArray = lsmPoolRecordAllocArray(pools.size()); ++ if( pools.size() ) { ++ *poolArray = lsmPoolRecordAllocArray(pools.size()); + +- for( size_t i = 0; i < pools.size(); ++i ) { +- (*poolArray)[i] = valueToPool(pools[i]); ++ for( size_t i = 0; i < pools.size(); ++i ) { ++ (*poolArray)[i] = valueToPool(pools[i]); ++ } + } + } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); ++ if( *poolArray && *count ) { ++ lsmPoolRecordFreeArray(*poolArray, *count); ++ *poolArray = NULL; ++ *count = 0; ++ } + } + return rc; + } + +-static int get_initiator_array(int rc, Value &response, ++static int get_initiator_array(lsmConnect *c, int rc, Value &response, + lsmInitiator **initiators[], uint32_t *count) + { +- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { +- std::vector inits = response.asArray(); +- +- *count = inits.size(); +- +- if( inits.size() ) { ++ try { ++ if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { ++ std::vector inits = response.asArray(); + +- *initiators = lsmInitiatorRecordAllocArray(inits.size()); ++ *count = inits.size(); + +- if( *initiators ) { ++ if( inits.size() ) { + ++ *initiators = lsmInitiatorRecordAllocArray(inits.size()); + +- for( size_t i = 0; i < inits.size(); ++i ) { +- (*initiators)[i] = valueToInitiator(inits[i]); ++ if( *initiators ) { ++ for( size_t i = 0; i < inits.size(); ++i ) { ++ (*initiators)[i] = valueToInitiator(inits[i]); ++ } ++ } else { ++ rc = LSM_ERR_NO_MEMORY; + } +- } else { +- rc = LSM_ERR_NO_MEMORY; + } + } ++ } catch ( const ValueException &ve ) { ++ if( *initiators && *count ) { ++ lsmInitiatorRecordFreeArray(*initiators, *count); ++ *initiators = NULL; ++ *count = 0; ++ } ++ ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); + } + return rc; + } +@@ -598,28 +686,39 @@ int lsmInitiatorList(lsmConnect *c, lsmInitiator **initiators[], + Value response; + + int rc = rpc(c, "initiators", parameters, response); +- return get_initiator_array(rc, response, initiators, count); ++ return get_initiator_array(c, rc, response, initiators, count); + } + +-static int get_volume_array(int rc, Value response, ++static int get_volume_array(lsmConnect *c, int rc, Value response, + lsmVolume **volumes[], uint32_t *count) + { +- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { +- std::vector vol = response.asArray(); ++ try { ++ if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { ++ std::vector vol = response.asArray(); + +- *count = vol.size(); ++ *count = vol.size(); + +- if( vol.size() ) { +- *volumes = lsmVolumeRecordAllocArray(vol.size()); ++ if( vol.size() ) { ++ *volumes = lsmVolumeRecordAllocArray(vol.size()); + +- if( *volumes ){ +- for( size_t i = 0; i < vol.size(); ++i ) { +- (*volumes)[i] = valueToVolume(vol[i]); ++ if( *volumes ){ ++ for( size_t i = 0; i < vol.size(); ++i ) { ++ (*volumes)[i] = valueToVolume(vol[i]); ++ } ++ } else { ++ rc = LSM_ERR_NO_MEMORY; + } +- } else { +- rc = LSM_ERR_NO_MEMORY; + } + } ++ } catch( const ValueException &ve) { ++ if( *volumes && *count ) { ++ lsmVolumeRecordFreeArray(*volumes, *count); ++ *volumes = NULL; ++ *count = 0; ++ } ++ ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); + } + return rc; + } +@@ -641,28 +740,38 @@ int lsmVolumeList(lsmConnect *c, lsmVolume **volumes[], uint32_t *count, + Value response; + + int rc = rpc(c, "volumes", parameters, response); +- return get_volume_array(rc, response, volumes, count); ++ return get_volume_array(c, rc, response, volumes, count); + } + +-static int get_disk_array(int rc, Value &response, lsmDisk **disks[], +- uint32_t *count) ++static int get_disk_array(lsmConnect *c, int rc, Value &response, ++ lsmDisk **disks[], uint32_t *count) + { +- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { +- std::vector d = response.asArray(); ++ try { ++ if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { ++ std::vector d = response.asArray(); + +- *count = d.size(); ++ *count = d.size(); + +- if( d.size() ) { +- *disks = lsmDiskRecordAllocArray(d.size()); ++ if( d.size() ) { ++ *disks = lsmDiskRecordAllocArray(d.size()); + +- if( *disks ){ +- for( size_t i = 0; i < d.size(); ++i ) { +- (*disks)[i] = valueToDisk(d[i]); ++ if( *disks ){ ++ for( size_t i = 0; i < d.size(); ++i ) { ++ (*disks)[i] = valueToDisk(d[i]); ++ } ++ } else { ++ rc = LSM_ERR_NO_MEMORY; + } +- } else { +- rc = LSM_ERR_NO_MEMORY; + } + } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); ++ if( *disks && *count ) { ++ lsmDiskRecordFreeArray(*disks, *count); ++ *disks = NULL; ++ *count = 0; ++ } + } + return rc; + +@@ -684,30 +793,39 @@ int lsmDiskList(lsmConnect *c, lsmDisk **disks[], + Value response; + + int rc = rpc(c, "disks", parameters, response); +- return get_disk_array(rc, response, disks, count); ++ return get_disk_array(c, rc, response, disks, count); + } + + typedef void* (*convert)(Value &v); + +-static void* parse_job_response(Value response, int &rc, char **job, convert conv) ++static void* parse_job_response(lsmConnect *c, Value response, int &rc, ++ char **job, convert conv) + { + void *val = NULL; +- //We get an array back. first value is job, second is data of interest. +- if( Value::array_t == response.valueType() ) { +- std::vector r = response.asArray(); +- if( Value::string_t == r[0].valueType()) { +- *job = strdup((r[0].asString()).c_str()); +- if( *job ) { ++ ++ try { ++ //We get an array back. first value is job, second is data of interest. ++ if( Value::array_t == response.valueType() ) { ++ std::vector r = response.asArray(); ++ if( Value::string_t == r[0].valueType()) { ++ *job = strdup((r[0].asString()).c_str()); ++ if( *job ) { ++ rc = LSM_ERR_JOB_STARTED; ++ } else { ++ rc = LSM_ERR_NO_MEMORY; ++ } ++ + rc = LSM_ERR_JOB_STARTED; +- } else { +- rc = LSM_ERR_NO_MEMORY; + } +- +- rc = LSM_ERR_JOB_STARTED; +- } +- if( Value::object_t == r[1].valueType() ) { +- val = conv(r[1]); ++ if( Value::object_t == r[1].valueType() ) { ++ val = conv(r[1]); ++ } + } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); ++ free(*job); ++ *job = NULL; + } + return val; + } +@@ -739,7 +857,7 @@ int lsmVolumeCreate(lsmConnect *c, lsmPool *pool, const char *volumeName, + + int rc = rpc(c, "volume_create", parameters, response); + if( LSM_ERR_OK == rc ) { +- *newVolume = (lsmVolume *)parse_job_response(response, rc, job, ++ *newVolume = (lsmVolume *)parse_job_response(c, response, rc, job, + (convert)valueToVolume); + } + return rc; +@@ -775,7 +893,7 @@ int lsmVolumeResize(lsmConnect *c, lsmVolume *volume, + + int rc = rpc(c, "volume_resize", parameters, response); + if( LSM_ERR_OK == rc ) { +- *resizedVolume = (lsmVolume *)parse_job_response(response, rc, job, ++ *resizedVolume = (lsmVolume *)parse_job_response(c, response, rc, job, + (convert)valueToVolume); + } + return rc; +@@ -813,7 +931,7 @@ int lsmVolumeReplicate(lsmConnect *c, lsmPool *pool, + + int rc = rpc(c, "volume_replicate", parameters, response); + if( LSM_ERR_OK == rc ) { +- *newReplicant = (lsmVolume *)parse_job_response(response, rc, job, ++ *newReplicant = (lsmVolume *)parse_job_response(c, response, rc, job, + (convert)valueToVolume); + } + return rc; +@@ -823,6 +941,7 @@ int lsmVolumeReplicate(lsmConnect *c, lsmPool *pool, + int lsmVolumeReplicateRangeBlockSize(lsmConnect *c, lsmSystem *system, + uint32_t *bs, lsmFlag_t flags) + { ++ int rc = 0; + CONN_SETUP(c); + + if( !bs || LSM_FLAG_UNUSED_CHECK(flags) ) { +@@ -833,17 +952,22 @@ int lsmVolumeReplicateRangeBlockSize(lsmConnect *c, lsmSystem *system, + return LSM_ERR_INVALID_SYSTEM; + } + +- std::map p; +- p["system"] = systemToValue(system); +- p["flags"] = Value(flags); +- Value parameters(p); +- Value response; +- +- int rc = rpc(c, "volume_replicate_range_block_size", parameters, response); +- if( LSM_ERR_OK == rc ) { +- if( Value::numeric_t == response.valueType() ) { +- *bs = response.asUint32_t(); ++ try { ++ std::map p; ++ p["system"] = systemToValue(system); ++ p["flags"] = Value(flags); ++ Value parameters(p); ++ Value response; ++ ++ rc = rpc(c, "volume_replicate_range_block_size", parameters, response); ++ if( LSM_ERR_OK == rc ) { ++ if( Value::numeric_t == response.valueType() ) { ++ *bs = response.asUint32_t(); ++ } + } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); + } + return rc; + } +@@ -879,12 +1003,13 @@ int lsmVolumeReplicateRange(lsmConnect *c, + Value response; + + int rc = rpc(c, "volume_replicate_range", parameters, response); +- return jobCheck(rc, response, job); ++ return jobCheck(c, rc, response, job); + } + + int lsmVolumeDelete(lsmConnect *c, lsmVolume *volume, char **job, + lsmFlag_t flags) + { ++ int rc = 0; + CONN_SETUP(c); + + if( !LSM_IS_VOL(volume) ) { +@@ -895,25 +1020,30 @@ int lsmVolumeDelete(lsmConnect *c, lsmVolume *volume, char **job, + return LSM_ERR_INVALID_ARGUMENT; + } + +- std::map p; +- p["volume"] = volumeToValue(volume); +- p["flags"] = Value(flags); +- +- Value parameters(p); +- Value response; +- +- int rc = rpc(c, "volume_delete", parameters, response); +- if( LSM_ERR_OK == rc ) { +- //We get a value back, either null or job id. +- if( Value::string_t == response.valueType() ) { +- *job = strdup(response.asString().c_str()); +- +- if( *job ) { +- rc = LSM_ERR_JOB_STARTED; +- } else { +- rc = LSM_ERR_NO_MEMORY; ++ try { ++ std::map p; ++ p["volume"] = volumeToValue(volume); ++ p["flags"] = Value(flags); ++ ++ Value parameters(p); ++ Value response; ++ ++ rc = rpc(c, "volume_delete", parameters, response); ++ if( LSM_ERR_OK == rc ) { ++ //We get a value back, either null or job id. ++ if( Value::string_t == response.valueType() ) { ++ *job = strdup(response.asString().c_str()); ++ ++ if( *job ) { ++ rc = LSM_ERR_JOB_STARTED; ++ } else { ++ rc = LSM_ERR_NO_MEMORY; ++ } + } + } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); + } + return rc; + +@@ -1026,7 +1156,7 @@ int lsmVolumesAccessibleByInitiator(lsmConnect *c, + Value response; + + int rc = rpc(c, "volumes_accessible_by_initiator", parameters, response); +- return get_volume_array(rc, response, volumes, count); ++ return get_volume_array(c, rc, response, volumes, count); + } + + int lsmInitiatorsGrantedToVolume(lsmConnect *c, lsmVolume *volume, +@@ -1050,7 +1180,7 @@ int lsmInitiatorsGrantedToVolume(lsmConnect *c, lsmVolume *volume, + Value response; + + int rc = rpc(c, "initiators_granted_to_volume", parameters, response); +- return get_initiator_array(rc, response, initiators, count); ++ return get_initiator_array(c, rc, response, initiators, count); + } + + +@@ -1101,7 +1231,7 @@ int lsmAccessGroupList( lsmConnect *c, lsmAccessGroup **groups[], + Value response; + + int rc = rpc(c, "access_group_list", parameters, response); +- return getAccessGroups(rc, response, groups, groupCount); ++ return getAccessGroups(c, rc, response, groups, groupCount); + } + + int lsmAccessGroupCreate(lsmConnect *c, const char *name, +@@ -1279,6 +1409,7 @@ int lsmVolumesAccessibleByAccessGroup(lsmConnect *c, + lsmVolume **volumes[], + uint32_t *count, lsmFlag_t flags) + { ++ int rc = 0; + CONN_SETUP(c); + + if( !LSM_IS_ACCESS_GROUP(group)) { +@@ -1289,26 +1420,36 @@ int lsmVolumesAccessibleByAccessGroup(lsmConnect *c, + return LSM_ERR_INVALID_ARGUMENT; + } + +- std::map p; +- p["group"] = accessGroupToValue(group); +- p["flags"] = Value(flags); ++ try { ++ std::map p; ++ p["group"] = accessGroupToValue(group); ++ p["flags"] = Value(flags); + +- Value parameters(p); +- Value response; ++ Value parameters(p); ++ Value response; + +- int rc = rpc(c, "volumes_accessible_by_access_group", parameters, response); +- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { +- std::vector vol = response.asArray(); ++ rc = rpc(c, "volumes_accessible_by_access_group", parameters, response); ++ if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { ++ std::vector vol = response.asArray(); + +- *count = vol.size(); ++ *count = vol.size(); + +- if( vol.size() ) { +- *volumes = lsmVolumeRecordAllocArray(vol.size()); ++ if( vol.size() ) { ++ *volumes = lsmVolumeRecordAllocArray(vol.size()); + +- for( size_t i = 0; i < vol.size(); ++i ) { +- (*volumes)[i] = valueToVolume(vol[i]); ++ for( size_t i = 0; i < vol.size(); ++i ) { ++ (*volumes)[i] = valueToVolume(vol[i]); ++ } + } + } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); ++ if( *volumes && *count ) { ++ lsmVolumeRecordFreeArray(*volumes, *count); ++ *volumes = NULL; ++ *count = 0; ++ } + } + return rc; + } +@@ -1336,12 +1477,13 @@ int lsmAccessGroupsGrantedToVolume(lsmConnect *c, + Value response; + + int rc = rpc(c, "access_groups_granted_to_volume", parameters, response); +- return getAccessGroups(rc, response, groups, groupCount); ++ return getAccessGroups(c, rc, response, groups, groupCount); + } + + int lsmVolumeChildDependency(lsmConnect *c, lsmVolume *volume, + uint8_t *yes, lsmFlag_t flags) + { ++ int rc = 0; + CONN_SETUP(c); + + if( !LSM_IS_VOL(volume)) { +@@ -1352,25 +1494,30 @@ int lsmVolumeChildDependency(lsmConnect *c, lsmVolume *volume, + return LSM_ERR_INVALID_ARGUMENT; + } + +- std::map p; +- p["volume"] = volumeToValue(volume); +- p["flags"] = Value(flags); ++ try { ++ std::map p; ++ p["volume"] = volumeToValue(volume); ++ p["flags"] = Value(flags); + +- Value parameters(p); +- Value response; ++ Value parameters(p); ++ Value response; + +- *yes = 0; ++ *yes = 0; + +- int rc = rpc(c, "volume_child_dependency", parameters, response); +- if( LSM_ERR_OK == rc ) { +- //We should be getting a boolean value back. +- if( Value::boolean_t == response.valueType() ) { +- if( response.asBool() ) { +- *yes = 1; ++ rc = rpc(c, "volume_child_dependency", parameters, response); ++ if( LSM_ERR_OK == rc ) { ++ //We should be getting a boolean value back. ++ if( Value::boolean_t == response.valueType() ) { ++ if( response.asBool() ) { ++ *yes = 1; ++ } ++ } else { ++ rc = LSM_ERR_INTERNAL_ERROR; + } +- } else { +- rc = LSM_ERR_INTERNAL_ERROR; + } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); + } + return rc; + } +@@ -1396,45 +1543,56 @@ int lsmVolumeChildDependencyRm(lsmConnect *c, lsmVolume *volume, + Value response; + + int rc = rpc(c, "volume_child_dependency_rm", parameters, response); +- return jobCheck(rc, response, job); ++ return jobCheck(c, rc, response, job); + } + + int lsmSystemList(lsmConnect *c, lsmSystem **systems[], + uint32_t *systemCount, lsmFlag_t flags) + { ++ int rc = 0; + CONN_SETUP(c); + + if( !systems || ! systemCount || LSM_FLAG_UNUSED_CHECK(flags) ) { + return LSM_ERR_INVALID_ARGUMENT; + } + +- std::map p; +- p["flags"] = Value(flags); +- Value parameters(p); +- Value response; +- +- int rc = rpc(c, "systems", parameters, response); +- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { +- std::vector sys = response.asArray(); +- +- *systemCount = sys.size(); +- +- if( sys.size() ) { +- *systems = lsmSystemRecordAllocArray(sys.size()); +- +- if( *systems ) { +- for( size_t i = 0; i < sys.size(); ++i ) { +- (*systems)[i] = valueToSystem(sys[i]); +- if( !(*systems)[i] ) { +- lsmSystemRecordFreeArray(*systems, i); +- rc = LSM_ERR_NO_MEMORY; +- break; ++ try { ++ std::map p; ++ p["flags"] = Value(flags); ++ Value parameters(p); ++ Value response; ++ ++ rc = rpc(c, "systems", parameters, response); ++ if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { ++ std::vector sys = response.asArray(); ++ ++ *systemCount = sys.size(); ++ ++ if( sys.size() ) { ++ *systems = lsmSystemRecordAllocArray(sys.size()); ++ ++ if( *systems ) { ++ for( size_t i = 0; i < sys.size(); ++i ) { ++ (*systems)[i] = valueToSystem(sys[i]); ++ if( !(*systems)[i] ) { ++ lsmSystemRecordFreeArray(*systems, i); ++ rc = LSM_ERR_NO_MEMORY; ++ break; ++ } + } ++ } else { ++ rc = LSM_ERR_NO_MEMORY; + } +- } else { +- rc = LSM_ERR_NO_MEMORY; + } + } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); ++ if( *systems ) { ++ lsmSystemRecordFreeArray( *systems, *systemCount); ++ *systems = NULL; ++ *systemCount = 0; ++ } + } + return rc; + } +@@ -1442,30 +1600,45 @@ int lsmSystemList(lsmConnect *c, lsmSystem **systems[], + int lsmFsList(lsmConnect *c, lsmFs **fs[], uint32_t *fsCount, + lsmFlag_t flags) + { ++ int rc = 0; + CONN_SETUP(c); + + if( !fs || !fsCount || LSM_FLAG_UNUSED_CHECK(flags) ) { + return LSM_ERR_INVALID_ARGUMENT; + } + +- std::map p; +- p["flags"] = Value(flags); +- Value parameters(p); +- Value response; ++ try { ++ std::map p; ++ p["flags"] = Value(flags); ++ Value parameters(p); ++ Value response; + +- int rc = rpc(c, "fs", parameters, response); +- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { +- std::vector sys = response.asArray(); ++ rc = rpc(c, "fs", parameters, response); ++ if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { ++ std::vector sys = response.asArray(); + +- *fsCount = sys.size(); ++ *fsCount = sys.size(); + +- if( sys.size() ) { +- *fs = lsmFsRecordAllocArray(sys.size()); ++ if( sys.size() ) { ++ *fs = lsmFsRecordAllocArray(sys.size()); + +- for( size_t i = 0; i < sys.size(); ++i ) { +- (*fs)[i] = valueToFs(sys[i]); ++ if( *fs ) { ++ for( size_t i = 0; i < sys.size(); ++i ) { ++ (*fs)[i] = valueToFs(sys[i]); ++ } ++ } else { ++ rc = LSM_ERR_NO_MEMORY; ++ } + } + } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); ++ if( *fs && *fsCount) { ++ lsmFsRecordFreeArray(*fs, *fsCount); ++ *fs = NULL; ++ *fsCount = 0; ++ } + } + return rc; + +@@ -1497,7 +1670,7 @@ int lsmFsCreate(lsmConnect *c, lsmPool *pool, const char *name, + + int rc = rpc(c, "fs_create", parameters, response); + if( LSM_ERR_OK == rc ) { +- *fs = (lsmFs *)parse_job_response(response, rc, job, ++ *fs = (lsmFs *)parse_job_response(c, response, rc, job, + (convert)valueToFs); + } + return rc; +@@ -1523,7 +1696,7 @@ int lsmFsDelete(lsmConnect *c, lsmFs *fs, char **job, lsmFlag_t flags) + Value response; + + int rc = rpc(c, "fs_delete", parameters, response); +- return jobCheck(rc, response, job); ++ return jobCheck(c, rc, response, job); + } + + +@@ -1551,7 +1724,7 @@ int lsmFsResize(lsmConnect *c, lsmFs *fs, + + int rc = rpc(c, "fs_resize", parameters, response); + if( LSM_ERR_OK == rc ) { +- *rfs = (lsmFs *)parse_job_response(response, rc, job, ++ *rfs = (lsmFs *)parse_job_response(c, response, rc, job, + (convert)valueToFs); + } + return rc; +@@ -1583,7 +1756,7 @@ int lsmFsClone(lsmConnect *c, lsmFs *src_fs, + + int rc = rpc(c, "fs_clone", parameters, response); + if( LSM_ERR_OK == rc ) { +- *cloned_fs = (lsmFs *)parse_job_response(response, rc, job, ++ *cloned_fs = (lsmFs *)parse_job_response(c, response, rc, job, + (convert)valueToFs); + } + return rc; +@@ -1615,12 +1788,13 @@ int lsmFsFileClone(lsmConnect *c, lsmFs *fs, const char *src_file_name, + Value response; + + int rc = rpc(c, "file_clone", parameters, response); +- return jobCheck(rc, response, job); ++ return jobCheck(c, rc, response, job); + } + + int lsmFsChildDependency( lsmConnect *c, lsmFs *fs, lsmStringList *files, + uint8_t *yes, lsmFlag_t flags) + { ++ int rc = 0; + CONN_SETUP(c); + + if( !LSM_IS_FS(fs) ) { +@@ -1637,26 +1811,31 @@ int lsmFsChildDependency( lsmConnect *c, lsmFs *fs, lsmStringList *files, + return LSM_ERR_INVALID_ARGUMENT; + } + +- std::map p; +- p["fs"] = fsToValue(fs); +- p["files"] = stringListToValue(files); +- p["flags"] = Value(flags); +- +- Value parameters(p); +- Value response; +- +- *yes = 0; +- +- int rc = rpc(c, "fs_child_dependency", parameters, response); +- if( LSM_ERR_OK == rc ) { +- //We should be getting a boolean value back. +- if( Value::boolean_t == response.valueType() ) { +- if( response.asBool() ) { +- *yes = 1; ++ try { ++ std::map p; ++ p["fs"] = fsToValue(fs); ++ p["files"] = stringListToValue(files); ++ p["flags"] = Value(flags); ++ ++ Value parameters(p); ++ Value response; ++ ++ *yes = 0; ++ ++ rc = rpc(c, "fs_child_dependency", parameters, response); ++ if( LSM_ERR_OK == rc ) { ++ //We should be getting a boolean value back. ++ if( Value::boolean_t == response.valueType() ) { ++ if( response.asBool() ) { ++ *yes = 1; ++ } ++ } else { ++ rc = LSM_ERR_INTERNAL_ERROR; + } +- } else { +- rc = LSM_ERR_INTERNAL_ERROR; + } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); + } + return rc; + } +@@ -1689,12 +1868,13 @@ int lsmFsChildDependencyRm( lsmConnect *c, lsmFs *fs, lsmStringList *files, + Value response; + + int rc = rpc(c, "fs_child_dependency_rm", parameters, response); +- return jobCheck(rc, response, job); ++ return jobCheck(c, rc, response, job); + } + + int lsmFsSsList(lsmConnect *c, lsmFs *fs, lsmSs **ss[], + uint32_t *ssCount, lsmFlag_t flags ) + { ++ int rc = 0; + CONN_SETUP(c); + + if( !LSM_IS_FS(fs) ) { +@@ -1712,19 +1892,33 @@ int lsmFsSsList(lsmConnect *c, lsmFs *fs, lsmSs **ss[], + Value parameters(p); + Value response; + +- int rc = rpc(c, "fs_snapshots", parameters, response); +- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { +- std::vector sys = response.asArray(); ++ try { ++ rc = rpc(c, "fs_snapshots", parameters, response); ++ if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { ++ std::vector sys = response.asArray(); + +- *ssCount = sys.size(); ++ *ssCount = sys.size(); + +- if( sys.size() ) { +- *ss = lsmSsRecordAllocArray(sys.size()); ++ if( sys.size() ) { ++ *ss = lsmSsRecordAllocArray(sys.size()); + +- for( size_t i = 0; i < sys.size(); ++i ) { +- (*ss)[i] = valueToSs(sys[i]); ++ if( *ss ) { ++ for( size_t i = 0; i < sys.size(); ++i ) { ++ (*ss)[i] = valueToSs(sys[i]); ++ } ++ } else { ++ rc = LSM_ERR_NO_MEMORY; ++ } + } + } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); ++ if( *ss && *ssCount ) { ++ lsmSsRecordFreeArray(*ss, *ssCount); ++ *ss = NULL; ++ *ssCount = 0; ++ } + } + return rc; + +@@ -1761,7 +1955,7 @@ int lsmFsSsCreate(lsmConnect *c, lsmFs *fs, const char *name, + + int rc = rpc(c, "fs_snapshot_create", parameters, response); + if( LSM_ERR_OK == rc ) { +- *snapshot = (lsmSs *)parse_job_response(response, rc, job, ++ *snapshot = (lsmSs *)parse_job_response(c, response, rc, job, + (convert)valueToSs); + } + return rc; +@@ -1793,7 +1987,7 @@ int lsmFsSsDelete(lsmConnect *c, lsmFs *fs, lsmSs *ss, char **job, + Value response; + + int rc = rpc(c, "fs_snapshot_delete", parameters, response); +- return jobCheck(rc, response, job); ++ return jobCheck(c, rc, response, job); + } + + int lsmFsSsRevert(lsmConnect *c, lsmFs *fs, lsmSs *ss, +@@ -1839,37 +2033,52 @@ int lsmFsSsRevert(lsmConnect *c, lsmFs *fs, lsmSs *ss, + Value response; + + int rc = rpc(c, "fs_snapshot_revert", parameters, response); +- return jobCheck(rc, response, job); ++ return jobCheck(c, rc, response, job); + + } + + int lsmNfsList( lsmConnect *c, lsmNfsExport **exports[], uint32_t *count, + lsmFlag_t flags) + { ++ int rc = 0; + CONN_SETUP(c); + + if( CHECK_RP(exports) || !count || LSM_FLAG_UNUSED_CHECK(flags) ) { + return LSM_ERR_INVALID_ARGUMENT; + } + +- std::map p; +- p["flags"] = Value(flags); +- Value parameters(p); +- Value response; ++ try { ++ std::map p; ++ p["flags"] = Value(flags); ++ Value parameters(p); ++ Value response; + +- int rc = rpc(c, "exports", parameters, response); +- if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { +- std::vector exps = response.asArray(); ++ rc = rpc(c, "exports", parameters, response); ++ if( LSM_ERR_OK == rc && Value::array_t == response.valueType()) { ++ std::vector exps = response.asArray(); + +- *count = exps.size(); ++ *count = exps.size(); + +- if( *count ) { +- *exports = lsmNfsExportRecordAllocArray(*count); ++ if( *count ) { ++ *exports = lsmNfsExportRecordAllocArray(*count); + +- for( size_t i = 0; i < *count; ++i ) { +- (*exports)[i] = valueToNfsExport(exps[i]); ++ if( *exports ) { ++ for( size_t i = 0; i < *count; ++i ) { ++ (*exports)[i] = valueToNfsExport(exps[i]); ++ } ++ } else { ++ rc = LSM_ERR_NO_MEMORY; ++ } + } + } ++ } catch( const ValueException &ve ) { ++ rc = logException(c, LSM_ERR_INTERNAL_ERROR, "Unexpected type", ++ ve.what()); ++ if( *exports && *count ) { ++ lsmNfsExportRecordFreeArray( *exports, *count ); ++ *exports = NULL; ++ *count = 0; ++ } + } + return rc; + } +diff --git src/lsm_plugin_ipc.cpp src/lsm_plugin_ipc.cpp +index c23806c..c68a742 100644 +--- src/lsm_plugin_ipc.cpp ++++ src/lsm_plugin_ipc.cpp +@@ -257,20 +257,20 @@ static int handle_startup(lsmPluginPtr p, Value ¶ms, Value &response) + { + int rc = LSM_ERR_NO_SUPPORT; + xmlURIPtr uri = NULL; ++ std::string uri_string = params["uri"].asString(); ++ std::string password; + + if( p ) { +- uri = xmlParseURI(params["uri"].asString().c_str()); ++ uri = xmlParseURI(uri_string.c_str()); + if( uri ) { +- const char *pass = NULL; +- + lsmFlag_t flags = LSM_FLAG_GET_VALUE(params); + + if( Value::string_t == params["password"].valueType() ) { +- pass = params["password"].asString().c_str(); ++ password = params["password"].asString(); + } + + //Let the plug-in initialize itself. +- rc = p->reg(p, uri, pass, params["timeout"].asUint32_t(), ++ rc = p->reg(p, uri, password.c_str(), params["timeout"].asUint32_t(), + flags); + xmlFreeURI(uri); + uri = NULL; +@@ -314,7 +314,7 @@ static int handle_get_time_out( lsmPluginPtr p, Value ¶ms, Value &response) + + static int handle_job_status( lsmPluginPtr p, Value ¶ms, Value &response) + { +- const char *job_id = NULL; ++ std::string job_id; + lsmJobStatus status; + uint8_t percent; + lsmDataType t = LSM_DATA_TYPE_UNKNOWN; +@@ -328,9 +328,9 @@ static int handle_job_status( lsmPluginPtr p, Value ¶ms, Value &response) + rc = LSM_ERR_TRANSPORT_INVALID_ARG; + } else { + +- job_id = params["job_id"].asString().c_str(); ++ job_id = params["job_id"].asString(); + +- rc = p->mgmtOps->job_status(p, job_id, &status, &percent, &t, ++ rc = p->mgmtOps->job_status(p, job_id.c_str(), &status, &percent, &t, + &value, LSM_FLAG_GET_VALUE(params)); + + if( LSM_ERR_OK == rc) { diff --git a/SOURCES/libstoragemgmt-0.0.24-nstor-json.patch b/SOURCES/libstoragemgmt-0.0.24-nstor-json.patch new file mode 100644 index 0000000..6b08541 --- /dev/null +++ b/SOURCES/libstoragemgmt-0.0.24-nstor-json.patch @@ -0,0 +1,16 @@ +diff --git lsm/lsm/nstor.py lsm/lsm/nstor.py +index 540a4db..10d4b65 100644 +--- lsm/lsm/nstor.py ++++ lsm/lsm/nstor.py +@@ -20,7 +20,10 @@ + + import urllib2 + import urlparse +-import simplejson as json ++try: ++ import simplejson as json ++except ImportError: ++ import json + import base64 + import time + diff --git a/SOURCES/libstoragemgmt-0.0.24-python_env.patch b/SOURCES/libstoragemgmt-0.0.24-python_env.patch new file mode 100644 index 0000000..829589c --- /dev/null +++ b/SOURCES/libstoragemgmt-0.0.24-python_env.patch @@ -0,0 +1,80 @@ +diff --git lsm/nstor_lsmplugin lsm/nstor_lsmplugin +index f183c86..9886181 100755 +--- lsm/nstor_lsmplugin ++++ lsm/nstor_lsmplugin +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2.7 + + # + # Copyright (C) 2012 Nexenta Systems, Inc. +diff --git lsm/ontap_lsmplugin lsm/ontap_lsmplugin +index 2695fa7..4f14516 100755 +--- lsm/ontap_lsmplugin ++++ lsm/ontap_lsmplugin +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2.7 + + # Copyright (C) 2011-2013 Red Hat, Inc. + # This library is free software; you can redistribute it and/or +diff --git lsm/sim_lsmplugin lsm/sim_lsmplugin +index e05dce5..fc19d13 100755 +--- lsm/sim_lsmplugin ++++ lsm/sim_lsmplugin +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2.7 + + # Copyright (C) 2011-2013 Red Hat, Inc. + # This library is free software; you can redistribute it and/or +diff --git lsm/smispy_lsmplugin lsm/smispy_lsmplugin +index 015cb34..ae93bba 100755 +--- lsm/smispy_lsmplugin ++++ lsm/smispy_lsmplugin +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2.7 + + # Copyright (C) 2011-2013 Red Hat, Inc. + # This library is free software; you can redistribute it and/or +diff --git lsm/targetd_lsmplugin lsm/targetd_lsmplugin +index f8e65bd..b3fa5bd 100755 +--- lsm/targetd_lsmplugin ++++ lsm/targetd_lsmplugin +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2.7 + + # Copyright (C) 2011-2013 Red Hat, Inc. + # This library is free software; you can redistribute it and/or +diff --git lsm/v7k_lsmplugin lsm/v7k_lsmplugin +index b772c59..7c41850 100755 +--- lsm/v7k_lsmplugin ++++ lsm/v7k_lsmplugin +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2.7 + + # Copyright (C) 2013 IBM Corporation + # This library is free software; you can redistribute it and/or +diff --git test/cmdtest.py test/cmdtest.py +index 0a545aa..c915bc8 100755 +--- test/cmdtest.py ++++ test/cmdtest.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2.7 + + # Copyright (C) 2011-2013 Red Hat, Inc. + # +diff --git tools/lsmclipy/lsmcli tools/lsmclipy/lsmcli +index c115e61..2d2541e 100755 +--- tools/lsmclipy/lsmcli ++++ tools/lsmclipy/lsmcli +@@ -1,4 +1,4 @@ +-#!/usr/bin/env python ++#!/usr/bin/env python2.7 + + # Copyright (C) 2012 Red Hat, Inc. + # This library is free software; you can redistribute it and/or diff --git a/SPECS/libstoragemgmt.spec b/SPECS/libstoragemgmt.spec index 3ba2f41..f76d66a 100644 --- a/SPECS/libstoragemgmt.spec +++ b/SPECS/libstoragemgmt.spec @@ -1,20 +1,19 @@ Name: libstoragemgmt -Version: 0.0.22 +Version: 0.0.24 Release: 4%{?dist} Summary: Storage array management library Group: System Environment/Libraries License: LGPLv2+ URL: http://sourceforge.net/projects/libstoragemgmt/ -Source0: http://sourceforge.net/projects/libstoragemgmt/files/Alpha/libstoragemgmt-%{version}.tar.gz -Patch0: %{name}-0.0.22-python_env.patch -Patch1: %{name}-0.0.22-ontap_ssl.patch -Patch2: %{name}-0.0.22-setgroups.patch -Patch3: %{name}-0.0.22-relro-pie.patch -Patch4: %{name}-0.0.22-auto-warnings.patch -Patch5: %{name}-0.0.22-autogen.patch +Source0: http://sourceforge.net/projects/libstoragemgmt/files/libstoragemgmt-%{version}.tar.gz +Patch0: %{name}-0.0.24-python_env.patch +Patch1: %{name}-0.0.24-nstor-json.patch +Patch2: %{name}-0.0.24-coverity-fix.patch +Patch3: %{name}-0.0.24-comment_out_ua_udev_rules.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: autoconf automake libtool yajl-devel libxml2-devel check-devel glib2-devel +BuildRequires: gcc-c++ Requires: %{name}-python %if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 @@ -47,7 +46,7 @@ Group: System Environment/Libraries Requires: %{name} = %{version}-%{release} BuildArch: noarch -%description python +%description python The %{name}-python package contains python client libraries as well as python framework support and open source plug-ins written in python. @@ -116,25 +115,29 @@ BuildArch: noarch The %{name}-nstor-plugin package contains plug-in for NexentaStor array support. +%package udev +Summary: udev files for %{name} +Group: System Environment/Base + +%description udev +The %{name}-udev package contains udev rules and helper utilities for +uevents generated by the kernel. + %prep %setup -q %patch0 -p0 %patch1 -p0 %patch2 -p0 %patch3 -p0 -%patch4 -p0 -%patch5 -p0 %build - -#Clean up & regen auto* as we have mucked with it. bash autogen.sh #Tell the install program to preserve file date/timestamps %if 0%{?rhel} >= 7 %configure --disable-static --without-paramiko %else -%configure --disable-static +%configure --disable-static %endif V=1 make %{?_smp_mflags} @@ -160,6 +163,10 @@ install packaging/daemon/libstoragemgmtd %{buildroot}/etc/rc.d/init.d/libstorage #Need these to exist at install so we can start the daemon mkdir -p %{buildroot}%{_localstatedir}/run/lsm/ipc +mkdir -p %{buildroot}/lib/udev/rules.d +install -m 644 tools/udev/90-scsi-ua.rules %{buildroot}/lib/udev/rules.d/90-scsi-ua.rules +install -m 755 tools/udev/scan-scsi-target %{buildroot}/lib/udev/scan-scsi-target + %clean rm -rf %{buildroot} @@ -264,6 +271,7 @@ fi %files targetd-plugin %defattr(-,root,root,-) +%{python_sitelib}/lsm/targetd.* %{_bindir}/targetd_lsmplugin @@ -276,9 +284,43 @@ fi %files nstor-plugin %defattr(-,root,root,-) +%{python_sitelib}/lsm/nstor.* %{_bindir}/nstor_lsmplugin +%files udev +%defattr(-,root,root,-) +/lib/udev/scan-scsi-target +/lib/udev/rules.d/90-scsi-ua.rules + %changelog +* Fri Feb 28 2014 Tony Asleson - 0.0.24-4 +- https://bugzilla.redhat.com/show_bug.cgi?id=1071382 + +* Mon Feb 10 2014 Tony Asleson - 0.0.24-3 +- Corrected coverity found bugs + +* Thu Jan 30 2014 Tony Asleson - 0.0.24-2 +- Missed patch to correct python paths + +* Thu Jan 30 2014 Tony Asleson - 0.0.24-1 +- New upstream release +- Patch nstor plugin for json instead of simple-json + +* Fri Jan 24 2014 Daniel Mach - 0.0.22-10 +- Mass rebuild 2014-01-24 + +* Fri Jan 3 2014 Ewan D. Milne 0.0.22-9 +- Fixed DEVPATH parsing in scan-scsi-target + +* Fri Dec 27 2013 Daniel Mach - 0.0.22-7 +- Mass rebuild 2013-12-27 + +* Mon Dec 2 2013 Tony Asleson 0.0.22-6 +- https://bugzilla.redhat.com/show_bug.cgi?id=1019467 + +* Fri Nov 22 2013 Tony Asleson 0.0.22-5 +- https://bugzilla.redhat.com/show_bug.cgi?id=1019320 + * Mon Oct 14 2013 Tony Asleson 0.0.22-4 - https://bugzilla.redhat.com/show_bug.cgi?id=905465