From 881f037d2923874a83f48afa79ed7287a5af6e9f Mon Sep 17 00:00:00 2001
From: "Walter A. Boring IV" <walter.boring@hp.com>
Date: Wed, 28 Aug 2013 16:05:46 -0700
Subject: [PATCH] Update the version for the FC and iSCSI driver

We also now have a version for the common class,
and report that version at startup time.

Change-Id: Ia1b6698450d151d6b4a8bc13bf3b92c72e8c0ab0
---
 cinder/volume/drivers/san/hp/hp_3par_common.py | 16 ++++++++++++++--
 cinder/volume/drivers/san/hp/hp_3par_fc.py     | 17 ++++++++++-------
 cinder/volume/drivers/san/hp/hp_3par_iscsi.py  | 15 +++++++++------
 3 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/cinder/volume/drivers/san/hp/hp_3par_common.py b/cinder/volume/drivers/san/hp/hp_3par_common.py
index e84aedd5d..6f8f147b7 100644
--- a/cinder/volume/drivers/san/hp/hp_3par_common.py
+++ b/cinder/volume/drivers/san/hp/hp_3par_common.py
@@ -113,6 +113,14 @@ CONF.register_opts(hp3par_opts)
 
 
 class HP3PARCommon(object):
+    """Class that contains common code for the 3PAR drivers.
+
+    Version history:
+        1.2.0 - Updated hp3parclient API use to 2.0.x
+
+    """
+
+    VERSION = "1.2.0"
 
     stats = {}
 
@@ -141,6 +149,9 @@ class HP3PARCommon(object):
                              "is no longer used. The domain is automatically "
                              "looked up based on the CPG."))
 
+    def get_version(self):
+        return self.VERSION
+
     def check_flags(self, options, required_flags):
         for flag in required_flags:
             if not getattr(options, flag, None):
@@ -154,8 +165,6 @@ class HP3PARCommon(object):
             ex_msg = (_('Invalid hp3parclient version. Version %s or greater '
                         'required.') % MIN_CLIENT_VERSION)
             raise hpexceptions.UnsupportedVersion(ex_msg)
-        else:
-            LOG.debug(('Using hp3parclient %s.') % client_version)
 
         return cl
 
@@ -176,6 +185,9 @@ class HP3PARCommon(object):
 
     def do_setup(self, context):
         self.client = self._create_client()
+        LOG.info(_("HP3PARCommon %(common_ver)s, hp3parclient %(rest_ver)s")
+                 % {"common_ver": self.VERSION,
+                     "rest_ver": hp3parclient.get_version_string()})
         if self.config.hp3par_debug:
             self.client.debug_rest(True)
 
diff --git a/cinder/volume/drivers/san/hp/hp_3par_fc.py b/cinder/volume/drivers/san/hp/hp_3par_fc.py
index 8a1d2d249..7562d6a74 100644
--- a/cinder/volume/drivers/san/hp/hp_3par_fc.py
+++ b/cinder/volume/drivers/san/hp/hp_3par_fc.py
@@ -19,10 +19,11 @@
 #
 """
 Volume driver for HP 3PAR Storage array.
-This driver requires 3.1.2 MU2 firmware on the 3PAR array.
+This driver requires 3.1.2 MU2 firmware on the 3PAR array, using
+the 2.x version of the hp3parclient.
 
 You will need to install the python hp3parclient.
-sudo pip install hp3parclient
+sudo pip install --upgrade "hp3parclient>=2.0"
 
 Set the following in the cinder.conf file to enable the
 3PAR Fibre Channel Driver along with the required flags:
@@ -47,13 +48,15 @@ class HP3PARFCDriver(cinder.volume.driver.FibreChannelDriver):
     """OpenStack Fibre Channel driver to enable 3PAR storage array.
 
     Version history:
-        1.0 - Initial driver
-        1.1 - QoS, extend volume, multiple iscsi ports, remove domain,
-              session changes, faster clone, requires 3.1.2 MU2 firmware,
-              copy volume <--> Image.
+        1.0   - Initial driver
+        1.1   - QoS, extend volume, multiple iscsi ports, remove domain,
+                session changes, faster clone, requires 3.1.2 MU2 firmware,
+                copy volume <--> Image.
+        1.2.0 - Updated the use of the hp3parclient to 2.0.0 and refactored
+                the drivers to use the new APIs.
     """
 
-    VERSION = "1.1.0"
+    VERSION = "1.2.0"
 
     def __init__(self, *args, **kwargs):
         super(HP3PARFCDriver, self).__init__(*args, **kwargs)
diff --git a/cinder/volume/drivers/san/hp/hp_3par_iscsi.py b/cinder/volume/drivers/san/hp/hp_3par_iscsi.py
index feb2723af..a1d91c174 100644
--- a/cinder/volume/drivers/san/hp/hp_3par_iscsi.py
+++ b/cinder/volume/drivers/san/hp/hp_3par_iscsi.py
@@ -19,10 +19,11 @@
 #
 """
 Volume driver for HP 3PAR Storage array.
-This driver requires 3.1.2 MU2 firmware on the 3PAR array.
+This driver requires 3.1.2 MU2 firmware on the 3PAR array, using
+the 2.x version of the hp3parclient.
 
 You will need to install the python hp3parclient.
-sudo pip install hp3parclient
+sudo pip install --upgrade "hp3parclient>=2.0"
 
 Set the following in the cinder.conf file to enable the
 3PAR iSCSI Driver along with the required flags:
@@ -49,13 +50,15 @@ class HP3PARISCSIDriver(cinder.volume.driver.ISCSIDriver):
     """OpenStack iSCSI driver to enable 3PAR storage array.
 
     Version history:
-        1.0 - Initial driver
-        1.1 - QoS, extend volume, multiple iscsi ports, remove domain,
-              session changes, faster clone, requires 3.1.2 MU2 firmware.
+        1.0   - Initial driver
+        1.1   - QoS, extend volume, multiple iscsi ports, remove domain,
+                session changes, faster clone, requires 3.1.2 MU2 firmware.
+        1.2.0 - Updated the use of the hp3parclient to 2.0.0 and refactored
+                the drivers to use the new APIs.
 
     """
 
-    VERSION = "1.1.0"
+    VERSION = "1.2.0"
 
     def __init__(self, *args, **kwargs):
         super(HP3PARISCSIDriver, self).__init__(*args, **kwargs)
-- 
2.45.2