Discussion:
[PATCH 00/11] Add system firmware version support.
Gris Ge
2015-09-23 13:41:00 UTC
Permalink
Python part:
* Add new optional argument for System.__init__().

C part:
* Plugin: lsm_system_fw_version_set()
* Client: lsm_system_fw_version_get()

Misc:
* Increase version in configure.ac to 1.3.
* Fix runtest.sh compatible issue with lsmenv.
* Included license of ***@HP Enterprise.

Please comment on:
https://github.com/libstorage/libstoragemgmt/pull/56/

Gris Ge (11):
Autotool: Mark current code base as version 1.3
C API: New method -- lsm_system_fw_version_get()
Python API: Add new property -- lsm.System.fw_version
lsmcli: Include Firmware version in system listing.
make check: Fix when running with lsmenv.
Test: Add test case for system firmware version.
Simulator Plugin: Add system firmware version support.
Simulator C Plugin: Add system firmware support.
HP SmartArray Plugin: Add system firmware version support.
MegaRAID Plugin: Add system firmware version support.
Add Joe Handzik in author list.

AUTHORS | 1 +
.../libstoragemgmt/libstoragemgmt_capabilities.h | 7 +++-
.../libstoragemgmt/libstoragemgmt_plug_interface.h | 20 +++++++--
.../libstoragemgmt/libstoragemgmt_systems.h | 15 ++++++-
c_binding/lsm_convert.cpp | 21 +++++++++-
c_binding/lsm_datatypes.cpp | 48 +++++++++++++++++++++-
c_binding/lsm_datatypes.hpp | 6 ++-
configure.ac | 4 +-
plugin/hpsa/hpsa.py | 8 +++-
plugin/megaraid/megaraid.py | 14 ++++---
plugin/sim/simarray.py | 2 +-
plugin/sim/simulator.py | 2 +-
plugin/simc/simc_lsmplugin.c | 3 +-
python_binding/lsm/_data.py | 20 ++++++++-
test/plugin_test.py | 15 ++++++-
test/runtests.sh | 7 ++--
test/tester.c | 35 +++++++++++++++-
tools/lsmcli/cmdline.py | 2 +-
tools/lsmcli/data_display.py | 10 ++++-
19 files changed, 211 insertions(+), 29 deletions(-)
--
1.8.3.1
Gris Ge
2015-09-23 13:41:01 UTC
Permalink
* Update version in configure.ac to 1.3.

Signed-off-by: Gris Ge <***@redhat.com>
---
configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 204d858..beae390 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,9 +1,9 @@
dnl Process this file with autoconf to produce a configure script.
-dnl Copyright (C) 2011 Red Hat, Inc.
+dnl Copyright (C) 2011-2015 Red Hat, Inc.
dnl See COPYING.LIB for the License of this software

