]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
HP 3PAR modules do not follow coding guidelines
authorRich Hagarty <richard.hagarty@hp.com>
Fri, 16 Jan 2015 21:11:28 +0000 (13:11 -0800)
committerRich Hagarty <richard.hagarty@hp.com>
Thu, 22 Jan 2015 22:35:54 +0000 (14:35 -0800)
Should use "," instead of "%" in logging messages, and
the use of "\" to continue lines should be avoided.

Change-Id: I23d53d66fda47981ed8f20b618b2ced8ef6e0682
Closes-Bug: #1411370

cinder/tests/test_hp3par.py
cinder/volume/drivers/san/hp/hp_3par_common.py

index 77878c9bac66f88d82539b47d29d2b769ac9b9a3..cb0763ce2ea3c41a94f45e8b1fcfcdc7a4c319a8 100644 (file)
@@ -498,8 +498,8 @@ class HP3PARBaseDriver(object):
         task_id = 1234
         interval = .001
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             waiter = common.TaskWaiter(mock_client, task_id, interval)
@@ -517,8 +517,8 @@ class HP3PARBaseDriver(object):
         # setup_mock_client drive with default configuration
         # and return the mock HTTP 3PAR client
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.driver.create_volume(self.volume)
             comment = (
@@ -544,8 +544,8 @@ class HP3PARBaseDriver(object):
         # setup_mock_client drive with default configuration
         # and return the mock HTTP 3PAR client
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
 
             return_model = self.driver.create_volume(self.volume_pool)
@@ -580,8 +580,8 @@ class HP3PARBaseDriver(object):
                 'snap_cpg': expected_type_snap_cpg,
                 'volume_type': self.volume_type}}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -601,8 +601,8 @@ class HP3PARBaseDriver(object):
                 'cpg': expected_cpg,
                 'volume_type': self.volume_type}}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -622,8 +622,8 @@ class HP3PARBaseDriver(object):
         conf = self.setup_configuration()
         expected_snap_cpg = conf.hp3par_cpg_snap
         mock_client = self.setup_driver(config=conf)
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -644,8 +644,8 @@ class HP3PARBaseDriver(object):
         conf.hp3par_cpg_snap = None
         expected_cpg = conf.hp3par_cpg
         mock_client = self.setup_driver(config=conf)
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -670,8 +670,8 @@ class HP3PARBaseDriver(object):
                 'tpvv': True,
                 'volume_type': self.volume_type}}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
 
             return_model = self.driver.create_volume(self.volume_qos)
