Don't clobber all iSCSI connections during nova cleanup

The existing cleanup_nova() code inadvertently logs out of all iSCSI
connections on the machine because it does not pass the target name
as the -T parameter. This patch changes it to step through the targets
that match the pattern, logging out of each individually, and following
up with a delete op to cleanup the database.

Change-Id: I26c14acbe0e8de18f0e3bf7ad83b37379503e199
diff --git a/lib/nova b/lib/nova
index 4449f81..46eeea4 100644
--- a/lib/nova
+++ b/lib/nova
@@ -156,8 +156,11 @@
         fi
 
         # Logout and delete iscsi sessions
-        sudo iscsiadm --mode node | grep $VOLUME_NAME_PREFIX | cut -d " " -f2 | xargs sudo iscsiadm --mode node --logout || true
-        sudo iscsiadm --mode node | grep $VOLUME_NAME_PREFIX | cut -d " " -f2 | sudo iscsiadm --mode node --op delete || true
+        tgts=$(sudo iscsiadm --mode node | grep $VOLUME_NAME_PREFIX | cut -d ' ' -f2)
+        for target in $tgts; do
+            sudo iscsiadm --mode node -T $target --logout || true
+        done
+        sudo iscsiadm --mode node --op delete || true
 
         # Clean out the instances directory.
         sudo rm -rf $NOVA_INSTANCES_PATH/*