On Wed, Dec 02, 2009 at 03:03:22PM +0100, Guido Trotter wrote: > By allowing also the primary ip field to be fetched directly, we avoid > one more confd lookup, or dns request, to find out which address the > master node lives at. > > Signed-off-by: Guido Trotter <[email protected]>
LGTM. > --- > lib/confd/querylib.py | 7 ++++++- > lib/constants.py | 1 + > 2 files changed, 7 insertions(+), 1 deletions(-) > > diff --git a/lib/confd/querylib.py b/lib/confd/querylib.py > index f757760..eda060a 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())) Two calls here to self._GetMasterNode(), but not easy to rewrite it better. iustin
