On Thu, May 22, 2014 at 3:39 PM, Jose A. Lopes <[email protected]> wrote:
> Typo in patch title. > ACK > > On May 22 14:56, 'Helga Velroyen' via ganeti-devel wrote: > > One 'too many branches' error. > > > > Signed-off-by: Helga Velroyen <[email protected]> > > --- > > tools/confd-client | 50 > ++++++++++++++++++++++++++++++-------------------- > > 1 file changed, 30 insertions(+), 20 deletions(-) > > > > diff --git a/tools/confd-client b/tools/confd-client > > index a070088..f2e6ae6 100755 > > --- a/tools/confd-client > > +++ b/tools/confd-client > > @@ -133,21 +133,40 @@ class TestClient(object): > > > > self.opts = options > > > > + def _ProcessNotOk(self, reply, reqtype): > > + Log("Query %s gave non-ok status %s: %s" % (reply.orig_request, > > + > reply.server_reply.status, > > + reply.server_reply)) > > + if self.is_timing: > > + Err("Aborting timing tests") > > + if reqtype == constants.CONFD_REQ_CLUSTER_MASTER: > > + Err("Cannot continue after master query failure") > > + if reqtype == constants.CONFD_REQ_INSTANCES_IPS_LIST: > > + Err("Cannot continue after instance IP list query failure") > > + > > + def _ProcessIpList(self, answer): > > + Log("Instance primary IP query: OK") > > + if not answer: > > + Log("no IPs received", indent=1) > > + else: > > + LogAtMost(answer, 5, indent=1) > > + self.instance_ips = answer > > If you still have patience, you could make also make these methods static. > > LGTM. > > Thanks, > Jose > > FYI, interdiff: diff --git a/tools/confd-client b/tools/confd-client index f2e6ae6..2224792 100755 --- a/tools/confd-client +++ b/tools/confd-client @@ -133,24 +133,24 @@ class TestClient(object): self.opts = options - def _ProcessNotOk(self, reply, reqtype): + def _ProcessNotOk(self, reply, reqtype, is_timing): Log("Query %s gave non-ok status %s: %s" % (reply.orig_request, reply.server_reply.status, reply.server_reply)) - if self.is_timing: + if is_timing: Err("Aborting timing tests") if reqtype == constants.CONFD_REQ_CLUSTER_MASTER: Err("Cannot continue after master query failure") if reqtype == constants.CONFD_REQ_INSTANCES_IPS_LIST: Err("Cannot continue after instance IP list query failure") - def _ProcessIpList(self, answer): + @staticmethod + def _ProcessIpList(answer): Log("Instance primary IP query: OK") if not answer: Log("no IPs received", indent=1) else: LogAtMost(answer, 5, indent=1) - self.instance_ips = answer @staticmethod def _ProcessMapping(answer): @@ -166,7 +166,7 @@ class TestClient(object): answer = reply.server_reply.answer reqtype = reply.orig_request.type if reply.server_reply.status != constants.CONFD_REPL_STATUS_OK: - self._ProcessNotOk(reply, reqtype) + self._ProcessNotOk(reply, reqtype, self.is_timing) return if self.is_timing: return @@ -189,7 +189,7 @@ class TestClient(object): Log("Master candidates primary IP query: OK") LogAtMost(answer, 5, indent=1) elif reqtype == constants.CONFD_REQ_INSTANCES_IPS_LIST: - self._ProcessIpList(answer) + self.instance_ips = self._ProcessIpList(answer) elif reqtype == constants.CONFD_REQ_NODE_PIP_BY_INSTANCE_IP: self._ProcessMapping(answer) else: > > + > > + @staticmethod > > + def _ProcessMapping(answer): > > + Log("Instance IP to node IP query: OK") > > + if not answer: > > + Log("no mapping received", indent=1) > > + else: > > + LogAtMost(answer, 5, indent=1) > > + > > def ConfdCallback(self, reply): > > """Callback for confd queries""" > > if reply.type == confd_client.UPCALL_REPLY: > > answer = reply.server_reply.answer > > reqtype = reply.orig_request.type > > if reply.server_reply.status != constants.CONFD_REPL_STATUS_OK: > > - Log("Query %s gave non-ok status %s: %s" % (reply.orig_request, > > - > reply.server_reply.status, > > - reply.server_reply)) > > - if self.is_timing: > > - Err("Aborting timing tests") > > - if reqtype == constants.CONFD_REQ_CLUSTER_MASTER: > > - Err("Cannot continue after master query failure") > > - if reqtype == constants.CONFD_REQ_INSTANCES_IPS_LIST: > > - Err("Cannot continue after instance IP list query failure") > > + self._ProcessNotOk(reply, reqtype) > > return > > if self.is_timing: > > return > > @@ -170,18 +189,9 @@ class TestClient(object): > > Log("Master candidates primary IP query: OK") > > LogAtMost(answer, 5, indent=1) > > elif reqtype == constants.CONFD_REQ_INSTANCES_IPS_LIST: > > - Log("Instance primary IP query: OK") > > - if not answer: > > - Log("no IPs received", indent=1) > > - else: > > - LogAtMost(answer, 5, indent=1) > > - self.instance_ips = answer > > + self._ProcessIpList(answer) > > elif reqtype == constants.CONFD_REQ_NODE_PIP_BY_INSTANCE_IP: > > - Log("Instance IP to node IP query: OK") > > - if not answer: > > - Log("no mapping received", indent=1) > > - else: > > - LogAtMost(answer, 5, indent=1) > > + self._ProcessMapping(answer) > > else: > > Log("Unhandled reply %s, please fix the client", reqtype) > > print answer > > -- > > 1.9.1.423.g4596e3a > > > > -- > Jose Antonio Lopes > Ganeti Engineering > Google Germany GmbH > Dienerstr. 12, 80331, München > > Registergericht und -nummer: Hamburg, HRB 86891 > Sitz der Gesellschaft: Hamburg > Geschäftsführer: Graham Law, Christine Elizabeth Flores > Steuernummer: 48/725/00206 > Umsatzsteueridentifikationsnummer: DE813741370 > -- -- Helga Velroyen | Software Engineer | [email protected] | Google Germany GmbH Dienerstr. 12 80331 München Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Geschäftsführer: Graham Law, Christine Elizabeth Flores
