From: Juan Zuluaga Date: Tue, 16 Sep 2014 15:09:02 +0000 (-0400) Subject: Timeout triggers failures running tempest for ZFSSA driver. X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=b04a1dd063d9678747194e416ed157109a17fdc7;p=openstack-build%2Fcinder-build.git Timeout triggers failures running tempest for ZFSSA driver. Adding a property to setup the RESTAPI connection timeout with ZFS Storage Appliance, allow tempest to pass with slower network links. DocImpact: New config parameter is added to allow configuring timeout value. Closes-Bug: #1369136 Change-Id: I8de19f56a18106324ed414cf41ee2323de639359 --- diff --git a/cinder/tests/test_zfssa.py b/cinder/tests/test_zfssa.py index c1bd1441e..49a55e6f6 100644 --- a/cinder/tests/test_zfssa.py +++ b/cinder/tests/test_zfssa.py @@ -36,7 +36,7 @@ class FakeZFSSA(object): def login(self, user): self.user = user - def set_host(self, host): + def set_host(self, host, timeout=None): self.host = host def create_project(self, pool, project, compression, logbias): @@ -265,6 +265,7 @@ class TestZFSSAISCSIDriver(test.TestCase): self.configuration.zfssa_target_password = '' self.configuration.zfssa_target_portal = '1.1.1.1:3260' self.configuration.zfssa_target_interfaces = 'e1000g0' + self.configuration.zfssa_rest_timeout = 60 def test_create_delete_volume(self): self.drv.create_volume(self.test_vol) diff --git a/cinder/volume/drivers/zfssa/restclient.py b/cinder/volume/drivers/zfssa/restclient.py index e904075c6..1e4122fab 100644 --- a/cinder/volume/drivers/zfssa/restclient.py +++ b/cinder/volume/drivers/zfssa/restclient.py @@ -276,7 +276,11 @@ class RestClientURL(object): try: response = urllib2.urlopen(req, timeout=self.timeout) except urllib2.HTTPError as err: - LOG.error(_('REST Not Available: %s') % err.code) + if err.code == httplib.NOT_FOUND: + LOG.debug('REST Not Found: %s' % err.code) + else: + LOG.error(_('REST Not Available: %s') % err.code) + if err.code == httplib.SERVICE_UNAVAILABLE and \ retry < maxreqretries: retry += 1 diff --git a/cinder/volume/drivers/zfssa/zfssaiscsi.py b/cinder/volume/drivers/zfssa/zfssaiscsi.py index b92ba2022..ade95d73c 100644 --- a/cinder/volume/drivers/zfssa/zfssaiscsi.py +++ b/cinder/volume/drivers/zfssa/zfssaiscsi.py @@ -59,7 +59,10 @@ ZFSSA_OPTS = [ cfg.StrOpt('zfssa_target_portal', help='iSCSI target portal (Data-IP:Port, w.x.y.z:3260).'), cfg.StrOpt('zfssa_target_interfaces', - help='Network interfaces of iSCSI targets. (comma separated)') + help='Network interfaces of iSCSI targets. (comma separated)'), + cfg.IntOpt('zfssa_rest_timeout', + help='REST connection timeout. (seconds)') + ] CONF.register_opts(ZFSSA_OPTS) @@ -95,7 +98,7 @@ class ZFSSAISCSIDriver(driver.ISCSIDriver): msg = (_('Connecting to host: %s.') % lcfg.san_ip) LOG.info(msg) self.zfssa = factory_zfssa() - self.zfssa.set_host(lcfg.san_ip) + self.zfssa.set_host(lcfg.san_ip, timeout=lcfg.zfssa_rest_timeout) auth_str = base64.encodestring('%s:%s' % (lcfg.san_login, lcfg.san_password))[:-1] diff --git a/cinder/volume/drivers/zfssa/zfssarest.py b/cinder/volume/drivers/zfssa/zfssarest.py index e64f8edd7..b86294e4c 100644 --- a/cinder/volume/drivers/zfssa/zfssarest.py +++ b/cinder/volume/drivers/zfssa/zfssarest.py @@ -57,10 +57,10 @@ class ZFSSAApi(object): return vdata['version']['asn'] == pdata['pool']['asn'] and \ vdata['version']['nodename'] == pdata['pool']['owner'] - def set_host(self, host): + def set_host(self, host, timeout=None): self.host = host self.url = "https://" + self.host + ":215" - self.rclient = restclient.RestClientURL(self.url) + self.rclient = restclient.RestClientURL(self.url, timeout=timeout) def login(self, auth_str): """Login to the appliance""" @@ -375,7 +375,7 @@ class ZFSSAApi(object): optional - volblocksize, sparse, compression, logbias """ svc = '/api/storage/v1/pools/' + pool + '/projects/' + \ - project + '/luns' + project + '/luns' arg = { 'name': lun, 'volsize': volsize, diff --git a/etc/cinder/cinder.conf.sample b/etc/cinder/cinder.conf.sample index 8457febea..4ba44f58e 100644 --- a/etc/cinder/cinder.conf.sample +++ b/etc/cinder/cinder.conf.sample @@ -2269,6 +2269,9 @@ # (string value) #zfssa_target_interfaces= +# REST connection timeout. (seconds) (integer value) +#zfssa_rest_timeout= + # # Options defined in cinder.volume.manager