If a cluster allows sharedfile as only disk template, the
amount of free spindles might not be available. This is
perfectly normal, hence the luxi backend of htools should
handle this case gracefully and just report 0 available spindles.

Signed-off-by: Klaus Aehlig <[email protected]>
---
 src/Ganeti/HTools/Backend/Luxi.hs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/Ganeti/HTools/Backend/Luxi.hs 
b/src/Ganeti/HTools/Backend/Luxi.hs
index bd04d60..669d9aa 100644
--- a/src/Ganeti/HTools/Backend/Luxi.hs
+++ b/src/Ganeti/HTools/Backend/Luxi.hs
@@ -220,7 +220,10 @@ parseNode ktg [ name, mtotal, mnode, mfree, dtotal, dfree
   xsptotal <- if xexcl_stor
               then lvconvert 0 "sptotal" sptotal
               else convert "spindles" spindles
-  xspfree <- lvconvert 0 "spfree" spfree
+  xspfree <- genericResult (const $ return (0 :: Int)) return
+               $ lvconvert 0 "spfree" spfree
+               -- "spfree" might be missing, if sharedfile is the only
+               -- supported disk template
   xmtotal <- lvconvert 0.0 "mtotal" mtotal
   xmnode <- lvconvert 0 "mnode" mnode
   xmfree <- lvconvert 0 "mfree" mfree
-- 
2.0.0.526.g5318336

Reply via email to