From nobody Mon Dec 30 16:23:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) client-ip=66.187.230.42; envelope-from=kimchi-devel-bounces@ovirt.org; helo=lists.ovirt.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of ovirt.org designates 66.187.230.42 as permitted sender) smtp.mailfrom=kimchi-devel-bounces@ovirt.org; Return-Path: Received: from lists.ovirt.org (lists.phx.ovirt.org [66.187.230.42]) by mx.zohomail.com with SMTPS id 1486492578043493.36949790407255; Tue, 7 Feb 2017 10:36:18 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 22CCB8205DD; Tue, 7 Feb 2017 18:36:17 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lists.ovirt.org (Postfix) with ESMTPS id 8BBD882054C for ; Tue, 7 Feb 2017 18:35:40 +0000 (UTC) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v17IXwg9039704 for ; Tue, 7 Feb 2017 13:35:40 -0500 Received: from e24smtp02.br.ibm.com (e24smtp02.br.ibm.com [32.104.18.86]) by mx0a-001b2d01.pphosted.com with ESMTP id 28fj84btaj-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 07 Feb 2017 13:35:39 -0500 Received: from localhost by e24smtp02.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 7 Feb 2017 16:35:37 -0200 Received: from d24dlp01.br.ibm.com (9.18.248.204) by e24smtp02.br.ibm.com (10.172.0.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 7 Feb 2017 16:35:36 -0200 Received: from d24relay02.br.ibm.com (d24relay02.br.ibm.com [9.18.232.42]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id 67AC1352006C for ; Tue, 7 Feb 2017 13:35:02 -0500 (EST) Received: from d24av01.br.ibm.com (d24av01.br.ibm.com [9.8.31.91]) by d24relay02.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v17IZZKv39649498 for ; Tue, 7 Feb 2017 16:35:35 -0200 Received: from d24av01.br.ibm.com (localhost [127.0.0.1]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v17IZZFa003375 for ; Tue, 7 Feb 2017 16:35:35 -0200 Received: from alinefm-TP440.ibmmodules.com ([9.85.187.18]) by d24av01.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v17IZRN1003298 for ; Tue, 7 Feb 2017 16:35:34 -0200 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Tue, 7 Feb 2017 16:35:13 -0200 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170207183516.5661-1-alinefm@linux.vnet.ibm.com> References: <20170207183516.5661-1-alinefm@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17020718-0020-0000-0000-00000284E6A0 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17020718-0021-0000-0000-0000309F0778 Message-Id: <20170207183516.5661-4-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-07_10:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1612050000 definitions=main-1702070175 Subject: [Kimchi-devel] [PATCH] [Kimchi 3/6] Bug fix: Set default host value while generating the virt-viewer config file X-BeenThere: kimchi-devel@ovirt.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: kimchi-devel-bounces@ovirt.org Errors-To: kimchi-devel-bounces@ovirt.org X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The test case was failing as below: =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D ERROR: test_vm_virtviewerfile_vmlifecycle (test_model.ModelTests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/mock/mock.py", line 1305, in patch= ed return func(*args, **keywargs) File "test_model.py", line 571, in test_vm_virtviewerfile_vmlifecycle vvmodel.lookup(vm_name.decode('utf-8')) File "/home/alinefm/wok/src/wok/plugins/kimchi/model/virtviewerfile.py", = line 133, in lookup file_path =3D create_virt_viewer_file(name, graphics_info) File "/home/alinefm/wok/src/wok/plugins/kimchi/model/virtviewerfile.py", = line 82, in create_virt_viewer_file {'name': vm_name, 'err': e.message}) OperationFailed: KCHVM0084E: KCHVM0084E Because the virt-viewer config file generation was relying on Wok configuration to get the host information but the host information is not part of Wok anymore. Instead of that, it is being configured on nginx. Set it to 'localhost' when that information is not part of request headers. Signed-off-by: Aline Manera --- model/virtviewerfile.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/model/virtviewerfile.py b/model/virtviewerfile.py index 8e3be8f..533978f 100644 --- a/model/virtviewerfile.py +++ b/model/virtviewerfile.py @@ -1,7 +1,7 @@ # # Project Kimchi # -# Copyright IBM Corp, 2016 +# Copyright IBM Corp, 2016-2017 # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -22,7 +22,6 @@ import cherrypy import libvirt import os =20 -from wok.config import config as wok_config from wok.exception import InvalidOperation, OperationFailed from wok.plugins.kimchi import config as kimchi_config from wok.plugins.kimchi.model.vms import VMModel @@ -49,9 +48,7 @@ port=3D%(graphics_port)s =20 =20 def _get_request_host(): - host =3D cherrypy.request.headers.get('Host') - if not host: - host =3D wok_config.get("server", "host") + host =3D cherrypy.request.headers.get('Host', 'localhost') host =3D host.split(':')[0] return host =20 @@ -107,7 +104,8 @@ class VMVirtViewerFileModel(object): vm_name =3D dom.name() self.firewall_mngr.remove_vm_graphics_port(vm_name) cb_id =3D self.vm_event_callbacks.pop(vm_name, None) - self.conn.get().domainEventDeregisterAny(cb_id) + if cb_id is not None: + self.conn.get().domainEventDeregisterAny(cb_id) =20 def handleVMShutdownPowerOff(self, vm_name): try: --=20 2.9.3 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel