LOG.error(_("Failed to create iscsi target for volume "
"id:%(vol_id)s. Please ensure your tgtd config file "
"contains 'include %(volumes_dir)s/*'") % {
- 'vol_id': vol_id,
- 'volumes_dir': volumes_dir,
- })
+ 'vol_id': vol_id,
+ 'volumes_dir': volumes_dir, })
raise exception.NotFound()
# NOTE(jdg): Sometimes we have some issues with the backing lun
% {'vol_id': vol_id, 'e': str(e)})
raise exception.ISCSITargetRemoveFailed(volume_id=vol_id)
- os.unlink(volume_path)
+ # NOTE(jdg): This *should* be there still but incase
+ # it's not we don't care, so just ignore it if was
+ # somehow deleted between entry of this method
+ # and here
+ if os.path.exists(volume_path):
+ os.unlink(volume_path)
+ else:
+ LOG.debug('Volume path %s not found at end, '
+ 'of remove_iscsi_target.' % volume_path)
def show_target(self, tid, iqn=None, **kwargs):
if iqn is None:
self._notify_about_volume_usage(context, volume, "attach.end")
return do_attach()
+ @locked_volume_operation
def detach_volume(self, context, volume_id):
"""Updates db to show volume is detached."""
# TODO(vish): refactor this into a more general "unreserve"