]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Retry remove iscsi target
authorMatt Riedemann <mriedem@us.ibm.com>
Fri, 7 Nov 2014 14:23:09 +0000 (06:23 -0800)
committerMatt Riedemann <mriedem@us.ibm.com>
Fri, 7 Nov 2014 14:23:09 +0000 (06:23 -0800)
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

index c7278207c507c9d0a3ba2f7ee68c536645ae40df..c68fa22beac1d10802c41c1f6d7c55c23371c28c 100644 (file)
@@ -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")