From nobody Thu Apr 25 19:04:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1595930325; cv=none; d=zohomail.com; s=zohoarc; b=ij8is/WpZ1s4oqWbeCOEqtVWHGWNVSYIA1FKgBOFDUi0riO6oLho8F2Ejtc4Gtmx7bOe35cwAH64TerFvDkSfozhp5D+6SLhNFZDon3Z0NTYsP7DT7LJHkJ2xE7WYJS8HsyuwQX9Yp/aqT7WBqb+RrUESt470IqF+XH8wblLW8Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1595930325; h=Content-Type:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:Sender:Subject:To; bh=Ai+MchdehaFqtqr3xPOvJmpqZ7x83gGH2AEDMFcwWjU=; b=Tj5YHQyBvTiDqrYchJ5wx37mmL2mwGV5HWRbHHEl7llhxwDLB2Iq1MKXLAOtQ8crn7anJKz2yCSxIy9gMd/EQhD1Mh3fCTGaLLynikhR0keEaCV6sNXSyyXi1DgGWmk2t/bdtSYRsHVPJZBEReUXHY/gXcYy5eQuZCUL+74VIDc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1595930325916134.5153140717747; Tue, 28 Jul 2020 02:58:45 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-25-npiKr2xcPWaNyye0us2NJA-1; Tue, 28 Jul 2020 05:58:42 -0400 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6649C800688; Tue, 28 Jul 2020 09:58:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2A09360BF4; Tue, 28 Jul 2020 09:58:36 +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 D0BF9A3594; Tue, 28 Jul 2020 09:58:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06S9wSdM004744 for ; Tue, 28 Jul 2020 05:58:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1AC672166BA3; Tue, 28 Jul 2020 09:58:28 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 16E802166B28 for ; Tue, 28 Jul 2020 09:58:25 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CE9FA1832D26 for ; Tue, 28 Jul 2020 09:58:25 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-5-1jnqDkBJOoqA7_FC0Xp6-g-1; Tue, 28 Jul 2020 05:58:23 -0400 Received: from [172.16.50.220] (helo=vz7.localdomain) by relay3.sw.ru with esmtp (Exim 4.93) (envelope-from ) id 1k0MN7-0002mt-NU for libvir-list@redhat.com; Tue, 28 Jul 2020 12:58:09 +0300 X-MC-Unique: npiKr2xcPWaNyye0us2NJA-1 X-MC-Unique: 1jnqDkBJOoqA7_FC0Xp6-g-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH] qemu: modprobe vhost-vsock module Date: Tue, 28 Jul 2020 12:58:07 +0300 Message-Id: <1595930287-902430-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" /dev/vhost-vsock is usable only if the module is loaded. Let's load the mo= dule just like in other places where kernel module is required (nbd, pci stub driver). Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_process.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index ec6ca14..5aaa77c 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -92,6 +92,7 @@ #include "viridentity.h" #include "virthreadjob.h" #include "virutil.h" +#include "virkmod.h" =20 #define VIR_FROM_THIS VIR_FROM_QEMU =20 @@ -6414,6 +6415,7 @@ qemuProcessPrepareHostStorage(virQEMUDriverPtr driver, return 0; } =20 +#define VHOST_VSOCK_MODULE "vhost-vsock" =20 int qemuProcessOpenVhostVsock(virDomainVsockDefPtr vsock) @@ -6422,6 +6424,22 @@ qemuProcessOpenVhostVsock(virDomainVsockDefPtr vsock) const char *vsock_path =3D "/dev/vhost-vsock"; int fd; =20 + if (virKModIsProhibited(VHOST_VSOCK_MODULE)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Failed to load vhost-vsock module: " + "administratively prohibited")); + return -1; + } else { + g_autofree char *errbuf =3D NULL; + + if ((errbuf =3D virKModLoad(VHOST_VSOCK_MODULE))) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to load vhost-vsock module: %s"), + errbuf); + return -1; + } + } + if ((fd =3D open(vsock_path, O_RDWR)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("unable to open vhost-vsock device")); --=20 1.8.3.1