@@ -705,8 +705,8 @@ class HP3PARBaseDriver(object):
         _mock_volume_types.return_value = self.RETYPE_VOLUME_TYPE_1
         mock_client = self.setup_driver(mock_conf=self.RETYPE_CONF)
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.assertRaises(exception.InvalidHost,
                               self.driver.retype,
@@ -728,8 +728,8 @@ class HP3PARBaseDriver(object):
         mock_client = self.setup_driver(mock_conf=self.RETYPE_CONF)
         mock_client.getVolume.side_effect = hpexceptions.HTTPNotFound
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.assertRaises(hpexceptions.HTTPNotFound,
                               self.driver.retype,
@@ -756,8 +756,8 @@ class HP3PARBaseDriver(object):
         mock_client.addVolumeToVolumeSet.side_effect = \
             hpexceptions.HTTPForbidden
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.assertRaises(hpexceptions.HTTPForbidden,
                               self.driver.retype,
@@ -794,8 +794,8 @@ class HP3PARBaseDriver(object):
         # Fail the QOS setting to test the revert of the snap CPG rename.
         mock_client.deleteVolumeSet.side_effect = hpexceptions.HTTPForbidden
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.assertRaises(hpexceptions.HTTPForbidden,
                               self.driver.retype,
@@ -821,8 +821,8 @@ class HP3PARBaseDriver(object):
         mock_client.getStorageSystemInfo.return_value = {
             'serialNumber': 'XXXXXXX'}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.assertRaises(exception.InvalidHost,
                               self.driver.retype,
@@ -851,8 +851,8 @@ class HP3PARBaseDriver(object):
             {'domain': 'domain2'},
         ]
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.assertRaises(exception.Invalid3PARDomain,
                               self.driver.retype,
@@ -885,8 +885,8 @@ class HP3PARBaseDriver(object):
             {'domain': 'snap_cpg_domain_1'},
         ]
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.assertRaises(exception.Invalid3PARDomain,
                               self.driver.retype,
@@ -915,8 +915,8 @@ class HP3PARBaseDriver(object):
         _mock_volume_types.return_value = self.RETYPE_VOLUME_TYPE_BAD_PERSONA
         mock_client = self.setup_driver(mock_conf=self.RETYPE_CONF)
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.assertRaises(exception.InvalidInput,
                               self.driver.retype,
@@ -938,8 +938,8 @@ class HP3PARBaseDriver(object):
         mock_client = self.setup_driver(mock_conf=self.RETYPE_CONF)
         mock_client.getCPG.side_effect = hpexceptions.HTTPNotFound
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.assertRaises(exception.InvalidInput,
                               self.driver.retype,
@@ -979,8 +979,8 @@ class HP3PARBaseDriver(object):
 
         volume = {'id': HP3PARBaseDriver.CLONE_ID}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
 
             retyped = self.driver.retype(
@@ -1011,8 +1011,8 @@ class HP3PARBaseDriver(object):
         cpg = "any_cpg"
         snap_cpg = "any_cpg"
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             common._retype(self.volume,
@@ -1042,8 +1042,8 @@ class HP3PARBaseDriver(object):
         # setup_mock_client drive with default configuration
         # and return the mock HTTP 3PAR client
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.driver.delete_volume(self.volume)
 
@@ -1059,8 +1059,8 @@ class HP3PARBaseDriver(object):
         # and return the mock HTTP 3PAR client
         mock_client = self.setup_driver()
         mock_client.copyVolume.return_value = {'taskid': 1}
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
 
             volume = {'name': HP3PARBaseDriver.VOLUME_NAME,
@@ -1092,8 +1092,8 @@ class HP3PARBaseDriver(object):
         _mock_volume_types.return_value = self.RETYPE_VOLUME_TYPE_2
         mock_client = self.setup_driver()
         mock_client.copyVolume.return_value = {'taskid': 1}
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
 
             src_vref = {}
@@ -1149,8 +1149,8 @@ class HP3PARBaseDriver(object):
                   'status': 'available',
                   'host': HP3PARBaseDriver.FAKE_HOST,
                   'source_volid': HP3PARBaseDriver.VOLUME_ID}
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -1212,8 +1212,8 @@ class HP3PARBaseDriver(object):
                   'host': HP3PARBaseDriver.FAKE_HOST,
                   'source_volid': HP3PARBaseDriver.VOLUME_ID}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -1281,8 +1281,8 @@ class HP3PARBaseDriver(object):
         host = {'host': 'stack@3parfc1',
                 'capabilities': {'location_info': loc_info}}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             result = self.driver.migrate_volume(context.get_admin_context(),
                                                 volume, host)
@@ -1318,8 +1318,8 @@ class HP3PARBaseDriver(object):
                   'host': HP3PARBaseDriver.FAKE_HOST,
                   'source_volid': HP3PARBaseDriver.VOLUME_ID}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -1365,8 +1365,8 @@ class HP3PARBaseDriver(object):
                   'host': HP3PARBaseDriver.FAKE_HOST,
                   'source_volid': HP3PARBaseDriver.VOLUME_ID}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -1440,8 +1440,8 @@ class HP3PARBaseDriver(object):
         # setup_mock_client drive with default configuration
         # and return the mock HTTP 3PAR client
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.driver.attach_volume(context.get_admin_context(),
                                       self.volume,
@@ -1471,8 +1471,8 @@ class HP3PARBaseDriver(object):
         # setup_mock_client drive with default configuration
         # and return the mock HTTP 3PAR client
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.driver.detach_volume(context.get_admin_context(), self.volume)
             expected = [
@@ -1494,8 +1494,8 @@ class HP3PARBaseDriver(object):
         # setup_mock_client drive with default configuration
         # and return the mock HTTP 3PAR client
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.driver.create_snapshot(self.snapshot)
 
@@ -1523,8 +1523,8 @@ class HP3PARBaseDriver(object):
         # setup_mock_client drive with default configuration
         # and return the mock HTTP 3PAR client
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.driver.delete_snapshot(self.snapshot)
 
@@ -1540,8 +1540,8 @@ class HP3PARBaseDriver(object):
         # setup_mock_client drive with default configuration
         # and return the mock HTTP 3PAR client
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.driver.create_snapshot(self.snapshot)
             self.driver.create_volume_from_snapshot(self.volume, self.snapshot)
@@ -1573,8 +1573,8 @@ class HP3PARBaseDriver(object):
         # setup_mock_client drive with default configuration
         # and return the mock HTTP 3PAR client
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
 
             model_update = self.driver.create_volume_from_snapshot(
@@ -1617,8 +1617,8 @@ class HP3PARBaseDriver(object):
         }
 
         mock_client = self.setup_driver(mock_conf=conf)
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -1683,8 +1683,8 @@ class HP3PARBaseDriver(object):
                 'tpvv': True,
                 'volume_type': self.volume_type}}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -1753,8 +1753,8 @@ class HP3PARBaseDriver(object):
         # setup_mock_client drive with default configuration
         # and return the mock HTTP 3PAR client
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             _mock_volume_types.return_value = {
                 'name': 'gold',
@@ -1807,8 +1807,8 @@ class HP3PARBaseDriver(object):
             }]
         }
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             self.driver.terminate_connection(
                 self.volume,
@@ -1841,8 +1841,8 @@ class HP3PARBaseDriver(object):
         key = 'a'
         value = 'b'
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             common.update_volume_key_value_pair(
@@ -1868,8 +1868,8 @@ class HP3PARBaseDriver(object):
         # setup_mock_client drive with default configuration
         # and return the mock HTTP 3PAR client
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             key = 'a'
             common = self.driver._login()
@@ -1891,8 +1891,8 @@ class HP3PARBaseDriver(object):
         # setup_mock_client drive with default configuration
         # and return the mock HTTP 3PAR client
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             grow_size = 3
             old_size = self.volume['size']
@@ -1919,8 +1919,8 @@ class HP3PARBaseDriver(object):
         }
 
         mock_client = self.setup_driver(mock_conf=conf)
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             grow_size = 3
             old_size = self.volume['size']
@@ -1942,8 +1942,8 @@ class HP3PARBaseDriver(object):
         }
 
         mock_client = self.setup_driver(mock_conf=conf)
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             grow_size = 3
             old_size = self.volume['size']
@@ -1986,8 +1986,8 @@ class HP3PARBaseDriver(object):
                  'type': 2,
                  'portPos': {'node': 0, 'slot': 6, 'cardPort': 3}}]}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             ports = common.get_ports()['members']
@@ -1995,8 +1995,8 @@ class HP3PARBaseDriver(object):
 
     def test_get_by_qos_spec_with_scoping(self):
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             qos_ref = qos_specs.create(self.ctxt, 'qos-specs-1', self.QOS)
@@ -2018,8 +2018,8 @@ class HP3PARBaseDriver(object):
 
     def test_get_by_qos_spec(self):
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             qos_ref = qos_specs.create(
@@ -2044,8 +2044,8 @@ class HP3PARBaseDriver(object):
 
     def test_get_by_qos_by_type_only(self):
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             type_ref = volume_types.create(self.ctxt,
@@ -2066,8 +2066,8 @@ class HP3PARBaseDriver(object):
         lun_id = 11
         nsp = '1:2:3'
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             location = ("%(name)s,%(lunid)s,%(host)s,%(nsp)s" %
                         {'name': self.VOLUME_NAME,
@@ -2103,8 +2103,8 @@ class HP3PARBaseDriver(object):
 
     def test__get_existing_volume_ref_name(self):
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -2144,8 +2144,8 @@ class HP3PARBaseDriver(object):
         mock_client.modifyVolume.return_value = ("anyResponse", {'taskid': 1})
         mock_client.getTask.return_value = self.STATUS_DONE
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -2237,8 +2237,8 @@ class HP3PARBaseDriver(object):
                   'volume_type_id': 'acfa9fa4-54a0-4340-a3d8-bfcf19aea65e',
                   'id': id}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -2306,8 +2306,8 @@ class HP3PARBaseDriver(object):
 
         mock_client.getVolume.return_value = {'comment': comment}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             unm_matcher = common._get_3par_unm_name(self.volume['id'])
@@ -2377,8 +2377,8 @@ class HP3PARBaseDriver(object):
 
         mock_client.getVolume.side_effect = hpexceptions.HTTPNotFound('fake')
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             unm_matcher = common._get_3par_unm_name(self.volume['id'])
@@ -2408,8 +2408,8 @@ class HP3PARBaseDriver(object):
 
         mock_client.getVolume.return_value = {'comment': comment}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             unm_matcher = common._get_3par_unm_name(self.volume['id'])
@@ -2456,8 +2456,8 @@ class HP3PARBaseDriver(object):
             {'domain': 'domain3'},
         ]
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -2497,8 +2497,8 @@ class HP3PARBaseDriver(object):
         mock_client = self.setup_driver()
         mock_client.getVolume.return_value = {'sizeMiB': 2048}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             unm_matcher = common._get_3par_unm_name(self.volume['id'])
@@ -2518,8 +2518,8 @@ class HP3PARBaseDriver(object):
 
     def test_manage_existing_get_size_invalid_reference(self):
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             volume = {}
             existing_ref = {'source-name': self.VOLUME_3PAR_NAME}
@@ -2548,8 +2548,8 @@ class HP3PARBaseDriver(object):
         mock_client = self.setup_driver()
         mock_client.getVolume.side_effect = hpexceptions.HTTPNotFound('fake')
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             unm_matcher = common._get_3par_unm_name(self.volume['id'])
@@ -2570,8 +2570,8 @@ class HP3PARBaseDriver(object):
 
     def test_unmanage(self):
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             self.driver.unmanage(self.volume)
@@ -2669,8 +2669,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
                      'nsp': 'something'})
         mock_client.createVLUN.return_value = location
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             result = self.driver.initialize_connection(
                 self.volume,
@@ -2757,8 +2757,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
                                          ['0987654321234']
                                          }}}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             result = self.driver.initialize_connection(self.volume, connector)
 
