Skip to content

Commit

Permalink
Merge pull request #101 from dell/92/performance_ci_changes
Browse files Browse the repository at this point in the history
92/Performance CI Enhancements for Thresholds
  • Loading branch information
Michael McAleer authored Oct 21, 2020
2 parents 8801d97 + fb039f7 commit 59c201a
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 21 deletions.
19 changes: 17 additions & 2 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
PyU4V Change Log
================

Version 9.2.0.2 - released 14/10/20
===================================
- When generating threshold CSV files from
PerformanceFunctions.generate_threshold_settings_csv it is now possible to
set category as an input value to limit the CSV threshold file to only that
performance category.
- CI tests for thresholds have been updated to target a default threshold
marked as KPI to ensure it has both first and second threshold values
populated before the test runs.
- Removed trailing white space from two performance metrics in the metric map,
'BEDisk ReadResponseTime ' is now 'BEDiskReadResponseTime' in diagnostic
category 'DeviceGroup', and, 'BEReadRequestTime ' is now 'BEReadRequestTime'
in category 'StorageContainer'.


Version 9.2.0.1 - released 12/10/20
===================================
-Tighten base CI tests around RDF group creation and deletion.
-Update Unisphere minimum version to reflect 9.2 GA Unisphere version.
- Tighten base CI tests around RDF group creation and deletion.
- Update Unisphere minimum version to reflect 9.2 GA Unisphere version.


Version 9.2.0.0 - released 29/09/20
Expand Down
2 changes: 1 addition & 1 deletion PyU4V/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from .univmax_conn import U4VConn # noqa: F401

__title__ = 'pyu4v'
__version__ = '9.2.0.1'
__version__ = '9.2.0.2'
__author__ = 'Dell EMC or its subsidiaries'
__license__ = 'Apache 2.0'
__copyright__ = 'Copyright 2020 Dell EMC Inc'
14 changes: 12 additions & 2 deletions PyU4V/performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,16 +902,18 @@ def update_threshold_settings(
resource_type=pc.UPDATE, resource_type_id=category,
payload=payload)

