Commit 67ec18c0 authored by Jose A. Lopes's avatar Jose A. Lopes

Fix evacuation out of drained node

* 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: default avatarJose A. Lopes <jabolopes@google.com>
Reviewed-by: default avatarThomas Thrainer <thomasth@google.com>
parent 0eb83d70
......@@ -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)
......
......@@ -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.
......
......@@ -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)
......
......@@ -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.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment