From 98a746b1724a53994a3707db6aad7110cf662537 Mon Sep 17 00:00:00 2001 From: Matt Riedemann Date: Fri, 7 Nov 2014 06:23:09 -0800 Subject: [PATCH] Retry remove iscsi target There is a race in the gate when removing an iscsi target in the remove export flow where the target is still active. It's about a 75% failure rate so simply adding a configurable retry on the delete call should clean that up. Change-Id: I8531652e8b80f1c65c9942e109dea01fda5674e0 Closes-Bug: #1363258 --- cinder/brick/iscsi/iscsi.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cinder/brick/iscsi/iscsi.py b/cinder/brick/iscsi/iscsi.py index c7278207c..c68fa22be 100644 --- a/cinder/brick/iscsi/iscsi.py +++ b/cinder/brick/iscsi/iscsi.py @@ -23,6 +23,7 @@ import re import stat import time +from oslo.config import cfg import six from cinder.brick import exception @@ -35,6 +36,8 @@ from cinder import utils LOG = logging.getLogger(__name__) +CONF = cfg.CONF + class TargetAdmin(executor.Executor): """iSCSI target administration. @@ -301,7 +304,8 @@ class TgtAdm(TargetAdmin): '--force', '--delete', iqn, - run_as_root=True) + run_as_root=True, + attempts=CONF.num_shell_tries) except putils.ProcessExecutionError as e: LOG.error(_("Failed to remove iscsi target for volume " "id:%(vol_id)s: %(e)s") -- 2.45.2