Merge "Correct IetAdm remove_iscsi_target"
This commit is contained in:
commit
32721a67ae
cinder
@ -118,5 +118,5 @@ class IetAdmTestCase(test.TestCase, TargetAdminTestCase):
|
||||
'ietadm --op new --tid=%(tid)s --lun=%(lun)s '
|
||||
'--params Path=%(path)s,Type=fileio',
|
||||
'ietadm --op show --tid=%(tid)s',
|
||||
'ietadm --op delete --tid=%(tid)s',
|
||||
'ietadm --op delete --tid=%(tid)s --lun=%(lun)s'])
|
||||
'ietadm --op delete --tid=%(tid)s --lun=%(lun)s',
|
||||
'ietadm --op delete --tid=%(tid)s'])
|
||||
|
@ -1029,3 +1029,18 @@ class UndoManager(object):
|
||||
LOG.exception(msg, **kwargs)
|
||||
|
||||
self._rollback()
|
||||
|
||||
|
||||
def ensure_tree(path):
|
||||
"""Create a directory (and any ancestor directories required)
|
||||
|
||||
:param path: Directory to create
|
||||
"""
|
||||
try:
|
||||
os.makedirs(path)
|
||||
except OSError as exc:
|
||||
if exc.errno == errno.EEXIST:
|
||||
if not os.path.isdir(path):
|
||||
raise
|
||||
else:
|
||||
raise
|
||||
|
@ -109,8 +109,7 @@ class TgtAdm(TargetAdmin):
|
||||
# Note(jdg) tid and lun aren't used by TgtAdm but remain for
|
||||
# compatibility
|
||||
|
||||
if not os.path.exists(FLAGS.volumes_dir):
|
||||
os.makedirs(FLAGS.volumes_dir)
|
||||
utils.ensure_tree(FLAGS.volumes_dir)
|
||||
|
||||
vol_id = name.split(':')[1]
|
||||
volume_conf = """
|
||||
@ -194,8 +193,8 @@ class IetAdm(TargetAdmin):
|
||||
|
||||
def remove_iscsi_target(self, tid, lun, vol_id, **kwargs):
|
||||
LOG.info(_('Removing volume: %s') % vol_id)
|
||||
self._delete_target(tid, **kwargs)
|
||||
self._delete_logicalunit(tid, lun, **kwargs)
|
||||
self._delete_target(tid, **kwargs)
|
||||
|
||||
def _new_target(self, name, tid, **kwargs):
|
||||
self._run('--op', 'new',
|
||||
|
Loading…
x
Reference in New Issue
Block a user