On Mon, Jul 7, 2014 at 3:05 PM, 'Hrvoje Ribicic' via ganeti-devel < [email protected]> wrote:
> LGTM, thanks > > > On Mon, Jul 7, 2014 at 3:02 PM, 'Klaus Aehlig' via ganeti-devel < > [email protected]> wrote: > >> 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 >> > I know that the ship has already sailed. Just an idea: since we're unwrapping the error, we don't need to be in the monad any more, it'd be enough to write something like let xspfree = genericResult (const $ 0 :: Int) id $ lvconvert 0 "spfree" spfree > xmtotal <- lvconvert 0.0 "mtotal" mtotal >> xmnode <- lvconvert 0 "mnode" mnode >> xmfree <- lvconvert 0 "mfree" mfree >> -- >> 2.0.0.526.g5318336 >> >> >
