LGTM, thanks.
On Fri, Nov 29, 2013 at 9:30 AM, Jose A. Lopes <[email protected]> wrote: > * fix node daemon not to skip data, such as, memory and disk size, > when building the node list to send to HBal, given that these data > are important for HBal to determine whether an evacuation is > possible > * fix iallocator to properly load drained nodes from the list passed > by the node daemon, instead of zeroing all the data, such as, the > memory and disk size > * this fixes issue 615 > > Signed-off-by: Jose A. Lopes <[email protected]> > --- > lib/masterd/iallocator.py | 2 +- > src/Ganeti/HTools/Backend/IAlloc.hs | 6 +++--- > src/Ganeti/HTools/Backend/Luxi.hs | 4 ++-- > src/Ganeti/HTools/Backend/Rapi.hs | 6 +++--- > 4 files changed, 9 insertions(+), 9 deletions(-) > > diff --git a/lib/masterd/iallocator.py b/lib/masterd/iallocator.py > index 4790d46..a32897b 100644 > --- a/lib/masterd/iallocator.py > +++ b/lib/masterd/iallocator.py > @@ -515,7 +515,7 @@ class IAllocator(object): > assert nname in node_results, "Missing basic data for node %s" % > nname > ninfo = node_cfg[nname] > > - if not (ninfo.offline or ninfo.drained): > + if not ninfo.offline: > nresult.Raise("Can't get data for node %s" % nname) > node_iinfo[nname].Raise("Can't get node instance info from node > %s" % > nname) > diff --git a/src/Ganeti/HTools/Backend/IAlloc.hs > b/src/Ganeti/HTools/Backend/IAlloc.hs > index c421b5f..b575af1 100644 > --- a/src/Ganeti/HTools/Backend/IAlloc.hs > +++ b/src/Ganeti/HTools/Backend/IAlloc.hs > @@ -132,7 +132,7 @@ parseNode ktg n a = do > gidx <- lookupGroup ktg n guuid > ndparams <- extract "ndparams" >>= asJSObject > spindles <- tryFromObj desc (fromJSObject ndparams) "spindle_count" > - let live = not offline && not drained && vm_capable' > + let live = not offline && vm_capable' > lvextract def = eitherLive live def . extract > mtotal <- lvextract 0.0 "total_memory" > mnode <- lvextract 0 "reserved_memory" > @@ -140,8 +140,8 @@ parseNode ktg n a = do > dtotal <- lvextract 0.0 "total_disk" > dfree <- lvextract 0 "free_disk" > ctotal <- lvextract 0.0 "total_cpus" > - let node = Node.create n mtotal mnode mfree dtotal dfree ctotal (not > live) > - spindles gidx > + let node = Node.create n mtotal mnode mfree dtotal dfree ctotal > + (not live || drained) spindles gidx > return (n, node) > > -- | Parses a group as found in the cluster group list. > diff --git a/src/Ganeti/HTools/Backend/Luxi.hs > b/src/Ganeti/HTools/Backend/Luxi.hs > index 728054e..2379591 100644 > --- a/src/Ganeti/HTools/Backend/Luxi.hs > +++ b/src/Ganeti/HTools/Backend/Luxi.hs > @@ -194,7 +194,7 @@ parseNode ktg [ name, mtotal, mnode, mfree, dtotal, > dfree > xvm_capable <- convert "vm_capable" vm_capable > xspindles <- convert "spindles" spindles > xgdx <- convert "group.uuid" g_uuid >>= lookupGroup ktg xname > - let live = not xoffline && not xdrained && xvm_capable > + let live = not xoffline && xvm_capable > lvconvert def n d = eitherLive live def $ convert n d > xmtotal <- lvconvert 0.0 "mtotal" mtotal > xmnode <- lvconvert 0 "mnode" mnode > @@ -203,7 +203,7 @@ parseNode ktg [ name, mtotal, mnode, mfree, dtotal, > dfree > xdfree <- lvconvert 0 "dfree" dfree > xctotal <- lvconvert 0.0 "ctotal" ctotal > let node = Node.create xname xmtotal xmnode xmfree xdtotal xdfree > - xctotal (not live) xspindles xgdx > + xctotal (not live || xdrained) xspindles xgdx > return (xname, node) > > parseNode _ v = fail ("Invalid node query result: " ++ show v) > diff --git a/src/Ganeti/HTools/Backend/Rapi.hs > b/src/Ganeti/HTools/Backend/Rapi.hs > index d078a79..e29fcb4 100644 > --- a/src/Ganeti/HTools/Backend/Rapi.hs > +++ b/src/Ganeti/HTools/Backend/Rapi.hs > @@ -157,7 +157,7 @@ parseNode ktg a = do > spindles <- tryFromObj desc (fromJSObject ndparams) "spindle_count" > guuid <- annotateResult desc $ maybeFromObj a "group.uuid" > guuid' <- lookupGroup ktg name (fromMaybe defaultGroupID guuid) > - let live = not offline && not drained && vm_cap' > + let live = not offline && vm_cap' > lvextract def = eitherLive live def . extract > mtotal <- lvextract 0.0 "mtotal" > mnode <- lvextract 0 "mnode" > @@ -165,8 +165,8 @@ parseNode ktg a = do > dtotal <- lvextract 0.0 "dtotal" > dfree <- lvextract 0 "dfree" > ctotal <- lvextract 0.0 "ctotal" > - let node = Node.create name mtotal mnode mfree dtotal dfree ctotal (not > live) > - spindles guuid' > + let node = Node.create name mtotal mnode mfree dtotal dfree ctotal > + (not live || drained) spindles guuid' > return (name, node) > > -- | Construct a group from a JSON object. > -- > 1.8.4.1 > > -- Thomas Thrainer | Software Engineer | [email protected] | Google Germany GmbH Dienerstr. 12 80331 München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores
