Update code to remove iscsi targets
* Fixes bug 928475
Change-Id: I9b54436522422d865c7add750d612c371945817a
diff --git a/stack.sh b/stack.sh
index cccde29..0ecbdf8 100755
--- a/stack.sh
+++ b/stack.sh
@@ -1077,15 +1077,12 @@
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