Fix off-by-one error in warning
This fixes an off-by-one error in a warning message.
This is a follow-up to 3189c16a5e
.
Change-Id: I89b56974c1b919f4c03498873d3ce9860d5644c5
Related-Bug: #1670916
This commit is contained in:
ironic_python_agent
@@ -392,6 +392,7 @@ class HardwareManager(object):
|
||||
if not CONF.disk_wait_attempts:
|
||||
return
|
||||
|
||||
max_waits = CONF.disk_wait_attempts - 1
|
||||
for attempt in range(CONF.disk_wait_attempts):
|
||||
try:
|
||||
self.get_os_install_device()
|
||||
@@ -400,13 +401,16 @@ class HardwareManager(object):
|
||||
'attempt %d of %d', attempt + 1,
|
||||
CONF.disk_wait_attempts)
|
||||
|
||||
if attempt < CONF.disk_wait_attempts - 1:
|
||||
if attempt < max_waits:
|
||||
time.sleep(CONF.disk_wait_delay)
|
||||
else:
|
||||
break
|
||||
else:
|
||||
LOG.warning('The root device was not detected in %d seconds',
|
||||
CONF.disk_wait_delay * CONF.disk_wait_attempts)
|
||||
if max_waits:
|
||||
LOG.warning('The root device was not detected in %d seconds',
|
||||
CONF.disk_wait_delay * max_waits)
|
||||
else:
|
||||
LOG.warning('The root device was not detected')
|
||||
|
||||
def list_hardware_info(self):
|
||||
"""Return full hardware inventory as a serializable dict.
|
||||
|
Reference in New Issue
Block a user