@@ -2813,8 +2813,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
             mock.call.getHostVLUNs(self.FAKE_HOST),
             mock.call.getPorts()]
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             conn_info = self.driver.terminate_connection(self.volume,
                                                          self.connector)
@@ -2892,8 +2892,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
             mock.call.getHostVLUNs(self.FAKE_HOST),
             mock.call.getPorts()]
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             conn_info = self.driver.terminate_connection(self.volume,
                                                          self.connector)
@@ -2959,8 +2959,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
                 self.FAKE_HOST),
             mock.call.getHostVLUNs(self.FAKE_HOST)]
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             conn_info = self.driver.terminate_connection(self.volume,
                                                          self.connector)
@@ -2986,8 +2986,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
             "usableFreeMiB": 1024.0 * 3
         }
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -3062,8 +3062,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
                              'wwn': self.wwn[1]}]}]
         mock_client.queryHost.return_value = None
         mock_client.getVLUN.return_value = {'lun': 186}
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             host = self.driver._create_host(
@@ -3104,8 +3104,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
             }]
         }
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             host = self.driver._create_host(
@@ -3137,8 +3137,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
                 'FCPaths': [{'wwn': '123456789012345'}, {
                     'wwn': '123456789054321'}]}]
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             host = self.driver._create_host(
@@ -3175,8 +3175,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
                         {'wwn': '123456789054321'}]}
         mock_client.getHost.side_effect = [getHost_ret1, getHost_ret2]
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             host = self.driver._create_host(
@@ -3215,8 +3215,8 @@ class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase):
                         {'wwn': 'xxxxxxxxxxxxxxx'}]}
         mock_client.getHost.side_effect = [getHost_ret1, getHost_ret2]
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             host = self.driver._create_host(
@@ -3301,8 +3301,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
                      'nsp': 'something'})
         mock_client.createVLUN.return_value = location
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             result = self.driver.initialize_connection(
                 self.volume,
@@ -3343,8 +3343,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
             "usableFreeMiB": 1024.0 * 3
         }
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
 
             stats = self.driver.get_volume_stats(True)
