From nobody Thu May 2 17:04:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1479787311314734.9394649263527; Mon, 21 Nov 2016 20:01:51 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAM3xO6M008239; Mon, 21 Nov 2016 22:59:24 -0500 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 uAM3wjW9031288 for ; Mon, 21 Nov 2016 22:58:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id A3E5F2156A5B; Tue, 22 Nov 2016 03:58:45 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.rdu2.redhat.com [10.11.55.2]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9CB812166BC9 for ; Tue, 22 Nov 2016 03:58:45 +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 F0CBF269AA for ; Tue, 22 Nov 2016 03:58:41 +0000 (UTC) Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAM3wTMv134843 for ; Mon, 21 Nov 2016 22:58:29 -0500 Received: from e36.co.us.ibm.com (e36.co.us.ibm.com [32.97.110.154]) by mx0b-001b2d01.pphosted.com with ESMTP id 26uyx4phj7-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 21 Nov 2016 22:58:29 -0500 Received: from localhost by e36.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 Nov 2016 20:58:28 -0700 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e36.co.us.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 21 Nov 2016 20:58:27 -0700 Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id E703E1FF0023; Mon, 21 Nov 2016 20:58:05 -0700 (MST) Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAM3wQuV48496654; Mon, 21 Nov 2016 20:58:26 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8096D136040; Mon, 21 Nov 2016 20:58:26 -0700 (MST) Received: from farman-ThinkPad-W540.ibm.com (unknown [9.85.134.169]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTPS id 0893313603A; Mon, 21 Nov 2016 20:58:25 -0700 (MST) From: Eric Farman To: libvirt-list@redhat.com Date: Mon, 21 Nov 2016 22:58:15 -0500 In-Reply-To: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> References: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112203-0020-0000-0000-00000A5179F3 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006120; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000189; SDB=6.00783707; UDB=6.00378500; IPR=6.00561326; BA=6.00004898; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013403; XFM=3.00000011; UTC=2016-11-22 03:58:27 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112203-0021-0000-0000-00005778B88D Message-Id: <1479787103-26581-2-git-send-email-farman@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-22_01:, , 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-1609300000 definitions=main-1611220070 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 199 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 22 Nov 2016 03:58:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Tue, 22 Nov 2016 03:58:42 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'farman@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.099 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.11.55.2 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 1/9] qemu: Introduce vhost-scsi capability 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-Zoho-Virus-Status: 2 X-ZohoMail-Forwarded-To: importer@patchew.org X-ZohoMail-Forwarded-For: patchew@euphon.net importer@patchew.org X-ZohoMail: RSF_0 Z_629925259 SPT_1 Z_629926901 SPT_1 UDT_7 RF_0 Content-Type: text/plain; charset="utf-8" Do all the stuff for the vhost-scsi capability in QEMU, so it's in place for our checks later. Signed-off-by: Eric Farman Reviewed-by: Boris Fiuczynski --- src/qemu/qemu_capabilities.c | 2 ++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml | 1 + tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml | 1 + 13 files changed, 14 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index cfd090c..f9e39a3 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -352,6 +352,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST, "ivshmem-doorbell", /* 240 */ "query-qmp-schema", "gluster.debug_level", + "vhost-scsi", ); =20 =20 @@ -1596,6 +1597,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[= ] =3D { { "intel-iommu", QEMU_CAPS_DEVICE_INTEL_IOMMU }, { "ivshmem-plain", QEMU_CAPS_DEVICE_IVSHMEM_PLAIN }, { "ivshmem-doorbell", QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL }, + { "vhost-scsi", QEMU_CAPS_DEVICE_VHOST_SCSI }, }; =20 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[]= =3D { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index 9163572..5255815 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -387,6 +387,7 @@ typedef enum { QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL, /* -device ivshmem-doorbell */ QEMU_CAPS_QUERY_QMP_SCHEMA, /* query-qmp-schema command */ QEMU_CAPS_GLUSTER_DEBUG_LEVEL, /* -drive gluster.debug_level=3D{0..9} = */ + QEMU_CAPS_DEVICE_VHOST_SCSI, /* -device vhost-scsi-{ccw,pci} */ =20 QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_1.5.3.x86_64.xml index cc4ffef..2931418 100644 --- a/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.5.3.x86_64.xml @@ -139,6 +139,7 @@ + 1005003 0 diff --git a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_1.6.0.x86_64.xml index 8e0e697..15f2075 100644 --- a/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.6.0.x86_64.xml @@ -144,6 +144,7 @@ + 1006000 0 diff --git a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_1.7.0.x86_64.xml index 40acf62..0726443 100644 --- a/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_1.7.0.x86_64.xml @@ -146,6 +146,7 @@ + 1007000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.1.1.x86_64.xml index a8a79af..498e2d0 100644 --- a/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.1.1.x86_64.xml @@ -161,6 +161,7 @@ + 2001001 0 diff --git a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.4.0.x86_64.xml index 3162758..18594e6 100644 --- a/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.4.0.x86_64.xml @@ -181,6 +181,7 @@ + 2004000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.5.0.x86_64.xml index bea01c7..033894a 100644 --- a/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.5.0.x86_64.xml @@ -187,6 +187,7 @@ + 2005000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml b/test= s/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml index b283444..24fb584 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv2.aarch64.xml @@ -162,6 +162,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml b/test= s/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml index 612a747..ecfe07e 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0-gicv3.aarch64.xml @@ -162,6 +162,7 @@ + 2005094 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml b/tests/qemu= capabilitiesdata/caps_2.6.0.ppc64le.xml index 5f22ed5..5fbc9af 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0.ppc64le.xml @@ -159,6 +159,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.6.0.x86_64.xml index e9bd5bb..2525d2d 100644 --- a/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.6.0.x86_64.xml @@ -196,6 +196,7 @@ + 2006000 0 diff --git a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml b/tests/qemuc= apabilitiesdata/caps_2.7.0.x86_64.xml index b6e34b0..f2a305f 100644 --- a/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_2.7.0.x86_64.xml @@ -198,6 +198,7 @@ + 2007000 0 (v2.7.0) --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 17:04:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1479787407789385.4745901538273; Mon, 21 Nov 2016 20:03:27 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAM3x57O029538; Mon, 21 Nov 2016 22:59:06 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id uAM3wY6B031220 for ; Mon, 21 Nov 2016 22:58:34 -0500 Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAM3wYnR026633 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 21 Nov 2016 22:58:34 -0500 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 0E0EE4E35B for ; Tue, 22 Nov 2016 03:58:33 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAM3wUSR142934 for ; Mon, 21 Nov 2016 22:58:32 -0500 Received: from e34.co.us.ibm.com (e34.co.us.ibm.com [32.97.110.152]) by mx0b-001b2d01.pphosted.com with ESMTP id 26vcp5m0jr-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 21 Nov 2016 22:58:32 -0500 Received: from localhost by e34.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 Nov 2016 20:58:31 -0700 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e34.co.us.ibm.com (192.168.1.134) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 21 Nov 2016 20:58:28 -0700 Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 8CD8E1FF0023; Mon, 21 Nov 2016 20:58:07 -0700 (MST) Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAM3wSoN47775862; Mon, 21 Nov 2016 20:58:28 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 252A0136043; Mon, 21 Nov 2016 20:58:28 -0700 (MST) Received: from farman-ThinkPad-W540.ibm.com (unknown [9.85.134.169]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTPS id ACADD13603C; Mon, 21 Nov 2016 20:58:27 -0700 (MST) From: Eric Farman To: libvirt-list@redhat.com Date: Mon, 21 Nov 2016 22:58:16 -0500 In-Reply-To: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> References: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112203-0016-0000-0000-0000053A7C30 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006120; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000189; SDB=6.00783707; UDB=6.00378500; IPR=6.00561326; BA=6.00004898; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013404; XFM=3.00000011; UTC=2016-11-22 03:58:30 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112203-0017-0000-0000-000034D88CFE Message-Id: <1479787103-26581-3-git-send-email-farman@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-22_01:, , 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-1609300000 definitions=main-1611220070 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 199 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 22 Nov 2016 03:58:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 22 Nov 2016 03:58:33 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'farman@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.099 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 2/9] Introduce framework for a hostdev SCSI_host subsystem type 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-ZohoMail: RSF_0 Z_629925259 SPT_1 Z_629926901 SPT_1 UDT_7 RF_0 X-Zoho-Virus-Status: 2 Content-Type: text/plain; charset="utf-8" We already have a "scsi" hostdev subsys type, which refers to a single LUN that is passed through to a guest. But what of things where multiple LUNs are passed through via a single SCSI HBA, such as with the vhost-scsi target? Create a new hostdev subsys type that will carry this. Signed-off-by: Eric Farman --- src/conf/domain_conf.c | 11 ++++++++++- src/conf/domain_conf.h | 18 ++++++++++++++++++ src/qemu/qemu_cgroup.c | 7 +++++++ src/qemu/qemu_hotplug.c | 2 ++ src/security/security_apparmor.c | 4 ++++ src/security/security_dac.c | 8 ++++++++ src/security/security_selinux.c | 8 ++++++++ tests/domaincapsschemadata/full.xml | 1 + 8 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6e008e2..3a4123d 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -647,7 +647,8 @@ VIR_ENUM_IMPL(virDomainHostdevMode, VIR_DOMAIN_HOSTDEV_= MODE_LAST, VIR_ENUM_IMPL(virDomainHostdevSubsys, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST, "usb", "pci", - "scsi") + "scsi", + "scsi_host") =20 VIR_ENUM_IMPL(virDomainHostdevSubsysPCIBackend, VIR_DOMAIN_HOSTDEV_PCI_BACKEND_TYPE_LAST, @@ -661,6 +662,11 @@ VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIProtocol, "adapter", "iscsi") =20 +VIR_ENUM_IMPL(virDomainHostdevSubsysSCSIHostProtocol, + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_LAST, + "none", + "vhost") + VIR_ENUM_IMPL(virDomainHostdevCaps, VIR_DOMAIN_HOSTDEV_CAPS_TYPE_LAST, "storage", "misc", @@ -13016,6 +13022,7 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr x= mlopt, if (virXPathBoolean("boolean(./shareable)", ctxt)) def->shareable =3D true; break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: break; @@ -13899,6 +13906,8 @@ virDomainHostdevMatchSubsys(virDomainHostdevDefPtr = a, return virDomainHostdevMatchSubsysSCSIiSCSI(a, b); else return virDomainHostdevMatchSubsysSCSIHost(a, b); + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + /* Fall through for now */ case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: return 0; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 541b600..3dfd780 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -294,6 +294,7 @@ typedef enum { VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI, VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI, + VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST, =20 VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST } virDomainHostdevSubsysType; @@ -368,6 +369,22 @@ struct _virDomainHostdevSubsysSCSI { } u; }; =20 +typedef enum { + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_NONE, + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_VHOST, + + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_LAST, +} virDomainHostdevSubsysSCSIHostProtocolType; + +VIR_ENUM_DECL(virDomainHostdevSubsysSCSIHostProtocol) + +typedef struct _virDomainHostdevSubsysSCSIVHost virDomainHostdevSubsysSCSI= VHost; +typedef virDomainHostdevSubsysSCSIVHost *virDomainHostdevSubsysSCSIVHostPt= r; +struct _virDomainHostdevSubsysSCSIVHost { + int protocol; /* enum virDomainHostdevSubsysSCSIHostProtocolType */ + char *wwpn; +}; + typedef struct _virDomainHostdevSubsys virDomainHostdevSubsys; typedef virDomainHostdevSubsys *virDomainHostdevSubsysPtr; struct _virDomainHostdevSubsys { @@ -376,6 +393,7 @@ struct _virDomainHostdevSubsys { virDomainHostdevSubsysUSB usb; virDomainHostdevSubsysPCI pci; virDomainHostdevSubsysSCSI scsi; + virDomainHostdevSubsysSCSIVHost scsi_host; } u; }; =20 diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 1443f7e..5c26086 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -376,6 +376,10 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm, break; } =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { + break; + } + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: break; } @@ -440,6 +444,9 @@ qemuTeardownHostdevCgroup(virDomainObjPtr vm, case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: /* nothing to tear down for SCSI */ break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + /* nothing to tear down for scsi_host */ + break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: break; } diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 6b3a068..0508c67 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3645,6 +3645,8 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver, case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: qemuDomainRemoveSCSIHostDevice(driver, vm, hostdev); break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: break; } diff --git a/src/security/security_apparmor.c b/src/security/security_appar= mor.c index beddf6d..19085ec 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -909,6 +909,10 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr = mgr, break; } =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { + /* Fall through for now */ + } + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: ret =3D 0; break; diff --git a/src/security/security_dac.c b/src/security/security_dac.c index fd74e8b..2803962 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -676,6 +676,10 @@ virSecurityDACSetHostdevLabel(virSecurityManagerPtr mg= r, break; } =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { + /* Fall through for now */ + } + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: ret =3D 0; break; @@ -805,6 +809,10 @@ virSecurityDACRestoreHostdevLabel(virSecurityManagerPt= r mgr, break; } =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { + /* Fall through for now */ + } + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: ret =3D 0; break; diff --git a/src/security/security_selinux.c b/src/security/security_selinu= x.c index 89c93dc..9870b41 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -1498,6 +1498,10 @@ virSecuritySELinuxSetHostdevSubsysLabel(virSecurityM= anagerPtr mgr, break; } =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { + /* Fall through for now */ + } + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: ret =3D 0; break; @@ -1700,6 +1704,10 @@ virSecuritySELinuxRestoreHostdevSubsysLabel(virSecur= ityManagerPtr mgr, break; } =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { + /* Fall through for now */ + } + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: ret =3D 0; break; diff --git a/tests/domaincapsschemadata/full.xml b/tests/domaincapsschemada= ta/full.xml index eaf6eb6..6abd499 100644 --- a/tests/domaincapsschemadata/full.xml +++ b/tests/domaincapsschemadata/full.xml @@ -87,6 +87,7 @@ usb pci scsi + scsi_host storage --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 17:04:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 1479787410707247.0738794078901; Mon, 21 Nov 2016 20:03:30 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id uAM3wb0a006606; Mon, 21 Nov 2016 22:58:38 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id uAM3waox031229 for ; Mon, 21 Nov 2016 22:58:36 -0500 Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAM3wabl012963 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 21 Nov 2016 22:58:36 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 7435B7971A for ; Tue, 22 Nov 2016 03:58:34 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAM3wSKG113525 for ; Mon, 21 Nov 2016 22:58:34 -0500 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 26vcrt3n2w-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 21 Nov 2016 22:58:33 -0500 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 Nov 2016 20:58:33 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 21 Nov 2016 20:58:30 -0700 Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id BE09219D8040; Mon, 21 Nov 2016 20:57:51 -0700 (MST) Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAM3wTK836438060; Mon, 21 Nov 2016 20:58:29 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D3262136040; Mon, 21 Nov 2016 20:58:29 -0700 (MST) Received: from farman-ThinkPad-W540.ibm.com (unknown [9.85.134.169]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTPS id 5112813603A; Mon, 21 Nov 2016 20:58:29 -0700 (MST) From: Eric Farman To: libvirt-list@redhat.com Date: Mon, 21 Nov 2016 22:58:17 -0500 In-Reply-To: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> References: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112203-0012-0000-0000-000011336EFA X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006120; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000189; SDB=6.00783707; UDB=6.00378500; IPR=6.00561326; BA=6.00004898; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013404; XFM=3.00000011; UTC=2016-11-22 03:58:31 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112203-0013-0000-0000-000047607B9A Message-Id: <1479787103-26581-4-git-send-email-farman@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-22_01:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=43 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611220070 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 199 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 22 Nov 2016 03:58:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 22 Nov 2016 03:58:34 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'farman@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.099 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 3/9] util: Management routines for scsi_host devices 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-ZohoMail: RSF_0 Z_629925259 SPT_1 Z_629926901 SPT_1 UDT_7 RF_0 X-Zoho-Virus-Status: 2 Content-Type: text/plain; charset="utf-8" For a new hostdev type=3D'scsi_host' we have a number of required functions for managing, adding, and removing the host device to/from guests. Provide the basic infrastructure for these tasks. The name "SCSIVHost" (and its variants) is chosen to avoid conflicts with existing code named "SCSIHost" to refer to a hostdev type=3D'scsi' protcol=3D'none'. Signed-off-by: Eric Farman --- po/POTFILES.in | 1 + src/Makefile.am | 1 + src/libvirt_private.syms | 18 +++ src/util/virhostdev.c | 163 +++++++++++++++++++++++++++ src/util/virhostdev.h | 16 +++ src/util/virscsivhost.c | 288 +++++++++++++++++++++++++++++++++++++++++++= ++++ src/util/virscsivhost.h | 65 +++++++++++ tests/qemuxml2argvmock.c | 9 ++ 8 files changed, 561 insertions(+) create mode 100644 src/util/virscsivhost.c create mode 100644 src/util/virscsivhost.h diff --git a/po/POTFILES.in b/po/POTFILES.in index 25867ae..bdff679 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -237,6 +237,7 @@ src/util/virqemu.c src/util/virrandom.c src/util/virrotatingfile.c src/util/virscsi.c +src/util/virscsivhost.c src/util/virsecret.c src/util/virsexpr.c src/util/virsocketaddr.c diff --git a/src/Makefile.am b/src/Makefile.am index aaba9e6..a0e5e92 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -163,6 +163,7 @@ UTIL_SOURCES =3D \ util/virrandom.h util/virrandom.c \ util/virrotatingfile.h util/virrotatingfile.c \ util/virscsi.c util/virscsi.h \ + util/virscsivhost.c util/virscsivhost.h \ util/virseclabel.c util/virseclabel.h \ util/virsecret.c util/virsecret.h \ util/virsexpr.c util/virsexpr.h \ diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index baff82b..46b4e87 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -1684,10 +1684,12 @@ virHostdevPCINodeDeviceReset; virHostdevPrepareDomainDevices; virHostdevPreparePCIDevices; virHostdevPrepareSCSIDevices; +virHostdevPrepareSCSIVHostDevices; virHostdevPrepareUSBDevices; virHostdevReAttachDomainDevices; virHostdevReAttachPCIDevices; virHostdevReAttachSCSIDevices; +virHostdevReAttachSCSIVHostDevices; virHostdevReAttachUSBDevices; virHostdevUpdateActiveDomainDevices; virHostdevUpdateActivePCIDevices; @@ -2305,6 +2307,22 @@ virSCSIDeviceNew; virSCSIDeviceSetUsedBy; =20 =20 +# util/virscsivhost.h +virSCSIVHostDeviceFileIterate; +virSCSIVHostDeviceFree; +virSCSIVHostDeviceGetName; +virSCSIVHostDeviceListAdd; +virSCSIVHostDeviceListCount; +virSCSIVHostDeviceListDel; +virSCSIVHostDeviceListFind; +virSCSIVHostDeviceListGet; +virSCSIVHostDeviceListNew; +virSCSIVHostDeviceListSteal; +virSCSIVHostDeviceNew; +virSCSIVHostDeviceSetUsedBy; +virSCSIVHostOpenVhostSCSI; + + # util/virseclabel.h virSecurityDeviceLabelDefFree; virSecurityDeviceLabelDefNew; diff --git a/src/util/virhostdev.c b/src/util/virhostdev.c index 9c2262e..ca4c339 100644 --- a/src/util/virhostdev.c +++ b/src/util/virhostdev.c @@ -146,6 +146,7 @@ virHostdevManagerDispose(void *obj) virObjectUnref(hostdevMgr->inactivePCIHostdevs); virObjectUnref(hostdevMgr->activeUSBHostdevs); virObjectUnref(hostdevMgr->activeSCSIHostdevs); + virObjectUnref(hostdevMgr->activeSCSIVHostHostdevs); VIR_FREE(hostdevMgr->stateDir); } =20 @@ -170,6 +171,9 @@ virHostdevManagerNew(void) if (!(hostdevMgr->activeSCSIHostdevs =3D virSCSIDeviceListNew())) goto error; =20 + if (!(hostdevMgr->activeSCSIVHostHostdevs =3D virSCSIVHostDeviceListNe= w())) + goto error; + if (privileged) { if (VIR_STRDUP(hostdevMgr->stateDir, HOSTDEV_STATE_DIR) < 0) goto error; @@ -1472,6 +1476,102 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr m= gr, return -1; } =20 +int +virHostdevPrepareSCSIVHostDevices(virHostdevManagerPtr mgr, + const char *drv_name, + const char *dom_name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs) +{ + size_t i, j; + int count; + virSCSIVHostDeviceListPtr list; + virSCSIVHostDevicePtr host, tmp; + + if (!nhostdevs) + return 0; + + /* To prevent situation where scsi_host device is assigned to two doma= ins + * we need to keep a list of currently assigned scsi_host devices. + * This is done in several loops which cannot be joined into one big + * loop. See virHostdevPreparePCIDevices() + */ + if (!(list =3D virSCSIVHostDeviceListNew())) + goto cleanup; + + /* Loop 1: build temporary list */ + for (i =3D 0; i < nhostdevs; i++) { + virDomainHostdevDefPtr hostdev =3D hostdevs[i]; + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &hostdev->source.su= bsys.u.scsi_host; + + if (hostdev->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || + hostdev->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYP= E_SCSI_HOST) + continue; + + if (hostsrc->protocol !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PRO= TOCOL_TYPE_VHOST) + continue; /* Not supported */ + + if (!(host =3D virSCSIVHostDeviceNew(hostsrc->wwpn))) + goto cleanup; + + if (virSCSIVHostDeviceListAdd(list, host) < 0) { + virSCSIVHostDeviceFree(host); + goto cleanup; + } + } + + /* Loop 2: Mark devices in temporary list as used by @name + * and add them to driver list. However, if something goes + * wrong, perform rollback. + */ + virObjectLock(mgr->activeSCSIVHostHostdevs); + count =3D virSCSIVHostDeviceListCount(list); + + for (i =3D 0; i < count; i++) { + host =3D virSCSIVHostDeviceListGet(list, i); + if ((tmp =3D virSCSIVHostDeviceListFind(mgr->activeSCSIVHostHostde= vs, + host))) { + virReportError(VIR_ERR_OPERATION_INVALID, + _("SCSI_host device %s is already in use by " + "another domain"), + virSCSIVHostDeviceGetName(tmp)); + goto error; + } else { + if (virSCSIVHostDeviceSetUsedBy(host, drv_name, dom_name) < 0) + goto error; + + VIR_DEBUG("Adding %s to activeSCSIVHostHostdevs", + virSCSIVHostDeviceGetName(host)); + + if (virSCSIVHostDeviceListAdd(mgr->activeSCSIVHostHostdevs, ho= st) < 0) + goto error; + } + } + + virObjectUnlock(mgr->activeSCSIVHostHostdevs); + + /* Loop 3: Temporary list was successfully merged with + * driver list, so steal all items to avoid freeing them + * when freeing temporary list. + */ + while (virSCSIVHostDeviceListCount(list) > 0) { + tmp =3D virSCSIVHostDeviceListGet(list, 0); + virSCSIVHostDeviceListSteal(list, tmp); + } + + virObjectUnref(list); + return 0; + error: + for (j =3D 0; j < i; j++) { + tmp =3D virSCSIVHostDeviceListGet(list, i); + virSCSIVHostDeviceListSteal(mgr->activeSCSIVHostHostdevs, tmp); + } + virObjectUnlock(mgr->activeSCSIVHostHostdevs); + cleanup: + virObjectUnref(list); + return -1; +} + void virHostdevReAttachUSBDevices(virHostdevManagerPtr mgr, const char *drv_name, @@ -1604,6 +1704,69 @@ virHostdevReAttachSCSIDevices(virHostdevManagerPtr m= gr, virObjectUnlock(mgr->activeSCSIHostdevs); } =20 +void +virHostdevReAttachSCSIVHostDevices(virHostdevManagerPtr mgr, + const char *drv_name, + const char *dom_name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs) +{ + size_t i; + virSCSIVHostDevicePtr host, tmp; + + + if (!nhostdevs) + return; + + virObjectLock(mgr->activeSCSIVHostHostdevs); + for (i =3D 0; i < nhostdevs; i++) { + virDomainHostdevDefPtr hostdev =3D hostdevs[i]; + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &hostdev->source.su= bsys.u.scsi_host; + const char *usedby_drvname; + const char *usedby_domname; + + if (hostdev->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || + hostdev->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYP= E_SCSI_HOST) + continue; + + if (hostsrc->protocol !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PRO= TOCOL_TYPE_VHOST) + continue; /* Not supported */ + + if (!(host =3D virSCSIVHostDeviceNew(hostsrc->wwpn))) { + VIR_WARN("Unable to reattach SCSI_host device %s on domain %s", + hostsrc->wwpn, dom_name); + virObjectUnlock(mgr->activeSCSIVHostHostdevs); + return; + } + + /* Only delete the devices which are marked as being used by @name, + * because qemuProcessStart could fail half way through. */ + + if (!(tmp =3D virSCSIVHostDeviceListFind(mgr->activeSCSIVHostHostd= evs, + host))) { + VIR_WARN("Unable to find device %s " + "in list of active SCSI_host devices", + hostsrc->wwpn); + virSCSIVHostDeviceFree(host); + virObjectUnlock(mgr->activeSCSIVHostHostdevs); + return; + } + + virSCSIVHostDeviceGetUsedBy(tmp, &usedby_drvname, &usedby_domname); + + if (STREQ_NULLABLE(drv_name, usedby_drvname) && + STREQ_NULLABLE(dom_name, usedby_domname)) { + VIR_DEBUG("Removing %s dom=3D%s from activeSCSIVHostHostdevs", + hostsrc->wwpn, dom_name); + + virSCSIVHostDeviceListDel(mgr->activeSCSIVHostHostdevs, tmp); + } + + virSCSIVHostDeviceFree(host); + } + virObjectUnlock(mgr->activeSCSIVHostHostdevs); +} + int virHostdevPCINodeDeviceDetach(virHostdevManagerPtr mgr, virPCIDevicePtr pci) diff --git a/src/util/virhostdev.h b/src/util/virhostdev.h index f2f51bd..1330cbc 100644 --- a/src/util/virhostdev.h +++ b/src/util/virhostdev.h @@ -30,6 +30,7 @@ # include "virpci.h" # include "virusb.h" # include "virscsi.h" +# include "virscsivhost.h" # include "domain_conf.h" =20 typedef enum { @@ -53,6 +54,7 @@ struct _virHostdevManager { virPCIDeviceListPtr inactivePCIHostdevs; virUSBDeviceListPtr activeUSBHostdevs; virSCSIDeviceListPtr activeSCSIHostdevs; + virSCSIVHostDeviceListPtr activeSCSIVHostHostdevs; }; =20 virHostdevManagerPtr virHostdevManagerGetDefault(void); @@ -87,6 +89,13 @@ virHostdevPrepareSCSIDevices(virHostdevManagerPtr hostde= v_mgr, virDomainHostdevDefPtr *hostdevs, int nhostdevs) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); +int +virHostdevPrepareSCSIVHostDevices(virHostdevManagerPtr hostdev_mgr, + const char *drv_name, + const char *dom_name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); void virHostdevReAttachPCIDevices(virHostdevManagerPtr hostdev_mgr, const char *drv_name, @@ -109,6 +118,13 @@ virHostdevReAttachSCSIDevices(virHostdevManagerPtr hos= tdev_mgr, virDomainHostdevDefPtr *hostdevs, int nhostdevs) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); +void +virHostdevReAttachSCSIVHostDevices(virHostdevManagerPtr hostdev_mgr, + const char *drv_name, + const char *dom_name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs) + ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); int virHostdevUpdateActivePCIDevices(virHostdevManagerPtr mgr, virDomainHostdevDefPtr *hostdevs, diff --git a/src/util/virscsivhost.c b/src/util/virscsivhost.c new file mode 100644 index 0000000..9d18b6e --- /dev/null +++ b/src/util/virscsivhost.c @@ -0,0 +1,288 @@ +/* + * virscsivhost.c: helper APIs for managing scsi_host devices + * + * Copyright (C) 2016 IBM Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + * Authors: + * Eric Farman + */ + +#include +#include + +#include "virscsivhost.h" +#include "virlog.h" +#include "viralloc.h" +#include "virerror.h" +#include "virfile.h" +#include "virstring.h" + +VIR_LOG_INIT("util.scsihost"); + +#define SYSFS_VHOST_SCSI_DEVICES "/sys/kernel/config/target/vhost/" +#define VHOST_SCSI_DEVICE "/dev/vhost-scsi" + +struct _virSCSIVHostDevice { + char *name; /* naa. */ + char *path; + char *used_by_drvname; + char *used_by_domname; +}; + +struct _virSCSIVHostDeviceList { + virObjectLockable parent; + size_t count; + virSCSIVHostDevicePtr *devs; +}; + +static virClassPtr virSCSIVHostDeviceListClass; + +static void +virSCSIVHostDeviceListDispose(void *obj) +{ + virSCSIVHostDeviceListPtr list =3D obj; + size_t i; + + for (i =3D 0; i < list->count; i++) + virSCSIVHostDeviceFree(list->devs[i]); + + VIR_FREE(list->devs); +} + + +static int +virSCSIVHostOnceInit(void) +{ + if (!(virSCSIVHostDeviceListClass =3D virClassNew(virClassForObjectLoc= kable(), + "virSCSIVHostDeviceLis= t", + sizeof(virSCSIVHostDev= iceList), + virSCSIVHostDeviceList= Dispose))) + return -1; + + return 0; +} + + +VIR_ONCE_GLOBAL_INIT(virSCSIVHost) + +/* For virReportOOMError() and virReportSystemError() */ +#define VIR_FROM_THIS VIR_FROM_NONE + + +int +virSCSIVHostOpenVhostSCSI(int *vhostfd) +{ + if (!virFileExists(VHOST_SCSI_DEVICE)) + goto error; + + *vhostfd =3D open(VHOST_SCSI_DEVICE, O_RDWR); + + if (*vhostfd < 0) { + virReportSystemError(errno, _("Failed to open %s"), VHOST_SCSI_DEV= ICE); + goto error; + } + + return 0; + + error: + VIR_FORCE_CLOSE(*vhostfd); + + return -1; +} + + +void +virSCSIVHostDeviceListDel(virSCSIVHostDeviceListPtr list, + virSCSIVHostDevicePtr dev) +{ + virSCSIVHostDevicePtr tmp =3D virSCSIVHostDeviceListSteal(list, dev); + virSCSIVHostDeviceFree(tmp); +} + + +static int +virSCSIVHostDeviceListFindIndex(virSCSIVHostDeviceListPtr list, + virSCSIVHostDevicePtr dev) +{ + size_t i; + + for (i =3D 0; i < list->count; i++) { + virSCSIVHostDevicePtr other =3D list->devs[i]; + if (STREQ_NULLABLE(other->name, dev->name)) + return i; + } + return -1; +} + + +virSCSIVHostDevicePtr +virSCSIVHostDeviceListGet(virSCSIVHostDeviceListPtr list, int idx) +{ + if (idx >=3D list->count || idx < 0) + return NULL; + + return list->devs[idx]; +} + + +size_t +virSCSIVHostDeviceListCount(virSCSIVHostDeviceListPtr list) +{ + return list->count; +} + + +virSCSIVHostDevicePtr +virSCSIVHostDeviceListSteal(virSCSIVHostDeviceListPtr list, + virSCSIVHostDevicePtr dev) +{ + virSCSIVHostDevicePtr ret =3D NULL; + size_t i; + + for (i =3D 0; i < list->count; i++) { + if (STREQ_NULLABLE(list->devs[i]->name, dev->name)) { + ret =3D list->devs[i]; + VIR_DELETE_ELEMENT(list->devs, i, list->count); + break; + } + } + + return ret; +} + + +virSCSIVHostDevicePtr +virSCSIVHostDeviceListFind(virSCSIVHostDeviceListPtr list, + virSCSIVHostDevicePtr dev) +{ + int idx; + + if ((idx =3D virSCSIVHostDeviceListFindIndex(list, dev)) >=3D 0) + return list->devs[idx]; + else + return NULL; +} + + +int +virSCSIVHostDeviceListAdd(virSCSIVHostDeviceListPtr list, + virSCSIVHostDevicePtr dev) +{ + if (virSCSIVHostDeviceListFind(list, dev)) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Device %s is already in use"), dev->name); + return -1; + } + return VIR_APPEND_ELEMENT(list->devs, list->count, dev); +} + + +virSCSIVHostDeviceListPtr +virSCSIVHostDeviceListNew(void) +{ + if (virSCSIVHostInitialize() < 0) + return NULL; + + return virObjectLockableNew(virSCSIVHostDeviceListClass); +} + + +int +virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevicePtr dev, + const char *drvname, + const char *domname) +{ + VIR_FREE(dev->used_by_drvname); + VIR_FREE(dev->used_by_domname); + if (VIR_STRDUP(dev->used_by_drvname, drvname) < 0) + return -1; + if (VIR_STRDUP(dev->used_by_domname, domname) < 0) + return -1; + + return 0; +} + + +void +virSCSIVHostDeviceGetUsedBy(virSCSIVHostDevicePtr dev, + const char **drv_name, + const char **dom_name) +{ + *drv_name =3D dev->used_by_drvname; + *dom_name =3D dev->used_by_domname; + } + + +int +virSCSIVHostDeviceFileIterate(virSCSIVHostDevicePtr dev, + virSCSIVHostDeviceFileActor actor, + void *opaque) +{ + return (actor)(dev, dev->path, opaque); +} + + +const char * +virSCSIVHostDeviceGetName(virSCSIVHostDevicePtr dev) +{ + return dev->name; +} + + +virSCSIVHostDevicePtr +virSCSIVHostDeviceNew(const char *name) +{ + virSCSIVHostDevicePtr dev; + + if (VIR_ALLOC(dev) < 0) + return NULL; + + if (VIR_STRDUP(dev->name, name) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("dev->name buffer overflow: %s"), + name); + goto error; + } + + if (virAsprintf(&dev->path, "%s/%s", + SYSFS_VHOST_SCSI_DEVICES, name) < 0) + goto cleanup; + + VIR_DEBUG("%s: initialized", dev->name); + + cleanup: + return dev; + + error: + virSCSIVHostDeviceFree(dev); + dev =3D NULL; + goto cleanup; +} + + +void +virSCSIVHostDeviceFree(virSCSIVHostDevicePtr dev) +{ + if (!dev) + return; + VIR_DEBUG("%s: freeing", dev->name); + VIR_FREE(dev->name); + VIR_FREE(dev->path); + VIR_FREE(dev->used_by_drvname); + VIR_FREE(dev->used_by_domname); + VIR_FREE(dev); +} diff --git a/src/util/virscsivhost.h b/src/util/virscsivhost.h new file mode 100644 index 0000000..1a52acf --- /dev/null +++ b/src/util/virscsivhost.h @@ -0,0 +1,65 @@ +/* + * virscsivhost.h: helper APIs for managing host scsi_host devices + * + * Copyright (C) 2016 IBM Corporation + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. If not, see + * . + * + * Authors: + * Eric Farman + */ + +#ifndef __VIR_SCSIHOST_H__ +# define __VIR_SCSIHOST_H__ + +# include "internal.h" +# include "virobject.h" +# include "virutil.h" + +typedef struct _virSCSIVHostDevice virSCSIVHostDevice; +typedef virSCSIVHostDevice *virSCSIVHostDevicePtr; +typedef struct _virSCSIVHostDeviceList virSCSIVHostDeviceList; +typedef virSCSIVHostDeviceList *virSCSIVHostDeviceListPtr; + +typedef int (*virSCSIVHostDeviceFileActor)(virSCSIVHostDevicePtr dev, + const char *name, void *opaque); + +int virSCSIVHostDeviceFileIterate(virSCSIVHostDevicePtr dev, + virSCSIVHostDeviceFileActor actor, + void *opaque); +const char *virSCSIVHostDeviceGetName(virSCSIVHostDevicePtr dev); +virSCSIVHostDevicePtr virSCSIVHostDeviceListGet(virSCSIVHostDeviceListPtr = list, + int idx); +size_t virSCSIVHostDeviceListCount(virSCSIVHostDeviceListPtr list); +virSCSIVHostDevicePtr virSCSIVHostDeviceListSteal(virSCSIVHostDeviceListPt= r list, + virSCSIVHostDevicePtr de= v); +virSCSIVHostDevicePtr virSCSIVHostDeviceListFind(virSCSIVHostDeviceListPtr= list, + virSCSIVHostDevicePtr dev= ); +int virSCSIVHostDeviceListAdd(virSCSIVHostDeviceListPtr list, + virSCSIVHostDevicePtr dev); +void virSCSIVHostDeviceListDel(virSCSIVHostDeviceListPtr list, + virSCSIVHostDevicePtr dev); +virSCSIVHostDeviceListPtr virSCSIVHostDeviceListNew(void); +virSCSIVHostDevicePtr virSCSIVHostDeviceNew(const char *name); +int virSCSIVHostDeviceSetUsedBy(virSCSIVHostDevicePtr dev, + const char *drvname, + const char *domname); +void virSCSIVHostDeviceGetUsedBy(virSCSIVHostDevicePtr dev, + const char **drv_name, + const char **dom_name); +void virSCSIVHostDeviceFree(virSCSIVHostDevicePtr dev); +int virSCSIVHostOpenVhostSCSI(int *vhostfd); + +#endif /* __VIR_SCSIHOST_H__ */ diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c index 78a224b..c501b59 100644 --- a/tests/qemuxml2argvmock.c +++ b/tests/qemuxml2argvmock.c @@ -31,6 +31,7 @@ #include "virnuma.h" #include "virrandom.h" #include "virscsi.h" +#include "virscsivhost.h" #include "virstring.h" #include "virtpm.h" #include "virutil.h" @@ -107,6 +108,14 @@ virSCSIDeviceGetSgName(const char *sysfs_prefix ATTRIB= UTE_UNUSED, } =20 int +virSCSIVHostOpenVhostSCSI(int *vhostfd) +{ + *vhostfd =3D STDERR_FILENO + 1; + + return 0; +} + +int virNetDevTapCreate(char **ifname, const char *tunpath ATTRIBUTE_UNUSED, int *tapfd, --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 17:04:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) client-ip=209.132.183.39; envelope-from=libvir-list-bounces@redhat.com; helo=mx6-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.39 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx6-phx2.redhat.com (mx6-phx2.redhat.com [209.132.183.39]) by mx.zohomail.com with SMTPS id 1479787389206276.13440460747677; Mon, 21 Nov 2016 20:03:09 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx6-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAM3xDZL008216; Mon, 21 Nov 2016 22:59:13 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id uAM3weMx031250 for ; Mon, 21 Nov 2016 22:58:40 -0500 Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAM3weOx012281 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 21 Nov 2016 22:58:40 -0500 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 EE80B61BB0 for ; Tue, 22 Nov 2016 03:58:38 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAM3wRQF093011 for ; Mon, 21 Nov 2016 22:58:38 -0500 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0a-001b2d01.pphosted.com with ESMTP id 26vcrrusan-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 21 Nov 2016 22:58:38 -0500 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 Nov 2016 20:58:37 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 21 Nov 2016 20:58:35 -0700 Received: from b03cxnp08026.gho.boulder.ibm.com (b03cxnp08026.gho.boulder.ibm.com [9.17.130.18]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 6B13E19D8040; Mon, 21 Nov 2016 20:57:53 -0700 (MST) Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08026.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAM3wVlM48103656; Mon, 21 Nov 2016 20:58:31 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 82A4C13603C; Mon, 21 Nov 2016 20:58:31 -0700 (MST) Received: from farman-ThinkPad-W540.ibm.com (unknown [9.85.134.169]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTPS id 0AF9713603A; Mon, 21 Nov 2016 20:58:30 -0700 (MST) From: Eric Farman To: libvirt-list@redhat.com Date: Mon, 21 Nov 2016 22:58:18 -0500 In-Reply-To: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> References: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112203-0028-0000-0000-000006168DF7 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006120; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000189; SDB=6.00783707; UDB=6.00378500; IPR=6.00561327; BA=6.00004898; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013404; XFM=3.00000011; UTC=2016-11-22 03:58:36 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112203-0029-0000-0000-00003109B8B0 Message-Id: <1479787103-26581-5-git-send-email-farman@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-22_01:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611220070 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 199 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 22 Nov 2016 03:58:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 22 Nov 2016 03:58:39 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'farman@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.099 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 4/9] qemu: Add vhost-scsi string for -device parameter 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-ZohoMail: RSF_0 Z_629925259 SPT_1 Z_629926901 SPT_1 UDT_7 RF_0 X-Zoho-Virus-Status: 2 Content-Type: text/plain; charset="utf-8" Open /dev/vhost-scsi, and record the resulting file descriptor, so that the guest has access to the host device outside of the libvirt daemon. Pass this information, along with data parsed from the XML file, to build a device string for the qemu command line. That device string will be for either a vhost-scsi-ccw device in the case of an s390 machine, or vhost-scsi-pci for any others. Signed-off-by: Eric Farman --- src/qemu/qemu_cgroup.c | 32 +++++++++++++++++ src/qemu/qemu_command.c | 80 ++++++++++++++++++++++++++++++++++++++= ++++ src/qemu/qemu_command.h | 5 +++ src/qemu/qemu_domain_address.c | 14 ++++++-- src/qemu/qemu_hostdev.c | 41 ++++++++++++++++++++++ src/qemu/qemu_hostdev.h | 8 +++++ 6 files changed, 178 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c index 5c26086..90f7ed4 100644 --- a/src/qemu/qemu_cgroup.c +++ b/src/qemu/qemu_cgroup.c @@ -277,6 +277,25 @@ qemuSetupHostSCSIDeviceCgroup(virSCSIDevicePtr dev ATT= RIBUTE_UNUSED, return ret; } =20 +static int +qemuSetupHostSCSIVHostDeviceCgroup(virSCSIVHostDevicePtr dev ATTRIBUTE_UNU= SED, + const char *path, + void *opaque) +{ + virDomainObjPtr vm =3D opaque; + qemuDomainObjPrivatePtr priv =3D vm->privateData; + int ret; + + VIR_DEBUG("Process path '%s' for scsi_host device", path); + + ret =3D virCgroupAllowDevicePath(priv->cgroup, path, + VIR_CGROUP_DEVICE_RW, false); + + virDomainAuditCgroupPath(vm, priv->cgroup, "allow", path, "rw", ret = =3D=3D 0); + + return ret; +} + int qemuSetupHostdevCgroup(virDomainObjPtr vm, virDomainHostdevDefPtr dev) @@ -286,9 +305,11 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm, virDomainHostdevSubsysUSBPtr usbsrc =3D &dev->source.subsys.u.usb; virDomainHostdevSubsysPCIPtr pcisrc =3D &dev->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &dev->source.subsys.u.scsi; + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &dev->source.subsys.u.s= csi_host; virPCIDevicePtr pci =3D NULL; virUSBDevicePtr usb =3D NULL; virSCSIDevicePtr scsi =3D NULL; + virSCSIVHostDevicePtr host =3D NULL; char *path =3D NULL; =20 /* currently this only does something for PCI devices using vfio @@ -377,6 +398,16 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm, } =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { + if (hostsrc->protocol =3D=3D + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_VHOST) { + if (!(host =3D virSCSIVHostDeviceNew(hostsrc->wwpn))) + goto cleanup; + + if (virSCSIVHostDeviceFileIterate(host, + qemuSetupHostSCSIVHostDeviceC= group, + vm) < 0) + goto cleanup; + } break; } =20 @@ -390,6 +421,7 @@ qemuSetupHostdevCgroup(virDomainObjPtr vm, virPCIDeviceFree(pci); virUSBDeviceFree(usb); virSCSIDeviceFree(scsi); + virSCSIVHostDeviceFree(host); VIR_FREE(path); return ret; } diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 4a5fce3..5ff6a39 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4742,6 +4742,44 @@ qemuBuildSCSIiSCSIHostdevDrvStr(virDomainHostdevDefP= tr dev) } =20 char * +qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def, + virDomainHostdevDefPtr dev, + virQEMUCapsPtr qemuCaps, + char *vhostfdName) +{ + virBuffer buf =3D VIR_BUFFER_INITIALIZER; + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &dev->source.subsys.u.s= csi_host; + + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_VHOST_SCSI)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("This QEMU doesn't support vhost-scsi devices")); + goto cleanup; + } + + if (ARCH_IS_S390(def->os.arch)) + virBufferAddLit(&buf, "vhost-scsi-ccw"); + else + virBufferAddLit(&buf, "vhost-scsi-pci"); + + virBufferAsprintf(&buf, ",wwpn=3D%s,vhostfd=3D%s,id=3D%s", + hostsrc->wwpn, + vhostfdName, + dev->info->alias); + + if (qemuBuildDeviceAddressStr(&buf, def, dev->info, qemuCaps) < 0) + goto cleanup; + + if (virBufferCheckError(&buf) < 0) + goto cleanup; + + return virBufferContentAndReset(&buf); + + cleanup: + virBufferFreeAndReset(&buf); + return NULL; +} + +char * qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPtr dev) { virBuffer buf =3D VIR_BUFFER_INITIALIZER; @@ -5222,6 +5260,48 @@ qemuBuildHostdevCommandLine(virCommandPtr cmd, return -1; } } + + /* SCSI_host */ + if (hostdev->mode =3D=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && + subsys->type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SCSI_GENERIC)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("SCSI passthrough is not supported by thi= s " + "version of qemu")); + return -1; + } + + if (hostdev->source.subsys.u.scsi_host.protocol =3D=3D + VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_VHOST) { + char *vhostfdName =3D NULL; + int vhostfd =3D -1; + + if (virSCSIVHostOpenVhostSCSI(&vhostfd) < 0) + return -1; + + if (virAsprintf(&vhostfdName, "%d", vhostfd) < 0) { + VIR_FORCE_CLOSE(vhostfd); + return -1; + } + + virCommandPassFD(cmd, vhostfd, + VIR_COMMAND_PASS_FD_CLOSE_PARENT); + + virCommandAddArg(cmd, "-device"); + if (!(devstr =3D qemuBuildSCSIVHostHostdevDevStr(def, + hostdev, + qemuCaps, + vhostfdName= ))) { + VIR_FREE(vhostfdName); + VIR_FORCE_CLOSE(vhostfd); + return -1; + } + virCommandAddArg(cmd, devstr); + + VIR_FREE(vhostfdName); + VIR_FREE(devstr); + } + } } =20 return 0; diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h index e0c84df..3bcfdc6 100644 --- a/src/qemu/qemu_command.h +++ b/src/qemu/qemu_command.h @@ -164,6 +164,11 @@ char *qemuBuildSCSIHostdevDrvStr(virDomainHostdevDefPt= r dev); char *qemuBuildSCSIHostdevDevStr(const virDomainDef *def, virDomainHostdevDefPtr dev, virQEMUCapsPtr qemuCaps); +char * +qemuBuildSCSIVHostHostdevDevStr(const virDomainDef *def, + virDomainHostdevDefPtr dev, + virQEMUCapsPtr qemuCaps, + char *vhostfdName); =20 char *qemuBuildRedirdevDevStr(const virDomainDef *def, virDomainRedirdevDefPtr dev, diff --git a/src/qemu/qemu_domain_address.c b/src/qemu/qemu_domain_address.c index 30ecb4e..13f6702 100644 --- a/src/qemu/qemu_domain_address.c +++ b/src/qemu/qemu_domain_address.c @@ -312,6 +312,14 @@ qemuDomainPrimeVirtioDeviceAddresses(virDomainDefPtr d= ef, } } =20 + for (i =3D 0; i < def->nhostdevs; i++) { + if (def->hostdevs[i]->mode =3D=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && + def->hostdevs[i]->source.subsys.type =3D=3D + VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST && + def->hostdevs[i]->info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_= TYPE_NONE) + def->hostdevs[i]->info->type =3D type; + } + if (def->memballoon && def->memballoon->model =3D=3D VIR_DOMAIN_MEMBALLOON_MODEL_VIRTIO && def->memballoon->info.type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_N= ONE) @@ -1594,8 +1602,10 @@ qemuDomainAssignDevicePCISlots(virDomainDefPtr def, for (i =3D 0; i < def->nhostdevs; i++) { if (!virDeviceInfoPCIAddressWanted(def->hostdevs[i]->info)) continue; - if (def->hostdevs[i]->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || - def->hostdevs[i]->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_S= UBSYS_TYPE_PCI) + if (def->hostdevs[i]->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) + continue; + if (def->hostdevs[i]->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_S= UBSYS_TYPE_PCI && + def->hostdevs[i]->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_S= UBSYS_TYPE_SCSI_HOST) continue; =20 if (qemuDomainPCIAddressReserveNextSlot(addrs, diff --git a/src/qemu/qemu_hostdev.c b/src/qemu/qemu_hostdev.c index dd3a3cf..a463d46 100644 --- a/src/qemu/qemu_hostdev.c +++ b/src/qemu/qemu_hostdev.c @@ -292,6 +292,17 @@ qemuHostdevPrepareSCSIDevices(virQEMUDriverPtr driver, name, hostdevs, nhostdevs); } =20 +int +qemuHostdevPrepareSCSIVHostDevices(virQEMUDriverPtr driver, + const char *name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs) +{ + virHostdevManagerPtr hostdev_mgr =3D driver->hostdevMgr; + + return virHostdevPrepareSCSIVHostDevices(hostdev_mgr, QEMU_DRIVER_NAME, + name, hostdevs, nhostdevs); +} =20 int qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver, @@ -315,6 +326,10 @@ qemuHostdevPrepareDomainDevices(virQEMUDriverPtr drive= r, def->hostdevs, def->nhostdevs) < 0) return -1; =20 + if (qemuHostdevPrepareSCSIVHostDevices(driver, def->name, + def->hostdevs, def->nhostdevs) = < 0) + return -1; + return 0; } =20 @@ -370,6 +385,29 @@ qemuHostdevReAttachSCSIDevices(virQEMUDriverPtr driver, } =20 void +qemuHostdevReAttachSCSIVHostDevices(virQEMUDriverPtr driver, + const char *name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs) +{ + size_t i; + virHostdevManagerPtr hostdev_mgr =3D driver->hostdevMgr; + + for (i =3D 0; i < nhostdevs; i++) { + virDomainHostdevDefPtr hostdev =3D hostdevs[i]; + virDomainDeviceDef dev; + + dev.type =3D VIR_DOMAIN_DEVICE_HOSTDEV; + dev.data.hostdev =3D hostdev; + + ignore_value(qemuRemoveSharedDevice(driver, &dev, name)); + } + + virHostdevReAttachSCSIVHostDevices(hostdev_mgr, QEMU_DRIVER_NAME, + name, hostdevs, nhostdevs); +} + +void qemuHostdevReAttachDomainDevices(virQEMUDriverPtr driver, virDomainDefPtr def) { @@ -384,4 +422,7 @@ qemuHostdevReAttachDomainDevices(virQEMUDriverPtr drive= r, =20 qemuHostdevReAttachSCSIDevices(driver, def->name, def->hostdevs, def->nhostdevs); + + qemuHostdevReAttachSCSIVHostDevices(driver, def->name, def->hostdevs, + def->nhostdevs); } diff --git a/src/qemu/qemu_hostdev.h b/src/qemu/qemu_hostdev.h index 0a3c715..74a7d4f 100644 --- a/src/qemu/qemu_hostdev.h +++ b/src/qemu/qemu_hostdev.h @@ -55,6 +55,10 @@ int qemuHostdevPrepareSCSIDevices(virQEMUDriverPtr drive= r, const char *name, virDomainHostdevDefPtr *hostdevs, int nhostdevs); +int qemuHostdevPrepareSCSIVHostDevices(virQEMUDriverPtr driver, + const char *name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs); int qemuHostdevPrepareDomainDevices(virQEMUDriverPtr driver, virDomainDefPtr def, virQEMUCapsPtr qemuCaps, @@ -72,6 +76,10 @@ void qemuHostdevReAttachSCSIDevices(virQEMUDriverPtr dri= ver, const char *name, virDomainHostdevDefPtr *hostdevs, int nhostdevs); +void qemuHostdevReAttachSCSIVHostDevices(virQEMUDriverPtr driver, + const char *name, + virDomainHostdevDefPtr *hostdevs, + int nhostdevs); void qemuHostdevReAttachDomainDevices(virQEMUDriverPtr driver, virDomainDefPtr def); =20 --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 17:04:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 14797872956471011.9633435401041; Mon, 21 Nov 2016 20:01:35 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAM3x5p4029534; Mon, 21 Nov 2016 22:59:05 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id uAM3wcM2031239 for ; Mon, 21 Nov 2016 22:58:38 -0500 Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAM3wcqZ026882 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 21 Nov 2016 22:58:38 -0500 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (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 6B0D38FCF3 for ; Tue, 22 Nov 2016 03:58:37 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAM3wadK113771 for ; Mon, 21 Nov 2016 22:58:37 -0500 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0a-001b2d01.pphosted.com with ESMTP id 26vcrt3n4d-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 21 Nov 2016 22:58:36 -0500 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 Nov 2016 20:58:36 -0700 Received: from d03dlp01.boulder.ibm.com (9.17.202.177) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 21 Nov 2016 20:58:33 -0700 Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 8FB7F1FF0025; Mon, 21 Nov 2016 20:58:12 -0700 (MST) Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAM3wXrf37224596; Mon, 21 Nov 2016 20:58:33 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 264E1136040; Mon, 21 Nov 2016 20:58:33 -0700 (MST) Received: from farman-ThinkPad-W540.ibm.com (unknown [9.85.134.169]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTPS id AD69F13603A; Mon, 21 Nov 2016 20:58:32 -0700 (MST) From: Eric Farman To: libvirt-list@redhat.com Date: Mon, 21 Nov 2016 22:58:19 -0500 In-Reply-To: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> References: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112203-0028-0000-0000-000006168DF3 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006120; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000189; SDB=6.00783707; UDB=6.00378500; IPR=6.00561327; BA=6.00004898; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013404; XFM=3.00000011; UTC=2016-11-22 03:58:35 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112203-0029-0000-0000-00003109B8A9 Message-Id: <1479787103-26581-6-git-send-email-farman@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-22_01:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=3 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611220070 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 199 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 22 Nov 2016 03:58:37 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 22 Nov 2016 03:58:37 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'farman@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.099 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 5/9] qemu: Allow hotplug of vhost-scsi device 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-Zoho-Virus-Status: 2 X-ZohoMail-Forwarded-To: importer@patchew.org X-ZohoMail-Forwarded-For: patchew@euphon.net importer@patchew.org X-ZohoMail: RSF_0 Z_629925259 SPT_1 Z_629926901 SPT_1 UDT_7 RF_0 Content-Type: text/plain; charset="utf-8" Adjust the device string that is built for vhost-scsi devices so that it can be invoked from hotplug. >From the QEMU command line, the file descriptors are expect to be numeric = only. However, for hotplug, the file descriptors are expected to begin with at le= ast one alphabetic character else this error occurs: # virsh attach-device guest_0001 ~/vhost.xml error: Failed to attach device from /root/vhost.xml error: internal error: unable to execute QEMU command 'getfd': Parameter 'fdname' expects a name not starting with a digit We also close the file descriptor in this case, so that shutting down the guest cleans up the host cgroup entries and allows future guests to use vhost-scsi devices. (Otherwise the guest will silently end.) Signed-off-by: Eric Farman --- src/qemu/qemu_hotplug.c | 164 ++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 164 insertions(+) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 0508c67..02e248f 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2443,6 +2443,126 @@ qemuDomainAttachHostSCSIDevice(virConnectPtr conn, goto cleanup; } =20 +static int +qemuDomainAttachSCSIVHostDevice(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainHostdevDefPtr hostdev) +{ + int ret =3D -1; + qemuDomainObjPrivatePtr priv =3D vm->privateData; + virErrorPtr orig_err; + virDomainDeviceDef dev =3D { VIR_DOMAIN_DEVICE_HOSTDEV, + { .hostdev =3D hostdev } }; + virDomainCCWAddressSetPtr ccwaddrs =3D NULL; + char *vhostfdName =3D NULL; + int vhostfd =3D -1; + char *devstr =3D NULL; + bool teardowncgroup =3D false; + bool teardownlabel =3D false; + bool releaseaddr =3D false; + + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE_SCSI_GENERIC)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("SCSI passthrough is not supported by this versio= n of qemu")); + goto cleanup; + } + + if (qemuHostdevPrepareSCSIVHostDevices(driver, vm->def->name, &hostdev= , 1) < 0) { + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &hostdev->source.su= bsys.u.scsi_host; + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unable to prepare scsi_host hostdev: %s"), + hostsrc->wwpn); + goto cleanup; + } + + if (qemuSetupHostdevCgroup(vm, hostdev) < 0) + goto cleanup; + teardowncgroup =3D true; + + if (virSecurityManagerSetHostdevLabel(driver->securityManager, + vm->def, hostdev, NULL) < 0) + goto cleanup; + teardownlabel =3D true; + + if (virSCSIVHostOpenVhostSCSI(&vhostfd) < 0) + goto cleanup; + + if (virAsprintf(&vhostfdName, "vhostfd-%d", vhostfd) < 0) + goto cleanup; + + if (hostdev->info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE) { + if (qemuDomainMachineIsS390CCW(vm->def) && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VIRTIO_CCW)) + hostdev->info->type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW; + } + + if (hostdev->info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE || + hostdev->info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) { + if (qemuDomainEnsurePCIAddress(vm, &dev) < 0) + goto cleanup; + } else if (hostdev->info->type =3D=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_C= CW) { + if (!(ccwaddrs =3D qemuDomainCCWAddrSetCreateFromDomain(vm->def))) + goto cleanup; + if (virDomainCCWAddressAssign(hostdev->info, ccwaddrs, + !hostdev->info->addr.ccw.assigned) <= 0) + goto cleanup; + } + releaseaddr =3D true; + + if (qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1) <= 0) + goto cleanup; + + if (!(devstr =3D qemuBuildSCSIVHostHostdevDevStr(vm->def, + hostdev, + priv->qemuCaps, + vhostfdName))) + goto cleanup; + + if (VIR_REALLOC_N(vm->def->hostdevs, vm->def->nhostdevs + 1) < 0) + goto cleanup; + + qemuDomainObjEnterMonitor(driver, vm); + + if (qemuMonitorAddDeviceWithFd(priv->mon, devstr, vhostfd, vhostfdName= ) < 0) + goto exit_monitor; + + if (qemuDomainObjExitMonitor(driver, vm) < 0) + goto audit; + + vm->def->hostdevs[vm->def->nhostdevs++] =3D hostdev; + ret =3D 0; + + audit: + virDomainAuditHostdev(vm, hostdev, "attach", (ret =3D=3D 0)); + + cleanup: + virDomainCCWAddressSetFree(ccwaddrs); + + VIR_FORCE_CLOSE(vhostfd); + VIR_FREE(vhostfdName); + VIR_FREE(devstr); + return ret; + + exit_monitor: + orig_err =3D virSaveLastError(); + + if (teardowncgroup && qemuTeardownHostdevCgroup(vm, hostdev) < 0) + VIR_WARN("Unable to remove host device cgroup ACL on hotplug fail"= ); + if (teardownlabel && + virSecurityManagerRestoreHostdevLabel(driver->securityManager, + vm->def, hostdev, NULL) < 0) + VIR_WARN("Unable to restore host device labelling on hotplug fail"= ); + if (releaseaddr) + qemuDomainReleaseDeviceAddress(vm, hostdev->info, NULL); + + if (orig_err) { + virSetError(orig_err); + virFreeError(orig_err); + } + + goto audit; +} + =20 int qemuDomainAttachHostDevice(virConnectPtr conn, @@ -2476,6 +2596,11 @@ qemuDomainAttachHostDevice(virConnectPtr conn, goto error; break; =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + if (qemuDomainAttachSCSIVHostDevice(driver, vm, hostdev) < 0) + goto error; + break; + default: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("hostdev subsys type '%s' not supported"), @@ -3568,6 +3693,14 @@ qemuDomainRemoveSCSIHostDevice(virQEMUDriverPtr driv= er, qemuHostdevReAttachSCSIDevices(driver, vm->def->name, &hostdev, 1); } =20 +static void +qemuDomainRemoveSCSIVHostDevice(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainHostdevDefPtr hostdev) +{ + qemuHostdevReAttachSCSIVHostDevices(driver, vm->def->name, &hostdev, 1= ); +} + static int qemuDomainRemoveHostDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, @@ -3646,6 +3779,7 @@ qemuDomainRemoveHostDevice(virQEMUDriverPtr driver, qemuDomainRemoveSCSIHostDevice(driver, vm, hostdev); break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + qemuDomainRemoveSCSIVHostDevice(driver, vm, hostdev); break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: break; @@ -4496,6 +4630,31 @@ qemuDomainDetachHostSCSIDevice(virQEMUDriverPtr driv= er, } =20 static int +qemuDomainDetachSCSIVHostDevice(virQEMUDriverPtr driver, + virDomainObjPtr vm, + virDomainHostdevDefPtr detach) +{ + qemuDomainObjPrivatePtr priv =3D vm->privateData; + int ret =3D -1; + + if (!detach->info->alias) { + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", _("device cannot be detached without a device= alias")); + return -1; + } + + qemuDomainMarkDeviceForRemoval(vm, detach->info); + + qemuDomainObjEnterMonitor(driver, vm); + ret =3D qemuMonitorDelDevice(priv->mon, detach->info->alias); + + if (qemuDomainObjExitMonitor(driver, vm) < 0) + return -1; + + return ret; +} + +static int qemuDomainDetachThisHostDevice(virQEMUDriverPtr driver, virDomainObjPtr vm, virDomainHostdevDefPtr detach) @@ -4517,6 +4676,9 @@ qemuDomainDetachThisHostDevice(virQEMUDriverPtr drive= r, case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: ret =3D qemuDomainDetachHostSCSIDevice(driver, vm, detach); break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + ret =3D qemuDomainDetachSCSIVHostDevice(driver, vm, detach); + break; default: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("hostdev subsys type '%s' not supported"), @@ -4594,6 +4756,8 @@ int qemuDomainDetachHostDevice(virQEMUDriverPtr drive= r, } break; } + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + break; default: virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected hostdev type %d"), subsys->type); --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 17:04:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1479787284938191.13423835810158; Mon, 21 Nov 2016 20:01:24 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id uAM3wfVx025351; Mon, 21 Nov 2016 22:58:41 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id uAM3weK9031255 for ; Mon, 21 Nov 2016 22:58:40 -0500 Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAM3weLI012989 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 21 Nov 2016 22:58:40 -0500 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 872DE81222 for ; Tue, 22 Nov 2016 03:58:39 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAM3wROs092999 for ; Mon, 21 Nov 2016 22:58:39 -0500 Received: from e35.co.us.ibm.com (e35.co.us.ibm.com [32.97.110.153]) by mx0a-001b2d01.pphosted.com with ESMTP id 26vcrrusb4-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 21 Nov 2016 22:58:38 -0500 Received: from localhost by e35.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 Nov 2016 20:58:38 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e35.co.us.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 21 Nov 2016 20:58:35 -0700 Received: from b03cxnp07028.gho.boulder.ibm.com (b03cxnp07028.gho.boulder.ibm.com [9.17.130.15]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id ADE5919D803F; Mon, 21 Nov 2016 20:57:56 -0700 (MST) Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp07028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAM3wXId15008134; Mon, 21 Nov 2016 20:58:34 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C6E8413603A; Mon, 21 Nov 2016 20:58:34 -0700 (MST) Received: from farman-ThinkPad-W540.ibm.com (unknown [9.85.134.169]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTPS id 5189A13603C; Mon, 21 Nov 2016 20:58:34 -0700 (MST) From: Eric Farman To: libvirt-list@redhat.com Date: Mon, 21 Nov 2016 22:58:20 -0500 In-Reply-To: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> References: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112203-0012-0000-0000-000011336F08 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006120; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000189; SDB=6.00783707; UDB=6.00378500; IPR=6.00561327; BA=6.00004898; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013404; XFM=3.00000011; UTC=2016-11-22 03:58:37 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112203-0013-0000-0000-000047607BB3 Message-Id: <1479787103-26581-7-git-send-email-farman@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-22_01:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=4 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611220070 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 199 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 22 Nov 2016 03:58:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 22 Nov 2016 03:58:39 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'farman@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.099 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 6/9] conf: Wire up the vhost-scsi connection from/to XML 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-Zoho-Virus-Status: 2 X-ZohoMail-Forwarded-To: importer@patchew.org X-ZohoMail-Forwarded-For: patchew@euphon.net importer@patchew.org X-ZohoMail: RSF_0 Z_629925259 SPT_1 Z_629926901 SPT_1 UDT_7 RF_0 Content-Type: text/plain; charset="utf-8" With the QEMU components in place, provide the XML parsing to invoke that code when given the following XML snippet: An optional address element can be specified within the hostdev (pick CCW or PCI as necessary):
Signed-off-by: Eric Farman --- docs/schemas/domaincommon.rng | 23 +++++++++++ src/conf/domain_audit.c | 7 ++++ src/conf/domain_conf.c | 92 +++++++++++++++++++++++++++++++++++++++= +++- 3 files changed, 121 insertions(+), 1 deletion(-) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 19d45fd..bb903ef 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -3974,6 +3974,7 @@ + =20 @@ -4102,6 +4103,28 @@ =20 + + + scsi_host + + + + + + + vhost + + + + + (naa\.)[0-9a-fA-F]{16} + + + + + + + storage diff --git a/src/conf/domain_audit.c b/src/conf/domain_audit.c index 2decf02..2d9ff5e 100644 --- a/src/conf/domain_audit.c +++ b/src/conf/domain_audit.c @@ -392,6 +392,7 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHost= devDefPtr hostdev, virDomainHostdevSubsysUSBPtr usbsrc =3D &hostdev->source.subsys.u.usb; virDomainHostdevSubsysPCIPtr pcisrc =3D &hostdev->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &hostdev->source.subsys.u.sc= si; + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &hostdev->source.subsys= .u.scsi_host; =20 virUUIDFormat(vm->def->uuid, uuidstr); if (!(vmname =3D virAuditEncode("vm", vm->def->name))) { @@ -444,6 +445,12 @@ virDomainAuditHostdev(virDomainObjPtr vm, virDomainHos= tdevDefPtr hostdev, } break; } + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + if (VIR_STRDUP_QUIET(address, hostsrc->wwpn) < 0) { + VIR_WARN("OOM while encoding audit message"); + goto cleanup; + } + break; default: VIR_WARN("Unexpected hostdev type while encoding audit message= : %d", hostdev->source.subsys.type); diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 3a4123d..618a214 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -2323,6 +2323,9 @@ void virDomainHostdevDefClear(virDomainHostdevDefPtr = def) } else { VIR_FREE(scsisrc->u.host.adapter); } + } else if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSY= S_TYPE_SCSI_HOST) { + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &def->source.su= bsys.u.scsi_host; + VIR_FREE(hostsrc->wwpn); } break; } @@ -6094,6 +6097,58 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sou= rcenode, return ret; } =20 +static int +virDomainHostdevSubsysSCSIVHostDefParseXML(xmlNodePtr sourcenode, + virDomainHostdevDefPtr def) +{ + char *protocol =3D NULL; + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &def->source.subsys.u.s= csi_host; + + if (!(protocol =3D virXMLPropString(sourcenode, "protocol"))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("Missing scsi_host subsystem protocol")); + return -1; + } + + if ((hostsrc->protocol =3D + virDomainHostdevSubsysSCSIHostProtocolTypeFromString(protocol)) <= =3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unknown scsi_host subsystem protocol '%s'"), + protocol); + goto cleanup; + } + + switch ((virDomainHostdevSubsysSCSIHostProtocolType) hostsrc->protocol= ) { + case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_VHOST: + if (!(hostsrc->wwpn =3D virXMLPropString(sourcenode, "wwpn"))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("missing vhost-scsi hostdev source wwpn")); + goto cleanup; + } + + if (!STRPREFIX(hostsrc->wwpn, "naa.") || + !virValidateWWN(hostsrc->wwpn + 4)) { + virReportError(VIR_ERR_XML_ERROR, "%s", _("malformed 'wwpn' va= lue")); + goto cleanup; + } + break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_NONE: + case VIR_DOMAIN_HOSTDEV_SUBSYS_SCSI_HOST_PROTOCOL_TYPE_LAST: + virReportError(VIR_ERR_XML_ERROR, + _("Invalid hostdev protocol '%s'"), + virDomainHostdevSubsysSCSIHostProtocolTypeToString(= hostsrc->protocol)); + goto cleanup; + break; + } + + return 0; + + cleanup: + VIR_FREE(hostsrc->wwpn); + VIR_FREE(protocol); + return -1; +} + =20 static int virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, @@ -6218,6 +6273,11 @@ virDomainHostdevDefParseXMLSubsys(xmlNodePtr node, goto error; break; =20 + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + if (virDomainHostdevSubsysSCSIVHostDefParseXML(sourcenode, def) < = 0) + goto error; + break; + default: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("address type=3D'%s' not supported in hostdev int= erfaces"), @@ -13023,6 +13083,15 @@ virDomainHostdevDefParseXML(virDomainXMLOptionPtr = xmlopt, def->shareable =3D true; break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + if (def->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE && + def->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI && + def->info->type !=3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_CCW) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("SCSI_host host device must use 'pci' " + "or 'ccw' address type")); + goto error; + } + break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: break; @@ -13907,7 +13976,14 @@ virDomainHostdevMatchSubsys(virDomainHostdevDefPtr= a, else return virDomainHostdevMatchSubsysSCSIHost(a, b); case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: - /* Fall through for now */ + if (a->source.subsys.u.scsi_host.protocol !=3D + b->source.subsys.u.scsi_host.protocol) + return 0; + if (STREQ(a->source.subsys.u.scsi_host.wwpn, + b->source.subsys.u.scsi_host.wwpn)) + return 1; + else + return 0; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: return 0; } @@ -20814,9 +20890,11 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, unsigned int flags, bool includeTypeInAddr) { + bool closedSource =3D false; virDomainHostdevSubsysUSBPtr usbsrc =3D &def->source.subsys.u.usb; virDomainHostdevSubsysPCIPtr pcisrc =3D &def->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &def->source.subsys.u.scsi; + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &def->source.subsys.u.s= csi_host; virDomainHostdevSubsysSCSIHostPtr scsihostsrc =3D &scsisrc->u.host; virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc =3D &scsisrc->u.iscsi; =20 @@ -20857,6 +20935,15 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, protocol, iscsisrc->path); } =20 + if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI= _HOST) { + const char *protocol =3D + virDomainHostdevSubsysSCSIHostProtocolTypeToString(hostsrc->pr= otocol); + closedSource =3D true; + + virBufferAsprintf(buf, " protocol=3D'%s' wwpn=3D'%s'/", + protocol, hostsrc->wwpn); + } + virBufferAddLit(buf, ">\n"); =20 virBufferAdjustIndent(buf, 2); @@ -20910,6 +20997,8 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, scsihostsrc->unit); } break; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + break; default: virReportError(VIR_ERR_INTERNAL_ERROR, _("unexpected hostdev type %d"), @@ -20925,6 +21014,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, } =20 virBufferAdjustIndent(buf, -2); + if (!closedSource) virBufferAddLit(buf, "\n"); =20 return 0; --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 17:04:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) client-ip=209.132.183.37; envelope-from=libvir-list-bounces@redhat.com; helo=mx5-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.37 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx5-phx2.redhat.com (mx5-phx2.redhat.com [209.132.183.37]) by mx.zohomail.com with SMTPS id 1479787423126501.8595234288824; Mon, 21 Nov 2016 20:03:43 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx5-phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAM3xLvS029582; Mon, 21 Nov 2016 22:59:21 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id uAM3wiB9031282 for ; Mon, 21 Nov 2016 22:58:44 -0500 Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAM3wixC010174 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 21 Nov 2016 22:58:44 -0500 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 6F8E3C04B95D for ; Tue, 22 Nov 2016 03:58:41 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAM3wU2e093127 for ; Mon, 21 Nov 2016 22:58:40 -0500 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0a-001b2d01.pphosted.com with ESMTP id 26vcrrusbu-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 21 Nov 2016 22:58:40 -0500 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 Nov 2016 20:58:39 -0700 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 21 Nov 2016 20:58:37 -0700 Received: from b03cxnp08027.gho.boulder.ibm.com (b03cxnp08027.gho.boulder.ibm.com [9.17.130.19]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id 865B63E40030; Mon, 21 Nov 2016 20:58:36 -0700 (MST) Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08027.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAM3wahI39845912; Mon, 21 Nov 2016 20:58:36 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 69C7113603C; Mon, 21 Nov 2016 20:58:36 -0700 (MST) Received: from farman-ThinkPad-W540.ibm.com (unknown [9.85.134.169]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTPS id F418B136040; Mon, 21 Nov 2016 20:58:35 -0700 (MST) From: Eric Farman To: libvirt-list@redhat.com Date: Mon, 21 Nov 2016 22:58:21 -0500 In-Reply-To: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> References: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112203-0028-0000-0000-000006168DFE X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006120; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000189; SDB=6.00783707; UDB=6.00378500; IPR=6.00561327; BA=6.00004898; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013404; XFM=3.00000011; UTC=2016-11-22 03:58:38 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112203-0029-0000-0000-00003109B8BC Message-Id: <1479787103-26581-8-git-send-email-farman@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-22_01:, , 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-1609300000 definitions=main-1611220070 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 199 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 22 Nov 2016 03:58:41 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Tue, 22 Nov 2016 03:58:41 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'farman@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.099 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 7/9] security: Include vhost-scsi in security labels 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-ZohoMail: RSF_0 Z_629925259 SPT_1 Z_629926901 SPT_1 UDT_7 RF_0 X-Zoho-Virus-Status: 2 Content-Type: text/plain; charset="utf-8" Ensure that the vhost-scsi wwpn information is passed to the different security policies. Signed-off-by: Eric Farman --- src/security/security_apparmor.c | 20 ++++++++++++++++- src/security/security_dac.c | 46 ++++++++++++++++++++++++++++++++++++= ++-- src/security/security_selinux.c | 43 +++++++++++++++++++++++++++++++++++-- 3 files changed, 104 insertions(+), 5 deletions(-) diff --git a/src/security/security_apparmor.c b/src/security/security_appar= mor.c index 19085ec..2c33abb 100644 --- a/src/security/security_apparmor.c +++ b/src/security/security_apparmor.c @@ -44,6 +44,7 @@ #include "viruuid.h" #include "virpci.h" #include "virusb.h" +#include "virscsivhost.h" #include "virfile.h" #include "configmake.h" #include "vircommand.h" @@ -357,6 +358,13 @@ AppArmorSetSecuritySCSILabel(virSCSIDevicePtr dev ATTR= IBUTE_UNUSED, return AppArmorSetSecurityHostdevLabelHelper(file, opaque); } =20 +static int +AppArmorSetSecurityHostLabel(virSCSIVHostDevicePtr dev ATTRIBUTE_UNUSED, + const char *file, void *opaque) +{ + return AppArmorSetSecurityHostdevLabelHelper(file, opaque); +} + /* Called on libvirtd startup to see if AppArmor is available */ static int AppArmorSecurityManagerProbe(const char *virtDriver ATTRIBUTE_UNUSED) @@ -831,6 +839,7 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr m= gr, virDomainHostdevSubsysUSBPtr usbsrc =3D &dev->source.subsys.u.usb; virDomainHostdevSubsysPCIPtr pcisrc =3D &dev->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &dev->source.subsys.u.scsi; + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &dev->source.subsys.u.s= csi_host; =20 if (!secdef) return -1; @@ -910,7 +919,16 @@ AppArmorSetSecurityHostdevLabel(virSecurityManagerPtr = mgr, } =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { - /* Fall through for now */ + virSCSIVHostDevicePtr host =3D virSCSIVHostDeviceNew(hostsrc->wwpn= ); + + if (!host) + goto done; + + ret =3D virSCSIVHostDeviceFileIterate(host, + AppArmorSetSecurityHostLabel, + ptr); + virSCSIVHostDeviceFree(host); + break; } =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: diff --git a/src/security/security_dac.c b/src/security/security_dac.c index 2803962..649219e 100644 --- a/src/security/security_dac.c +++ b/src/security/security_dac.c @@ -36,6 +36,7 @@ #include "virpci.h" #include "virusb.h" #include "virscsi.h" +#include "virscsivhost.h" #include "virstoragefile.h" #include "virstring.h" #include "virutil.h" @@ -582,6 +583,15 @@ virSecurityDACSetSCSILabel(virSCSIDevicePtr dev ATTRIB= UTE_UNUSED, =20 =20 static int +virSecurityDACSetHostLabel(virSCSIVHostDevicePtr dev ATTRIBUTE_UNUSED, + const char *file, + void *opaque) +{ + return virSecurityDACSetHostdevLabelHelper(file, opaque); +} + + +static int virSecurityDACSetHostdevLabel(virSecurityManagerPtr mgr, virDomainDefPtr def, virDomainHostdevDefPtr dev, @@ -592,6 +602,7 @@ virSecurityDACSetHostdevLabel(virSecurityManagerPtr mgr, virDomainHostdevSubsysUSBPtr usbsrc =3D &dev->source.subsys.u.usb; virDomainHostdevSubsysPCIPtr pcisrc =3D &dev->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &dev->source.subsys.u.scsi; + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &dev->source.subsys.u.s= csi_host; int ret =3D -1; =20 if (!priv->dynamicOwnership) @@ -677,7 +688,16 @@ virSecurityDACSetHostdevLabel(virSecurityManagerPtr mg= r, } =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { - /* Fall through for now */ + virSCSIVHostDevicePtr host =3D virSCSIVHostDeviceNew(hostsrc->wwpn= ); + + if (!host) + goto done; + + ret =3D virSCSIVHostDeviceFileIterate(host, + virSecurityDACSetHostLabel, + &cbdata); + virSCSIVHostDeviceFree(host); + break; } =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: @@ -724,6 +744,17 @@ virSecurityDACRestoreSCSILabel(virSCSIDevicePtr dev AT= TRIBUTE_UNUSED, =20 =20 static int +virSecurityDACRestoreHostLabel(virSCSIVHostDevicePtr dev ATTRIBUTE_UNUSED, + const char *file, + void *opaque) +{ + virSecurityManagerPtr mgr =3D opaque; + virSecurityDACDataPtr priv =3D virSecurityManagerGetPrivateData(mgr); + return virSecurityDACRestoreFileLabel(priv, file); +} + + +static int virSecurityDACRestoreHostdevLabel(virSecurityManagerPtr mgr, virDomainDefPtr def, virDomainHostdevDefPtr dev, @@ -735,6 +766,7 @@ virSecurityDACRestoreHostdevLabel(virSecurityManagerPtr= mgr, virDomainHostdevSubsysUSBPtr usbsrc =3D &dev->source.subsys.u.usb; virDomainHostdevSubsysPCIPtr pcisrc =3D &dev->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &dev->source.subsys.u.scsi; + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &dev->source.subsys.u.s= csi_host; int ret =3D -1; =20 secdef =3D virDomainDefGetSecurityLabelDef(def, SECURITY_DAC_NAME); @@ -810,7 +842,17 @@ virSecurityDACRestoreHostdevLabel(virSecurityManagerPt= r mgr, } =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { - /* Fall through for now */ + virSCSIVHostDevicePtr host =3D virSCSIVHostDeviceNew(hostsrc->wwpn= ); + + if (!host) + goto done; + + ret =3D virSCSIVHostDeviceFileIterate(host, + virSecurityDACRestoreHostLabel, + mgr); + virSCSIVHostDeviceFree(host); + + break; } =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: diff --git a/src/security/security_selinux.c b/src/security/security_selinu= x.c index 9870b41..1776a63 100644 --- a/src/security/security_selinux.c +++ b/src/security/security_selinux.c @@ -39,6 +39,7 @@ #include "virpci.h" #include "virusb.h" #include "virscsi.h" +#include "virscsivhost.h" #include "virstoragefile.h" #include "virfile.h" #include "virhash.h" @@ -1416,6 +1417,13 @@ virSecuritySELinuxSetSCSILabel(virSCSIDevicePtr dev, } =20 static int +virSecuritySELinuxSetHostLabel(virSCSIVHostDevicePtr dev ATTRIBUTE_UNUSED, + const char *file, void *opaque) +{ + return virSecuritySELinuxSetHostdevLabelHelper(file, opaque); +} + +static int virSecuritySELinuxSetHostdevSubsysLabel(virSecurityManagerPtr mgr, virDomainDefPtr def, virDomainHostdevDefPtr dev, @@ -1425,6 +1433,7 @@ virSecuritySELinuxSetHostdevSubsysLabel(virSecurityMa= nagerPtr mgr, virDomainHostdevSubsysUSBPtr usbsrc =3D &dev->source.subsys.u.usb; virDomainHostdevSubsysPCIPtr pcisrc =3D &dev->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &dev->source.subsys.u.scsi; + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &dev->source.subsys.u.s= csi_host; virSecuritySELinuxCallbackData data =3D {.mgr =3D mgr, .def =3D def}; =20 int ret =3D -1; @@ -1499,7 +1508,16 @@ virSecuritySELinuxSetHostdevSubsysLabel(virSecurityM= anagerPtr mgr, } =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { - /* Fall through for now */ + virSCSIVHostDevicePtr host =3D virSCSIVHostDeviceNew(hostsrc->wwpn= ); + + if (!host) + goto done; + + ret =3D virSCSIVHostDeviceFileIterate(host, + virSecuritySELinuxSetHostLabel, + &data); + virSCSIVHostDeviceFree(host); + break; } =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: @@ -1627,6 +1645,16 @@ virSecuritySELinuxRestoreSCSILabel(virSCSIDevicePtr = dev, } =20 static int +virSecuritySELinuxRestoreHostLabel(virSCSIVHostDevicePtr dev ATTRIBUTE_UNU= SED, + const char *file, + void *opaque) +{ + virSecurityManagerPtr mgr =3D opaque; + + return virSecuritySELinuxRestoreFileLabel(mgr, file); +} + +static int virSecuritySELinuxRestoreHostdevSubsysLabel(virSecurityManagerPtr mgr, virDomainHostdevDefPtr dev, const char *vroot) @@ -1635,6 +1663,7 @@ virSecuritySELinuxRestoreHostdevSubsysLabel(virSecuri= tyManagerPtr mgr, virDomainHostdevSubsysUSBPtr usbsrc =3D &dev->source.subsys.u.usb; virDomainHostdevSubsysPCIPtr pcisrc =3D &dev->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &dev->source.subsys.u.scsi; + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &dev->source.subsys.u.s= csi_host; int ret =3D -1; =20 /* Like virSecuritySELinuxRestoreImageLabelInt() for a networked @@ -1705,7 +1734,17 @@ virSecuritySELinuxRestoreHostdevSubsysLabel(virSecur= ityManagerPtr mgr, } =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: { - /* Fall through for now */ + virSCSIVHostDevicePtr host =3D virSCSIVHostDeviceNew(hostsrc->wwpn= ); + + if (!host) + goto done; + + ret =3D virSCSIVHostDeviceFileIterate(host, + virSecuritySELinuxRestoreHostL= abel, + mgr); + virSCSIVHostDeviceFree(host); + + break; } =20 case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 17:04:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) client-ip=209.132.183.24; envelope-from=libvir-list-bounces@redhat.com; helo=mx3-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.24 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Return-Path: Received: from mx3-phx2.redhat.com (mx3-phx2.redhat.com [209.132.183.24]) by mx.zohomail.com with SMTPS id 147978732109655.19682559934677; Mon, 21 Nov 2016 20:02:01 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx3-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id uAM3xHbk006655; Mon, 21 Nov 2016 22:59:17 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id uAM3whXm031270 for ; Mon, 21 Nov 2016 22:58:43 -0500 Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAM3wgtI013007 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 21 Nov 2016 22:58:43 -0500 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 C8E31811A7 for ; Tue, 22 Nov 2016 03:58:41 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAM3wSBK093031 for ; Mon, 21 Nov 2016 22:58:41 -0500 Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) by mx0a-001b2d01.pphosted.com with ESMTP id 26vcrrusc9-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 21 Nov 2016 22:58:41 -0500 Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 Nov 2016 20:58:40 -0700 Received: from d03dlp03.boulder.ibm.com (9.17.202.179) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 21 Nov 2016 20:58:38 -0700 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id E7A9F19D8026; Mon, 21 Nov 2016 20:57:59 -0700 (MST) Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAM3wc0Z58982628; Mon, 21 Nov 2016 20:58:38 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0B2EA136046; Mon, 21 Nov 2016 20:58:38 -0700 (MST) Received: from farman-ThinkPad-W540.ibm.com (unknown [9.85.134.169]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTPS id 95DFC13603C; Mon, 21 Nov 2016 20:58:37 -0700 (MST) From: Eric Farman To: libvirt-list@redhat.com Date: Mon, 21 Nov 2016 22:58:22 -0500 In-Reply-To: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> References: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112203-8235-0000-0000-000009A965BD X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006120; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000189; SDB=6.00783708; UDB=6.00378500; IPR=6.00561326; BA=6.00004898; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013404; XFM=3.00000011; UTC=2016-11-22 03:58:39 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112203-8236-0000-0000-000036A883F1 Message-Id: <1479787103-26581-9-git-send-email-farman@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-22_01:, , 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-1609300000 definitions=main-1611220070 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 199 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 22 Nov 2016 03:58:42 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 22 Nov 2016 03:58:42 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'farman@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.099 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 8/9] tests: Introduce basic vhost-scsi tests 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-Zoho-Virus-Status: 2 X-ZohoMail-Forwarded-To: importer@patchew.org X-ZohoMail-Forwarded-For: patchew@euphon.net importer@patchew.org X-ZohoMail: RSF_0 Z_629925259 SPT_1 Z_629926901 SPT_1 UDT_7 RF_0 Content-Type: text/plain; charset="utf-8" These tests were cloned from hostdev-scsi-virtio-scsi in both xml2argv and xml2xml We add ones for both vhost-scsi-ccw and vhost-scsi-pci since the syntaxes are slightly different between them. Signed-off-by: Eric Farman Reviewed-by: Boris Fiuczynski --- .../qemuxml2argv-hostdev-scsi-vhost-scsi-ccw.args | 23 ++++++++++++ .../qemuxml2argv-hostdev-scsi-vhost-scsi-ccw.xml | 34 ++++++++++++++++++ .../qemuxml2argv-hostdev-scsi-vhost-scsi-pci.args | 24 +++++++++++++ .../qemuxml2argv-hostdev-scsi-vhost-scsi-pci.xml | 42 ++++++++++++++++++= ++++ tests/qemuxml2argvtest.c | 6 ++++ .../qemuxml2xmlout-hostdev-scsi-vhost-scsi-ccw.xml | 1 + .../qemuxml2xmlout-hostdev-scsi-vhost-scsi-pci.xml | 1 + tests/qemuxml2xmltest.c | 6 ++++ 8 files changed, 137 insertions(+) create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-= scsi-ccw.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-= scsi-ccw.xml create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-= scsi-pci.args create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-= scsi-pci.xml create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-vh= ost-scsi-ccw.xml create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-vh= ost-scsi-pci.xml diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi-cc= w.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi-ccw.ar= gs new file mode 100644 index 0000000..25e7bd4 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi-ccw.args @@ -0,0 +1,23 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu \ +-name QEMUGuest2 \ +-S \ +-M s390-ccw \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9466-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest2/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-device virtio-scsi-ccw,id=3Dscsi0,devno=3Dfe.0.0001 \ +-drive file=3D/dev/HostVG/QEMUGuest2,format=3Draw,if=3Dnone,id=3Ddrive-vir= tio-disk0 \ +-device virtio-blk-ccw,devno=3Dfe.0.0000,drive=3Ddrive-virtio-disk0,id=3Dv= irtio-disk0 \ +-device vhost-scsi-ccw,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostde= v0,devno=3Dfe.0.0002 \ +-device virtio-balloon-ccw,id=3Dballoon0,devno=3Dfe.0.0003 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi-cc= w.xml b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi-ccw.xml new file mode 100644 index 0000000..e428518 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi-ccw.xml @@ -0,0 +1,34 @@ + + QEMUGuest2 + c7a5fdbd-edaf-9466-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + +
+ + +
+ + + +
+ + +
+ + + + diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi-pc= i.args b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi-pci.ar= gs new file mode 100644 index 0000000..7071e62 --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi-pci.args @@ -0,0 +1,24 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/home/test \ +USER=3Dtest \ +LOGNAME=3Dtest \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu \ +-name QEMUGuest2 \ +-S \ +-M pc \ +-m 214 \ +-smp 1,sockets=3D1,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9466-926a-d65c16db1809 \ +-nographic \ +-nodefaults \ +-monitor unix:/tmp/lib/domain--1-QEMUGuest2/monitor.sock,server,nowait \ +-no-acpi \ +-boot c \ +-device virtio-scsi-pci,id=3Dscsi0,bus=3Dpci.0,addr=3D0x3 \ +-usb \ +-drive file=3D/dev/HostVG/QEMUGuest2,format=3Draw,if=3Dnone,id=3Ddrive-ide= 0-0-0 \ +-device ide-drive,bus=3Dide.0,unit=3D0,drive=3Ddrive-ide0-0-0,id=3Dide0-0-= 0 \ +-device vhost-scsi-pci,wwpn=3Dnaa.5123456789abcde0,vhostfd=3D3,id=3Dhostde= v0,bus=3Dpci.0,addr=3D0x5 \ +-device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x4 diff --git a/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi-pc= i.xml b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi-pci.xml new file mode 100644 index 0000000..aea6f7f --- /dev/null +++ b/tests/qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi-pci.xml @@ -0,0 +1,42 @@ + + QEMUGuest2 + c7a5fdbd-edaf-9466-926a-d65c16db1809 + 219100 + 219100 + 1 + + hvm + + + + destroy + restart + destroy + + /usr/bin/qemu + + + +
+ + +
+ + +
+ + +
+ + + + + + +
+ + +
+ + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 985f45d..1954696 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2034,6 +2034,12 @@ mymain(void) DO_TEST("hostdev-scsi-virtio-iscsi-auth", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); + DO_TEST("hostdev-scsi-vhost-scsi-ccw", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC, QEMU_CAPS_VIRTIO_CCW); + DO_TEST("hostdev-scsi-vhost-scsi-pci", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC); =20 DO_TEST("mlock-on", QEMU_CAPS_REALTIME_MLOCK); DO_TEST_FAILURE("mlock-on", NONE); diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-vhost-scs= i-ccw.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-vhost-scsi= -ccw.xml new file mode 120000 index 0000000..adea6e5 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-vhost-scsi-ccw.x= ml @@ -0,0 +1 @@ +../qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi-ccw.xml \ No newline at end of file diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-vhost-scs= i-pci.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-vhost-scsi= -pci.xml new file mode 120000 index 0000000..891aaf9 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-hostdev-scsi-vhost-scsi-pci.x= ml @@ -0,0 +1 @@ +../qemuxml2argvdata/qemuxml2argv-hostdev-scsi-vhost-scsi-pci.xml \ No newline at end of file diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index e22b63f..4c7f147 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -858,6 +858,12 @@ mymain(void) QEMU_CAPS_DEVICE_IOH3420, QEMU_CAPS_HDA_DUPLEX); =20 + DO_TEST("hostdev-scsi-vhost-scsi-ccw", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC, QEMU_CAPS_VIRTIO_CCW); + DO_TEST("hostdev-scsi-vhost-scsi-pci", + QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_DEVICE_VHOST_SCSI, + QEMU_CAPS_DEVICE_SCSI_GENERIC); DO_TEST("hostdev-scsi-lsi", QEMU_CAPS_VIRTIO_SCSI, QEMU_CAPS_SCSI_LSI, QEMU_CAPS_DEVICE_SCSI_GENERIC); --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu May 2 17:04:04 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; envelope-from=libvir-list-bounces@redhat.com; helo=mx4-phx2.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com [209.132.183.25]) by mx.zohomail.com with SMTPS id 1479787398711340.75524850254317; Mon, 21 Nov 2016 20:03:18 -0800 (PST) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id uAM3xBLw025392; Mon, 21 Nov 2016 22:59:11 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id uAM3wiB0031277 for ; Mon, 21 Nov 2016 22:58:44 -0500 Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAM3wh6d026925 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 21 Nov 2016 22:58:44 -0500 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 0D551793C1 for ; Tue, 22 Nov 2016 03:58:43 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAM3wT7B142891 for ; Mon, 21 Nov 2016 22:58:42 -0500 Received: from e38.co.us.ibm.com (e38.co.us.ibm.com [32.97.110.159]) by mx0b-001b2d01.pphosted.com with ESMTP id 26vcp5m0r6-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 21 Nov 2016 22:58:42 -0500 Received: from localhost by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 21 Nov 2016 20:58:41 -0700 Received: from d03dlp02.boulder.ibm.com (9.17.202.178) by e38.co.us.ibm.com (192.168.1.138) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 21 Nov 2016 20:58:40 -0700 Received: from b03cxnp08028.gho.boulder.ibm.com (b03cxnp08028.gho.boulder.ibm.com [9.17.130.20]) by d03dlp02.boulder.ibm.com (Postfix) with ESMTP id C2ABD3E40030; Mon, 21 Nov 2016 20:58:39 -0700 (MST) Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp08028.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAM3wdkd49414186; Mon, 21 Nov 2016 20:58:39 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9F3EE136043; Mon, 21 Nov 2016 20:58:39 -0700 (MST) Received: from farman-ThinkPad-W540.ibm.com (unknown [9.85.134.169]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTPS id 372F613603C; Mon, 21 Nov 2016 20:58:39 -0700 (MST) From: Eric Farman To: libvirt-list@redhat.com Date: Mon, 21 Nov 2016 22:58:23 -0500 In-Reply-To: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> References: <1479787103-26581-1-git-send-email-farman@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16112203-0028-0000-0000-000006168E07 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006120; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000189; SDB=6.00783707; UDB=6.00378500; IPR=6.00561327; BA=6.00004898; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00013404; XFM=3.00000011; UTC=2016-11-22 03:58:41 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16112203-0029-0000-0000-00003109B8CA Message-Id: <1479787103-26581-10-git-send-email-farman@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-22_01:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=15 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611220070 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 199 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 22 Nov 2016 03:58:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 22 Nov 2016 03:58:43 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'farman@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.099 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Scanned-By: MIMEDefang 2.78 on 10.5.110.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 9/9] docs: Add vhost-scsi 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-ZohoMail: RSF_0 Z_629925259 SPT_1 Z_629926901 SPT_1 UDT_7 RF_0 X-Zoho-Virus-Status: 2 Content-Type: text/plain; charset="utf-8" Signed-off-by: Eric Farman --- docs/formatdomain.html.in | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 4e40aa1..6bd02cc 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3694,6 +3694,17 @@ </devices> ... =20 +

or:

+ +
+  ...
+  <devices>
+    <hostdev mode=3D'subsystem' type=3D'scsi_host'>
+      <source protocol=3D'vhost' wwpn=3D'naa.50014057667280d8'/>
+    </hostdev>
+  </devices>
+  ...
+
hostdev
The hostdev element is the main container for descr= ibing @@ -3732,6 +3743,12 @@ If a disk lun in the domain already has the rawio capability, then this setting not required.
+
scsi_host
+
since 2.5.0For SCSI devices, us= er + is responsible to make sure the device is not used by host. Th= is + type passes all LUNs presented by a single HBA to + the guest. +

Note: The managed attribute is only used with PCI d= evices @@ -3795,6 +3812,13 @@ credentials to the iSCSI server.

+
scsi_host
+
Since 2.5.0, multiple LUNs behi= nd a + single SCSI HBA are described by a protocol + attribute set to "vhost" and a wwpn attribute that + is the vhost_scsi wwpn (16 hexadecimal digits with a prefix of + "naa.") established in the host configfs. +
vendor, product
--=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list