Commit 368e95fd authored by Apollon Oikonomopoulos's avatar Apollon Oikonomopoulos Committed by Klaus Aehlig

luxid: fix detection of master node in node query

Ganeti.Config.getNodeRole would rely on clusterMasterNode returning the
master node name, however clusterMasterNode returns the master node's
UUID. We fix this and a similar issue in Ganeti.Query.Node.nodeFields.

Together with 1ec34e26, this fixes issue #687.
Signed-off-by: default avatarApollon Oikonomopoulos <apoikos@gmail.com>
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 1ec34e26
...@@ -119,7 +119,7 @@ getNodeInstances cfg nname = ...@@ -119,7 +119,7 @@ getNodeInstances cfg nname =
-- | Computes the role of a node. -- | Computes the role of a node.
getNodeRole :: ConfigData -> Node -> NodeRole getNodeRole :: ConfigData -> Node -> NodeRole
getNodeRole cfg node getNodeRole cfg node
| nodeName node == clusterMasterNode (configCluster cfg) = NRMaster | nodeUuid node == clusterMasterNode (configCluster cfg) = NRMaster
| nodeMasterCandidate node = NRCandidate | nodeMasterCandidate node = NRCandidate
| nodeDrained node = NRDrained | nodeDrained node = NRDrained
| nodeOffline node = NROffline | nodeOffline node = NROffline
......
...@@ -200,7 +200,7 @@ nodeFields = ...@@ -200,7 +200,7 @@ nodeFields =
FieldSimple (rsNormal . nodeSecondaryIp), QffNormal) FieldSimple (rsNormal . nodeSecondaryIp), QffNormal)
, (FieldDefinition "master" "IsMaster" QFTBool "Whether node is master", , (FieldDefinition "master" "IsMaster" QFTBool "Whether node is master",
FieldConfig (\cfg node -> FieldConfig (\cfg node ->
rsNormal (nodeName node == rsNormal (nodeUuid node ==
clusterMasterNode (configCluster cfg))), clusterMasterNode (configCluster cfg))),
QffNormal) QffNormal)
, (FieldDefinition "group" "Group" QFTText "Node group", , (FieldDefinition "group" "Group" QFTText "Node group",
......
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