@@ -3396,8 +3396,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
         mock_client.queryHost.return_value = None
         mock_client.getVLUN.return_value = {'lun': self.TARGET_LUN}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             host, auth_username, auth_password = self.driver._create_host(
@@ -3451,8 +3451,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
 
         mock_client.getVolumeMetaData.side_effect = get_side_effect
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             host, auth_username, auth_password = self.driver._create_host(
@@ -3497,8 +3497,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
             }]
         }
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             host, auth_username, auth_password = self.driver._create_host(
@@ -3552,8 +3552,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
             'chapSecret': 'test-pass'
         }
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             host, auth_username, auth_password = self.driver._create_host(
@@ -3592,8 +3592,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
              'FCPaths': [{'wwn': '123456789012345'},
                          {'wwn': '123456789054321'}]}]
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             host, auth_username, auth_password = self.driver._create_host(
@@ -3648,8 +3648,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
             'chapSecret': 'test-pass'
         }
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             host, auth_username, auth_password = self.driver._create_host(
@@ -3688,8 +3688,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
         mock_client.getPorts.return_value = PORTS_RET
         mock_client.getVLUNs.return_value = VLUNS1_RET
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -3710,8 +3710,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
         mock_client.getPorts.return_value = PORTS_RET
         mock_client.getVLUNs.return_value = VLUNS1_RET
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -3734,8 +3734,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
         mock_client.getPorts.return_value = PORTS_RET
         mock_client.getVLUNs.return_value = VLUNS1_RET
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -3765,8 +3765,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
         iscsi_ips = ["10.10.220.252", "10.10.220.253"]
         self.driver.configuration.hp3par_iscsi_ips = iscsi_ips
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             self.driver.initialize_iscsi_ports(common)
@@ -3822,8 +3822,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
             {'portPos': {'node': 0, 'slot': 2, 'cardPort': 1}, 'active': True}]
         mock_client.getVLUNs.return_value = {'members': ports}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             # in use count
