mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
tests: nawk -> awk
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13259
This commit is contained in:
@@ -2018,13 +2018,8 @@ function verify_pool
|
||||
#
|
||||
function get_disklist # pool
|
||||
{
|
||||
typeset disklist=""
|
||||
|
||||
disklist=$(zpool iostat -v $1 | nawk '(NR >4) {print $1}' | \
|
||||
grep -v "\-\-\-\-\-" | \
|
||||
egrep -v -e "^(mirror|raidz[1-3]|draid[1-3]|spare|log|cache|special|dedup)|\-[0-9]$")
|
||||
|
||||
echo $disklist
|
||||
zpool iostat -v $1 | awk '(NR > 4) {print $1}' | \
|
||||
egrep -v -e '^-----' -e "^(mirror|raidz[1-3]|draid[1-3]|spare|log|cache|special|dedup)|\-[0-9]$"
|
||||
}
|
||||
|
||||
#
|
||||
@@ -2033,8 +2028,7 @@ function get_disklist # pool
|
||||
#
|
||||
function get_disklist_fullpath # pool
|
||||
{
|
||||
args="-P $1"
|
||||
get_disklist $args
|
||||
get_disklist "-P $1"
|
||||
}
|
||||
|
||||
|
||||
@@ -2183,14 +2177,12 @@ function check_pool_status # pool token keyword <verbose>
|
||||
typeset keyword=$3
|
||||
typeset verbose=${4:-false}
|
||||
|
||||
scan=$(zpool status -v "$pool" 2>/dev/null | nawk -v token="$token:" '
|
||||
scan=$(zpool status -v "$pool" 2>/dev/null | awk -v token="$token:" '
|
||||
($1==token) {print $0}')
|
||||
if [[ $verbose == true ]]; then
|
||||
log_note $scan
|
||||
fi
|
||||
echo $scan | egrep -i "$keyword" > /dev/null 2>&1
|
||||
|
||||
return $?
|
||||
echo $scan | egrep -qi "$keyword"
|
||||
}
|
||||
|
||||
#
|
||||
@@ -2968,15 +2960,14 @@ function get_device_state #pool disk field("", "spares","logs")
|
||||
typeset disk=${2#$DEV_DSKDIR/}
|
||||
typeset field=${3:-$pool}
|
||||
|
||||
state=$(zpool status -v "$pool" 2>/dev/null | \
|
||||
nawk -v device=$disk -v pool=$pool -v field=$field \
|
||||
zpool status -v "$pool" 2>/dev/null | \
|
||||
awk -v device=$disk -v pool=$pool -v field=$field \
|
||||
'BEGIN {startconfig=0; startfield=0; }
|
||||
/config:/ {startconfig=1}
|
||||
(startconfig==1) && ($1==field) {startfield=1; next;}
|
||||
(startfield==1) && ($1==device) {print $2; exit;}
|
||||
(startfield==1) &&
|
||||
($1==field || $1 ~ "^spares$" || $1 ~ "^logs$") {startfield=0}')
|
||||
echo $state
|
||||
($1==field || $1 ~ "^spares$" || $1 ~ "^logs$") {startfield=0}'
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user