AC_INIT(
- [libstoragemgmt], [1.2.3], [libstoragemgmt-***@lists.fedorahosted.org],
+ [libstoragemgmt], [1.3.0], [libstoragemgmt-***@lists.fedorahosted.org],
[], [https://github.com/libstorage/libstoragemgmt/])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_AUX_DIR([build-aux])
--
1.8.3.1
Gris Ge
2015-09-23 13:41:03 UTC
Permalink
Plugin:
lsm.System(..., _fw_version="1.2.3")

Client:
lsm.System.fw_version

Capability:
lsm.Capability.SYS_FW_VERSION_GET

Misc:
* Update Red Hat license line.
* Include HP Enterprise Development license line.
* Add Joe Handzik and Gris Ge to author list.

Signed-off-by: Gris Ge <***@redhat.com>
Signed-off-by: Joe Handzik <***@hpe.com>
---
python_binding/lsm/_data.py | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/python_binding/lsm/_data.py b/python_binding/lsm/_data.py
index 21767b2..8d4aeb1 100644
--- a/python_binding/lsm/_data.py
+++ b/python_binding/lsm/_data.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2014 Red Hat, Inc.
+# Copyright (C) 2011-2015 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -357,12 +357,26 @@ class System(IData):
STATUS_PREDICTIVE_FAILURE = 1 << 4
STATUS_OTHER = 1 << 5

- def __init__(self, _id, _name, _status, _status_info, _plugin_data=None):
+ def __init__(self, _id, _name, _status, _status_info, _plugin_data=None,
+ _fw_version=''):
self._id = _id
self._name = _name
self._status = _status
self._status_info = _status_info
self._plugin_data = _plugin_data
+ self._fw_version = _fw_version
+
+ @property
+ def fw_version(self):
+ """
+ String. Firmware version string. New in version 1.3.
+ On some system, it might contains multiple version string.
+ """
+ if self._fw_version == '':
+ raise LsmError(ErrorNumber.NO_SUPPORT,
+ "System.fw_version() is not supported by this "
+ "plugin yet")
+ return self._fw_version


@default_property('id', doc="Unique identifier")
@@ -750,6 +764,8 @@ class Capabilities(IData):
EXPORT_REMOVE = 123
EXPORT_CUSTOM_PATH = 124

+ SYS_FW_VERSION_GET = 160
+
POOLS_QUICK_SEARCH = 210
VOLUMES_QUICK_SEARCH = 211
DISKS_QUICK_SEARCH = 212
--
1.8.3.1
Gris Ge
2015-09-23 13:41:02 UTC
Permalink
Plugin method:
* int lsm_system_fw_version_set(lsm_system *s, const char *fw_ver);

Client method:
* int lsm_system_fw_version_get(lsm_system *s, const char **fw_ver);

New capability:
* LSM_CAP_SYS_FW_VERSION_GET

Misc:
* Update license:
* Bump the year number to 2015.
* Add "Hewlett Packard Enterprise Development LP" license line.
* Add Joe Handzik to author list.

Signed-off-by: Joe Handzik <***@hpe.com>
Signed-off-by: Gris Ge <***@redhat.com>
---
.../libstoragemgmt/libstoragemgmt_capabilities.h | 7 +++-
.../libstoragemgmt/libstoragemgmt_plug_interface.h | 20 +++++++--
.../libstoragemgmt/libstoragemgmt_systems.h | 15 ++++++-
c_binding/lsm_convert.cpp | 21 +++++++++-
c_binding/lsm_datatypes.cpp | 48 +++++++++++++++++++++-
c_binding/lsm_datatypes.hpp | 6 ++-
6 files changed, 109 insertions(+), 8 deletions(-)

diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h b/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
index 4d0c351..6f81450 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#ifndef LSM_CAPABILITIES_H
@@ -152,6 +155,8 @@ typedef enum {
LSM_CAP_EXPORT_CUSTOM_PATH = 124,
/**^ Plug-in allows user to define custome export path */

+ LSM_CAP_SYS_FW_VERSION_GET = 160,
+ /**^ Plug-in allows user to retrieve storage firmware version */
LSM_CAP_POOLS_QUICK_SEARCH = 210,
/**^ Seach occurs on array */
LSM_CAP_VOLUMES_QUICK_SEARCH = 211,
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h b/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
index 763c278..6d69082 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#ifndef LIBSTORAGEMGMT_PLUG_INTERFACE_H
@@ -980,8 +983,6 @@ typedef int (*lsm_plug_volume_raid_create) (lsm_plugin_ptr c,

/** \struct lsm_ops_v1_2
* \brief Functions added in version 1.2
- * NOTE: This structure will change during the developement util version 1.2
- * released.
*/
struct lsm_ops_v1_2 {
lsm_plug_volume_raid_info vol_raid_info;
@@ -1249,6 +1250,19 @@ lsm_system LSM_DLL_EXPORT *lsm_system_record_alloc(const char *id,
const char *plugin_data);

/**
+ * New in version 1.3. Set firmware version.
+ * @param[in] id Id
+ * @param[in] sys System to update.
+ * @param[in] fw_ver Firmware version string.
+ * Will got LSM_ERR_INVALID_ARGUMENT for
+ * empty string('\0').
+ * @return LSM_ERR_OK or LSM_ERR_NO_MEMORY or LSM_ERR_INVALID_ARGUMENT.
+ */
+int LSM_DLL_EXPORT lsm_system_fw_version_set(lsm_system *sys,
+ const char *fw_ver);
+
+
+/**
* Retrieve plugin private data
* @param s System
* @return Optional data, NULL if none exist
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h b/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h
index 5664a92..1d3f278 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/
#ifndef LIBSTORAGEMGMT_SYSTEMS_H
#define LIBSTORAGEMGMT_SYSTEMS_H
@@ -74,6 +77,16 @@ const char LSM_DLL_EXPORT *lsm_system_name_get(lsm_system *s);
*/
uint32_t LSM_DLL_EXPORT lsm_system_status_get(lsm_system *s);

+/**
+ * New in version 1.3. Retrieves firmware version of the specified system.
+ * Do not free returned string, free the struct 'lsm_system' instead.
+ * @param s System to retrieve firmware version for.
+ * @param[out] fw_ver Firmware version string.
+ * @return LSM_ERR_OK on success, or LSM_ERR_NO_SUPPORT, or
+ * LSM_ERR_INVALID_ARGUMENT.
+ */
+int LSM_DLL_EXPORT lsm_system_fw_version_get(lsm_system *s,
+ const char **fw_ver);

#ifdef __cplusplus
}
diff --git a/c_binding/lsm_convert.cpp b/c_binding/lsm_convert.cpp
index 68981c0..ce7c29b 100644
--- a/c_binding/lsm_convert.cpp
+++ b/c_binding/lsm_convert.cpp
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,12 +15,17 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#include "lsm_convert.hpp"
#include "libstoragemgmt/libstoragemgmt_accessgroups.h"
#include "libstoragemgmt/libstoragemgmt_blockrange.h"
#include "libstoragemgmt/libstoragemgmt_nfsexport.h"
+#include "libstoragemgmt/libstoragemgmt_plug_interface.h"
+
+#define _STD_MAP_HAS_KEY(x, y) (x).find((y)) != (x).end()

bool is_expected_object(Value & obj, std::string class_name)
{
@@ -260,6 +266,17 @@ lsm_system *value_to_system(Value & system)
i["status"].asUint32_t(),
i["status_info"].asString().c_str(),
i["plugin_data"].asC_str());
+ if ((rc != NULL) && (_STD_MAP_HAS_KEY(i, "fw_version") == 1) &&
+ (i["fw_version"].asC_str()[0] != '\0')) {
+
+ if (lsm_system_fw_version_set(rc, i["fw_version"].asC_str()) !=
+ LSM_ERR_OK) {
+ lsm_system_record_free(rc);
+ rc= NULL;
+ throw ValueException("value_to_system: failed to update "
+ "fw_version");
+ }
+ }
} else {
throw ValueException("value_to_system: Not correct type");
}
@@ -276,6 +293,8 @@ Value system_to_value(lsm_system * system)
s["status"] = Value(system->status);
s["status_info"] = Value(system->status_info);
s["plugin_data"] = Value(system->plugin_data);
+ if (system->fw_version != NULL)
+ s["fw_version"] = Value(system->fw_version);
return Value(s);
}
return Value();
diff --git a/c_binding/lsm_datatypes.cpp b/c_binding/lsm_datatypes.cpp
index 8218db3..f81f0eb 100644
--- a/c_binding/lsm_datatypes.cpp
+++ b/c_binding/lsm_datatypes.cpp
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#ifndef __cplusplus
@@ -37,6 +40,7 @@
#include "libstoragemgmt/libstoragemgmt_targetport.h"
#include "libstoragemgmt/libstoragemgmt_types.h"
#include "libstoragemgmt/libstoragemgmt_volumes.h"
+#include "libstoragemgmt/libstoragemgmt_plug_interface.h"

#include <string.h>
#include <stdlib.h>
@@ -724,6 +728,7 @@ lsm_system *lsm_system_record_alloc(const char *id, const char *name,
rc->name = strdup(name);
rc->status = status;
rc->status_info = strdup(status_info);
+ rc->fw_version = NULL;

if (plugin_data) {
rc->plugin_data = strdup(plugin_data);
@@ -760,6 +765,9 @@ int lsm_system_record_free(lsm_system * s)

free(s->plugin_data);

+ if (s->fw_version != NULL)
+ free((char *) s->fw_version);
+
free(s);
return LSM_ERR_OK;
}
@@ -775,6 +783,12 @@ lsm_system *lsm_system_record_copy(lsm_system * s)
if (LSM_IS_SYSTEM(s)) {
rc = lsm_system_record_alloc(s->id, s->name, s->status, s->status_info,
s->plugin_data);
+
+ if ((s->fw_version != NULL) &&
+ (lsm_system_fw_version_set(rc, s->fw_version) != LSM_ERR_OK)) {
+ lsm_system_record_free(rc);
+ rc = NULL;
+ }
}
return rc;
}
@@ -803,6 +817,38 @@ uint32_t lsm_system_status_get(lsm_system * s)
return UINT32_MAX;
}

+int lsm_system_fw_version_set(lsm_system *sys, const char *fw_ver)
+{
+ if ((sys == NULL) || (fw_ver == NULL) || (fw_ver[0] == '\0'))
+ return LSM_ERR_INVALID_ARGUMENT;
+
+ if (sys->fw_version != NULL)
+ free((char *) sys->fw_version);
+
+ sys->fw_version = strdup(fw_ver);
+ if (sys->fw_version == NULL)
+ return LSM_ERR_NO_MEMORY;
+
+ return LSM_ERR_OK;
+}
+
+int lsm_system_fw_version_get(lsm_system *s, const char **fw_ver)
+{
+ if ((s == NULL) || (fw_ver == NULL))
+ return LSM_ERR_INVALID_ARGUMENT;
+
+ if (! LSM_IS_SYSTEM(s)) {
+ return LSM_ERR_INVALID_ARGUMENT;
+ }
+
+ *fw_ver = s->fw_version;
+
+ if (s->fw_version[0] != '\0' )
+ return LSM_ERR_OK;
+ else
+ return LSM_ERR_NO_SUPPORT;
+}
+
MEMBER_FUNC_GET(const char *, lsm_system_plugin_data_get, lsm_system * s,
s, LSM_IS_SYSTEM, plugin_data, NULL)

diff --git a/c_binding/lsm_datatypes.hpp b/c_binding/lsm_datatypes.hpp
index 558dce0..02472e3 100644
--- a/c_binding/lsm_datatypes.hpp
+++ b/c_binding/lsm_datatypes.hpp
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#ifndef LSM_DATATYPES_H
@@ -162,6 +165,7 @@ struct _lsm_system {
uint32_t status; /**< Enumerated status value */
char *status_info; /**< System status text */
char *plugin_data; /**< Reserved for the plugin to use */
+ const char *fw_version; /**< Firmware version */
};

#define LSM_CONNECT_MAGIC 0xAA7A000A
--
1.8.3.1
Gris Ge
2015-09-23 13:41:04 UTC
Permalink
* Include firmware version in output of 'lsmcli list --type systems' command.
* Leave that column as empty if not supported.

Signed-off-by: Gris Ge <***@redhat.com>
---
tools/lsmcli/cmdline.py | 2 +-
tools/lsmcli/data_display.py | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/lsmcli/cmdline.py b/tools/lsmcli/cmdline.py
index b2693e4..c66eaf2 100644
--- a/tools/lsmcli/cmdline.py
+++ b/tools/lsmcli/cmdline.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2014 Red Hat, Inc.
+# Copyright (C) 2012-2015 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
diff --git a/tools/lsmcli/data_display.py b/tools/lsmcli/data_display.py
index e4ba6c3..2868b46 100644
--- a/tools/lsmcli/data_display.py
+++ b/tools/lsmcli/data_display.py
@@ -331,6 +331,7 @@ def __init__(self):
SYSTEM_HEADER['name'] = 'Name'
SYSTEM_HEADER['status'] = 'Status'
SYSTEM_HEADER['status_info'] = 'Info'
+ SYSTEM_HEADER['fw_version'] = "FW Ver"

SYSTEM_COLUMN_SKIP_KEYS = []
# XXX_COLUMN_SKIP_KEYS contain a list of property should be skipped when
@@ -632,7 +633,14 @@ def __init__(self):
@staticmethod
def _get_man_pro_value(obj, key, value_conv_enum, value_conv_human,
flag_human, flag_enum):
- value = getattr(obj, key)
+ try:
+ value = getattr(obj, key)
+ except LsmError as lsm_err:
+ if lsm_err.code == ErrorNumber.NO_SUPPORT:
+ value = ''
+ else:
+ raise lsm_err
+
if not flag_enum:
if key in value_conv_enum.keys():
value = value_conv_enum[key](value)
--
1.8.3.1
Gris Ge
2015-09-23 13:41:06 UTC
Permalink
* Added both C and python API test for system firmware version.
* cmdtest.py not touched as existing test for 'lsmcli list --type systems'
covered it.
* Updated license lines and years.

Signed-off-by: Gris Ge <***@redhat.com>
Signed-off-by: Joe Handzik <***@hpe.com>
---
test/plugin_test.py | 15 ++++++++++++++-
test/tester.c | 35 ++++++++++++++++++++++++++++++++++-
2 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/test/plugin_test.py b/test/plugin_test.py
index d91b151..660d7bb 100755
--- a/test/plugin_test.py
+++ b/test/plugin_test.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python2

-# Copyright (C) 2013-2014 Red Hat, Inc.
+# Copyright (C) 2013-2015 Red Hat, Inc.
+# (C) Copyright 2015 Hewlett Packard Enterprise Development LP
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -13,6 +14,10 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: tasleson
+# Joe Handzik <***@hpe.com>
+# Gris Ge <***@redhat.com>

import lsm
import functools
@@ -306,6 +311,14 @@ def test_plugin_info(self):
self.assertTrue(desc is not None and len(desc) > 0)
self.assertTrue(version is not None and len(version) > 0)

+ def test_fw_version_get(self):
+ for s in self.systems:
+ cap = self.c.capabilities(s)
+ if supported(cap, [Cap.SYS_FW_VERSION_GET]):
+ fw_ver = s.fw_version
+ self.assertTrue(fw_ver is not None and len(fw_ver) > 0,
+ "Firmware version retrieval failed")
+
def test_timeout(self):
tmo = 40000
self.c.time_out_set(tmo)
diff --git a/test/tester.c b/test/tester.c
index 8510584..01543bd 100644
--- a/test/tester.c
+++ b/test/tester.c
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#include <stdio.h>
@@ -1960,6 +1963,35 @@ START_TEST(test_plugin_info)
}
END_TEST

+START_TEST(test_system_fw_version)
+{
+ const char *fw_ver = NULL;
+ int rc = 0;
+ lsm_system **sys = NULL;
+ uint32_t sys_count = 0;
+
+ G(rc, lsm_system_list, c, &sys, &sys_count, LSM_CLIENT_FLAG_RSVD);
+ fail_unless( sys_count >= 1, "count = %d", sys_count);
+
+ if(sys_count > 0) {
+
+ G(rc, lsm_system_fw_version_get, sys[0], &fw_ver);
+
+ if( LSM_ERR_OK == rc ) {
+ printf("Firmware version: (%s)\n", fw_ver);
+ }
+
+ rc = lsm_system_fw_version_get(sys[0], NULL);
+ fail_unless(LSM_ERR_INVALID_ARGUMENT == rc, "rc = %d", rc);
+ }
+
+ rc = lsm_system_fw_version_get(NULL, &fw_ver);
+ fail_unless(LSM_ERR_INVALID_ARGUMENT == rc, "rc = %d", rc);
+ lsm_system_record_array_free(sys, sys_count);
+
+}
+END_TEST
+
START_TEST(test_get_available_plugins)
{
int i = 0;
@@ -3045,6 +3077,7 @@ Suite * lsm_suite(void)
tcase_add_test(basic, test_nfs_export_funcs);
tcase_add_test(basic, test_disks);
tcase_add_test(basic, test_plugin_info);
+ tcase_add_test(basic, test_system_fw_version);
tcase_add_test(basic, test_get_available_plugins);
tcase_add_test(basic, test_volume_methods);
tcase_add_test(basic, test_iscsi_auth_in);
--
1.8.3.1
Gris Ge
2015-09-23 13:41:05 UTC
Permalink
* lsmenv will create link in python_binding/lsm folder to plugin and lsmcli
which cannot detected by bash [ -e $FILE_PATH], fixed by checking 'test -L'
also.

Signed-off-by: Gris Ge <***@redhat.com>
---
test/runtests.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/test/runtests.sh b/test/runtests.sh
index edd008d..8b3c499 100755
--- a/test/runtests.sh
+++ b/test/runtests.sh
@@ -1,6 +1,6 @@
#!/bin/bash

-# Copyright (C) 2011-2014 Red Hat, Inc.
+# Copyright (C) 2011-2015 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -15,6 +15,7 @@
# License along with this library; If not, see <http://www.gnu.org/licenses/>.
#
# Author: tasleson
+# Gris Ge <***@redhat.com>
#
# Unit test case driver

@@ -134,11 +135,11 @@ good "cp $shared_libs/*.so.* $LD_LIBRARY_PATH"
# user account exists.
good "cp -av $lsm_py_folder/lsm $PYTHONPATH/"
# In case the plugin and lsmcli link also copyed.
-if [ -e "$PYTHONPATH/lsm/plugin" ];then
+if [ -e "$PYTHONPATH/lsm/plugin" ] || [ -L "$PYTHONPATH/lsm/plugin" ];then
good "rm $PYTHONPATH/lsm/plugin"
fi
good "cp -av $lsm_plugin_py_folder $PYTHONPATH/lsm/"
-if [ -e "$PYTHONPATH/lsm/lsmcli" ];then
+if [ -e "$PYTHONPATH/lsm/lsmcli" ] || [ -L "$PYTHONPATH/lsm/lsmcli" ];then
good "rm $PYTHONPATH/lsm/lsmcli"
fi
good "cp -av $lsmcli_py_folder $PYTHONPATH/lsm/"
--
1.8.3.1
Gris Ge
2015-09-23 13:41:07 UTC
Permalink
* Include data version as system firmware version.
* Updated license year.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/sim/simarray.py | 2 +-
plugin/sim/simulator.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugin/sim/simarray.py b/plugin/sim/simarray.py
index b6ff80c..4fc2087 100644
--- a/plugin/sim/simarray.py
+++ b/plugin/sim/simarray.py
@@ -1725,7 +1725,7 @@ def time_out_get(self, flags=0):
def _sim_sys_2_lsm(sim_sys):
return System(
sim_sys['id'], sim_sys['name'], sim_sys['status'],
- sim_sys['status_info'])
+ sim_sys['status_info'], _fw_version=sim_sys["version"])

