From nobody Thu Mar 13 17:50:07 2025 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 1486605800087319.7793610800377; Wed, 8 Feb 2017 18:03:20 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id 1B18F8205EA; Thu, 9 Feb 2017 02:03:19 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lists.ovirt.org (Postfix) with ESMTPS id 97E928205B7 for ; Thu, 9 Feb 2017 02:02:24 +0000 (UTC) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v191wVwJ061629 for ; Wed, 8 Feb 2017 21:02:24 -0500 Received: from e24smtp03.br.ibm.com (e24smtp03.br.ibm.com [32.104.18.24]) by mx0b-001b2d01.pphosted.com with ESMTP id 28gburevy2-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Wed, 08 Feb 2017 21:02:23 -0500 Received: from localhost by e24smtp03.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 9 Feb 2017 00:02:21 -0200 Received: from d24dlp02.br.ibm.com (9.18.248.206) by e24smtp03.br.ibm.com (10.172.0.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 9 Feb 2017 00:02:20 -0200 Received: from d24relay03.br.ibm.com (d24relay03.br.ibm.com [9.18.232.225]) by d24dlp02.br.ibm.com (Postfix) with ESMTP id 203251DC006D for ; Wed, 8 Feb 2017 21:02:21 -0500 (EST) Received: from d24av05.br.ibm.com (d24av05.br.ibm.com [9.18.232.44]) by d24relay03.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v1922JRs39125068 for ; Thu, 9 Feb 2017 00:02:19 -0200 Received: from d24av05.br.ibm.com (localhost [127.0.0.1]) by d24av05.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v1922KEQ015808 for ; Thu, 9 Feb 2017 00:02:20 -0200 Received: from alinefm-TP440.ibmmodules.com ([9.80.222.200]) by d24av05.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v1922D8H015772 for ; Thu, 9 Feb 2017 00:02:19 -0200 X-Original-To: kimchi-devel@ovirt.org From: Aline Manera To: Kimchi Devel Date: Thu, 9 Feb 2017 00:01:59 -0200 X-Mailer: git-send-email 2.9.3 In-Reply-To: <20170209020202.17425-1-alinefm@linux.vnet.ibm.com> References: <20170209020202.17425-1-alinefm@linux.vnet.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17020902-0024-0000-0000-0000015185E4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17020902-0025-0000-0000-00001615AA1B Message-Id: <20170209020202.17425-4-alinefm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-02-09_01:, , 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-1702090015 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