diff --git a/etc/ironic/ironic.conf.sample b/etc/ironic/ironic.conf.sample index 5c114d8c6e..1ee1c0c87b 100644 --- a/etc/ironic/ironic.conf.sample +++ b/etc/ironic/ironic.conf.sample @@ -752,6 +752,23 @@ #check_device_max_retries=20 +[drac] + +# +# Options defined in ironic.drivers.modules.drac.client +# + +# In case there is a communication failure, the DRAC client is +# going to resend the request as many times as defined in this +# setting. (integer value) +#client_retry_count=5 + +# In case there is a communication failure, the DRAC client is +# going to wait for as many seconds as defined in this setting +# before resending the request. (integer value) +#client_retry_delay=5 + + [glance] # diff --git a/ironic/drivers/modules/drac/client.py b/ironic/drivers/modules/drac/client.py index a2b23b8abe..00c775927f 100644 --- a/ironic/drivers/modules/drac/client.py +++ b/ironic/drivers/modules/drac/client.py @@ -18,6 +18,7 @@ Wrapper for pywsman.Client import time from xml.etree import ElementTree +from oslo_config import cfg from oslo_log import log as logging from oslo_utils import importutils @@ -27,6 +28,25 @@ from ironic.drivers.modules.drac import common as drac_common pywsman = importutils.try_import('pywsman') +opts = [ + cfg.IntOpt('client_retry_count', + default=5, + help='In case there is a communication failure, the DRAC ' + 'client is going to resend the request as many times as ' + 'defined in this setting.'), + cfg.IntOpt('client_retry_delay', + default=5, + help='In case there is a communication failure, the DRAC ' + 'client is going to wait for as many seconds as defined ' + 'in this setting before resending the request.') +] + +CONF = cfg.CONF +opt_group = cfg.OptGroup(name='drac', + title='Options for the DRAC driver') +CONF.register_group(opt_group) +CONF.register_opts(opts, opt_group) + LOG = logging.getLogger(__name__) _SOAP_ENVELOPE_URI = 'http://www.w3.org/2003/05/soap-envelope' @@ -41,9 +61,6 @@ RET_SUCCESS = '0' RET_ERROR = '2' RET_CREATED = '4096' -RETRY_COUNT = 5 -RETRY_DELAY = 5 - def get_wsman_client(node): """Return a DRAC client object. @@ -65,7 +82,7 @@ def retry_on_empty_response(client, action, *args, **kwargs): """Wrapper to retry an action on failure.""" func = getattr(client, action) - for i in range(RETRY_COUNT): + for i in range(CONF.drac.client_retry_count): response = func(*args, **kwargs) if response: return response @@ -81,7 +98,7 @@ def retry_on_empty_response(client, action, *args, **kwargs): 'response_code': client.response_code(), 'count': i + 1}) - time.sleep(RETRY_DELAY) + time.sleep(CONF.drac.client_retry_delay) class Client(object):