@_handle_errors
def systems(self):
diff --git a/plugin/sim/simulator.py b/plugin/sim/simulator.py
index 052c48d..cdec8f3 100644
--- a/plugin/sim/simulator.py
+++ b/plugin/sim/simulator.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2014 Red Hat, Inc.
+# Copyright (C) 2011-2015 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
--
1.8.3.1
Gris Ge
2015-09-23 13:41:08 UTC
Permalink
* Simply use static variable `version` as firmware version.
* Updated license year.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/simc/simc_lsmplugin.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugin/simc/simc_lsmplugin.c b/plugin/simc/simc_lsmplugin.c
index 4c8c505..4403414 100644
--- a/plugin/simc/simc_lsmplugin.c
+++ b/plugin/simc/simc_lsmplugin.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -2285,6 +2285,7 @@ int load(lsm_plugin_ptr c, const char *uri, const char *password,
"LSM simulated storage plug-in",
LSM_SYSTEM_STATUS_OK, "",
NULL);
+ lsm_system_fw_version_set(pd->system[0], version);

p = lsm_pool_record_alloc("POOL_3", "lsm_test_aggr",
LSM_POOL_ELEMENT_TYPE_FS |
--
1.8.3.1
Gris Ge
2015-09-23 13:41:09 UTC
Permalink
* Use 'Firmware Version' entry from 'hpssacli ctrl all show detail' command
output.

* Included HP Enterprise Development LP license line.
* Included Joe Handzik in author list.

Signed-off-by: Gris Ge <***@redhat.com>
Signed-off-by: Joe Handzik <***@hpe.com>
---
plugin/hpsa/hpsa.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugin/hpsa/hpsa.py b/plugin/hpsa/hpsa.py
index 9c49cbe..b92cbdf 100644
--- a/plugin/hpsa/hpsa.py
+++ b/plugin/hpsa/hpsa.py
@@ -1,4 +1,5 @@
# Copyright (C) 2015 Red Hat, Inc.
+# (C) Copyright 2015 Hewlett Packard Enterprise Development LP
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -13,6 +14,7 @@
# License along with this library; If not, see <http://www.gnu.org/licenses/>.
#
# Author: Gris Ge <***@redhat.com>
+# Joe Handzik <***@hpe.com>

import os
import errno
@@ -324,6 +326,7 @@ def capabilities(self, system, flags=Client.FLAG_RSVD):
cap.set(Capabilities.VOLUME_RAID_INFO)
cap.set(Capabilities.POOL_MEMBER_INFO)
cap.set(Capabilities.VOLUME_RAID_CREATE)
+ cap.set(Capabilities.SYS_FW_VERSION_GET)
return cap

def _sacli_exec(self, sacli_cmds, flag_convert=True):
@@ -366,9 +369,10 @@ def systems(self, flags=0):
(status, status_info) = _sys_status_of(ctrl_all_status[ctrl_name])

plugin_data = "%s" % ctrl_data['Slot']
+ fw_ver = "%s" % ctrl_data['Firmware Version']

- rc_lsm_syss.append(
- System(sys_id, ctrl_name, status, status_info, plugin_data))
+ rc_lsm_syss.append(System(sys_id, ctrl_name, status, status_info,
+ plugin_data, _fw_version=fw_ver))

return rc_lsm_syss
--
1.8.3.1
Gris Ge
2015-09-23 13:41:10 UTC
Permalink
* Remove firmware version from system name.
* Include these values in system firmware version:
* Firmware Package Build:
Version string of download firmware file.
* BIOS Version:
PCI card optional BIOS version.
* Firmware Version:
Real MegaRAID firmware version.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/megaraid/megaraid.py | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/plugin/megaraid/megaraid.py b/plugin/megaraid/megaraid.py
index 3a41c78..d06283a 100644
--- a/plugin/megaraid/megaraid.py
+++ b/plugin/megaraid/megaraid.py
@@ -366,20 +366,24 @@ def systems(self, flags=Client.FLAG_RSVD):
ctrl_show_all_output = self._storcli_exec(
["/c%d" % ctrl_num, "show", "all"])
sys_id = self._sys_id_of_ctrl_num(ctrl_num, ctrl_show_all_output)
- sys_name = "%s %s %s ver: %s" % (
+ sys_name = "%s %s %s" % (
ctrl_show_all_output['Basics']['Model'],
ctrl_show_all_output['Bus']['Host Interface'],
- ctrl_show_all_output['Basics']['PCI Address'],
- ctrl_show_all_output['Version']['Firmware Package Build'],
- )
+ ctrl_show_all_output['Basics']['PCI Address'])
(status, status_info) = self._lsm_status_of_ctrl(
ctrl_show_all_output)
plugin_data = "/c%d" % ctrl_num
# Since PCI slot sequence might change.
# This string just stored for quick system verification.

+ fw_ver = "Package: %s, BIOS: %s, FW: %s" % (
+ ctrl_show_all_output["Version"]["Firmware Package Build"],
+ ctrl_show_all_output["Version"]["Bios Version"],
+ ctrl_show_all_output["Version"]["Firmware Version"])
+
rc_lsm_syss.append(
- System(sys_id, sys_name, status, status_info, plugin_data))
+ System(sys_id, sys_name, status, status_info, plugin_data,
+ _fw_version=fw_ver))

return rc_lsm_syss
--
1.8.3.1
Gris Ge
2015-09-23 13:41:11 UTC
Permalink
Signed-off-by: Gris Ge <***@redhat.com>
---
AUTHORS | 1 +
1 file changed, 1 insertion(+)

diff --git a/AUTHORS b/AUTHORS
index 9fbf913..2137a2b 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -26,6 +26,7 @@ Patches have also been contributed by:
Ma Shimiao <***@cn.fujitsu.com>
Ewan Milne <***@redhat.com>
Charles Rose <***@gmail.com>
+ Joe Handzik <***@hpe.com>


[....send patches to get your name here....]
--
1.8.3.1
Gris Ge
2015-09-24 14:25:33 UTC
Permalink
* Update version in configure.ac to 1.3.

Signed-off-by: Gris Ge <***@redhat.com>
---
configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 204d858..beae390 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,9 +1,9 @@
dnl Process this file with autoconf to produce a configure script.
-dnl Copyright (C) 2011 Red Hat, Inc.
+dnl Copyright (C) 2011-2015 Red Hat, Inc.
dnl See COPYING.LIB for the License of this software

AC_INIT(
- [libstoragemgmt], [1.2.3], [libstoragemgmt-***@lists.fedorahosted.org],
+ [libstoragemgmt], [1.3.0], [libstoragemgmt-***@lists.fedorahosted.org],
[], [https://github.com/libstorage/libstoragemgmt/])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_AUX_DIR([build-aux])
--
1.8.3.1
Gris Ge
2015-09-24 14:25:35 UTC
Permalink
Plugin:
lsm.System(..., _fw_version="1.2.3")

Client:
lsm.System.fw_version

Capability:
lsm.Capability.SYS_FW_VERSION_GET

Misc:
* Update Red Hat license line.
* Include HP Enterprise Development license line.
* Add Joe Handzik and Gris Ge to author list.

Signed-off-by: Gris Ge <***@redhat.com>
Signed-off-by: Joe Handzik <***@hpe.com>
---
python_binding/lsm/_data.py | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/python_binding/lsm/_data.py b/python_binding/lsm/_data.py
index 21767b2..f4b3be8 100644
--- a/python_binding/lsm/_data.py
+++ b/python_binding/lsm/_data.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2014 Red Hat, Inc.
+# Copyright (C) 2011-2015 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -357,12 +357,27 @@ class System(IData):
STATUS_PREDICTIVE_FAILURE = 1 << 4
STATUS_OTHER = 1 << 5

- def __init__(self, _id, _name, _status, _status_info, _plugin_data=None):
+ def __init__(self, _id, _name, _status, _status_info, _plugin_data=None,
+ _fw_version=''):
self._id = _id
self._name = _name
self._status = _status
self._status_info = _status_info
self._plugin_data = _plugin_data
+ self._fw_version = _fw_version
+
+ @property
+ def fw_version(self):
+ """
+ String. Firmware version string. New in version 1.3.
+ On some system, it might contain multiple version strings, example:
+ "Package: 23.32.0-0009, FW: 3.440.05-3712"
+ """
+ if self._fw_version == '':
+ raise LsmError(ErrorNumber.NO_SUPPORT,
+ "System.fw_version() is not supported by this "
+ "plugin yet")
+ return self._fw_version


@default_property('id', doc="Unique identifier")
@@ -750,6 +765,8 @@ class Capabilities(IData):
EXPORT_REMOVE = 123
EXPORT_CUSTOM_PATH = 124

+ SYS_FW_VERSION_GET = 160
+
POOLS_QUICK_SEARCH = 210
VOLUMES_QUICK_SEARCH = 211
DISKS_QUICK_SEARCH = 212
--
1.8.3.1
Gris Ge
2015-09-24 14:25:34 UTC
Permalink
Plugin method:
* int lsm_system_fw_version_set(lsm_system *s, const char *fw_ver);

Client method:
* int lsm_system_fw_version_get(lsm_system *s, const char **fw_ver);

New capability:
* LSM_CAP_SYS_FW_VERSION_GET

Misc:
* Update license:
* Bump the year number to 2015.
* Add "Hewlett Packard Enterprise Development LP" license line.
* Add Joe Handzik to author list.

Signed-off-by: Joe Handzik <***@hpe.com>
Signed-off-by: Gris Ge <***@redhat.com>
---
.../libstoragemgmt/libstoragemgmt_capabilities.h | 7 +++-
.../libstoragemgmt/libstoragemgmt_plug_interface.h | 19 +++++++--
.../libstoragemgmt/libstoragemgmt_systems.h | 15 ++++++-
c_binding/lsm_convert.cpp | 21 +++++++++-
c_binding/lsm_datatypes.cpp | 48 +++++++++++++++++++++-
c_binding/lsm_datatypes.hpp | 6 ++-
6 files changed, 108 insertions(+), 8 deletions(-)

diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h b/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
index 4d0c351..6f81450 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#ifndef LSM_CAPABILITIES_H
@@ -152,6 +155,8 @@ typedef enum {
LSM_CAP_EXPORT_CUSTOM_PATH = 124,
/**^ Plug-in allows user to define custome export path */

+ LSM_CAP_SYS_FW_VERSION_GET = 160,
+ /**^ Plug-in allows user to retrieve storage firmware version */
LSM_CAP_POOLS_QUICK_SEARCH = 210,
/**^ Seach occurs on array */
LSM_CAP_VOLUMES_QUICK_SEARCH = 211,
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h b/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
index 763c278..7dc4497 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#ifndef LIBSTORAGEMGMT_PLUG_INTERFACE_H
@@ -980,8 +983,6 @@ typedef int (*lsm_plug_volume_raid_create) (lsm_plugin_ptr c,

/** \struct lsm_ops_v1_2
* \brief Functions added in version 1.2
- * NOTE: This structure will change during the developement util version 1.2
- * released.
*/
struct lsm_ops_v1_2 {
lsm_plug_volume_raid_info vol_raid_info;
@@ -1249,6 +1250,18 @@ lsm_system LSM_DLL_EXPORT *lsm_system_record_alloc(const char *id,
const char *plugin_data);

/**
+ * New in version 1.3. Set firmware version.
+ * @param[in] id Id
+ * @param[in] sys System to update.
+ * @param[in] fw_ver Firmware version string.
+ * Caller will get LSM_ERR_INVALID_ARGUMENT for
+ * empty string('\0').
+ * @return LSM_ERR_OK or LSM_ERR_NO_MEMORY or LSM_ERR_INVALID_ARGUMENT.
+ */
+int LSM_DLL_EXPORT lsm_system_fw_version_set(lsm_system *sys,
+ const char *fw_ver);
+
+/**
* Retrieve plugin private data
* @param s System
* @return Optional data, NULL if none exist
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h b/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h
index 5664a92..1d3f278 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/
#ifndef LIBSTORAGEMGMT_SYSTEMS_H
#define LIBSTORAGEMGMT_SYSTEMS_H
@@ -74,6 +77,16 @@ const char LSM_DLL_EXPORT *lsm_system_name_get(lsm_system *s);
*/
uint32_t LSM_DLL_EXPORT lsm_system_status_get(lsm_system *s);

+/**
+ * New in version 1.3. Retrieves firmware version of the specified system.
+ * Do not free returned string, free the struct 'lsm_system' instead.
+ * @param s System to retrieve firmware version for.
+ * @param[out] fw_ver Firmware version string.
+ * @return LSM_ERR_OK on success, or LSM_ERR_NO_SUPPORT, or
+ * LSM_ERR_INVALID_ARGUMENT.
+ */
+int LSM_DLL_EXPORT lsm_system_fw_version_get(lsm_system *s,
+ const char **fw_ver);

#ifdef __cplusplus
}
diff --git a/c_binding/lsm_convert.cpp b/c_binding/lsm_convert.cpp
index 68981c0..ce7c29b 100644
--- a/c_binding/lsm_convert.cpp
+++ b/c_binding/lsm_convert.cpp
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,12 +15,17 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#include "lsm_convert.hpp"
#include "libstoragemgmt/libstoragemgmt_accessgroups.h"
#include "libstoragemgmt/libstoragemgmt_blockrange.h"
#include "libstoragemgmt/libstoragemgmt_nfsexport.h"
+#include "libstoragemgmt/libstoragemgmt_plug_interface.h"
+
+#define _STD_MAP_HAS_KEY(x, y) (x).find((y)) != (x).end()

bool is_expected_object(Value & obj, std::string class_name)
{
@@ -260,6 +266,17 @@ lsm_system *value_to_system(Value & system)
i["status"].asUint32_t(),
i["status_info"].asString().c_str(),
i["plugin_data"].asC_str());
+ if ((rc != NULL) && (_STD_MAP_HAS_KEY(i, "fw_version") == 1) &&
+ (i["fw_version"].asC_str()[0] != '\0')) {
+
+ if (lsm_system_fw_version_set(rc, i["fw_version"].asC_str()) !=
+ LSM_ERR_OK) {
+ lsm_system_record_free(rc);
+ rc= NULL;
+ throw ValueException("value_to_system: failed to update "
+ "fw_version");
+ }
+ }
} else {
throw ValueException("value_to_system: Not correct type");
}
@@ -276,6 +293,8 @@ Value system_to_value(lsm_system * system)
s["status"] = Value(system->status);
s["status_info"] = Value(system->status_info);
s["plugin_data"] = Value(system->plugin_data);
+ if (system->fw_version != NULL)
+ s["fw_version"] = Value(system->fw_version);
return Value(s);
}
return Value();
diff --git a/c_binding/lsm_datatypes.cpp b/c_binding/lsm_datatypes.cpp
index 8218db3..f81f0eb 100644
--- a/c_binding/lsm_datatypes.cpp
+++ b/c_binding/lsm_datatypes.cpp
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#ifndef __cplusplus
@@ -37,6 +40,7 @@
#include "libstoragemgmt/libstoragemgmt_targetport.h"
#include "libstoragemgmt/libstoragemgmt_types.h"
#include "libstoragemgmt/libstoragemgmt_volumes.h"
+#include "libstoragemgmt/libstoragemgmt_plug_interface.h"

#include <string.h>
#include <stdlib.h>
@@ -724,6 +728,7 @@ lsm_system *lsm_system_record_alloc(const char *id, const char *name,
rc->name = strdup(name);
rc->status = status;
rc->status_info = strdup(status_info);
+ rc->fw_version = NULL;

if (plugin_data) {
rc->plugin_data = strdup(plugin_data);
@@ -760,6 +765,9 @@ int lsm_system_record_free(lsm_system * s)

free(s->plugin_data);

+ if (s->fw_version != NULL)
+ free((char *) s->fw_version);
+
free(s);
return LSM_ERR_OK;
}
@@ -775,6 +783,12 @@ lsm_system *lsm_system_record_copy(lsm_system * s)
if (LSM_IS_SYSTEM(s)) {
rc = lsm_system_record_alloc(s->id, s->name, s->status, s->status_info,
s->plugin_data);
+
+ if ((s->fw_version != NULL) &&
+ (lsm_system_fw_version_set(rc, s->fw_version) != LSM_ERR_OK)) {
+ lsm_system_record_free(rc);
+ rc = NULL;
+ }
}
return rc;
}
@@ -803,6 +817,38 @@ uint32_t lsm_system_status_get(lsm_system * s)
return UINT32_MAX;
}

+int lsm_system_fw_version_set(lsm_system *sys, const char *fw_ver)
+{
+ if ((sys == NULL) || (fw_ver == NULL) || (fw_ver[0] == '\0'))
+ return LSM_ERR_INVALID_ARGUMENT;
+
+ if (sys->fw_version != NULL)
+ free((char *) sys->fw_version);
+
+ sys->fw_version = strdup(fw_ver);
+ if (sys->fw_version == NULL)
+ return LSM_ERR_NO_MEMORY;
+
+ return LSM_ERR_OK;
+}
+
+int lsm_system_fw_version_get(lsm_system *s, const char **fw_ver)
+{
+ if ((s == NULL) || (fw_ver == NULL))
+ return LSM_ERR_INVALID_ARGUMENT;
+
+ if (! LSM_IS_SYSTEM(s)) {
+ return LSM_ERR_INVALID_ARGUMENT;
+ }
+
+ *fw_ver = s->fw_version;
+
+ if (s->fw_version[0] != '\0' )
+ return LSM_ERR_OK;
+ else
+ return LSM_ERR_NO_SUPPORT;
+}
+
MEMBER_FUNC_GET(const char *, lsm_system_plugin_data_get, lsm_system * s,
s, LSM_IS_SYSTEM, plugin_data, NULL)

diff --git a/c_binding/lsm_datatypes.hpp b/c_binding/lsm_datatypes.hpp
index 558dce0..02472e3 100644
--- a/c_binding/lsm_datatypes.hpp
+++ b/c_binding/lsm_datatypes.hpp
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#ifndef LSM_DATATYPES_H
@@ -162,6 +165,7 @@ struct _lsm_system {
uint32_t status; /**< Enumerated status value */
char *status_info; /**< System status text */
char *plugin_data; /**< Reserved for the plugin to use */
+ const char *fw_version; /**< Firmware version */
};

#define LSM_CONNECT_MAGIC 0xAA7A000A
--
1.8.3.1
Gris Ge
2015-09-24 14:25:36 UTC
Permalink
* Include firmware version in output of 'lsmcli list --type systems' command.
* Leave that column as empty if not supported.

Signed-off-by: Gris Ge <***@redhat.com>
---
tools/lsmcli/cmdline.py | 2 +-
tools/lsmcli/data_display.py | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/lsmcli/cmdline.py b/tools/lsmcli/cmdline.py
index b2693e4..c66eaf2 100644
--- a/tools/lsmcli/cmdline.py
+++ b/tools/lsmcli/cmdline.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2014 Red Hat, Inc.
+# Copyright (C) 2012-2015 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
diff --git a/tools/lsmcli/data_display.py b/tools/lsmcli/data_display.py
index e4ba6c3..2868b46 100644
--- a/tools/lsmcli/data_display.py
+++ b/tools/lsmcli/data_display.py
@@ -331,6 +331,7 @@ def __init__(self):
SYSTEM_HEADER['name'] = 'Name'
SYSTEM_HEADER['status'] = 'Status'
SYSTEM_HEADER['status_info'] = 'Info'
+ SYSTEM_HEADER['fw_version'] = "FW Ver"

SYSTEM_COLUMN_SKIP_KEYS = []
# XXX_COLUMN_SKIP_KEYS contain a list of property should be skipped when
@@ -632,7 +633,14 @@ def __init__(self):
@staticmethod
def _get_man_pro_value(obj, key, value_conv_enum, value_conv_human,
flag_human, flag_enum):
- value = getattr(obj, key)
+ try:
+ value = getattr(obj, key)
+ except LsmError as lsm_err:
+ if lsm_err.code == ErrorNumber.NO_SUPPORT:
+ value = ''
+ else:
+ raise lsm_err
+
if not flag_enum:
if key in value_conv_enum.keys():
value = value_conv_enum[key](value)
--
1.8.3.1
Gris Ge
2015-09-24 14:25:37 UTC
Permalink
* lsmenv will create link in python_binding/lsm folder to plugin and lsmcli
which cannot detected by bash [ -e $FILE_PATH], fixed by checking 'test -L'
also.

Signed-off-by: Gris Ge <***@redhat.com>
---
test/runtests.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/test/runtests.sh b/test/runtests.sh
index edd008d..8b3c499 100755
--- a/test/runtests.sh
+++ b/test/runtests.sh
@@ -1,6 +1,6 @@
#!/bin/bash

-# Copyright (C) 2011-2014 Red Hat, Inc.
+# Copyright (C) 2011-2015 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -15,6 +15,7 @@
# License along with this library; If not, see <http://www.gnu.org/licenses/>.
#
# Author: tasleson
+# Gris Ge <***@redhat.com>
#
# Unit test case driver

@@ -134,11 +135,11 @@ good "cp $shared_libs/*.so.* $LD_LIBRARY_PATH"
# user account exists.
good "cp -av $lsm_py_folder/lsm $PYTHONPATH/"
# In case the plugin and lsmcli link also copyed.
-if [ -e "$PYTHONPATH/lsm/plugin" ];then
+if [ -e "$PYTHONPATH/lsm/plugin" ] || [ -L "$PYTHONPATH/lsm/plugin" ];then
good "rm $PYTHONPATH/lsm/plugin"
fi
good "cp -av $lsm_plugin_py_folder $PYTHONPATH/lsm/"
-if [ -e "$PYTHONPATH/lsm/lsmcli" ];then
+if [ -e "$PYTHONPATH/lsm/lsmcli" ] || [ -L "$PYTHONPATH/lsm/lsmcli" ];then
good "rm $PYTHONPATH/lsm/lsmcli"
fi
good "cp -av $lsmcli_py_folder $PYTHONPATH/lsm/"
--
1.8.3.1
Gris Ge
2015-09-24 14:25:38 UTC
Permalink
* Added both C and python API test for system firmware version.
* cmdtest.py not touched as existing test for 'lsmcli list --type systems'
covered it.
* Updated license lines and years.

Signed-off-by: Gris Ge <***@redhat.com>
Signed-off-by: Joe Handzik <***@hpe.com>
---
test/plugin_test.py | 15 ++++++++++++++-
test/tester.c | 35 ++++++++++++++++++++++++++++++++++-
2 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/test/plugin_test.py b/test/plugin_test.py
index d91b151..660d7bb 100755
--- a/test/plugin_test.py
+++ b/test/plugin_test.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python2

-# Copyright (C) 2013-2014 Red Hat, Inc.
+# Copyright (C) 2013-2015 Red Hat, Inc.
+# (C) Copyright 2015 Hewlett Packard Enterprise Development LP
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -13,6 +14,10 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: tasleson
+# Joe Handzik <***@hpe.com>
+# Gris Ge <***@redhat.com>

import lsm
import functools
@@ -306,6 +311,14 @@ def test_plugin_info(self):
self.assertTrue(desc is not None and len(desc) > 0)
self.assertTrue(version is not None and len(version) > 0)

+ def test_fw_version_get(self):
+ for s in self.systems:
+ cap = self.c.capabilities(s)
+ if supported(cap, [Cap.SYS_FW_VERSION_GET]):
+ fw_ver = s.fw_version
+ self.assertTrue(fw_ver is not None and len(fw_ver) > 0,
+ "Firmware version retrieval failed")
+
def test_timeout(self):
tmo = 40000
self.c.time_out_set(tmo)
diff --git a/test/tester.c b/test/tester.c
index 8510584..01543bd 100644
--- a/test/tester.c
+++ b/test/tester.c
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#include <stdio.h>
@@ -1960,6 +1963,35 @@ START_TEST(test_plugin_info)
}
END_TEST

