Skip to content

Commit

Permalink
Timeout triggers failures running tempest for ZFSSA driver.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Juan Zuluaga committed Sep 19, 2014
1 parent b35c97c commit b04a1dd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
3 changes: 2 additions & 1 deletion cinder/tests/test_zfssa.py
Expand Up @@ -36,7 +36,7 @@ def __init__(self):
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):
Expand Down Expand Up @@ -265,6 +265,7 @@ def _create_fake_config(self):
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)
Expand Down
6 changes: 5 additions & 1 deletion cinder/volume/drivers/zfssa/restclient.py
Expand Up @@ -276,7 +276,11 @@ def request(self, path, request, body=None, **kwargs):
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
Expand Down
7 changes: 5 additions & 2 deletions cinder/volume/drivers/zfssa/zfssaiscsi.py
Expand Up @@ -59,7 +59,10 @@
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)
Expand Down Expand Up @@ -95,7 +98,7 @@ def do_setup(self, context):
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]
Expand Down
6 changes: 3 additions & 3 deletions cinder/volume/drivers/zfssa/zfssarest.py
Expand Up @@ -57,10 +57,10 @@ def _is_pool_owned(self, pdata):
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"""
Expand Down Expand Up @@ -375,7 +375,7 @@ def create_lun(self, pool, project, lun, volsize, targetgroup,
optional - volblocksize, sparse, compression, logbias
"""
svc = '/api/storage/v1/pools/' + pool + '/projects/' + \
project + '/luns'
project + '/luns'
arg = {
'name': lun,
'volsize': volsize,
Expand Down
3 changes: 3 additions & 0 deletions etc/cinder/cinder.conf.sample
Expand Up @@ -2269,6 +2269,9 @@
# (string value)
#zfssa_target_interfaces=<None>

# REST connection timeout. (seconds) (integer value)
#zfssa_rest_timeout=<None>


#
# Options defined in cinder.volume.manager
Expand Down

0 comments on commit b04a1dd

Please sign in to comment.