From patchwork Fri Sep 16 02:56:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Spring Zhang X-Patchwork-Id: 4115 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 5B4AD23EF8 for ; Fri, 16 Sep 2011 02:56:15 +0000 (UTC) Received: from mail-fx0-f52.google.com (mail-fx0-f52.google.com [209.85.161.52]) by fiordland.canonical.com (Postfix) with ESMTP id 44D58A1855B for ; Fri, 16 Sep 2011 02:56:15 +0000 (UTC) Received: by fxe23 with SMTP id 23so1805810fxe.11 for ; Thu, 15 Sep 2011 19:56:15 -0700 (PDT) Received: by 10.223.61.66 with SMTP id s2mr1539847fah.27.1316141775058; Thu, 15 Sep 2011 19:56:15 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.11.8 with SMTP id m8cs114850lab; Thu, 15 Sep 2011 19:56:14 -0700 (PDT) Received: by 10.216.133.74 with SMTP id p52mr104065wei.93.1316141774215; Thu, 15 Sep 2011 19:56:14 -0700 (PDT) Received: from indium.canonical.com (indium.canonical.com [91.189.90.7]) by mx.google.com with ESMTPS id k12si9864751wed.73.2011.09.15.19.56.14 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 15 Sep 2011 19:56:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) client-ip=91.189.90.7; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bounces@canonical.com designates 91.189.90.7 as permitted sender) smtp.mail=bounces@canonical.com Received: from ackee.canonical.com ([91.189.89.26]) by indium.canonical.com with esmtp (Exim 4.71 #1 (Debian)) id 1R4Ob7-0002GB-NY for ; Fri, 16 Sep 2011 02:56:13 +0000 Received: from ackee.canonical.com (localhost [127.0.0.1]) by ackee.canonical.com (Postfix) with ESMTP id A8C0FE04A9 for ; Fri, 16 Sep 2011 02:56:13 +0000 (UTC) MIME-Version: 1.0 X-Launchpad-Project: lava-dispatcher X-Launchpad-Branch: ~linaro-validation/lava-dispatcher/trunk X-Launchpad-Message-Rationale: Subscriber X-Launchpad-Branch-Revision-Number: 113 X-Launchpad-Notification-Type: branch-revision To: Linaro Patch Tracker From: noreply@launchpad.net Subject: [Branch ~linaro-validation/lava-dispatcher/trunk] Rev 113: Merge fix for bug 827727, support both xml-rpc and RPC2 endpoints now. Message-Id: <20110916025613.15617.41192.launchpad@ackee.canonical.com> Date: Fri, 16 Sep 2011 02:56:13 -0000 Reply-To: noreply@launchpad.net Sender: bounces@canonical.com Errors-To: bounces@canonical.com Precedence: bulk X-Generated-By: Launchpad (canonical.com); Revision="13955"; Instance="initZopeless config overlay" X-Launchpad-Hash: 182d34eb3addd7820a74fc0b1034a67f58b0d964 Merge authors: Spring Zhang (qzhang) Related merge proposals: https://code.launchpad.net/~qzhang/lava-dispatcher/fix-827727/+merge/74351 proposed by: Spring Zhang (qzhang) review: Approve - Spring Zhang (qzhang) review: Approve - Michael Hudson-Doyle (mwhudson) review: Needs Fixing - Paul Larson (pwlars) ------------------------------------------------------------ revno: 113 [merge] committer: Spring Zhang branch nick: fix-827727 timestamp: Fri 2011-09-16 10:51:47 +0800 message: Merge fix for bug 827727, support both xml-rpc and RPC2 endpoints now. Bug #827727: dispatcher only works with dashboard endpoint modified: doc/android-0xbench-job.json doc/android-basic-job.json doc/android-monkey-job.json doc/lava-ltp-job.json doc/lava-new-kernel.json doc/lava-out-of-tree-test-1.json doc/lava-out-of-tree-test-2.json lava_dispatcher/actions/launch_control.py --- lp:lava-dispatcher https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk You are subscribed to branch lp:lava-dispatcher. To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-dispatcher/trunk/+edit-subscription === modified file 'doc/android-0xbench-job.json' --- doc/android-0xbench-job.json 2011-06-02 20:00:26 +0000 +++ doc/android-0xbench-job.json 2011-09-13 09:15:07 +0000 @@ -28,7 +28,7 @@ "command": "submit_results", "parameters": { - "server": "http://validation.linaro.org/launch-control", + "server": "http://validation.linaro.org/lava-server/RPC2/", "stream": "/anonymous/android-panda01-0xbench/", "result_disk": "sdcard" } === modified file 'doc/android-basic-job.json' --- doc/android-basic-job.json 2011-06-02 20:00:26 +0000 +++ doc/android-basic-job.json 2011-09-13 09:15:07 +0000 @@ -28,7 +28,7 @@ "command": "submit_results_on_host", "parameters": { - "server": "http://validation.linaro.org/launch-control", + "server": "http://validation.linaro.org/lava-server/RPC2/", "stream": "/anonymous/android-panda01-basic/" } } === modified file 'doc/android-monkey-job.json' --- doc/android-monkey-job.json 2011-06-02 20:00:26 +0000 +++ doc/android-monkey-job.json 2011-09-13 09:15:07 +0000 @@ -28,7 +28,7 @@ "command": "submit_results_on_host", "parameters": { - "server": "http://validation.linaro.org/launch-control", + "server": "http://validation.linaro.org/lava-server/RPC2/", "stream": "/anonymous/android-panda01-monkey/" } } === modified file 'doc/lava-ltp-job.json' --- doc/lava-ltp-job.json 2011-09-14 04:18:40 +0000 +++ doc/lava-ltp-job.json 2011-09-16 02:51:47 +0000 @@ -32,7 +32,7 @@ "command": "submit_results", "parameters": { - "server": "http://validation.linaro.org/launch-control", + "server": "http://validation.linaro.org/lava-server/RPC2/", "stream": "/anonymous/panda01-ltp/" } } === modified file 'doc/lava-new-kernel.json' --- doc/lava-new-kernel.json 2011-08-18 10:40:22 +0000 +++ doc/lava-new-kernel.json 2011-09-16 02:51:47 +0000 @@ -22,7 +22,7 @@ "command": "submit_results", "parameters": { - "server": "http://validation.linaro.org/launch-control", + "server": "http://validation.linaro.org/lava-server/RPC2/", "stream": "/anonymous/testresult/" } } === modified file 'doc/lava-out-of-tree-test-1.json' --- doc/lava-out-of-tree-test-1.json 2011-08-19 01:32:22 +0000 +++ doc/lava-out-of-tree-test-1.json 2011-09-13 09:15:07 +0000 @@ -40,7 +40,7 @@ "command": "submit_results", "parameters": { - "server": "http://validation.linaro.org/launch-control", + "server": "http://validation.linaro.org/lava-server/RPC2/", "stream": "/anonymous/panda01-tesing/" } } === modified file 'doc/lava-out-of-tree-test-2.json' --- doc/lava-out-of-tree-test-2.json 2011-08-18 20:38:38 +0000 +++ doc/lava-out-of-tree-test-2.json 2011-09-13 09:15:07 +0000 @@ -33,7 +33,7 @@ "command": "submit_results", "parameters": { - "server": "http://validation.linaro.org/launch-control", + "server": "http://validation.linaro.org/lava-server/dashboard/xml-rpc/", "stream": "/anonymous/panda01-testing/" } } === modified file 'lava_dispatcher/actions/launch_control.py' --- lava_dispatcher/actions/launch_control.py 2011-09-10 03:02:04 +0000 +++ lava_dispatcher/actions/launch_control.py 2011-09-16 02:47:34 +0000 @@ -17,8 +17,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along -# with this program; if not, see . +# along with this program; if not, see . import json import os @@ -34,10 +33,8 @@ class cmd_submit_results_on_host(BaseAction): def run(self, server, stream): - xmlrpc_url = "%s/xml-rpc/" % server - srv = xmlrpclib.ServerProxy(xmlrpc_url, - allow_none=True, use_datetime=True) - + dashboard = _get_dashboard(server) + #Upload bundle files to dashboard bundle_list = os.listdir("/tmp/%s" % self.context.lava_result_dir) for bundle_name in bundle_list: @@ -47,7 +44,7 @@ f.close() try: print >> self.context.oob_file, 'dashboard-put-result:', \ - srv.put_ex(content, bundle, stream) + dashboard.put_ex(content, bundle, stream) except xmlrpclib.Fault, err: print "xmlrpclib.Fault occurred" print "Fault code: %d" % err.faultCode @@ -61,14 +58,12 @@ all_bundles = [] def run(self, server, stream, result_disk="testrootfs"): - """Submit test results to a launch-control server - :param server: URL of the launch-control server - :param stream: Stream on the launch-control server to save the result to + """Submit test results to a lava-dashboard server + :param server: URL of the lava-dashboard server RPC endpoint + :param stream: Stream on the lava-dashboard server to save the result to """ - #Create l-c server connection - xmlrpc_url = "%s/xml-rpc/" % server - srv = xmlrpclib.ServerProxy(xmlrpc_url, - allow_none=True, use_datetime=True) + #Create l-d server connection + dashboard = _get_dashboard(server) client = self.client try: @@ -156,7 +151,7 @@ test_run['attributes'] = attributes json_bundle = json.dumps(main_bundle) print >> self.context.oob_file, 'dashboard-put-result:', \ - srv.put_ex(json_bundle, 'lava-dispatcher.bundle', stream) + dashboard.put_ex(json_bundle, 'lava-dispatcher.bundle', stream) if status == 'fail': raise OperationFailed(err_msg) @@ -173,3 +168,26 @@ test_runs += bundle['test_runs'] return main_bundle +#util function, see if it needs to be part of utils.py +def _get_dashboard(server): + if not server.endswith("/"): + server = ''.join([server, "/"]) + #add backward compatible for 'dashboard/'-end URL + #Fix it: it's going to be deleted after transition + if server.endswith("dashboard/"): + server = ''.join([server, "xml-rpc/"]) + print "WARNING: Please use whole endpoint URL not just end with 'dashboard/', 'xml-rpc/' is added automatically now!!!" + + srv = xmlrpclib.ServerProxy(server, allow_none=True, use_datetime=True) + if server.endswith("xml-rpc/"): + print "WARNING: Please use RPC2 endpoint instead, xml-rpc is deprecated!!!" + dashboard = srv + elif server.endswith("RPC2/"): + #include lava-server/RPC2/ + dashboard = srv.dashboard + else: + print "WARNING: The url seems not RPC2 or xml-rpc endpoints, please make sure it's a valid one!!!" + dashboard = srv.dashboard + print " server RPC endpoint URL: %s" %server + return dashboard +