From nobody Thu May 2 20:16:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1500910527090519.0158982695217; Mon, 24 Jul 2017 08:35:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 78A2B883C0; Mon, 24 Jul 2017 15:35:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1147F94C7E; Mon, 24 Jul 2017 15:35:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9D72C180597B; Mon, 24 Jul 2017 15:35:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6OFZ693021361 for ; Mon, 24 Jul 2017 11:35:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id C193487CBF; Mon, 24 Jul 2017 15:35:06 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B96B287CAF for ; Mon, 24 Jul 2017 15:35:01 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0C2425AFE8 for ; Mon, 24 Jul 2017 15:34:58 +0000 (UTC) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6OFY5DR134011 for ; Mon, 24 Jul 2017 11:34:57 -0400 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0b-001b2d01.pphosted.com with ESMTP id 2bwdew1cu5-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 24 Jul 2017 11:34:57 -0400 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 24 Jul 2017 09:34:56 -0600 Received: from b03cxnp07028.gho.boulder.ibm.com (9.17.130.15) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 24 Jul 2017 09:34:54 -0600 Received: from b03ledav005.gho.boulder.ibm.com (b03ledav005.gho.boulder.ibm.com [9.17.130.236]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6OFYrNL3342618; Mon, 24 Jul 2017 08:34:53 -0700 Received: from b03ledav005.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B47DFBE03A; Mon, 24 Jul 2017 09:34:53 -0600 (MDT) Received: from kofr2.aus.stglabs.ibm.com (unknown [9.40.193.43]) by b03ledav005.gho.boulder.ibm.com (Postfix) with ESMTP id 8CBAABE038; Mon, 24 Jul 2017 09:34:53 -0600 (MDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 78A2B883C0 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 78A2B883C0 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 0C2425AFE8 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=us.ibm.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=seg@us.ibm.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 0C2425AFE8 From: seg@us.ibm.com To: libvir-list@redhat.com Date: Mon, 24 Jul 2017 10:34:49 -0500 In-Reply-To: <1500910489-11941-1-git-send-email-seg@us.ibm.com> References: <1500910489-11941-1-git-send-email-seg@us.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17072415-0012-0000-0000-000014B910EC X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007417; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000214; SDB=6.00892249; UDB=6.00445948; IPR=6.00672413; BA=6.00005489; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016351; XFM=3.00000015; UTC=2017-07-24 15:34:55 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17072415-0013-0000-0000-00004EBECCE0 Message-Id: <1500910489-11941-2-git-send-email-seg@us.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-24_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1707240238 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 24 Jul 2017 15:34:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 24 Jul 2017 15:34:59 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'seg@us.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.721 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_PASS) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: Scott Garfinkle Subject: [libvirt] [PATCH] Generate unique socket file X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Mon, 24 Jul 2017 15:35:24 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Scott Garfinkle --- src/qemu/qemu_domain.c | 23 +++++++++++++++---= ---- .../qemuxml2argv-channel-virtio-unix.args | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 78e75f1..791d4cf 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7178,18 +7178,27 @@ int qemuDomainPrepareChannel(virDomainChrDefPtr channel, const char *domainChannelTargetDir) { - if (channel->targetType =3D=3D VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRT= IO && - channel->source->type =3D=3D VIR_DOMAIN_CHR_TYPE_UNIX && - !channel->source->data.nix.path) { + if (channel->targetType !=3D VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO= || + channel->source->type !=3D VIR_DOMAIN_CHR_TYPE_UNIX || + channel->source->data.nix.path) + return 0; + + if (channel->target.name) { if (virAsprintf(&channel->source->data.nix.path, "%s/%s", domainChannelTargetDir, - channel->target.name ? channel->target.name - : "unknown.sock") < 0) + channel->target.name) < 0) + return -1; + } else { // Generate a unique name + if (virAsprintf(&channel->source->data.nix.path, + "%s/unknown.sock%d%d%d", domainChannelTargetDir, + channel->info.addr.vioserial.controller, + channel->info.addr.vioserial.bus, + channel->info.addr.vioserial.port) < 0) return -1; - - channel->source->data.nix.listen =3D true; } =20 + channel->source->data.nix.listen =3D true; + return 0; } =20 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.args b= /tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.args index 2b72965..c875a09 100644 --- a/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.args +++ b/tests/qemuxml2argvdata/qemuxml2argv-channel-virtio-unix.args @@ -29,7 +29,7 @@ path=3D/tmp/channel/domain--1-QEMUGuest1/org.qemu.guest_a= gent.0,server,nowait \ -device virtserialport,bus=3Dvirtio-serial0.0,nr=3D1,chardev=3Dcharchannel= 0,\ id=3Dchannel0,name=3Dorg.qemu.guest_agent.0 \ -chardev socket,id=3Dcharchannel1,\ -path=3D/tmp/channel/domain--1-QEMUGuest1/unknown.sock,server,nowait \ +path=3D/tmp/channel/domain--1-QEMUGuest1/unknown.sock002,server,nowait \ -device virtserialport,bus=3Dvirtio-serial0.0,nr=3D2,chardev=3Dcharchannel= 1,\ id=3Dchannel1 \ -chardev socket,id=3Dcharchannel2,path=3D/tmp/channel/domain--1-QEMUGuest1= /ble,\ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list