diff --git a/lib/confd/querylib.py b/lib/confd/querylib.py index f757760df13b3ddc6558bc6cc97c9ee3f35158ab..eda060a3c129d924c3ead6ebef9686c8093ffff8 100644 --- a/lib/confd/querylib.py +++ b/lib/confd/querylib.py @@ -94,6 +94,9 @@ class ClusterMasterQuery(ConfdQuery): It accepts no arguments, and returns the current cluster master. """ + def _GetMasterNode(self): + return self.reader.GetMasterNode() + def Exec(self, query): """ClusterMasterQuery main execution @@ -109,9 +112,11 @@ class ClusterMasterQuery(ConfdQuery): answer = [] for field in req_fields: if field == constants.CONFD_REQFIELD_NAME: - answer.append(self.reader.GetMasterNode()) + answer.append(self._GetMasterNode()) elif field == constants.CONFD_REQFIELD_IP: answer.append(self.reader.GetMasterIP()) + elif field == constants.CONFD_REQFIELD_MNODE_PIP: + answer.append(self.reader.GetNodePrimaryIp(self._GetMasterNode())) else: logging.debug("missing FIELDS in query dict") return QUERY_ARGUMENT_ERROR diff --git a/lib/constants.py b/lib/constants.py index 07493cd3cb22b31474351c281b076bf3b3fecef3..54a8a01629f0c42dc7bf3d15a32664c33e1cf336 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -691,6 +691,7 @@ CONFD_REQQ_FIELDS = "3" CONFD_REQFIELD_NAME = "0" CONFD_REQFIELD_IP = "1" +CONFD_REQFIELD_MNODE_PIP = "2" CONFD_REQS = frozenset([ CONFD_REQ_PING,