From 7edfaa232161665ad7b2e5a4cbe0284cc713d0ca Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Tue, 22 Mar 2016 10:02:35 -0400 Subject: [PATCH] Oops - fix a typo in the new zfs list_pools output to preserve the "%" symbols in the outputs. That symbol only needs to get trimmed out during the system health checks - not globally. --- src/server/EventWatcher.cpp | 3 ++- src/server/library/sysadm-zfs.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/server/EventWatcher.cpp b/src/server/EventWatcher.cpp index 07d8bca..1d49fa8 100644 --- a/src/server/EventWatcher.cpp +++ b/src/server/EventWatcher.cpp @@ -352,7 +352,8 @@ void EventWatcher::CheckSystemState(){ } // Check the capacity, if over 90% we should warn bool ok = false; - int cap = zpools.value(pools[i]).toObject().value("capacity").toInt(ok); + QString capacity = zpools.value(pools[i]).toObject().value("capacity").toString(); + int cap = capacity.replace("%","").toInt(&ok); if(ok && cap>90) { if(priority < 6){ priority = 6; } } diff --git a/src/server/library/sysadm-zfs.cpp b/src/server/library/sysadm-zfs.cpp index 3ab95af..5209040 100644 --- a/src/server/library/sysadm-zfs.cpp +++ b/src/server/library/sysadm-zfs.cpp @@ -24,8 +24,8 @@ QJsonObject ZFS::zpool_list(){ QString used = info[i].section(" ",2,2,QString::SectionSkipEmpty); QString free = info[i].section(" ",3,3,QString::SectionSkipEmpty); QString expandsz = info[i].section(" ",4,4,QString::SectionSkipEmpty); - QString frag = info[i].section(" ",5,5,QString::SectionSkipEmpty).replace("%",""); - QString cap = info[i].section(" ",6,6,QString::SectionSkipEmpty).replace("%",""); + QString frag = info[i].section(" ",5,5,QString::SectionSkipEmpty); + QString cap = info[i].section(" ",6,6,QString::SectionSkipEmpty); QString dedup = info[i].section(" ",7,7,QString::SectionSkipEmpty); QString health = info[i].section(" ",8,8,QString::SectionSkipEmpty); QString altroot = info[i].section(" ",9,9,QString::SectionSkipEmpty);