From nobody Sat Dec 21 16:39:25 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 148855815717453.4205435897494; Fri, 3 Mar 2017 08:22:37 -0800 (PST) Received: from lists.phx.ovirt.org (localhost [127.0.0.1]) by lists.ovirt.org (Postfix) with ESMTP id A68E68205C4; Fri, 3 Mar 2017 16:22:35 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lists.ovirt.org (Postfix) with ESMTPS id 3C0A18203D9 for ; Fri, 3 Mar 2017 16:22:21 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v23GIpVp135960 for ; Fri, 3 Mar 2017 11:22:21 -0500 Received: from e24smtp04.br.ibm.com (e24smtp04.br.ibm.com [32.104.18.25]) by mx0b-001b2d01.pphosted.com with ESMTP id 28yb052x46-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Fri, 03 Mar 2017 11:22:21 -0500 Received: from localhost by e24smtp04.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 3 Mar 2017 13:22:19 -0300 Received: from d24dlp01.br.ibm.com (9.18.248.204) by e24smtp04.br.ibm.com (10.172.0.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Fri, 3 Mar 2017 13:22:17 -0300 Received: from d24relay04.br.ibm.com (d24relay04.br.ibm.com [9.18.232.146]) by d24dlp01.br.ibm.com (Postfix) with ESMTP id B0DC6352005C for ; Fri, 3 Mar 2017 11:21:42 -0500 (EST) Received: from d24av03.br.ibm.com (d24av03.br.ibm.com [9.8.31.95]) by d24relay04.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v23GMGq336569170 for ; Fri, 3 Mar 2017 13:22:16 -0300 Received: from d24av03.br.ibm.com (localhost [127.0.0.1]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v23GMGhR000595 for ; Fri, 3 Mar 2017 13:22:16 -0300 Received: from t440.ibm.com ([9.85.166.210]) by d24av03.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v23GMEqr000557; Fri, 3 Mar 2017 13:22:15 -0300 X-Original-To: kimchi-devel@ovirt.org From: Lucio Correia To: Kimchi Devel Date: Fri, 3 Mar 2017 13:22:06 -0300 X-Mailer: git-send-email 2.7.4 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 17030316-0028-0000-0000-0000019C2EA1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17030316-0029-0000-0000-0000149A368F Message-Id: <1488558126-32096-1-git-send-email-luciojhc@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-03-03_12:, , 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-1702020001 definitions=main-1703030151 Subject: [Kimchi-devel] [PATCH] [Kimchi] Allow kvmusertests to run with regular user 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" Signed-off-by: Lucio Correia --- kvmusertests.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/kvmusertests.py b/kvmusertests.py index a3fb273..3b3a603 100644 --- a/kvmusertests.py +++ b/kvmusertests.py @@ -1,6 +1,6 @@ # Project Kimchi # -# Copyright IBM Corp, 2015-2016 +# Copyright IBM Corp, 2015-2017 # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -17,6 +17,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301= USA =20 import libvirt +import os import platform import psutil import threading @@ -56,12 +57,18 @@ class UserTests(object): =20 with RollbackContext() as rollback: with cls.lock: - conn =3D libvirt.open(None) + conn =3D libvirt.open("qemu:///session") rollback.prependDefer(conn.close) f =3D libvirt.VIR_DOMAIN_START_AUTODESTROY dom =3D conn.createXML(xml, flags=3Df) rollback.prependDefer(dom.destroy) - filename =3D '/var/run/libvirt/qemu/%s.pid' % KVMUSERTEST_= VM_NAME + + # find pid file for VM + uid =3D str(os.getuid()) + filedir =3D os.path.join('/run/user', uid, 'libvirt/qemu/r= un') + if uid =3D=3D '0': + filedir =3D '/var/run/libvirt/qemu' + filename =3D os.path.join(filedir, KVMUSERTEST_VM_NAME + "= .pid") with open(filename) as f: pidStr =3D f.read() p =3D psutil.Process(int(pidStr)) --=20 2.7.4 _______________________________________________ Kimchi-devel mailing list Kimchi-devel@ovirt.org http://lists.ovirt.org/mailman/listinfo/kimchi-devel