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: Apollon Oikonomopoulos <[email protected]>
---
 src/Ganeti/Config.hs     | 2 +-
 src/Ganeti/Query/Node.hs | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/Ganeti/Config.hs b/src/Ganeti/Config.hs
index 9eb016d..1f70836 100644
--- a/src/Ganeti/Config.hs
+++ b/src/Ganeti/Config.hs
@@ -119,7 +119,7 @@ getNodeInstances cfg nname =
 -- | Computes the role of a node.
 getNodeRole :: ConfigData -> Node -> NodeRole
 getNodeRole cfg node
-  | nodeName node == clusterMasterNode (configCluster cfg) = NRMaster
+  | nodeUuid node == clusterMasterNode (configCluster cfg) = NRMaster
   | nodeMasterCandidate node = NRCandidate
   | nodeDrained node = NRDrained
   | nodeOffline node = NROffline
diff --git a/src/Ganeti/Query/Node.hs b/src/Ganeti/Query/Node.hs
index a3ad236..8f154c6 100644
--- a/src/Ganeti/Query/Node.hs
+++ b/src/Ganeti/Query/Node.hs
@@ -200,7 +200,7 @@ nodeFields =
      FieldSimple (rsNormal . nodeSecondaryIp), QffNormal)
   , (FieldDefinition "master" "IsMaster" QFTBool "Whether node is master",
      FieldConfig (\cfg node ->
-                    rsNormal (nodeName node ==
+                    rsNormal (nodeUuid node ==
                               clusterMasterNode (configCluster cfg))),
      QffNormal)
   , (FieldDefinition "group" "Group" QFTText "Node group",
-- 
1.8.5.2

Reply via email to