@@ -3895,8 +3895,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
         # and return the mock HTTP 3PAR client
         mock_client = self.setup_driver()
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             expected = []
@@ -3910,8 +3910,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
         config.hp3par_iscsi_chap_enabled = True
         mock_client = self.setup_driver(config=config)
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             expected_mod_request = {
@@ -3954,8 +3954,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
         expected = []
         expected_model = {'provider_auth': None}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             model = self.driver._do_export(common, volume)
@@ -4000,8 +4000,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
         ]
         expected_model = {'provider_auth': 'CHAP test-host random-pass'}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             model = self.driver._do_export(common, volume)
@@ -4035,8 +4035,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
         ]
         expected_model = {'provider_auth': 'CHAP test-host random-pass'}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             model = self.driver._do_export(common, volume)
@@ -4080,8 +4080,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
         ]
         expected_model = {'provider_auth': 'CHAP test-host random-pass'}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             model = self.driver._do_export(common, volume)
@@ -4123,8 +4123,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
         ]
         expected_model = {'provider_auth': 'CHAP test-host random-pass'}
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
             model = self.driver._do_export(common, volume)
@@ -4144,8 +4144,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
             'members': []
         }
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             model = self.driver.ensure_export(None, volume)
 
@@ -4206,8 +4206,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
         mock_client.getVolume.side_effect = hpexceptions.HTTPNotFound(
             'fake')
 
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             model = self.driver.ensure_export(None, volume)
 
@@ -4228,8 +4228,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
             'id': 'gold-id',
             'extra_specs': {}}
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
@@ -4241,8 +4241,8 @@ class TestHP3PARISCSIDriver(HP3PARBaseDriver, test.TestCase):
 
     def test_get_model_update(self):
         mock_client = self.setup_driver()
-        with mock.patch.object(hpcommon.HP3PARCommon, '_create_client')\
-                as mock_create_client:
+        with mock.patch.object(hpcommon.HP3PARCommon,
+                               '_create_client') as mock_create_client:
             mock_create_client.return_value = mock_client
             common = self.driver._login()
 
index 0df3575241cd97e3b6abd63e598e158d983ac667..dc0719638ad5e9c5734cfc8909992640f50ddabd 100644 (file)
@@ -162,10 +162,11 @@ class HP3PARCommon(object):
         2.0.31 - Removed usage of host name cache #1398914
         2.0.32 - Update LOG usage to fix translations.  bug #1384312
         2.0.33 - Fix host persona to match WSAPI mapping bug #1403997
+        2.0.34 - Fix log messages to match guidelines. bug #1411370
 
     """
 
-    VERSION = "2.0.33"
+    VERSION = "2.0.34"
 
     stats = {}
 
@@ -308,7 +309,7 @@ class HP3PARCommon(object):
         old_size = volume['size']
         growth_size = int(new_size) - old_size
         LOG.debug("Extending Volume %(vol)s from %(old)s to %(new)s, "
-                  " by %(diff)s GB." %
+                  " by %(diff)s GB.",
                   {'vol': volume_name, 'old': old_size, 'new': new_size,
                    'diff': growth_size})
         growth_size_mib = growth_size * units.Ki
@@ -1051,7 +1052,7 @@ class HP3PARCommon(object):
         return volume_settings
 
     def create_volume(self, volume):
-        LOG.debug("CREATE VOLUME (%s : %s %s)" %
+        LOG.debug("CREATE VOLUME (%s : %s %s)",
                   (volume['display_name'], volume['name'],
                    self._get_3par_vol_name(volume['id'])))
         try:
@@ -1119,7 +1120,7 @@ class HP3PARCommon(object):
     def _copy_volume(self, src_name, dest_name, cpg, snap_cpg=None,
                      tpvv=True):
         # Virtual volume sets are not supported with the -online option
-        LOG.debug('Creating clone of a volume %(src)s to %(dest)s.' %
+        LOG.debug('Creating clone of a volume %(src)s to %(dest)s.',
                   {'src': src_name, 'dest': dest_name})
 
         optional = {'tpvv': tpvv, 'online': True}
@@ -1205,8 +1206,8 @@ class HP3PARCommon(object):
             except hpexceptions.HTTPBadRequest as ex:
                 if ex.get_code() == 29:
                     if self.client.isOnlinePhysicalCopy(volume_name):
-                        LOG.debug("Found an online copy for %(volume)s"
-                                  {'volume': volume_name})
+                        LOG.debug("Found an online copy for %(volume)s",
+                                  {'volume': volume_name})
                         # the volume is in process of being cloned.
                         # stopOnlinePhysicalCopy will also delete
                         # the volume once it stops the copy.
@@ -1222,7 +1223,7 @@ class HP3PARCommon(object):
                     # This is a special case which means the
                     # volume is part of a volume set.
                     vvset_name = self.client.findVolumeSet(volume_name)
-                    LOG.debug("Returned vvset_name = %s" % vvset_name)
+                    LOG.debug("Returned vvset_name = %s", vvset_name)
                     if vvset_name is not None and \
                        vvset_name.startswith('vvs-'):
                         # We have a single volume per volume set, so
@@ -1269,7 +1270,7 @@ class HP3PARCommon(object):
         """Creates a volume from a snapshot.
 
         """
-        LOG.debug("Create Volume from Snapshot\n%s\n%s" %
+        LOG.debug("Create Volume from Snapshot\n%s\n%s",
                   (pprint.pformat(volume['display_name']),
                    pprint.pformat(snapshot['display_name'])))
 
@@ -1309,11 +1310,11 @@ class HP3PARCommon(object):
             growth_size = volume['size'] - snapshot['volume_size']
             if growth_size > 0:
                 try:
-                    LOG.debug('Converting to base volume type: %s.' %
+                    LOG.debug('Converting to base volume type: %s.',
                               volume['id'])
                     model_update = self._convert_to_base_volume(volume)
                     growth_size_mib = growth_size * units.Gi / units.Mi
-                    LOG.debug('Growing volume: %(id)s by %(size)s GiB.' %
+                    LOG.debug('Growing volume: %(id)s by %(size)s GiB.',
                               {'id': volume['id'], 'size': growth_size})
                     self.client.growVolume(volume_name, growth_size_mib)
                 except Exception as ex:
@@ -1347,7 +1348,7 @@ class HP3PARCommon(object):
         return model_update
 
     def create_snapshot(self, snapshot):
-        LOG.debug("Create Snapshot\n%s" % pprint.pformat(snapshot))
+        LOG.debug("Create Snapshot\n%s", pprint.pformat(snapshot))
 
         try:
             snap_name = self._get_3par_snap_name(snapshot['id'])
@@ -1391,7 +1392,7 @@ class HP3PARCommon(object):
 
         If key already exists, the value will be replaced.
         """