def generate_threshold_settings_csv(self, output_csv_path):
def generate_threshold_settings_csv(self, output_csv_path, category=None):
"""Generate a csv file with threshold settings.
Creates a CSV file with current alert configuration for the given
unisphere instance category, metric, first_threshold, second_threshold,
alert_user, kpi.
:param output_csv_path: filename for CSV to be generated -- str
:param category: threshold specific category -- str
"""
category_list = self.get_threshold_categories()
category_list = (
self.get_threshold_categories() if not category else [category])
data_for_csv = list()
data_for_csv.append([pc.CATEGORY, pc.METRIC, pc.FIRST_THRESH,
pc.SEC_THRESH, pc.ALERT_ERR, pc.KPI])
Expand Down Expand Up @@ -969,6 +971,14 @@ def _str_to_bool(str_in):
for i in range(0, len(metric_list)):
if not _str_to_bool(is_kpi[i]) and kpi_only:
continue
if int(f_threshold_list[i]) >= int(s_threshold_list[i]):
LOG.warning(
'Not setting performance metric {m} threshold, second '
'threshold value {f} must be greater than first threshold '
'value {s}.'.format(
m=metric_list[i], f=f_threshold_list[i],
s=s_threshold_list[i]))
continue
self.update_threshold_settings(
category=category_list[i], metric=metric_list[i],
alert=notify_list[i], first_threshold=f_threshold_list[i],
Expand Down
12 changes: 6 additions & 6 deletions PyU4V/tests/ci_tests/test_pyu4v_ci_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def test_set_perf_threshold_and_alert(self):

def test_update_threshold_settings(self):
"""Test set_perf_threshold_and_alert."""
metric = 'ReadResponseTime'
metric = 'PercentCacheWP'
alert, f_threshold, s_threshold = None, None, None

cat_thresh_settings = self.perf.get_threshold_category_settings(
Expand Down Expand Up @@ -466,23 +466,23 @@ def test_set_thresholds_from_csv(self):
csv_file_name = 'test.csv'
temp_dir = self.create_temp_directory()
csv_file_path = os.path.join(temp_dir, csv_file_name)
self.perf.generate_threshold_settings_csv(csv_file_path)
self.perf.generate_threshold_settings_csv(csv_file_path,
category='Array')
self.assertTrue(os.path.isfile(csv_file_path))
# Read CSV file
csv_data = file_handler.read_csv_values(csv_file_path)
# Make change to metric
num_metrics = len(csv_data.get('metric'))
orig_values = (0, 0)
updated_values = (0, 0)
metric_set = 'ReadResponseTime'
metric_set = 'PercentCacheWP'
for i in range(0, num_metrics):
category = csv_data.get(pc.CATEGORY)[i]
metric = csv_data.get(pc.METRIC)[i]
if category == pc.ARRAY and metric == metric_set:
if metric == metric_set:
orig_values = (csv_data.get(pc.FIRST_THRESH)[i],
csv_data.get(pc.SEC_THRESH)[i])
updated_values = (int(orig_values[0]) + 5,
int(orig_values[1]) + 5)
int(orig_values[1]) + 10)
csv_data[pc.FIRST_THRESH][i] = updated_values[0]
csv_data[pc.SEC_THRESH][i] = updated_values[1]
csv_data[pc.KPI][i] = True
Expand Down
26 changes: 26 additions & 0 deletions PyU4V/tests/unit_tests/test_pyu4v_performance.py
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,32 @@ def test_set_thresholds_from_csv(self):
self.perf.set_thresholds_from_csv('fake_csv_path')
self.assertEqual(mck_update.call_count, 1)

def test_set_thresholds_from_csv_invalid_threshold_values(self):
"""Test set_perfthresholds_csv."""
threshold_settings = self.p_data.threshold_settings_resp.get(
pc.PERF_THRESH)

mock_csv_data = {pc.CATEGORY: list(), pc.METRIC: list(),
pc.KPI: list(), pc.ALERT_ERR: list(),
pc.FIRST_THRESH: list(), pc.SEC_THRESH: list()}

for threshold_setting in threshold_settings:
mock_csv_data[pc.CATEGORY].append(
self.p_data.threshold_settings_resp.get(pc.CATEGORY))
mock_csv_data[pc.METRIC].append(threshold_setting.get(pc.METRIC))
mock_csv_data[pc.KPI].append(threshold_setting.get(pc.KPI))
mock_csv_data[pc.ALERT_ERR].append(
threshold_setting.get(pc.ALERT_ERR))
mock_csv_data[pc.FIRST_THRESH].append(10)
mock_csv_data[pc.SEC_THRESH].append(10)

with mock.patch.object(file_handler, 'read_csv_values',
return_value=mock_csv_data):
with mock.patch.object(
self.perf, 'update_threshold_settings') as mck_update:
self.perf.set_thresholds_from_csv('fake_csv_path')
self.assertEqual(mck_update.call_count, 0)

def test_generate_threshold_settings_csv(self):
"""Test generate_threshold_settings_csv."""
data_for_csv = list()
Expand Down
2 changes: 1 addition & 1 deletion PyU4V/utils/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
APP_MPART = 'multipart/form-data'

# Unisphere REST URI constants
PYU4V_VERSION = '9.2.0.1'
PYU4V_VERSION = '9.2.0.2'
UNISPHERE_VERSION = '92'
VERSION = 'version'
ITERATOR = 'Iterator'
Expand Down
4 changes: 2 additions & 2 deletions PyU4V/utils/performance_category_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@
'metrics_kpi_cnt': 29,
'metrics_all': [
'AllocatedCapacity', 'AvgIOSize', 'AvgReadSize',
'AvgWritePacedDelay', 'AvgWriteSize', 'BEDisk ReadResponseTime ',
'AvgWritePacedDelay', 'AvgWriteSize', 'BEDiskReadResponseTime',
'BEMBReads', 'BEMBTransferred', 'BEMBWritten', 'BEPercentReads',
'BEPercentWrites', 'BEPrefetchedMBs', 'BEPrefetchedTrackUsed',
'BEPrefetchedTrackss', 'BERdfCopy', 'BERdfCopyMB', 'BEReadReqs',
Expand Down Expand Up @@ -652,7 +652,7 @@
'BEDiskReadResponseTime', 'BEMBReads', 'BEMBTransferred',
'BEMBWritten', 'BEPercentReads', 'BEPercentWrites',
'BEPrefetchedMBs', 'BEPrefetchedTrackUsed', 'BEPrefetchedTrackss',
'BEReadReqs', 'BEReadRequestTime ', 'BEReadTaskTime', 'BEReqs',
'BEReadReqs', 'BEReadRequestTime', 'BEReadTaskTime', 'BEReqs',
'BEWriteReqs', 'BlockSize', 'CompressedTracks',
'CriticalAlertCount', 'HostHits', 'HostIOLimitPercentTimeExceeded',
'HostIOs', 'HostMBReads', 'HostMBWritten', 'HostMBs',
Expand Down
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ PyU4V Version 9.2
+-------------------------------+----------------------------+
| **Author** | Dell EMC |
+-------------------------------+----------------------------+
| **PyU4V Version** | 9.2.0.1 |
| **PyU4V Version** | 9.2.0.2 |
+-------------------------------+----------------------------+
| **Minimum Unisphere Version** | 9.2.0.1 |
+-------------------------------+----------------------------+
Expand Down Expand Up @@ -80,7 +80,7 @@ specifying ``PyU4V`` as the install package for ``pip``::

$ pip install PyU4V
# Install a specific version
$ pip install PyU4V==9.2.0.1
$ pip install PyU4V==9.2.0.2

Copy the sample ``PyU4V.conf`` provided with PyU4V to either your working
directory or within a directory named ``.PyU4V`` in your current users home
Expand Down
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
# The short X.Y version.
version = u'9.2'
# The full version, including alpha/beta/rc tags
release = '9.2.0.1'
release = '9.2.0.2'

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Supported PyU4V Versions
------------------------

+-------------------------------+----------------------------------------+
| **PyU4V Version** | 9.2.0.1 |
| **PyU4V Version** | 9.2.0.2 |
+-------------------------------+----------------------------------------+
| **Minimum Unisphere Version** | 9.2.0.1 |
+-------------------------------+----------------------------------------+
Expand Down
4 changes: 2 additions & 2 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Requirements
------------

+-------------------------------+----------------------------------------+
| **PyU4V Version** | 9.2.0.1 |
| **PyU4V Version** | 9.2.0.2 |
+-------------------------------+----------------------------------------+
| **Minimum Unisphere Version** | 9.2.0.1 |
+-------------------------------+----------------------------------------+
Expand Down Expand Up @@ -66,7 +66,7 @@ specifying ``PyU4V`` as the install package for ``pip``:
$ pip install PyU4V
# Install a specific version
$ pip install PyU4V==9.2.0.1
$ pip install PyU4V==9.2.0.2
.. URL LINKS
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

setuptools.setup(
name='PyU4V',
version='9.2.0.1',
version='9.2.0.2',
url='https://github.com/dell/PyU4V/',
author='Dell Inc. or its subsidiaries',
author_email='Michael.Mcaleer@dell.com',
Expand Down

0 comments on commit 59c201a

Please sign in to comment.