Skip to content

Commit

Permalink
Update code to remove iscsi targets
Browse files Browse the repository at this point in the history
 * Fixes bug 928475

Change-Id: I9b54436522422d865c7add750d612c371945817a
  • Loading branch information
sleepsonthefloor authored and vishvananda committed Feb 14, 2012
1 parent b644295 commit 6325216
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions stack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1077,15 +1077,12 @@ if [[ "$ENABLED_SERVICES" =~ "n-vol" ]]; then
fi

if sudo vgs $VOLUME_GROUP; then
# Remove nova iscsi targets
sudo tgtadm --op show --mode target | grep $VOLUME_NAME_PREFIX | grep Target | cut -f3 -d ' ' | sudo xargs -n1 tgt-admin --delete || true
# Clean out existing volumes
for lv in `sudo lvs --noheadings -o lv_name $VOLUME_GROUP`; do
# VOLUME_NAME_PREFIX prefixes the LVs we want
if [[ "${lv#$VOLUME_NAME_PREFIX}" != "$lv" ]]; then
tid=`egrep "^tid.+$lv" /proc/net/iet/volume | cut -f1 -d' ' | tr ':' '='`
if [[ -n "$tid" ]]; then
lun=`egrep "lun.+$lv" /proc/net/iet/volume | cut -f1 -d' ' | tr ':' '=' | tr -d '\t'`
sudo ietadm --op delete --$tid --$lun
fi
sudo lvremove -f $VOLUME_GROUP/$lv
fi
done
Expand Down

0 comments on commit 6325216

Please sign in to comment.