Permalink
Browse files

Add a better check to ensure the disk we are trying to add isn't

already in a zpool
  • Loading branch information...
1 parent ddd6a12 commit 6b017ea04a48625d5c39fa713295954a5657d89a @kmoore134 kmoore134 committed Sep 12, 2013
Showing with 5 additions and 0 deletions.
  1. +5 −0 src-sh/lpreserver/backend/functions.sh
@@ -412,6 +412,11 @@ add_zpool_disk() {
exit 0
fi
+ zpool list -H -v | awk '{print $1}' | grep -q "^$disk"
+ if [ $? -eq 0 ] ; then
+ exit_err "Error: This disk is already apart of a zpool!"
+ fi
+
# Check if pool exists
zpool status $pool >/dev/null 2>/dev/null
if [ $? -ne 0 ] ; then exit_err "Invalid pool: $pool"; fi

0 comments on commit 6b017ea

Please sign in to comment.