-        LOG.debug("VOLUME (%s : %s %s) Updating KEY-VALUE pair: (%s : %s)" %
+        LOG.debug("VOLUME (%s : %s %s) Updating KEY-VALUE pair: (%s : %s)",
                   (volume['display_name'],
                    volume['name'],
                    self._get_3par_vol_name(volume['id']),
@@ -1410,7 +1411,7 @@ class HP3PARCommon(object):
     def clear_volume_key_value_pair(self, volume, key):
         """Clears key,value pairs metadata from virtual volume."""
 
-        LOG.debug("VOLUME (%s : %s %s) Clearing Key : %s)" %
+        LOG.debug("VOLUME (%s : %s %s) Clearing Key : %s)",
                   (volume['display_name'], volume['name'],
                    self._get_3par_vol_name(volume['id']), key))
         try:
@@ -1422,7 +1423,7 @@ class HP3PARCommon(object):
             raise exception.VolumeBackendAPIException(data=msg)
 
     def attach_volume(self, volume, instance_uuid):
-        LOG.debug("Attach Volume\n%s" % pprint.pformat(volume))
+        LOG.debug("Attach Volume\n%s", pprint.pformat(volume))
         try:
             self.update_volume_key_value_pair(volume,
                                               'HPQ-CS-instance_uuid',
@@ -1432,7 +1433,7 @@ class HP3PARCommon(object):
                 LOG.error(_LE("Error attaching volume %s"), volume)
 
     def detach_volume(self, volume):
-        LOG.debug("Detach Volume\n%s" % pprint.pformat(volume))
+        LOG.debug("Detach Volume\n%s", pprint.pformat(volume))
         try:
             self.clear_volume_key_value_pair(volume, 'HPQ-CS-instance_uuid')
         except Exception:
@@ -1454,7 +1455,7 @@ class HP3PARCommon(object):
         dbg = {'id': volume['id'],
                'host': host['host'],
                'status': volume['status']}
-        LOG.debug('enter: migrate_volume: id=%(id)s, host=%(host)s.' % dbg)
+        LOG.debug('enter: migrate_volume: id=%(id)s, host=%(host)s.', dbg)
 
         ret = False, None
 
@@ -1469,8 +1470,8 @@ class HP3PARCommon(object):
                 LOG.info(_LI('3PAR driver cannot perform migration. '
                              'Retype exception: %s'), e)
 
-        LOG.debug('leave: migrate_volume: id=%(id)s, host=%(host)s.' % dbg)
-        LOG.debug('migrate_volume result: %s, %s' % ret)
+        LOG.debug('leave: migrate_volume: id=%(id)s, host=%(host)s.', dbg)
+        LOG.debug('migrate_volume result: %s, %s', ret)
         return ret
 
     def _convert_to_base_volume(self, volume, new_cpg=None):
@@ -1491,12 +1492,12 @@ class HP3PARCommon(object):
                                         cpg, cpg, type_info['tpvv'])
 
             LOG.debug('Copy volume scheduled: convert_to_base_volume: '
-                      'id=%s.' % volume['id'])
+                      'id=%s.', volume['id'])
 
             # Wait for the physical copy task to complete
             def _wait_for_task(task_id):
                 status = self.client.getTask(task_id)
-                LOG.debug("3PAR Task id %(id)s status = %(status)s" %
+                LOG.debug("3PAR Task id %(id)s status = %(status)s",
                           {'id': task_id,
                            'status': status['status']})
                 if status['status'] is not self.client.TASK_ACTIVE:
@@ -1515,18 +1516,18 @@ class HP3PARCommon(object):
                 raise exception.CinderException(msg)
             else:
                 LOG.debug('Copy volume completed: convert_to_base_volume: '
-                          'id=%s.' % volume['id'])
+                          'id=%s.', volume['id'])
 
             comment = self._get_3par_vol_comment(volume_name)
             if comment:
                 self.client.modifyVolume(temp_vol_name, {'comment': comment})
             LOG.debug('Volume rename completed: convert_to_base_volume: '
-                      'id=%s.' % volume['id'])
+                      'id=%s.', volume['id'])
 
             # Delete source volume after the copy is complete
             self.client.deleteVolume(volume_name)
             LOG.debug('Delete src volume completed: convert_to_base_volume: '
-                      'id=%s.' % volume['id'])
+                      'id=%s.', volume['id'])
 
             # Rename the new volume to the original name
             self.client.modifyVolume(temp_vol_name, {'newName': volume_name})
@@ -1553,8 +1554,8 @@ class HP3PARCommon(object):
         return self._get_model_update(volume['host'], cpg)
 
     def delete_snapshot(self, snapshot):
-        LOG.debug("Delete Snapshot id %s %s" % (snapshot['id'],
-                                                pprint.pformat(snapshot)))
+        LOG.debug("Delete Snapshot id %s %s", (snapshot['id'],
+                                               pprint.pformat(snapshot)))
 
         try:
             snap_name = self._get_3par_snap_name(snapshot['id'])
@@ -1836,9 +1837,9 @@ class HP3PARCommon(object):
         if 'snapCPG' in old_volume_info:
             old_snap_cpg = old_volume_info['snapCPG']
 
-        LOG.debug("retype old_volume_info=%s" % old_volume_info)
-        LOG.debug("retype old_volume_settings=%s" % old_volume_settings)
-        LOG.debug("retype new_volume_settings=%s" % new_volume_settings)
+        LOG.debug("retype old_volume_info=%s", old_volume_info)
+        LOG.debug("retype old_volume_settings=%s", old_volume_settings)
+        LOG.debug("retype new_volume_settings=%s", new_volume_settings)
 
         self._retype(volume, volume_name, new_type_name, new_type_id,
                      host, new_persona, old_cpg, new_cpg,
@@ -1880,10 +1881,10 @@ class HP3PARCommon(object):
                      is just skipped if host is None.
         """
         LOG.debug(("enter: retype: id=%(id)s, new_type=%(new_type)s,"
-                   "diff=%(diff)s, host=%(host)s") % {'id': volume['id'],
-                                                      'new_type': new_type,
-                                                      'diff': diff,
-                                                      'host': host})
+                   "diff=%(diff)s, host=%(host)s"), {'id': volume['id'],
+                                                     'new_type': new_type,
+                                                     'diff': diff,
+                                                     'host': host})
         old_volume_settings = self.get_volume_settings_from_type(volume, host)
         return self._retype_from_old_to_new(volume, new_type,
                                             old_volume_settings, host)
@@ -1899,7 +1900,7 @@ class HP3PARCommon(object):
 
         def _wait_for_task(self):
             status = self.client.getTask(self.task_id)
-            LOG.debug("3PAR Task id %(id)s status = %(status)s" %
+            LOG.debug("3PAR Task id %(id)s status = %(status)s",
                       {'id': self.task_id,
                        'status': status['status']})
             if status['status'] is not self.client.TASK_ACTIVE: