diff --git a/cinder/tests/test_hp3par.py b/cinder/tests/test_hp3par.py index 3861a168a1b..8a0a70a9567 100644 --- a/cinder/tests/test_hp3par.py +++ b/cinder/tests/test_hp3par.py @@ -27,6 +27,7 @@ from cinder.openstack.common import log as logging from cinder.openstack.common import units from cinder import test from cinder.tests import fake_hp_3par_client as hp3parclient +from cinder.volume.drivers.san.hp import hp_3par_common as hpcommon from cinder.volume.drivers.san.hp import hp_3par_fc as hpfcdriver from cinder.volume.drivers.san.hp import hp_3par_iscsi as hpdriver from cinder.volume import qos_specs @@ -1935,6 +1936,13 @@ class HP3PARBaseDriver(object): mock_client.assert_has_calls(expected) + def test__safe_hostname(self): + long_hostname = "abc123abc123abc123abc123abc123abc123" + fixed_hostname = "abc123abc123abc123abc123abc123a" + common = hpcommon.HP3PARCommon(None) + safe_host = common._safe_hostname(long_hostname) + self.assertEqual(fixed_hostname, safe_host) + class TestHP3PARFCDriver(HP3PARBaseDriver, test.TestCase): diff --git a/cinder/volume/drivers/san/hp/hp_3par_common.py b/cinder/volume/drivers/san/hp/hp_3par_common.py index 9d3d976253e..7681635261c 100644 --- a/cinder/volume/drivers/san/hp/hp_3par_common.py +++ b/cinder/volume/drivers/san/hp/hp_3par_common.py @@ -150,10 +150,11 @@ class HP3PARCommon(object): 2.0.20 - Configurable SSH missing key policy and known hosts file 2.0.21 - Remove bogus invalid snapCPG=None exception 2.0.22 - HP 3PAR drivers should not claim to have 'infinite' space + 2.0.23 - Increase the hostname size from 23 to 31 Bug #1371242 """ - VERSION = "2.0.22" + VERSION = "2.0.23" stats = {} @@ -561,8 +562,8 @@ class HP3PARCommon(object): index = len(hostname) # we'll just chop this off for now. - if index > 23: - index = 23 + if index > 31: + index = 31 return hostname[:index]