+START_TEST(test_system_fw_version)
+{
+ const char *fw_ver = NULL;
+ int rc = 0;
+ lsm_system **sys = NULL;
+ uint32_t sys_count = 0;
+
+ G(rc, lsm_system_list, c, &sys, &sys_count, LSM_CLIENT_FLAG_RSVD);
+ fail_unless( sys_count >= 1, "count = %d", sys_count);
+
+ if(sys_count > 0) {
+
+ G(rc, lsm_system_fw_version_get, sys[0], &fw_ver);
+
+ if( LSM_ERR_OK == rc ) {
+ printf("Firmware version: (%s)\n", fw_ver);
+ }
+
+ rc = lsm_system_fw_version_get(sys[0], NULL);
+ fail_unless(LSM_ERR_INVALID_ARGUMENT == rc, "rc = %d", rc);
+ }
+
+ rc = lsm_system_fw_version_get(NULL, &fw_ver);
+ fail_unless(LSM_ERR_INVALID_ARGUMENT == rc, "rc = %d", rc);
+ lsm_system_record_array_free(sys, sys_count);
+
+}
+END_TEST
+
START_TEST(test_get_available_plugins)
{
int i = 0;
@@ -3045,6 +3077,7 @@ Suite * lsm_suite(void)
tcase_add_test(basic, test_nfs_export_funcs);
tcase_add_test(basic, test_disks);
tcase_add_test(basic, test_plugin_info);
+ tcase_add_test(basic, test_system_fw_version);
tcase_add_test(basic, test_get_available_plugins);
tcase_add_test(basic, test_volume_methods);
tcase_add_test(basic, test_iscsi_auth_in);
--
1.8.3.1
Gris Ge
2015-09-24 14:25:39 UTC
Permalink
* Include data version as system firmware version.
* Updated license year.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/sim/simarray.py | 2 +-
plugin/sim/simulator.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugin/sim/simarray.py b/plugin/sim/simarray.py
index b6ff80c..4fc2087 100644
--- a/plugin/sim/simarray.py
+++ b/plugin/sim/simarray.py
@@ -1725,7 +1725,7 @@ def time_out_get(self, flags=0):
def _sim_sys_2_lsm(sim_sys):
return System(
sim_sys['id'], sim_sys['name'], sim_sys['status'],
- sim_sys['status_info'])
+ sim_sys['status_info'], _fw_version=sim_sys["version"])

@_handle_errors
def systems(self):
diff --git a/plugin/sim/simulator.py b/plugin/sim/simulator.py
index 052c48d..cdec8f3 100644
--- a/plugin/sim/simulator.py
+++ b/plugin/sim/simulator.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2014 Red Hat, Inc.
+# Copyright (C) 2011-2015 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
--
1.8.3.1
Gris Ge
2015-09-24 14:25:40 UTC
Permalink
* Simply use static variable `version` as firmware version.
* Updated license year.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/simc/simc_lsmplugin.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugin/simc/simc_lsmplugin.c b/plugin/simc/simc_lsmplugin.c
index 4c8c505..4403414 100644
--- a/plugin/simc/simc_lsmplugin.c
+++ b/plugin/simc/simc_lsmplugin.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -2285,6 +2285,7 @@ int load(lsm_plugin_ptr c, const char *uri, const char *password,
"LSM simulated storage plug-in",
LSM_SYSTEM_STATUS_OK, "",
NULL);
+ lsm_system_fw_version_set(pd->system[0], version);

p = lsm_pool_record_alloc("POOL_3", "lsm_test_aggr",
LSM_POOL_ELEMENT_TYPE_FS |
--
1.8.3.1
Gris Ge
2015-09-24 14:25:41 UTC
Permalink
* Use 'Firmware Version' entry from 'hpssacli ctrl all show detail' command
output.

* Included HP Enterprise Development LP license line.
* Included Joe Handzik in author list.

Signed-off-by: Gris Ge <***@redhat.com>
Signed-off-by: Joe Handzik <***@hpe.com>
---
plugin/hpsa/hpsa.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugin/hpsa/hpsa.py b/plugin/hpsa/hpsa.py
index 9c49cbe..b92cbdf 100644
--- a/plugin/hpsa/hpsa.py
+++ b/plugin/hpsa/hpsa.py
@@ -1,4 +1,5 @@
# Copyright (C) 2015 Red Hat, Inc.
+# (C) Copyright 2015 Hewlett Packard Enterprise Development LP
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -13,6 +14,7 @@
# License along with this library; If not, see <http://www.gnu.org/licenses/>.
#
# Author: Gris Ge <***@redhat.com>
+# Joe Handzik <***@hpe.com>

import os
import errno
@@ -324,6 +326,7 @@ def capabilities(self, system, flags=Client.FLAG_RSVD):
cap.set(Capabilities.VOLUME_RAID_INFO)
cap.set(Capabilities.POOL_MEMBER_INFO)
cap.set(Capabilities.VOLUME_RAID_CREATE)
+ cap.set(Capabilities.SYS_FW_VERSION_GET)
return cap

def _sacli_exec(self, sacli_cmds, flag_convert=True):
@@ -366,9 +369,10 @@ def systems(self, flags=0):
(status, status_info) = _sys_status_of(ctrl_all_status[ctrl_name])

plugin_data = "%s" % ctrl_data['Slot']
+ fw_ver = "%s" % ctrl_data['Firmware Version']

- rc_lsm_syss.append(
- System(sys_id, ctrl_name, status, status_info, plugin_data))
+ rc_lsm_syss.append(System(sys_id, ctrl_name, status, status_info,
+ plugin_data, _fw_version=fw_ver))

return rc_lsm_syss
--
1.8.3.1
Gris Ge
2015-09-24 14:25:42 UTC
Permalink
* Remove firmware version from system name.
* Include these values in system firmware version:
* Firmware Package Build:
Version string of download firmware file.
* BIOS Version:
PCI card optional BIOS version.
* Firmware Version:
Real MegaRAID firmware version.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/megaraid/megaraid.py | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/plugin/megaraid/megaraid.py b/plugin/megaraid/megaraid.py
index 3a41c78..d06283a 100644
--- a/plugin/megaraid/megaraid.py
+++ b/plugin/megaraid/megaraid.py
@@ -366,20 +366,24 @@ def systems(self, flags=Client.FLAG_RSVD):
ctrl_show_all_output = self._storcli_exec(
["/c%d" % ctrl_num, "show", "all"])
sys_id = self._sys_id_of_ctrl_num(ctrl_num, ctrl_show_all_output)
- sys_name = "%s %s %s ver: %s" % (
+ sys_name = "%s %s %s" % (
ctrl_show_all_output['Basics']['Model'],
ctrl_show_all_output['Bus']['Host Interface'],
- ctrl_show_all_output['Basics']['PCI Address'],
- ctrl_show_all_output['Version']['Firmware Package Build'],
- )
+ ctrl_show_all_output['Basics']['PCI Address'])
(status, status_info) = self._lsm_status_of_ctrl(
ctrl_show_all_output)
plugin_data = "/c%d" % ctrl_num
# Since PCI slot sequence might change.
# This string just stored for quick system verification.

+ fw_ver = "Package: %s, BIOS: %s, FW: %s" % (
+ ctrl_show_all_output["Version"]["Firmware Package Build"],
+ ctrl_show_all_output["Version"]["Bios Version"],
+ ctrl_show_all_output["Version"]["Firmware Version"])
+
rc_lsm_syss.append(
- System(sys_id, sys_name, status, status_info, plugin_data))
+ System(sys_id, sys_name, status, status_info, plugin_data,
+ _fw_version=fw_ver))

return rc_lsm_syss
--
1.8.3.1
Gris Ge
2015-09-24 14:25:43 UTC
Permalink
Signed-off-by: Gris Ge <***@redhat.com>
---
AUTHORS | 1 +
1 file changed, 1 insertion(+)

diff --git a/AUTHORS b/AUTHORS
index 9fbf913..2137a2b 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -26,6 +26,7 @@ Patches have also been contributed by:
Ma Shimiao <***@cn.fujitsu.com>
Ewan Milne <***@redhat.com>
Charles Rose <***@gmail.com>
+ Joe Handzik <***@hpe.com>


[....send patches to get your name here....]
--
1.8.3.1
Gris Ge
2015-09-29 13:53:40 UTC
Permalink
* Update version in configure.ac to 1.3.

Signed-off-by: Gris Ge <***@redhat.com>
---
configure.ac | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configure.ac b/configure.ac
index 204d858..beae390 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,9 +1,9 @@
dnl Process this file with autoconf to produce a configure script.
-dnl Copyright (C) 2011 Red Hat, Inc.
+dnl Copyright (C) 2011-2015 Red Hat, Inc.
dnl See COPYING.LIB for the License of this software

AC_INIT(
- [libstoragemgmt], [1.2.3], [libstoragemgmt-***@lists.fedorahosted.org],
+ [libstoragemgmt], [1.3.0], [libstoragemgmt-***@lists.fedorahosted.org],
[], [https://github.com/libstorage/libstoragemgmt/])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_AUX_DIR([build-aux])
--
1.8.3.1
Gris Ge
2015-09-29 13:53:41 UTC
Permalink
Plugin method:
* int lsm_system_fw_version_set(lsm_system *s, const char *fw_ver);

Client method:
* int lsm_system_fw_version_get(lsm_system *s, const char **fw_ver);

New capability:
* LSM_CAP_SYS_FW_VERSION_GET

Misc:
* Update license:
* Bump the year number to 2015.
* Add "Hewlett Packard Enterprise Development LP" license line.
* Add Joe Handzik to author list.

Signed-off-by: Joe Handzik <***@hpe.com>
Signed-off-by: Gris Ge <***@redhat.com>
---
.../libstoragemgmt/libstoragemgmt_capabilities.h | 7 +++-
.../libstoragemgmt/libstoragemgmt_plug_interface.h | 19 +++++++--
.../libstoragemgmt/libstoragemgmt_systems.h | 15 ++++++-
c_binding/lsm_convert.cpp | 21 +++++++++-
c_binding/lsm_datatypes.cpp | 48 +++++++++++++++++++++-
c_binding/lsm_datatypes.hpp | 6 ++-
6 files changed, 108 insertions(+), 8 deletions(-)

diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h b/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
index 4d0c351..6f81450 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_capabilities.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#ifndef LSM_CAPABILITIES_H
@@ -152,6 +155,8 @@ typedef enum {
LSM_CAP_EXPORT_CUSTOM_PATH = 124,
/**^ Plug-in allows user to define custome export path */

+ LSM_CAP_SYS_FW_VERSION_GET = 160,
+ /**^ Plug-in allows user to retrieve storage firmware version */
LSM_CAP_POOLS_QUICK_SEARCH = 210,
/**^ Seach occurs on array */
LSM_CAP_VOLUMES_QUICK_SEARCH = 211,
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h b/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
index 763c278..7dc4497 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_plug_interface.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#ifndef LIBSTORAGEMGMT_PLUG_INTERFACE_H
@@ -980,8 +983,6 @@ typedef int (*lsm_plug_volume_raid_create) (lsm_plugin_ptr c,

/** \struct lsm_ops_v1_2
* \brief Functions added in version 1.2
- * NOTE: This structure will change during the developement util version 1.2
- * released.
*/
struct lsm_ops_v1_2 {
lsm_plug_volume_raid_info vol_raid_info;
@@ -1249,6 +1250,18 @@ lsm_system LSM_DLL_EXPORT *lsm_system_record_alloc(const char *id,
const char *plugin_data);

/**
+ * New in version 1.3. Set firmware version.
+ * @param[in] id Id
+ * @param[in] sys System to update.
+ * @param[in] fw_ver Firmware version string.
+ * Caller will get LSM_ERR_INVALID_ARGUMENT for
+ * empty string('\0').
+ * @return LSM_ERR_OK or LSM_ERR_NO_MEMORY or LSM_ERR_INVALID_ARGUMENT.
+ */
+int LSM_DLL_EXPORT lsm_system_fw_version_set(lsm_system *sys,
+ const char *fw_ver);
+
+/**
* Retrieve plugin private data
* @param s System
* @return Optional data, NULL if none exist
diff --git a/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h b/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h
index 5664a92..1d3f278 100644
--- a/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h
+++ b/c_binding/include/libstoragemgmt/libstoragemgmt_systems.h
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/
#ifndef LIBSTORAGEMGMT_SYSTEMS_H
#define LIBSTORAGEMGMT_SYSTEMS_H
@@ -74,6 +77,16 @@ const char LSM_DLL_EXPORT *lsm_system_name_get(lsm_system *s);
*/
uint32_t LSM_DLL_EXPORT lsm_system_status_get(lsm_system *s);

+/**
+ * New in version 1.3. Retrieves firmware version of the specified system.
+ * Do not free returned string, free the struct 'lsm_system' instead.
+ * @param s System to retrieve firmware version for.
+ * @param[out] fw_ver Firmware version string.
+ * @return LSM_ERR_OK on success, or LSM_ERR_NO_SUPPORT, or
+ * LSM_ERR_INVALID_ARGUMENT.
+ */
+int LSM_DLL_EXPORT lsm_system_fw_version_get(lsm_system *s,
+ const char **fw_ver);

#ifdef __cplusplus
}
diff --git a/c_binding/lsm_convert.cpp b/c_binding/lsm_convert.cpp
index 68981c0..ce7c29b 100644
--- a/c_binding/lsm_convert.cpp
+++ b/c_binding/lsm_convert.cpp
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,12 +15,17 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#include "lsm_convert.hpp"
#include "libstoragemgmt/libstoragemgmt_accessgroups.h"
#include "libstoragemgmt/libstoragemgmt_blockrange.h"
#include "libstoragemgmt/libstoragemgmt_nfsexport.h"
+#include "libstoragemgmt/libstoragemgmt_plug_interface.h"
+
+#define _STD_MAP_HAS_KEY(x, y) (x).find((y)) != (x).end()

bool is_expected_object(Value & obj, std::string class_name)
{
@@ -260,6 +266,17 @@ lsm_system *value_to_system(Value & system)
i["status"].asUint32_t(),
i["status_info"].asString().c_str(),
i["plugin_data"].asC_str());
+ if ((rc != NULL) && (_STD_MAP_HAS_KEY(i, "fw_version") == 1) &&
+ (i["fw_version"].asC_str()[0] != '\0')) {
+
+ if (lsm_system_fw_version_set(rc, i["fw_version"].asC_str()) !=
+ LSM_ERR_OK) {
+ lsm_system_record_free(rc);
+ rc= NULL;
+ throw ValueException("value_to_system: failed to update "
+ "fw_version");
+ }
+ }
} else {
throw ValueException("value_to_system: Not correct type");
}
@@ -276,6 +293,8 @@ Value system_to_value(lsm_system * system)
s["status"] = Value(system->status);
s["status_info"] = Value(system->status_info);
s["plugin_data"] = Value(system->plugin_data);
+ if (system->fw_version != NULL)
+ s["fw_version"] = Value(system->fw_version);
return Value(s);
}
return Value();
diff --git a/c_binding/lsm_datatypes.cpp b/c_binding/lsm_datatypes.cpp
index 8218db3..f81f0eb 100644
--- a/c_binding/lsm_datatypes.cpp
+++ b/c_binding/lsm_datatypes.cpp
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#ifndef __cplusplus
@@ -37,6 +40,7 @@
#include "libstoragemgmt/libstoragemgmt_targetport.h"
#include "libstoragemgmt/libstoragemgmt_types.h"
#include "libstoragemgmt/libstoragemgmt_volumes.h"
+#include "libstoragemgmt/libstoragemgmt_plug_interface.h"

#include <string.h>
#include <stdlib.h>
@@ -724,6 +728,7 @@ lsm_system *lsm_system_record_alloc(const char *id, const char *name,
rc->name = strdup(name);
rc->status = status;
rc->status_info = strdup(status_info);
+ rc->fw_version = NULL;

if (plugin_data) {
rc->plugin_data = strdup(plugin_data);
@@ -760,6 +765,9 @@ int lsm_system_record_free(lsm_system * s)

free(s->plugin_data);

+ if (s->fw_version != NULL)
+ free((char *) s->fw_version);
+
free(s);
return LSM_ERR_OK;
}
@@ -775,6 +783,12 @@ lsm_system *lsm_system_record_copy(lsm_system * s)
if (LSM_IS_SYSTEM(s)) {
rc = lsm_system_record_alloc(s->id, s->name, s->status, s->status_info,
s->plugin_data);
+
+ if ((s->fw_version != NULL) &&
+ (lsm_system_fw_version_set(rc, s->fw_version) != LSM_ERR_OK)) {
+ lsm_system_record_free(rc);
+ rc = NULL;
+ }
}
return rc;
}
@@ -803,6 +817,38 @@ uint32_t lsm_system_status_get(lsm_system * s)
return UINT32_MAX;
}

+int lsm_system_fw_version_set(lsm_system *sys, const char *fw_ver)
+{
+ if ((sys == NULL) || (fw_ver == NULL) || (fw_ver[0] == '\0'))
+ return LSM_ERR_INVALID_ARGUMENT;
+
+ if (sys->fw_version != NULL)
+ free((char *) sys->fw_version);
+
+ sys->fw_version = strdup(fw_ver);
+ if (sys->fw_version == NULL)
+ return LSM_ERR_NO_MEMORY;
+
+ return LSM_ERR_OK;
+}
+
+int lsm_system_fw_version_get(lsm_system *s, const char **fw_ver)
+{
+ if ((s == NULL) || (fw_ver == NULL))
+ return LSM_ERR_INVALID_ARGUMENT;
+
+ if (! LSM_IS_SYSTEM(s)) {
+ return LSM_ERR_INVALID_ARGUMENT;
+ }
+
+ *fw_ver = s->fw_version;
+
+ if (s->fw_version[0] != '\0' )
+ return LSM_ERR_OK;
+ else
+ return LSM_ERR_NO_SUPPORT;
+}
+
MEMBER_FUNC_GET(const char *, lsm_system_plugin_data_get, lsm_system * s,
s, LSM_IS_SYSTEM, plugin_data, NULL)

diff --git a/c_binding/lsm_datatypes.hpp b/c_binding/lsm_datatypes.hpp
index 558dce0..02472e3 100644
--- a/c_binding/lsm_datatypes.hpp
+++ b/c_binding/lsm_datatypes.hpp
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#ifndef LSM_DATATYPES_H
@@ -162,6 +165,7 @@ struct _lsm_system {
uint32_t status; /**< Enumerated status value */
char *status_info; /**< System status text */
char *plugin_data; /**< Reserved for the plugin to use */
+ const char *fw_version; /**< Firmware version */
};

#define LSM_CONNECT_MAGIC 0xAA7A000A
--
1.8.3.1
Gris Ge
2015-09-29 13:53:42 UTC
Permalink
Plugin:
lsm.System(..., _fw_version="1.2.3")

Client:
lsm.System.fw_version

Capability:
lsm.Capability.SYS_FW_VERSION_GET

Misc:
* Update Red Hat license line.
* Include HP Enterprise Development license line.
* Add Joe Handzik and Gris Ge to author list.

Signed-off-by: Gris Ge <***@redhat.com>
Signed-off-by: Joe Handzik <***@hpe.com>
---
python_binding/lsm/_data.py | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/python_binding/lsm/_data.py b/python_binding/lsm/_data.py
index 21767b2..f4b3be8 100644
--- a/python_binding/lsm/_data.py
+++ b/python_binding/lsm/_data.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2014 Red Hat, Inc.
+# Copyright (C) 2011-2015 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -357,12 +357,27 @@ class System(IData):
STATUS_PREDICTIVE_FAILURE = 1 << 4
STATUS_OTHER = 1 << 5

- def __init__(self, _id, _name, _status, _status_info, _plugin_data=None):
+ def __init__(self, _id, _name, _status, _status_info, _plugin_data=None,
+ _fw_version=''):
self._id = _id
self._name = _name
self._status = _status
self._status_info = _status_info
self._plugin_data = _plugin_data
+ self._fw_version = _fw_version
+
+ @property
+ def fw_version(self):
+ """
+ String. Firmware version string. New in version 1.3.
+ On some system, it might contain multiple version strings, example:
+ "Package: 23.32.0-0009, FW: 3.440.05-3712"
+ """
+ if self._fw_version == '':
+ raise LsmError(ErrorNumber.NO_SUPPORT,
+ "System.fw_version() is not supported by this "
+ "plugin yet")
+ return self._fw_version


@default_property('id', doc="Unique identifier")
@@ -750,6 +765,8 @@ class Capabilities(IData):
EXPORT_REMOVE = 123
EXPORT_CUSTOM_PATH = 124

+ SYS_FW_VERSION_GET = 160
+
POOLS_QUICK_SEARCH = 210
VOLUMES_QUICK_SEARCH = 211
DISKS_QUICK_SEARCH = 212
--
1.8.3.1
Gris Ge
2015-09-29 13:53:43 UTC
Permalink
* Include firmware version in output of 'lsmcli list --type systems' command.
* Leave that column as empty if not supported.

Signed-off-by: Gris Ge <***@redhat.com>
---
tools/lsmcli/cmdline.py | 2 +-
tools/lsmcli/data_display.py | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/tools/lsmcli/cmdline.py b/tools/lsmcli/cmdline.py
index b2693e4..c66eaf2 100644
--- a/tools/lsmcli/cmdline.py
+++ b/tools/lsmcli/cmdline.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2012-2014 Red Hat, Inc.
+# Copyright (C) 2012-2015 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
diff --git a/tools/lsmcli/data_display.py b/tools/lsmcli/data_display.py
index e4ba6c3..2868b46 100644
--- a/tools/lsmcli/data_display.py
+++ b/tools/lsmcli/data_display.py
@@ -331,6 +331,7 @@ def __init__(self):
SYSTEM_HEADER['name'] = 'Name'
SYSTEM_HEADER['status'] = 'Status'
SYSTEM_HEADER['status_info'] = 'Info'
+ SYSTEM_HEADER['fw_version'] = "FW Ver"

SYSTEM_COLUMN_SKIP_KEYS = []
# XXX_COLUMN_SKIP_KEYS contain a list of property should be skipped when
@@ -632,7 +633,14 @@ def __init__(self):
@staticmethod
def _get_man_pro_value(obj, key, value_conv_enum, value_conv_human,
flag_human, flag_enum):
- value = getattr(obj, key)
+ try:
+ value = getattr(obj, key)
+ except LsmError as lsm_err:
+ if lsm_err.code == ErrorNumber.NO_SUPPORT:
+ value = ''
+ else:
+ raise lsm_err
+
if not flag_enum:
if key in value_conv_enum.keys():
value = value_conv_enum[key](value)
--
1.8.3.1
Gris Ge
2015-09-29 13:53:44 UTC
Permalink
* lsmenv will create link in python_binding/lsm folder to plugin and lsmcli
which cannot detected by bash [ -e $FILE_PATH], fixed by checking 'test -L'
also.

Signed-off-by: Gris Ge <***@redhat.com>
---
test/runtests.sh | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/test/runtests.sh b/test/runtests.sh
index edd008d..8b3c499 100755
--- a/test/runtests.sh
+++ b/test/runtests.sh
@@ -1,6 +1,6 @@
#!/bin/bash

-# Copyright (C) 2011-2014 Red Hat, Inc.
+# Copyright (C) 2011-2015 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -15,6 +15,7 @@
# License along with this library; If not, see <http://www.gnu.org/licenses/>.
#
# Author: tasleson
+# Gris Ge <***@redhat.com>
#
# Unit test case driver

@@ -134,11 +135,11 @@ good "cp $shared_libs/*.so.* $LD_LIBRARY_PATH"
# user account exists.
good "cp -av $lsm_py_folder/lsm $PYTHONPATH/"
# In case the plugin and lsmcli link also copyed.
-if [ -e "$PYTHONPATH/lsm/plugin" ];then
+if [ -e "$PYTHONPATH/lsm/plugin" ] || [ -L "$PYTHONPATH/lsm/plugin" ];then
good "rm $PYTHONPATH/lsm/plugin"
fi
good "cp -av $lsm_plugin_py_folder $PYTHONPATH/lsm/"
-if [ -e "$PYTHONPATH/lsm/lsmcli" ];then
+if [ -e "$PYTHONPATH/lsm/lsmcli" ] || [ -L "$PYTHONPATH/lsm/lsmcli" ];then
good "rm $PYTHONPATH/lsm/lsmcli"
fi
good "cp -av $lsmcli_py_folder $PYTHONPATH/lsm/"
--
1.8.3.1
Gris Ge
2015-09-29 13:53:45 UTC
Permalink
* Added both C and python API test for system firmware version.
* cmdtest.py not touched as existing test for 'lsmcli list --type systems'
covered it.
* Updated license lines and years.

Signed-off-by: Gris Ge <***@redhat.com>
Signed-off-by: Joe Handzik <***@hpe.com>
---
test/plugin_test.py | 15 ++++++++++++++-
test/tester.c | 35 ++++++++++++++++++++++++++++++++++-
2 files changed, 48 insertions(+), 2 deletions(-)

diff --git a/test/plugin_test.py b/test/plugin_test.py
index d91b151..660d7bb 100755
--- a/test/plugin_test.py
+++ b/test/plugin_test.py
@@ -1,6 +1,7 @@
#!/usr/bin/env python2

-# Copyright (C) 2013-2014 Red Hat, Inc.
+# Copyright (C) 2013-2015 Red Hat, Inc.
+# (C) Copyright 2015 Hewlett Packard Enterprise Development LP
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -13,6 +14,10 @@
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; If not, see <http://www.gnu.org/licenses/>.
+#
+# Author: tasleson
+# Joe Handzik <***@hpe.com>
+# Gris Ge <***@redhat.com>

import lsm
import functools
@@ -306,6 +311,14 @@ def test_plugin_info(self):
self.assertTrue(desc is not None and len(desc) > 0)
self.assertTrue(version is not None and len(version) > 0)

+ def test_fw_version_get(self):
+ for s in self.systems:
+ cap = self.c.capabilities(s)
+ if supported(cap, [Cap.SYS_FW_VERSION_GET]):
+ fw_ver = s.fw_version
+ self.assertTrue(fw_ver is not None and len(fw_ver) > 0,
+ "Firmware version retrieval failed")
+
def test_timeout(self):
tmo = 40000
self.c.time_out_set(tmo)
diff --git a/test/tester.c b/test/tester.c
index 8510584..01543bd 100644
--- a/test/tester.c
+++ b/test/tester.c
@@ -1,5 +1,6 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
+ * (C) Copyright 2015 Hewlett Packard Enterprise Development LP
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -14,6 +15,8 @@
* License along with this library; If not, see <http://www.gnu.org/licenses/>.
*
* Author: tasleson
+ * Joe Handzik <***@hpe.com>
+ * Gris Ge <***@redhat.com>
*/

#include <stdio.h>
@@ -1960,6 +1963,35 @@ START_TEST(test_plugin_info)
}
END_TEST

+START_TEST(test_system_fw_version)
+{
+ const char *fw_ver = NULL;
+ int rc = 0;
+ lsm_system **sys = NULL;
+ uint32_t sys_count = 0;
+
+ G(rc, lsm_system_list, c, &sys, &sys_count, LSM_CLIENT_FLAG_RSVD);
+ fail_unless( sys_count >= 1, "count = %d", sys_count);
+
+ if(sys_count > 0) {
+
+ G(rc, lsm_system_fw_version_get, sys[0], &fw_ver);
+
+ if( LSM_ERR_OK == rc ) {
+ printf("Firmware version: (%s)\n", fw_ver);
+ }
+
+ rc = lsm_system_fw_version_get(sys[0], NULL);
+ fail_unless(LSM_ERR_INVALID_ARGUMENT == rc, "rc = %d", rc);
+ }
+
+ rc = lsm_system_fw_version_get(NULL, &fw_ver);
+ fail_unless(LSM_ERR_INVALID_ARGUMENT == rc, "rc = %d", rc);
+ lsm_system_record_array_free(sys, sys_count);
+
+}
+END_TEST
+
START_TEST(test_get_available_plugins)
{
int i = 0;
@@ -3045,6 +3077,7 @@ Suite * lsm_suite(void)
tcase_add_test(basic, test_nfs_export_funcs);
tcase_add_test(basic, test_disks);
tcase_add_test(basic, test_plugin_info);
+ tcase_add_test(basic, test_system_fw_version);
tcase_add_test(basic, test_get_available_plugins);
tcase_add_test(basic, test_volume_methods);
tcase_add_test(basic, test_iscsi_auth_in);
--
1.8.3.1
Gris Ge
2015-09-29 13:53:46 UTC
Permalink
* Include data version as system firmware version.
* Updated license year.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/sim/simarray.py | 2 +-
plugin/sim/simulator.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugin/sim/simarray.py b/plugin/sim/simarray.py
index b6ff80c..4fc2087 100644
--- a/plugin/sim/simarray.py
+++ b/plugin/sim/simarray.py
@@ -1725,7 +1725,7 @@ def time_out_get(self, flags=0):
def _sim_sys_2_lsm(sim_sys):
return System(
sim_sys['id'], sim_sys['name'], sim_sys['status'],
- sim_sys['status_info'])
+ sim_sys['status_info'], _fw_version=sim_sys["version"])

@_handle_errors
def systems(self):
diff --git a/plugin/sim/simulator.py b/plugin/sim/simulator.py
index 052c48d..cdec8f3 100644
--- a/plugin/sim/simulator.py
+++ b/plugin/sim/simulator.py
@@ -1,4 +1,4 @@
-# Copyright (C) 2011-2014 Red Hat, Inc.
+# Copyright (C) 2011-2015 Red Hat, Inc.
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
--
1.8.3.1
Gris Ge
2015-09-29 13:53:47 UTC
Permalink
* Simply use static variable `version` as firmware version.
* Updated license year.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/simc/simc_lsmplugin.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/plugin/simc/simc_lsmplugin.c b/plugin/simc/simc_lsmplugin.c
index 4c8c505..4403414 100644
--- a/plugin/simc/simc_lsmplugin.c
+++ b/plugin/simc/simc_lsmplugin.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2011-2014 Red Hat, Inc.
+ * Copyright (C) 2011-2015 Red Hat, Inc.
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
@@ -2285,6 +2285,7 @@ int load(lsm_plugin_ptr c, const char *uri, const char *password,
"LSM simulated storage plug-in",
LSM_SYSTEM_STATUS_OK, "",
NULL);
+ lsm_system_fw_version_set(pd->system[0], version);

p = lsm_pool_record_alloc("POOL_3", "lsm_test_aggr",
LSM_POOL_ELEMENT_TYPE_FS |
--
1.8.3.1
Gris Ge
2015-09-29 13:53:48 UTC
Permalink
* Use 'Firmware Version' entry from 'hpssacli ctrl all show detail' command
output.

* Included HP Enterprise Development LP license line.
* Included Joe Handzik in author list.

Signed-off-by: Gris Ge <***@redhat.com>
Signed-off-by: Joe Handzik <***@hpe.com>
---
plugin/hpsa/hpsa.py | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/plugin/hpsa/hpsa.py b/plugin/hpsa/hpsa.py
index 9c49cbe..b92cbdf 100644
--- a/plugin/hpsa/hpsa.py
+++ b/plugin/hpsa/hpsa.py
@@ -1,4 +1,5 @@
# Copyright (C) 2015 Red Hat, Inc.
+# (C) Copyright 2015 Hewlett Packard Enterprise Development LP
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
@@ -13,6 +14,7 @@
# License along with this library; If not, see <http://www.gnu.org/licenses/>.
#
# Author: Gris Ge <***@redhat.com>
+# Joe Handzik <***@hpe.com>

import os
import errno
@@ -324,6 +326,7 @@ def capabilities(self, system, flags=Client.FLAG_RSVD):
cap.set(Capabilities.VOLUME_RAID_INFO)
cap.set(Capabilities.POOL_MEMBER_INFO)
cap.set(Capabilities.VOLUME_RAID_CREATE)
+ cap.set(Capabilities.SYS_FW_VERSION_GET)
return cap

def _sacli_exec(self, sacli_cmds, flag_convert=True):
@@ -366,9 +369,10 @@ def systems(self, flags=0):
(status, status_info) = _sys_status_of(ctrl_all_status[ctrl_name])

plugin_data = "%s" % ctrl_data['Slot']
+ fw_ver = "%s" % ctrl_data['Firmware Version']

- rc_lsm_syss.append(
- System(sys_id, ctrl_name, status, status_info, plugin_data))
+ rc_lsm_syss.append(System(sys_id, ctrl_name, status, status_info,
+ plugin_data, _fw_version=fw_ver))

return rc_lsm_syss
--
1.8.3.1
Gris Ge
2015-09-29 13:53:49 UTC
Permalink
* Remove firmware version from system name.
* Include these values in system firmware version:
* Firmware Package Build:
Version string of download firmware file.
* BIOS Version:
PCI card optional BIOS version.
* Firmware Version:
Real MegaRAID firmware version.

Signed-off-by: Gris Ge <***@redhat.com>
---
plugin/megaraid/megaraid.py | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/plugin/megaraid/megaraid.py b/plugin/megaraid/megaraid.py
index 3a41c78..d06283a 100644
--- a/plugin/megaraid/megaraid.py
+++ b/plugin/megaraid/megaraid.py
@@ -366,20 +366,24 @@ def systems(self, flags=Client.FLAG_RSVD):
ctrl_show_all_output = self._storcli_exec(
["/c%d" % ctrl_num, "show", "all"])
sys_id = self._sys_id_of_ctrl_num(ctrl_num, ctrl_show_all_output)
- sys_name = "%s %s %s ver: %s" % (
+ sys_name = "%s %s %s" % (
ctrl_show_all_output['Basics']['Model'],
ctrl_show_all_output['Bus']['Host Interface'],
- ctrl_show_all_output['Basics']['PCI Address'],
- ctrl_show_all_output['Version']['Firmware Package Build'],
- )
+ ctrl_show_all_output['Basics']['PCI Address'])
(status, status_info) = self._lsm_status_of_ctrl(
ctrl_show_all_output)
plugin_data = "/c%d" % ctrl_num
# Since PCI slot sequence might change.
# This string just stored for quick system verification.

+ fw_ver = "Package: %s, BIOS: %s, FW: %s" % (
+ ctrl_show_all_output["Version"]["Firmware Package Build"],
+ ctrl_show_all_output["Version"]["Bios Version"],
+ ctrl_show_all_output["Version"]["Firmware Version"])
+
rc_lsm_syss.append(
- System(sys_id, sys_name, status, status_info, plugin_data))
+ System(sys_id, sys_name, status, status_info, plugin_data,
+ _fw_version=fw_ver))

return rc_lsm_syss
--
1.8.3.1
Gris Ge
2015-09-29 13:53:50 UTC
Permalink
Signed-off-by: Gris Ge <***@redhat.com>
---
AUTHORS | 1 +
1 file changed, 1 insertion(+)

diff --git a/AUTHORS b/AUTHORS
index 9fbf913..2137a2b 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -26,6 +26,7 @@ Patches have also been contributed by:
Ma Shimiao <***@cn.fujitsu.com>
Ewan Milne <***@redhat.com>
Charles Rose <***@gmail.com>
+ Joe Handzik <***@hpe.com>


[....send patches to get your name here....]
--
1.8.3.1
Loading...