From nobody Fri May 3 12:35:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594749651; cv=none; d=zohomail.com; s=zohoarc; b=AeuTMJWKPPFDWGfAb83xgXL2Suv1Y/Ny7aJSNtmFrK/MtBwVmHe1Red1tlE+H0o3DYd5WflaR7SIPU6bOz0YpyEhMcSozbTdtQ3faZCfYuECiHZHb7P3CW6UfYXN3ht2OcPBFXMWubkcopXr3XNGVKHrb7jfIhqJmGoNzhTNabA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594749651; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QBOf/oVgXEzDyQAmS1gh80sM0Fz4v9Ua6LY8QWETm1M=; b=OQr7UGWoPl78hokG4SBFDodnVsXIx3hoidCL2e06dvYN1/gmH9QVNhQ5R8kCUvq6QB7A72EmUlConWEFW4nBJJZIAtvy+PeHsB1GnU4gGpzvVGHhr6uAdMztExQfIePjkrbLYHpowu2Y1EKyD9LcrO1J/+sgtMDlQkY6efYcUSU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594749651599718.2986014423129; Tue, 14 Jul 2020 11:00:51 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-479-qjiWXr8WMBCyLWfOk1tkYA-1; Tue, 14 Jul 2020 14:00:48 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A6BA98E2EA3; Tue, 14 Jul 2020 18:00:22 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 30036102470F; Tue, 14 Jul 2020 18:00:22 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EAC53180954D; Tue, 14 Jul 2020 18:00:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06EI0Kgw023929 for ; Tue, 14 Jul 2020 14:00:20 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0E7FD61B9D; Tue, 14 Jul 2020 18:00:20 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id E5D6F69509 for ; Tue, 14 Jul 2020 18:00:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594749650; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=QBOf/oVgXEzDyQAmS1gh80sM0Fz4v9Ua6LY8QWETm1M=; b=Kfqt078VXhCzUN1A4oyEigJUrqs3wDN75QjHD7y9DDeZG3eP+kokpZL3F8MNQAcw7WtFxu ovhtLu2mbd6tkTwNtZglkaRfjrwmQaa9mzUlVdvpCb6cUWUkHjSXFpxj/GPrxqu+BEoI2v m68r3cgEgLTcq3L3x6HSE5u6CJ19EG8= X-MC-Unique: qjiWXr8WMBCyLWfOk1tkYA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/11] virDomainHostdevDefFormatSubsys: Use virXMLFormatElement Date: Tue, 14 Jul 2020 20:00:06 +0200 Message-Id: <9548efddb1396c4b879f582e288220c3637e54c9.1594749375.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Refactor the formatter to the new multiple buffer based approach so that we can easily separate it into formatters per subsys type. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 65 ++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 38 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 8f5a8ef4a4..4b1f27fcea 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -26030,7 +26030,9 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, bool includeTypeInAddr, virDomainXMLOptionPtr xmlopt) { - bool closedSource =3D false; + g_auto(virBuffer) sourceAttrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) sourceChildBuf =3D VIR_BUFFER_INIT_CHILD(buf); + g_auto(virBuffer) origstatesChildBuf =3D VIR_BUFFER_INIT_CHILD(&source= ChildBuf); virDomainHostdevSubsysUSBPtr usbsrc =3D &def->source.subsys.u.usb; virDomainHostdevSubsysPCIPtr pcisrc =3D &def->source.subsys.u.pci; virDomainHostdevSubsysSCSIPtr scsisrc =3D &def->source.subsys.u.scsi; @@ -26053,18 +26055,17 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, virBufferAsprintf(buf, "\n", backend); } - virBufferAddLit(buf, "source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB)= { if (def->startupPolicy) { const char *policy; policy =3D virDomainStartupPolicyTypeToString(def->startupPoli= cy); - virBufferAsprintf(buf, " startupPolicy=3D'%s'", policy); + virBufferAsprintf(&sourceAttrBuf, " startupPolicy=3D'%s'", pol= icy); } if (usbsrc->autoAddress && (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATAB= LE)) - virBufferAddLit(buf, " autoAddress=3D'yes'"); + virBufferAddLit(&sourceAttrBuf, " autoAddress=3D'yes'"); if (def->missing && !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) - virBufferAddLit(buf, " missing=3D'yes'"); + virBufferAddLit(&sourceAttrBuf, " missing=3D'yes'"); } if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI= && @@ -26072,69 +26073,59 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, const char *protocol =3D virDomainHostdevSubsysSCSIProtocolTypeToString(scsisrc->protoc= ol); - virBufferAsprintf(buf, " protocol=3D'%s' name=3D'%s'", + virBufferAsprintf(&sourceAttrBuf, " protocol=3D'%s' name=3D'%s'", protocol, iscsisrc->src->path); } 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'/", + virBufferAsprintf(&sourceAttrBuf, " protocol=3D'%s' wwpn=3D'%s'", protocol, hostsrc->wwpn); } - virBufferAddLit(buf, ">\n"); - - virBufferAdjustIndent(buf, 2); switch (def->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: if (usbsrc->vendor) { - virBufferAsprintf(buf, "\n", usbsrc->ve= ndor); - virBufferAsprintf(buf, "\n", usbsrc->p= roduct); + virBufferAsprintf(&sourceChildBuf, "\n"= , usbsrc->vendor); + virBufferAsprintf(&sourceChildBuf, "\n= ", usbsrc->product); } if (usbsrc->bus || usbsrc->device) { - virBufferAsprintf(buf, "
\= n", + virBufferAsprintf(&sourceChildBuf, "
\n", includeTypeInAddr ? "type=3D'usb' " : "", usbsrc->bus, usbsrc->device); } break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: - virPCIDeviceAddressFormat(buf, pcisrc->addr, + virPCIDeviceAddressFormat(&sourceChildBuf, pcisrc->addr, includeTypeInAddr); - if ((flags & VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES) && - (def->origstates.states.pci.unbind_from_stub || - def->origstates.states.pci.remove_slot || - def->origstates.states.pci.reprobe)) { - virBufferAddLit(buf, "\n"); - virBufferAdjustIndent(buf, 2); + if ((flags & VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES)) { if (def->origstates.states.pci.unbind_from_stub) - virBufferAddLit(buf, "\n"); + virBufferAddLit(&origstatesChildBuf, "\n"); if (def->origstates.states.pci.remove_slot) - virBufferAddLit(buf, "\n"); + virBufferAddLit(&origstatesChildBuf, "\n"); if (def->origstates.states.pci.reprobe) - virBufferAddLit(buf, "\n"); - virBufferAdjustIndent(buf, -2); - virBufferAddLit(buf, "\n"); + virBufferAddLit(&origstatesChildBuf, "\n"); + virXMLFormatElement(&sourceChildBuf, "origstates", NULL, &orig= statesChildBuf); } break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: if (scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE= _ISCSI) { - virBufferAddLit(buf, "src->host= s[0].name); + virBufferAddLit(&sourceChildBuf, "src->hosts[0].name); if (iscsisrc->src->hosts[0].port) - virBufferAsprintf(buf, " port=3D'%u'", iscsisrc->src->host= s[0].port); - virBufferAddLit(buf, "/>\n"); + virBufferAsprintf(&sourceChildBuf, " port=3D'%u'", iscsisr= c->src->hosts[0].port); + virBufferAddLit(&sourceChildBuf, "/>\n"); - if (virDomainDiskSourceFormatPrivateData(buf, iscsisrc->src, + if (virDomainDiskSourceFormatPrivateData(&sourceChildBuf, iscs= isrc->src, flags, xmlopt) < 0) return -1; } else { - virBufferAsprintf(buf, "\n", + virBufferAsprintf(&sourceChildBuf, "\n", scsihostsrc->adapter); - virBufferAsprintf(buf, + virBufferAsprintf(&sourceChildBuf, "
\n", includeTypeInAddr ? "type=3D'scsi' " : "", scsihostsrc->bus, scsihostsrc->target, @@ -26144,7 +26135,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: - virBufferAsprintf(buf, "
\n", + virBufferAsprintf(&sourceChildBuf, "
\n", mdevsrc->uuidstr); break; default: @@ -26157,11 +26148,9 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI= && scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI && iscsisrc->src->auth) - virStorageAuthDefFormat(buf, iscsisrc->src->auth); + virStorageAuthDefFormat(&sourceChildBuf, iscsisrc->src->auth); - virBufferAdjustIndent(buf, -2); - if (!closedSource) - virBufferAddLit(buf, "\n"); + virXMLFormatElement(buf, "source", &sourceAttrBuf, &sourceChildBuf); return 0; } --=20 2.26.2 From nobody Fri May 3 12:35:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594749658; cv=none; d=zohomail.com; s=zohoarc; b=Jeu8v1/Ym3M8nuMJEwphXMqDm6SIKkvJhIn33mbnTKfQrbmYU/k8x9JxEh09EK7FlXEpYfxjuuVGCSpCA3YR75MLLoyYkCuzIkcg8JfhVNGfqZ3fzfRxG7sLfa/hLMGhIHR/+mHn9P/XtNzDYmmum8VoHRJ9XG5I8MLvX8Sobis= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594749658; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=QhtV50mTcT0mh8GGLQwe7BuiHzue6kBcYJdM7LeKXC0=; b=EVIf94SmNZnwerTlK5moxdSCDNlFPZKII1WILtjn4y8mMxOX/NF24pCNmPyGeecmpgnYqYZZ5f++vVnkih8eXRVXkthJYUzTF7iedC232Eo2HTHo7jqpX3OUt6Ax62woH7aMGxZ2ZJMNsnklgU5NoAengoBlRMIKSNx2sr5BFKQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594749658856991.8097364262118; Tue, 14 Jul 2020 11:00:58 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-25-bAbyPnMiOjGaLkLmqiCliA-1; Tue, 14 Jul 2020 14:00:55 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D8F1510831E0; Tue, 14 Jul 2020 18:00:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 199B31057F27; Tue, 14 Jul 2020 18:00:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CC00E94F0F; Tue, 14 Jul 2020 18:00:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06EI0L46023935 for ; Tue, 14 Jul 2020 14:00:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2BCA561D07; Tue, 14 Jul 2020 18:00:21 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 47A876A53D for ; Tue, 14 Jul 2020 18:00:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594749657; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=QhtV50mTcT0mh8GGLQwe7BuiHzue6kBcYJdM7LeKXC0=; b=caCm/1f9dHBa5YlopALAHPw2vtzUvBqrcvAB7mqXANYV0Cj6WwBd0rjhqfVXXYiRKgVWLK KGx3cUvHqwaYRh5yhfajeOJ3w3gFxvxpvJqyA7RiyMIRNQBOxpt0A7GopJnlis8EaQzW+G ++d/1lmYgEbG65EEaIy2+nSuhrU31Es= X-MC-Unique: bAbyPnMiOjGaLkLmqiCliA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/11] virDomainHostdevDefFormatSubsys: Split out formatting of USB subsystem Date: Tue, 14 Jul 2020 20:00:07 +0200 Message-Id: <6df27aaf7ac73960bdb367630954714a535d9ecb.1594749375.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Separate out bits related to USB so that the logic isn't entangled in multiple conditional statements. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 73 +++++++++++++++++++++++++++++------------- 1 file changed, 51 insertions(+), 22 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 4b1f27fcea..7718a59c66 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -26023,6 +26023,40 @@ virDomainNetIPInfoFormat(virBufferPtr buf, } +static void +virDomainHostdevDefFormatSubsysUSB(virBufferPtr buf, + virDomainHostdevDefPtr def, + unsigned int flags, + bool includeTypeInAddr) +{ + g_auto(virBuffer) sourceAttrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) sourceChildBuf =3D VIR_BUFFER_INIT_CHILD(buf); + virDomainHostdevSubsysUSBPtr usbsrc =3D &def->source.subsys.u.usb; + + if (def->startupPolicy) + virBufferAsprintf(&sourceAttrBuf, " startupPolicy=3D'%s'", + virDomainStartupPolicyTypeToString(def->startupP= olicy)); + + if (usbsrc->autoAddress && (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATABLE)) + virBufferAddLit(&sourceAttrBuf, " autoAddress=3D'yes'"); + + if (def->missing && !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) + virBufferAddLit(&sourceAttrBuf, " missing=3D'yes'"); + + if (usbsrc->vendor) { + virBufferAsprintf(&sourceChildBuf, "\n", us= bsrc->vendor); + virBufferAsprintf(&sourceChildBuf, "\n", u= sbsrc->product); + } + + if (usbsrc->bus || usbsrc->device) + virBufferAsprintf(&sourceChildBuf, "
\n", + includeTypeInAddr ? "type=3D'usb' " : "", + usbsrc->bus, usbsrc->device); + + virXMLFormatElement(buf, "source", &sourceAttrBuf, &sourceChildBuf); +} + + static int virDomainHostdevDefFormatSubsys(virBufferPtr buf, virDomainHostdevDefPtr def, @@ -26033,7 +26067,6 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, g_auto(virBuffer) sourceAttrBuf =3D VIR_BUFFER_INITIALIZER; g_auto(virBuffer) sourceChildBuf =3D VIR_BUFFER_INIT_CHILD(buf); g_auto(virBuffer) origstatesChildBuf =3D VIR_BUFFER_INIT_CHILD(&source= ChildBuf); - 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; @@ -26041,6 +26074,23 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, virDomainHostdevSubsysSCSIHostPtr scsihostsrc =3D &scsisrc->u.host; virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc =3D &scsisrc->u.iscsi; + switch ((virDomainHostdevSubsysType) def->source.subsys.type) { + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: + virDomainHostdevDefFormatSubsysUSB(buf, def, flags, includeTypeInA= ddr); + return 0; + + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: + break; + + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: + default: + virReportEnumRangeError(virDomainHostdevSubsysType, def->source.su= bsys.type); + return -1; + } + if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI = && pcisrc->backend !=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) { const char *backend =3D @@ -26055,18 +26105,6 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, virBufferAsprintf(buf, "\n", backend); } - if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB)= { - if (def->startupPolicy) { - const char *policy; - policy =3D virDomainStartupPolicyTypeToString(def->startupPoli= cy); - virBufferAsprintf(&sourceAttrBuf, " startupPolicy=3D'%s'", pol= icy); - } - if (usbsrc->autoAddress && (flags & VIR_DOMAIN_DEF_FORMAT_MIGRATAB= LE)) - virBufferAddLit(&sourceAttrBuf, " autoAddress=3D'yes'"); - - if (def->missing && !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) - virBufferAddLit(&sourceAttrBuf, " missing=3D'yes'"); - } if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI= && scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI) { @@ -26087,15 +26125,6 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, switch (def->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: - if (usbsrc->vendor) { - virBufferAsprintf(&sourceChildBuf, "\n"= , usbsrc->vendor); - virBufferAsprintf(&sourceChildBuf, "\n= ", usbsrc->product); - } - if (usbsrc->bus || usbsrc->device) { - virBufferAsprintf(&sourceChildBuf, "
\n", - includeTypeInAddr ? "type=3D'usb' " : "", - usbsrc->bus, usbsrc->device); - } break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: virPCIDeviceAddressFormat(&sourceChildBuf, pcisrc->addr, --=20 2.26.2 From nobody Fri May 3 12:35:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594749665; cv=none; d=zohomail.com; s=zohoarc; b=HKbjGywnItyDiwCYdDeSu4BGEyQazZTjG2SpEn5E2QiCBS9a14DS8hrtVe4vompT8yJiD+scowPv4wV0SIAvQBu36YEWa7ScqIhA1qOB++OyjNxg/a/4mvCT8Tn0DSKF98Rg6nXF5gD8XmCYkU4o443ezFeCt6rOJz2B3kRvST8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594749665; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=DOVh3055zB3kpGQFZ2PvTEdVdIvglRi/Xlyw5B3MKOM=; b=IMfumvoV7tENMgd1k7jAxvX9TfwnaTEITYjPCAoDDAL8vQ1a7tkskGD5qc3O7wF9Fz+KYVDgJIqcB2/f7unAKUAWDkO4jelWEWBbsLO/4slfzjW0eY6Xg3lOONGZ/jUkUTyWJEqYP4aQd8wC+DXwdZaF6tXvuDepPnGgVnSPRuw= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594749665739303.793549688791; Tue, 14 Jul 2020 11:01:05 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-24-lPWsgyaeOzC4xe_Vy1y_5g-1; Tue, 14 Jul 2020 14:01:01 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DE0EE803CED; Tue, 14 Jul 2020 18:00:25 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A004F61483; Tue, 14 Jul 2020 18:00:25 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 648CB1809563; Tue, 14 Jul 2020 18:00:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06EI0MvP023947 for ; Tue, 14 Jul 2020 14:00:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2B414765AB; Tue, 14 Jul 2020 18:00:22 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5207865970 for ; Tue, 14 Jul 2020 18:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594749664; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=DOVh3055zB3kpGQFZ2PvTEdVdIvglRi/Xlyw5B3MKOM=; b=Lxe4GjbLJOVsRf4xDWv7/1iiNsf+hAsO22b+SqtzH2sdpS1OVQ4xaRFIIZdXqDsWDoqigG H+S4YGIjUD6VA4Wy+fDyC1MQNrgudlok9xXVnjfFDropbEqCefgPRYX0saBgyY7nUCI7hA unlYYzhFbWRe5VHHwk64eFk8T2ckp4c= X-MC-Unique: lPWsgyaeOzC4xe_Vy1y_5g-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/11] virDomainHostdevDefFormatSubsys: Split out formatting of PCI subsystem Date: Tue, 14 Jul 2020 20:00:08 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Similarly to previous commit split out formatting of the PCI subsystem related stuff. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 74 ++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 28 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7718a59c66..d4a2aa7623 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -26057,6 +26057,50 @@ virDomainHostdevDefFormatSubsysUSB(virBufferPtr bu= f, } +static int +virDomainHostdevDefFormatSubsysPCI(virBufferPtr buf, + virDomainHostdevDefPtr def, + unsigned int flags, + bool includeTypeInAddr) +{ + g_auto(virBuffer) sourceAttrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) sourceChildBuf =3D VIR_BUFFER_INIT_CHILD(buf); + g_auto(virBuffer) origstatesChildBuf =3D VIR_BUFFER_INIT_CHILD(&source= ChildBuf); + virDomainHostdevSubsysPCIPtr pcisrc =3D &def->source.subsys.u.pci; + + if (pcisrc->backend !=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) { + const char *backend =3D virDomainHostdevSubsysPCIBackendTypeToStri= ng(pcisrc->backend); + + if (!backend) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("unexpected pci hostdev driver name type %d"), + pcisrc->backend); + return -1; + } + + virBufferAsprintf(buf, "\n", backend); + } + + virPCIDeviceAddressFormat(&sourceChildBuf, pcisrc->addr, includeTypeIn= Addr); + + if ((flags & VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES)) { + if (def->origstates.states.pci.unbind_from_stub) + virBufferAddLit(&origstatesChildBuf, "\n"); + + if (def->origstates.states.pci.remove_slot) + virBufferAddLit(&origstatesChildBuf, "\n"); + + if (def->origstates.states.pci.reprobe) + virBufferAddLit(&origstatesChildBuf, "\n"); + + virXMLFormatElement(&sourceChildBuf, "origstates", NULL, &origstat= esChildBuf); + } + + virXMLFormatElement(buf, "source", &sourceAttrBuf, &sourceChildBuf); + return 0; +} + + static int virDomainHostdevDefFormatSubsys(virBufferPtr buf, virDomainHostdevDefPtr def, @@ -26066,8 +26110,6 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, { g_auto(virBuffer) sourceAttrBuf =3D VIR_BUFFER_INITIALIZER; g_auto(virBuffer) sourceChildBuf =3D VIR_BUFFER_INIT_CHILD(buf); - g_auto(virBuffer) origstatesChildBuf =3D VIR_BUFFER_INIT_CHILD(&source= ChildBuf); - 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; virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &def->source.subsys.u= .mdev; @@ -26080,6 +26122,8 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, return 0; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: + return virDomainHostdevDefFormatSubsysPCI(buf, def, flags, include= TypeInAddr); + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: @@ -26091,20 +26135,6 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, return -1; } - if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI = && - pcisrc->backend !=3D VIR_DOMAIN_HOSTDEV_PCI_BACKEND_DEFAULT) { - const char *backend =3D - virDomainHostdevSubsysPCIBackendTypeToString(pcisrc->backend); - - if (!backend) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected pci hostdev driver name type %d"), - pcisrc->backend); - return -1; - } - virBufferAsprintf(buf, "\n", backend); - } - if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI= && scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI) { @@ -26127,18 +26157,6 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: - virPCIDeviceAddressFormat(&sourceChildBuf, pcisrc->addr, - includeTypeInAddr); - - if ((flags & VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES)) { - if (def->origstates.states.pci.unbind_from_stub) - virBufferAddLit(&origstatesChildBuf, "\n"); - if (def->origstates.states.pci.remove_slot) - virBufferAddLit(&origstatesChildBuf, "\n"); - if (def->origstates.states.pci.reprobe) - virBufferAddLit(&origstatesChildBuf, "\n"); - virXMLFormatElement(&sourceChildBuf, "origstates", NULL, &orig= statesChildBuf); - } break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: if (scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE= _ISCSI) { --=20 2.26.2 From nobody Fri May 3 12:35:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594749667; cv=none; d=zohomail.com; s=zohoarc; b=YJgSLehqC8oRe1seNdSuBd6Lrq6v/v3O1h80JSm1qJwTwC0IEUFZ1/Zbu77vpxOyI/h+ZDRZ5+qVgFiCfYksjW+mFRyZIel1IKi91PuQFddeq8NUNPcjscRd84Eg5ckrGEBK1BnhHKoZAw1qbsOb9eNOqYo7hR6yde59tmr9fiY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594749667; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=8w0sq0Uvu/ryFfcYCk9XPIrMc5aVJFyUQziVjlaP/qM=; b=bjQ9pbloXGNvn4x5D8ryFbLwNypRDJXHX7yU7Ukq1ZJT2TUOYjQ3hEoLo/pR0XsiiA8FvUEPh8sYN1qvwgn0D8VPMJzM3xbYxLR+Co/diOE326jQ1RdEmiB9FkRMsUCQSb7tFsAv+IRCQ0iy0qsbFRM91IyQIQZvMdecUgKYLUo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1594749667224590.7978267443925; Tue, 14 Jul 2020 11:01:07 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-361-29Xzu2X3OWKG69fUkcLqLw-1; Tue, 14 Jul 2020 14:01:02 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 34F998CA010; Tue, 14 Jul 2020 18:00:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5C76210631E0; Tue, 14 Jul 2020 18:00:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 20D931809554; Tue, 14 Jul 2020 18:00:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06EI0Ntj023957 for ; Tue, 14 Jul 2020 14:00:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4FBD561789; Tue, 14 Jul 2020 18:00:23 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7208461485 for ; Tue, 14 Jul 2020 18:00:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594749666; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=8w0sq0Uvu/ryFfcYCk9XPIrMc5aVJFyUQziVjlaP/qM=; b=aYewmM43n9fFO5jiP71HRmmir3tqp+D9DRTT9J+QG0TvsCZiGJXfbAyNHs4xaYFSR4srXW pCF6JettEJfe2U4p6W/q/zm205ZXWF0K7sP5uGzB0LgskkdM51nJzZydhY9qH/cmuXosGz 1O6K9ABgYmqS20ChvmgmTwHS6q7QBZc= X-MC-Unique: 29Xzu2X3OWKG69fUkcLqLw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/11] virDomainHostdevDefFormatSubsys: Split out formatting of SCSI subsystem Date: Tue, 14 Jul 2020 20:00:09 +0200 Message-Id: <9aaf731ec5540b225d1b92c421a07d51b7e7d89c.1594749375.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Similarly to previous commit split out formatting of the SCSI subsystem related stuff. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 83 ++++++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 36 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d4a2aa7623..b337bba534 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -26101,6 +26101,51 @@ virDomainHostdevDefFormatSubsysPCI(virBufferPtr bu= f, } +static int +virDomainHostdevDefFormatSubsysSCSI(virBufferPtr buf, + virDomainHostdevDefPtr def, + unsigned int flags, + bool includeTypeInAddr, + virDomainXMLOptionPtr xmlopt) +{ + g_auto(virBuffer) sourceAttrBuf =3D VIR_BUFFER_INITIALIZER; + g_auto(virBuffer) sourceChildBuf =3D VIR_BUFFER_INIT_CHILD(buf); + virDomainHostdevSubsysSCSIPtr scsisrc =3D &def->source.subsys.u.scsi; + virDomainHostdevSubsysSCSIHostPtr scsihostsrc =3D &scsisrc->u.host; + virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc =3D &scsisrc->u.iscsi; + + if (scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI) { + virBufferAsprintf(&sourceAttrBuf, " protocol=3D'%s' name=3D'%s'", + virDomainHostdevSubsysSCSIProtocolTypeToString(s= csisrc->protocol), + iscsisrc->src->path); + + virBufferAddLit(&sourceChildBuf, "s= rc->hosts[0].name); + if (iscsisrc->src->hosts[0].port) + virBufferAsprintf(&sourceChildBuf, " port=3D'%u'", iscsisrc->s= rc->hosts[0].port); + virBufferAddLit(&sourceChildBuf, "/>\n"); + + if (virDomainDiskSourceFormatPrivateData(&sourceChildBuf, iscsisrc= ->src, + flags, xmlopt) < 0) + return -1; + + if (iscsisrc->src->auth) + virStorageAuthDefFormat(&sourceChildBuf, iscsisrc->src->auth); + } else { + virBufferAsprintf(&sourceChildBuf, "\n", + scsihostsrc->adapter); + virBufferAsprintf(&sourceChildBuf, + "
\n", + includeTypeInAddr ? "type=3D'scsi' " : "", + scsihostsrc->bus, scsihostsrc->target, + scsihostsrc->unit); + } + + virXMLFormatElement(buf, "source", &sourceAttrBuf, &sourceChildBuf); + return 0; +} + + static int virDomainHostdevDefFormatSubsys(virBufferPtr buf, virDomainHostdevDefPtr def, @@ -26110,11 +26155,8 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, { g_auto(virBuffer) sourceAttrBuf =3D VIR_BUFFER_INITIALIZER; g_auto(virBuffer) sourceChildBuf =3D VIR_BUFFER_INIT_CHILD(buf); - virDomainHostdevSubsysSCSIPtr scsisrc =3D &def->source.subsys.u.scsi; virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &def->source.subsys.u.s= csi_host; virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &def->source.subsys.u= .mdev; - virDomainHostdevSubsysSCSIHostPtr scsihostsrc =3D &scsisrc->u.host; - virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc =3D &scsisrc->u.iscsi; switch ((virDomainHostdevSubsysType) def->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: @@ -26125,6 +26167,8 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, return virDomainHostdevDefFormatSubsysPCI(buf, def, flags, include= TypeInAddr); case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: + return virDomainHostdevDefFormatSubsysSCSI(buf, def, flags, includ= eTypeInAddr, xmlopt); + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: break; @@ -26136,15 +26180,6 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, } - if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI= && - scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI) { - const char *protocol =3D - virDomainHostdevSubsysSCSIProtocolTypeToString(scsisrc->protoc= ol); - - virBufferAsprintf(&sourceAttrBuf, " protocol=3D'%s' name=3D'%s'", - protocol, iscsisrc->src->path); - } - if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI= _HOST) { const char *protocol =3D virDomainHostdevSubsysSCSIHostProtocolTypeToString(hostsrc->pr= otocol); @@ -26159,25 +26194,6 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: - if (scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE= _ISCSI) { - virBufferAddLit(&sourceChildBuf, "src->hosts[0].name); - if (iscsisrc->src->hosts[0].port) - virBufferAsprintf(&sourceChildBuf, " port=3D'%u'", iscsisr= c->src->hosts[0].port); - virBufferAddLit(&sourceChildBuf, "/>\n"); - - if (virDomainDiskSourceFormatPrivateData(&sourceChildBuf, iscs= isrc->src, - flags, xmlopt) < 0) - return -1; - } else { - virBufferAsprintf(&sourceChildBuf, "\n", - scsihostsrc->adapter); - virBufferAsprintf(&sourceChildBuf, - "
\n", - includeTypeInAddr ? "type=3D'scsi' " : "", - scsihostsrc->bus, scsihostsrc->target, - scsihostsrc->unit); - } break; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: break; @@ -26192,11 +26208,6 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, return -1; } - if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI= && - scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI && - iscsisrc->src->auth) - virStorageAuthDefFormat(&sourceChildBuf, iscsisrc->src->auth); - virXMLFormatElement(buf, "source", &sourceAttrBuf, &sourceChildBuf); return 0; --=20 2.26.2 From nobody Fri May 3 12:35:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594749670; cv=none; d=zohomail.com; s=zohoarc; b=WNv+Xh5bWpWl9vE5xtp6Dj/0wY2+qQGgi8peRgpKmt0DBZWg+dgL3/fcbR1Psw/bj6jP1owdIglZnCwleYdMecAPuW3Lcq9XP2eGDQ2WxAjBoJMoZH+aQhfqEEI07zZ8C/XafUkYvFUbMmEzkuzHIgii6fCtMlZCyZiGeBBa9io= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594749670; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=T/ieen7CDk90B2WFneV2teiMTKM9viLMXjaT0QPCU9U=; b=fAJJPR8a9kn0WObQlLD/+gdfXHwZoMiHO9gf3VAc/QByaahH1cM7IAFpMfwlV1ZGLlQYGi68pd7vGvvx3hbe54cS0jcx8bwM0pURvlof+sSGNN8TOcOvOfruiZWIkKqxg7W3HWrIRg811QkZfCUzfnE6hkTsoOCg9c5W0F3lvAQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 15947496708519.378735171457379; Tue, 14 Jul 2020 11:01:10 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-477-r7k6GQWkNwmOW7kYVXxSuw-1; Tue, 14 Jul 2020 14:01:06 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 514AE8F496E; Tue, 14 Jul 2020 18:00:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 41A0E10A4B55; Tue, 14 Jul 2020 18:00:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EE48E94EFA; Tue, 14 Jul 2020 18:00:27 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06EI0OWZ023966 for ; Tue, 14 Jul 2020 14:00:24 -0400 Received: by smtp.corp.redhat.com (Postfix) id 86EF661462; Tue, 14 Jul 2020 18:00:24 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id D6F1B5C6DD for ; Tue, 14 Jul 2020 18:00:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594749669; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=T/ieen7CDk90B2WFneV2teiMTKM9viLMXjaT0QPCU9U=; b=bwyvvReOJu6ul+z0vZu07Qj7SCuBC89XFjKqDdeFZJXJf+0gIcZ9FhyQo9Sr59Pv47wr4k YoHNJnC1/Zm1SdVOBEs8hQU6omyZOVlJenTvwkBhCWZvmRxsNAkrcShMzDVneZiGeQ50nB 2hE7l1ch+d8fPDe52gcZ0lsSBUpDfXY= X-MC-Unique: r7k6GQWkNwmOW7kYVXxSuw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/11] virDomainHostdevDefFormatSubsysSCSI: Avoid ternary operator when formatting address Date: Tue, 14 Jul 2020 20:00:10 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Split up formatting of the '
' element rather that trying to optimize it with formatting string hacks. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index b337bba534..7b181e0587 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -26134,11 +26134,13 @@ virDomainHostdevDefFormatSubsysSCSI(virBufferPtr = buf, } else { virBufferAsprintf(&sourceChildBuf, "\n", scsihostsrc->adapter); - virBufferAsprintf(&sourceChildBuf, - "
\n", - includeTypeInAddr ? "type=3D'scsi' " : "", - scsihostsrc->bus, scsihostsrc->target, - scsihostsrc->unit); + + virBufferAddLit(&sourceChildBuf, "bus, scsihostsrc->target, scsihosts= rc->unit); + virBufferAddLit(&sourceChildBuf, "/>\n"); } virXMLFormatElement(buf, "source", &sourceAttrBuf, &sourceChildBuf); --=20 2.26.2 From nobody Fri May 3 12:35:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594749679; cv=none; d=zohomail.com; s=zohoarc; b=dV+IxxHOysM8c92GQhq6LSklJog5i4vINa/HYpMh+CQa9mJdWP2Kfdn01dbLwtZze7mraCjrGhS21OIxA50DnXUjR+0aY5QCEKYQt67wS5wdmRjb4XXUcMHPYHuyO0qPKcBIZUucy37QU5kAN5xv2rEguykxhQSiDcz6rbSZAuk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594749679; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tsH2wgI0cqsjrL6V98HKY5CKrUTuw8gC9sj5g/BExUo=; b=OLcl/FvUxyOhgu4McWeIR1NNcUZYlorpewkIgi7GaRGy0npoAuww+MkRixn9BSnbGX/5G1yeOIKHyvqqGJQLcNao4w82zianBM8hWfWGdSJyMJUxqufRdlT3nO9TIE0kSeczfRiZDzqsVRlBSek77HOihjQzbYiEJ8q0gIzOY90= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1594749679724555.3993756581375; Tue, 14 Jul 2020 11:01:19 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-39-elIUKmMMMB61GDdUiKqsOQ-1; Tue, 14 Jul 2020 14:01:16 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9A515A4507; Tue, 14 Jul 2020 18:00:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 93C497D5A6; Tue, 14 Jul 2020 18:00:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 3C3121809554; Tue, 14 Jul 2020 18:00:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06EI0Ped023974 for ; Tue, 14 Jul 2020 14:00:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id B438061465; Tue, 14 Jul 2020 18:00:25 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07FC861462 for ; Tue, 14 Jul 2020 18:00:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594749678; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=tsH2wgI0cqsjrL6V98HKY5CKrUTuw8gC9sj5g/BExUo=; b=DGxTP1oohoR/m2Jxs1905L+uz7xXAa3oEeYlUq03USgECwrkHjdPGI1659NeBMFJtlGjvY XMmoQSW0xnxIpsuiXyqRIPcH1M2PQR5l5WkfdI8gp7qz5B38ynMqy3Pbshc+KBkXQP3ee3 MpEZ2sgbJV03l10HVUzYVJy3TYfFYIo= X-MC-Unique: elIUKmMMMB61GDdUiKqsOQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/11] virDomainHostdevDefFormatSubsys: Split out formatting of vHBA subsystem Date: Tue, 14 Jul 2020 20:00:11 +0200 Message-Id: <7705e9e79a82c45bd4885a3e75d1d79a8829f280.1594749375.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Similarly to previous commit split out formatting of the vHBA subsystem related stuff. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 7b181e0587..facfddeea7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -26148,6 +26148,21 @@ virDomainHostdevDefFormatSubsysSCSI(virBufferPtr b= uf, } +static void +virDomainHostdevDefFormatSubsysSCSIHost(virBufferPtr buf, + virDomainHostdevDefPtr def) +{ + g_auto(virBuffer) sourceAttrBuf =3D VIR_BUFFER_INITIALIZER; + virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &def->source.subsys.u.s= csi_host; + + virBufferAsprintf(&sourceAttrBuf, " protocol=3D'%s' wwpn=3D'%s'", + virDomainHostdevSubsysSCSIHostProtocolTypeToString(h= ostsrc->protocol), + hostsrc->wwpn); + + virXMLFormatElement(buf, "source", &sourceAttrBuf, NULL); +} + + static int virDomainHostdevDefFormatSubsys(virBufferPtr buf, virDomainHostdevDefPtr def, @@ -26155,9 +26170,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, bool includeTypeInAddr, virDomainXMLOptionPtr xmlopt) { - g_auto(virBuffer) sourceAttrBuf =3D VIR_BUFFER_INITIALIZER; g_auto(virBuffer) sourceChildBuf =3D VIR_BUFFER_INIT_CHILD(buf); - virDomainHostdevSubsysSCSIVHostPtr hostsrc =3D &def->source.subsys.u.s= csi_host; virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &def->source.subsys.u= .mdev; switch ((virDomainHostdevSubsysType) def->source.subsys.type) { @@ -26172,6 +26185,9 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, return virDomainHostdevDefFormatSubsysSCSI(buf, def, flags, includ= eTypeInAddr, xmlopt); case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: + virDomainHostdevDefFormatSubsysSCSIHost(buf, def); + return 0; + case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: break; @@ -26182,14 +26198,6 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, } - if (def->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI= _HOST) { - const char *protocol =3D - virDomainHostdevSubsysSCSIHostProtocolTypeToString(hostsrc->pr= otocol); - - virBufferAsprintf(&sourceAttrBuf, " protocol=3D'%s' wwpn=3D'%s'", - protocol, hostsrc->wwpn); - } - switch (def->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: break; @@ -26210,7 +26218,7 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, return -1; } - virXMLFormatElement(buf, "source", &sourceAttrBuf, &sourceChildBuf); + virXMLFormatElement(buf, "source", NULL, &sourceChildBuf); return 0; } --=20 2.26.2 From nobody Fri May 3 12:35:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594749715; cv=none; d=zohomail.com; s=zohoarc; b=oJL1pPN+5dR9PFcT2JoAUZDkj+3h6daOjPWpkW1sqnPlkg8YuFfms9nzmDxQUGIuRGJLhDD78wcoriAT5pRKdvre/SClleeG9L3FONGjiX2YBHdLkEMc12/UaUjR0vNP1THk4YRlYAq4raFiTc9I4qyNCKgvrbpasfeCU11LrAs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594749715; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=jJ4s8pPgjNPmV6l5Tgh2bxqgAAEK7izfjI0+bQWcv2w=; b=hzgM7TKEvBUh2C2tzArw9RI5o3TNBEW1+Ve+yO5pPaWp9xcNcCAYLmUr/sw61VQkrxrzeBrhGrvsBBM2usI8pvVqwZzNOLBPYvP1nLu/F+l+mnq8oaKbErmGGtcaQxdIgHYxz9cBFbYTY2OxSZxpasYe6aB5dn2k20ck2fX28fg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594749714959904.9715581567025; Tue, 14 Jul 2020 11:01:54 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-480-YjAXd2ejMO-iN8yCSwxAfw-1; Tue, 14 Jul 2020 14:01:28 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7179C8044CA; Tue, 14 Jul 2020 18:00:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1A04B6178E; Tue, 14 Jul 2020 18:00:34 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D35A394F0D; Tue, 14 Jul 2020 18:00:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06EI0QOT023988 for ; Tue, 14 Jul 2020 14:00:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id B6A765FC1A; Tue, 14 Jul 2020 18:00:26 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 15C4D5C679 for ; Tue, 14 Jul 2020 18:00:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594749713; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=jJ4s8pPgjNPmV6l5Tgh2bxqgAAEK7izfjI0+bQWcv2w=; b=EA6HeO0+eGFBWUK6Swabosg75QE1jwyM15Xs9HyoAIvc9N5WSu6biKKWRd/PDqRisdOaii jJxdMpO9jfCDYbONdhLLqGHiEmKhnYnwqjeJ6ZWhK+iIkbSOBZWYpI+vfZcOkHNFq+uPHY nPajdVKogvFjXaezjSOnSd8m8uhU3B4= X-MC-Unique: YjAXd2ejMO-iN8yCSwxAfw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/11] virDomainHostdevDefFormatSubsys: Split out formatting of mdev subsystem Date: Tue, 14 Jul 2020 20:00:12 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Similarly to previous commit split out formatting of the mdev subsystem related stuff. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 42 +++++++++++++++--------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index facfddeea7..e9fee10e31 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -26163,6 +26163,19 @@ virDomainHostdevDefFormatSubsysSCSIHost(virBufferP= tr buf, } +static void +virDomainHostdevDefFormatSubsysMDEV(virBufferPtr buf, + virDomainHostdevDefPtr def) +{ + g_auto(virBuffer) sourceChildBuf =3D VIR_BUFFER_INIT_CHILD(buf); + virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &def->source.subsys.u= .mdev; + + virBufferAsprintf(&sourceChildBuf, "
\n", mdevsrc= ->uuidstr); + + virXMLFormatElement(buf, "source", NULL, &sourceChildBuf); +} + + static int virDomainHostdevDefFormatSubsys(virBufferPtr buf, virDomainHostdevDefPtr def, @@ -26170,9 +26183,6 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, bool includeTypeInAddr, virDomainXMLOptionPtr xmlopt) { - g_auto(virBuffer) sourceChildBuf =3D VIR_BUFFER_INIT_CHILD(buf); - virDomainHostdevSubsysMediatedDevPtr mdevsrc =3D &def->source.subsys.u= .mdev; - switch ((virDomainHostdevSubsysType) def->source.subsys.type) { case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: virDomainHostdevDefFormatSubsysUSB(buf, def, flags, includeTypeInA= ddr); @@ -26189,7 +26199,8 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, return 0; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: - break; + virDomainHostdevDefFormatSubsysMDEV(buf, def); + return 0; case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST: default: @@ -26197,29 +26208,6 @@ virDomainHostdevDefFormatSubsys(virBufferPtr buf, return -1; } - - switch (def->source.subsys.type) { - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB: - break; - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI: - break; - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI: - break; - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SCSI_HOST: - break; - case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV: - virBufferAsprintf(&sourceChildBuf, "
\n", - mdevsrc->uuidstr); - break; - default: - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected hostdev type %d"), - def->source.subsys.type); - return -1; - } - - virXMLFormatElement(buf, "source", NULL, &sourceChildBuf); - return 0; } --=20 2.26.2 From nobody Fri May 3 12:35:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594749685; cv=none; d=zohomail.com; s=zohoarc; b=SJajSj8VqAMqKJIYCS7wpT2OFRS4k8NE7D8R/zHDJKYE01eikyN6xb50bY+EeuPagH04gDQFoKTWrQ9ZSyaFpeQQkrOuE/3358KVeSFca3Hq/8okE/zqLbDrzb9ecy7MyCxmbu48BI1HhGHa2UaYnYicjAV1GVIyZWmLVvDpE/Y= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594749685; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MuisLfXhVVV+9VVyJ4GzqqRFvu/Dtmq7pKo4Ouotc7Q=; b=iS8/oSOjq81v8sC2CRnKl+g024TKLXgTANrbg5olRtWYdVdXuXqpMlaOQ1MfZlhBcuuCfgTnAB/ZA1UWOuX6pZT2F7gsbHuZoR9pX+ba64l2P+5n/J485AEgVH7vBnNGeShiGz3/WI8wIGn2MTYT2fHfytl2VHGLHHVRqB/muwg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594749685686330.4218334047665; Tue, 14 Jul 2020 11:01:25 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-87-oKshWxorM_CGqiv1EifCyQ-1; Tue, 14 Jul 2020 14:01:08 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3110D527EC; Tue, 14 Jul 2020 18:00:29 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D7D306146F; Tue, 14 Jul 2020 18:00:28 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A008C94F0E; Tue, 14 Jul 2020 18:00:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06EI0RTa024002 for ; Tue, 14 Jul 2020 14:00:27 -0400 Received: by smtp.corp.redhat.com (Postfix) id C9D795C679; Tue, 14 Jul 2020 18:00:27 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 31DC35C6DD for ; Tue, 14 Jul 2020 18:00:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594749684; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MuisLfXhVVV+9VVyJ4GzqqRFvu/Dtmq7pKo4Ouotc7Q=; b=dEX3KMwKoGcb3NutA1RAcMVMxXECEd1ynzFLTT3JdN4FVNOgJn2oOh6FrDoEwpEspEmMgE Aa3BfAmwdFhu/obp2c7mPH/oWylpBE3gXG6pExbRHej7cR1eBdCisu/c7Mox1+vSCM4L8s LXO4oXb0iWoZzv7s53xW2GZfZfn85c8= X-MC-Unique: oKshWxorM_CGqiv1EifCyQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/11] virDomainHostdevSubsysSCSIDefParseXML: Use typecasted switch Date: Tue, 14 Jul 2020 20:00:13 +0200 Message-Id: <78111c83c56d7fd5bebb9a4dc0a71c730d310c71.1594749375.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Use a switch statement which will not be omitted when adding potential new types. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index e9fee10e31..c8ac4380c4 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8392,11 +8392,21 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr so= urcenode, } } - if (scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI) + switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: + return virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsis= rc); + + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: return virDomainHostdevSubsysSCSIiSCSIDefParseXML(sourcenode, scsi= src, ctxt, flags, xmlopt); - return virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsisrc); + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST: + default: + virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsisrc-= >protocol); + return -1; + } + + return 0; } static int --=20 2.26.2 From nobody Fri May 3 12:35:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594749679; cv=none; d=zohomail.com; s=zohoarc; b=av+g6m0YFhxOlNcw2OEqgqtrweVuHC9fvW4jSQdnpwe01/xtYJRSTgkBcHx64NA9AIQS/jo8b9NuNGIjJlZ5W6X4U6+1HKXvYeXAtR0ADVoquj71/FFZt+NMaIKdlVvtJlKKkT/LmAX4u8BOjQYnuUwyFid/NSxQGWt0qdNeMaw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594749679; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=BcREbi2vFMDoGRAOiCNBVUeVJKfmUEdXuKs1sLmkLeQ=; b=NL6G1WZM4k1tx2giNAd7qZec2D9oVEuUmnV2k/KZ0pJeiefd8HmBNx85s7biRPlCVaqRhVL+nufzMyPjd2GW+/boOOmhpeoQ+jaMfsSfTjgUmVPqEPF5CPkEp6y6KYzbjM98haxVGOfh/bxxGSrXHeR4c595v4yiz2cecgEk1Z4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1594749679300910.2159632480228; Tue, 14 Jul 2020 11:01:19 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-166-jEXEvi4OOVCgzm5rSkkMxw-1; Tue, 14 Jul 2020 14:01:15 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B047B10A51FA; Tue, 14 Jul 2020 18:00:32 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8E4161024889; Tue, 14 Jul 2020 18:00:31 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 428FF18006D3; Tue, 14 Jul 2020 18:00:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06EI0T57024015 for ; Tue, 14 Jul 2020 14:00:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 29F7A5FC30; Tue, 14 Jul 2020 18:00:29 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7DE9A61474 for ; Tue, 14 Jul 2020 18:00:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594749678; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=BcREbi2vFMDoGRAOiCNBVUeVJKfmUEdXuKs1sLmkLeQ=; b=hh67WQgWbVThIDNcB54DEV05qmnUOIdqYyVNyizwQcQqYXs8vQNHXzauMQLZtOh6PG+tMP ijLWGAWWpIyCSYPX+uIqMopXvDL+lTc4t1deXWDCI8cJbTZ341CCx/SFhJcIpeoSLqJtxZ o6JHZQar93vZtc7CUAGhlmj8MXi6t28= X-MC-Unique: jEXEvi4OOVCgzm5rSkkMxw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/11] virDomainHostdevSubsysSCSIiSCSIDefParseXML: Use XPath to fetch elements Date: Tue, 14 Jul 2020 20:00:14 +0200 Message-Id: <4a81fd5ab768130ed99430a66377271a2cc82778.1594749375.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Conver the code to the new approach which uses XPath to fetch known elements rather than looping through all XML children. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 51 ++++++++++++++++-------------------------- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c8ac4380c4..5988a13986 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8295,9 +8295,12 @@ virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodePt= r sourcenode, virDomainXMLOptionPtr xmlopt) { int auth_secret_usage =3D -1; - xmlNodePtr cur; virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc =3D &def->u.iscsi; g_autoptr(virStorageAuthDef) authdef =3D NULL; + xmlNodePtr node; + VIR_XPATH_NODE_AUTORESTORE(ctxt); + + ctxt->node =3D sourcenode; /* For the purposes of command line creation, this needs to look * like a disk storage source */ @@ -8328,42 +8331,26 @@ virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodeP= tr sourcenode, return -1; } - cur =3D sourcenode->children; - while (cur !=3D NULL) { - if (cur->type =3D=3D XML_ELEMENT_NODE && - virXMLNodeNameEqual(cur, "auth")) { - if (iscsisrc->src->auth) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("an definition already found for " - "the iSCSI definition")); - return -1; - } - if (!(authdef =3D virStorageAuthDefParse(cur, ctxt))) - return -1; - if ((auth_secret_usage =3D - virSecretUsageTypeFromString(authdef->secrettype)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid secret type %s"), - authdef->secrettype); - return -1; - } - if (auth_secret_usage !=3D VIR_SECRET_USAGE_TYPE_ISCSI) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("hostdev invalid secret type '%s'"), - authdef->secrettype); - return -1; - } - iscsisrc->src->auth =3D g_steal_pointer(&authdef); + if ((node =3D virXPathNode("./auth", ctxt))) { + if (!(authdef =3D virStorageAuthDefParse(node, ctxt))) + return -1; + if ((auth_secret_usage =3D virSecretUsageTypeFromString(authdef->s= ecrettype)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("invalid secret type %s"), + authdef->secrettype); + return -1; } - cur =3D cur->next; + if (auth_secret_usage !=3D VIR_SECRET_USAGE_TYPE_ISCSI) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("hostdev invalid secret type '%s'"), + authdef->secrettype); + return -1; + } + iscsisrc->src->auth =3D g_steal_pointer(&authdef); } if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) && xmlopt && xmlopt->privateData.storageParse) { - VIR_XPATH_NODE_AUTORESTORE(ctxt); - - ctxt->node =3D sourcenode; - if ((ctxt->node =3D virXPathNode("./privateData", ctxt)) && xmlopt->privateData.storageParse(ctxt, iscsisrc->src) < 0) return -1; --=20 2.26.2 From nobody Fri May 3 12:35:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594749696; cv=none; d=zohomail.com; s=zohoarc; b=PvIYvw4q6S+PYB2vud84ASVo9y3tixw1vu0TrQZyhlh2Z7gW6IXu2EJrb/i2CrAOEUMopF4lBYU3/rg7jdkdcYEsJjMqrH++UAH2Edl3mFJo6JkH+6X0aOPNszrux+misV/Ith8Y14pzErvAvziQ9Hm2gQSHbeCgjZ/VQbLEuYo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594749696; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=/xO5QDs5XdEeeYlpp/ymvhw1R0KSvlkjLOhrWdBmTwM=; b=lCk5sTMDp4LPvNJRtOU71m0+oNvpj3t6d0fFoRJ9RkLRPPdZzI9dxM4D5a1vNZeJ2n5bhWTfu3sczFm9hc7ZbnIDXeDZZw3x+HTfqOwNdmU8pa5ZNN/4al1ydu/6DadLt8GWKrfqr9/mo+lRG9P3Als4aadwj2HNG9ag43BtE9U= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1594749696489407.27395522422296; Tue, 14 Jul 2020 11:01:36 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-282-SC-FwIMYPme-UFcSB4fBMg-1; Tue, 14 Jul 2020 14:01:31 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D4D0E8027F9; Tue, 14 Jul 2020 18:00:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7FF5E10013D7; Tue, 14 Jul 2020 18:00:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 4A354180954D; Tue, 14 Jul 2020 18:00:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06EI0UJR024031 for ; Tue, 14 Jul 2020 14:00:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7D0D55C679; Tue, 14 Jul 2020 18:00:30 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 971735FC30 for ; Tue, 14 Jul 2020 18:00:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594749695; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=/xO5QDs5XdEeeYlpp/ymvhw1R0KSvlkjLOhrWdBmTwM=; b=apwg6sBY0buRRsqSRiton7+9C0bw4YG9qOGXCMdOzqTIJrqRUfpfYJXVR7bKyPvDYLYhji QTKxzXmWrOBfY45yCYcTN0CJqOJD6a6MHfi1DtFIpEqP9nYhnAfM+uPyz2dCNnWM5ef/XR kpfxTK7y17IJ6N6nQS1XOJUhaQpub+Q= X-MC-Unique: SC-FwIMYPme-UFcSB4fBMg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/11] docs: formatdomain-devices: Split out '' into separate file Date: Tue, 14 Jul 2020 20:00:15 +0200 Message-Id: <12d94fd9461b2a43c8802a3fb1415d8d68e1b4d4.1594749375.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa --- docs/formatdomain-devices-hostdev.rst.in | 337 ++++++++++++++++++++++ docs/formatdomain-devices.rst.in | 338 +---------------------- 2 files changed, 338 insertions(+), 337 deletions(-) create mode 100644 docs/formatdomain-devices-hostdev.rst.in diff --git a/docs/formatdomain-devices-hostdev.rst.in b/docs/formatdomain-d= evices-hostdev.rst.in new file mode 100644 index 0000000000..859c4b4ec5 --- /dev/null +++ b/docs/formatdomain-devices-hostdev.rst.in @@ -0,0 +1,337 @@ +:anchor:`` + +Host device assignment +~~~~~~~~~~~~~~~~~~~~~~ + +:anchor:`` + +USB / PCI / SCSI devices +^^^^^^^^^^^^^^^^^^^^^^^^ + +USB, PCI and SCSI devices attached to the host can be passed through to the +guest using the ``hostdev`` element. :since:`since after 0.4.4 for USB, 0.= 6.0 +for PCI (KVM only) and 1.0.6 for SCSI (KVM only)` : + +:: + + ... + + + + + + + + + + ... + +or: + +:: + + ... + + + +
+ + + + + + ... + +or: + +:: + + ... + + + + +
+ + +
+ + + ... + +or: + +:: + + ... + + + + + + + + +
+ + + ... + +or: + +:: + + ... + + + + + + ... + +or: + +:: + + ... + + + +
+ + + + +
+ +
+ + + ... + +``hostdev`` + The ``hostdev`` element is the main container for describing host devic= es. + For each device, the ``mode`` is always "subsystem" and the ``type`` is= one + of the following values with additional attributes noted. + + ``usb`` + USB devices are detached from the host on guest startup and reattach= ed + after the guest exits or the device is hot-unplugged. + ``pci`` + For PCI devices, when ``managed`` is "yes" it is detached from the h= ost + before being passed on to the guest and reattached to the host after= the + guest exits. If ``managed`` is omitted or "no", the user is responsi= ble to + call ``virNodeDeviceDetachFlags`` (or ``virsh nodedev-detach`` before + starting the guest or hot-plugging the device and + ``virNodeDeviceReAttach`` (or ``virsh nodedev-reattach``) after hot-= unplug + or stopping the guest. + ``scsi`` + For SCSI devices, user is responsible to make sure the device is not= used + by host. If supported by the hypervisor and OS, the optional ``sgio`= ` ( + :since:`since 1.0.6` ) attribute indicates whether unprivileged SG_IO + commands are filtered for the disk. Valid settings are "filtered" or + "unfiltered", where the default is "filtered". The optional ``rawio`= ` ( + :since:`since 1.2.9` ) attribute indicates whether the lun needs the= rawio + capability. Valid settings are "yes" or "no". See the rawio descript= ion + within the `disk <#elementsDisks>`__ section. If a disk lun in the d= omain + already has the rawio capability, then this setting not required. + ``scsi_host`` + :since:`since 2.5.0` For SCSI devices, user is responsible to make s= ure + the device is not used by host. This ``type`` passes all LUNs presen= ted by + a single HBA to the guest. :since:`Since 5.2.0,` the ``model`` attri= bute + can be specified further with "virtio-transitional", + "virtio-non-transitional", or "virtio". See `Virtio transitional + devices <#elementsVirtioTransitional>`__ for more details. + ``mdev`` + For mediated devices ( :since:`Since 3.2.0` ) the ``model`` attribute + specifies the device API which determines how the host's vfio driver= will + expose the device to the guest. Currently, ``model=3D'vfio-pci'``, + ``model=3D'vfio-ccw'`` ( :since:`Since 4.4.0` ) and ``model=3D'vfio-= ap'`` ( + :since:`Since 4.9.0` ) is supported. `MDEV `__ + section provides more information about mediated devices as well as = how to + create mediated devices on the host. :since:`Since 4.6.0 (QEMU 2.12)= ` an + optional ``display`` attribute may be used to enable or disable supp= ort + for an accelerated remote desktop backed by a mediated device (such = as + NVIDIA vGPU or Intel GVT-g) as an alternative to emulated `video + devices <#elementsVideo>`__. This attribute is limited to + ``model=3D'vfio-pci'`` only. Supported values are either ``on`` or `= `off`` + (default is 'off'). It is required to use a `graphical + framebuffer <#elementsGraphics>`__ in order to use this attribute, + currently only supported with VNC, Spice and egl-headless graphics + devices. :since:`Since version 5.10.0` , there is an optional ``ramf= b`` + attribute for devices with ``model=3D'vfio-pci'``. Supported values = are + either ``on`` or ``off`` (default is 'off'). When enabled, this attr= ibute + provides a memory framebuffer device to the guest. This framebuffer = will + be used as a boot display when a vgpu device is the primary display. + + Note: There are also some implications on the usage of guest's addre= ss + type depending on the ``model`` attribute, see the ``address`` eleme= nt + below. + + Note: The ``managed`` attribute is only used with ``type=3D'pci'`` and = is + ignored by all the other device types, thus setting ``managed`` explici= tly + with other than a PCI device has the same effect as omitting it. Simila= rly, + ``model`` attribute is only supported by mediated devices and ignored b= y all + other device types. + +``source`` + The source element describes the device as seen from the host using the + following mechanism to describe: + + ``usb`` + The USB device can either be addressed by vendor / product id using = the + ``vendor`` and ``product`` elements or by the device's address on th= e host + using the ``address`` element. + + :since:`Since 1.0.0` , the ``source`` element of USB devices may con= tain + ``startupPolicy`` attribute which can be used to define policy what = to do + if the specified host USB device is not found. The attribute accepts= the + following values: + + =3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D + mandatory fail if missing for any reason (the default) + requisite fail if missing on boot up, drop if missing on migrate/res= tore/revert + optional drop if missing at any start attempt + =3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D + + ``pci`` + PCI devices can only be described by their ``address``. + ``scsi`` + SCSI devices are described by both the ``adapter`` and ``address`` + elements. The ``address`` element includes a ``bus`` attribute (a 2-= digit + bus number), a ``target`` attribute (a 10-digit target number), and a + ``unit`` attribute (a 20-digit unit number on the bus). Not all + hypervisors support larger ``target`` and ``unit`` values. It is up = to + each hypervisor to determine the maximum value supported for the ada= pter. + + :since:`Since 1.2.8` , the ``source`` element of a SCSI device may c= ontain + the ``protocol`` attribute. When the attribute is set to "iscsi", th= e host + device XML follows the network `disk <#elementsDisks>`__ device usin= g the + same ``name`` attribute and optionally using the ``auth`` element to + provide the authentication credentials to the iSCSI server. + + ``scsi_host`` + :since:`Since 2.5.0` , multiple LUNs behind 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. + ``mdev`` + Mediated devices ( :since:`Since 3.2.0` ) are described by the ``add= ress`` + element. The ``address`` element contains a single mandatory attribu= te + ``uuid``. + +``vendor``, ``product`` + The ``vendor`` and ``product`` elements each have an ``id`` attribute t= hat + specifies the USB vendor and product id. The ids can be given in decima= l, + hexadecimal (starting with 0x) or octal (starting with 0) form. +``boot`` + Specifies that the device is bootable. The ``order`` attribute determin= es the + order in which devices will be tried during boot sequence. The per-devi= ce + ``boot`` elements cannot be used together with general boot elements in= `BIOS + bootloader <#elementsOSBIOS>`__ section. :since:`Since 0.8.8` for PCI + devices, :since:`Since 1.0.1` for USB devices. +``rom`` + The ``rom`` element is used to change how a PCI device's ROM is present= ed to + the guest. The optional ``bar`` attribute can be set to "on" or "off", = and + determines whether or not the device's ROM will be visible in the guest= 's + memory map. (In PCI documentation, the "rombar" setting controls the pr= esence + of the Base Address Register for the ROM). If no rom bar is specified, = the + qemu default will be used (older versions of qemu used a default of "of= f", + while newer qemus have a default of "on"). :since:`Since 0.9.7 (QEMU an= d KVM + only)` . The optional ``file`` attribute contains an absolute path to a + binary file to be presented to the guest as the device's ROM BIOS. This= can + be useful, for example, to provide a PXE boot ROM for a virtual functio= n of + an sr-iov capable ethernet device (which has no boot ROMs for the VFs). + :since:`Since 0.9.10 (QEMU and KVM only)` . The optional ``enabled`` + attribute can be set to ``no`` to disable PCI ROM loading completely fo= r the + device; if PCI ROM loading is disabled through this attribute, attempts= to + tweak the loading process further using the ``bar`` or ``file`` attribu= tes + will be rejected. :since:`Since 4.3.0 (QEMU and KVM only)` . +``address`` + The ``address`` element for USB devices has a ``bus`` and ``device`` + attribute to specify the USB bus and device number the device appears a= t on + the host. The values of these attributes can be given in decimal, hexad= ecimal + (starting with 0x) or octal (starting with 0) form. For PCI devices the + element carries 4 attributes allowing to designate the device as can be= found + with the ``lspci`` or with ``virsh nodedev-list``. For SCSI devices a '= drive' + address type must be used. For mediated devices, which are software-only + devices defining an allocation of resources on the physical parent devi= ce, + the address type used must conform to the ``model`` attribute of element + ``hostdev``, e.g. any address type other than PCI for ``vfio-pci`` devi= ce API + or any address type other than CCW for ``vfio-ccw`` device API will res= ult in + an error. `See above <#elementsAddress>`__ for more details on the addr= ess + element. +``driver`` + PCI devices can have an optional ``driver`` subelement that specifies w= hich + backend driver to use for PCI device assignment. Use the ``name`` attri= bute + to select either "vfio" (for the new VFIO device assignment backend, wh= ich is + compatible with UEFI SecureBoot) or "kvm" (the legacy device assignment + handled directly by the KVM kernel module) :since:`Since 1.0.5 (QEMU an= d KVM + only, requires kernel 3.6 or newer)` . When specified, device assignmen= t will + fail if the requested method of device assignment isn't available on the + host. When not specified, the default is "vfio" on systems where the VF= IO + driver is available and loaded, and "kvm" on older systems, or those wh= ere + the VFIO driver hasn't been loaded :since:`Since 1.1.3` (prior to that = the + default was always "kvm"). +``readonly`` + Indicates that the device is readonly, only supported by SCSI host devi= ce + now. :since:`Since 1.0.6 (QEMU and KVM only)` +``shareable`` + If present, this indicates the device is expected to be shared between + domains (assuming the hypervisor and OS support this). Only supported b= y SCSI + host device. :since:`Since 1.0.6` + + Note: Although ``shareable`` was introduced :since:`in 1.0.6` , it did = not + work as as expected until :since:`1.2.2` . + +:anchor:`` + +Block / character devices +^^^^^^^^^^^^^^^^^^^^^^^^^ + +Block / character devices from the host can be passed through to the guest= using +the ``hostdev`` element. This is only possible with container based +virtualization. Devices are specified by a fully qualified path. :since:`s= ince +after 1.0.1 for LXC` : + +:: + + ... + + + /dev/sdf1 + + + ... + +:: + + ... + + + /dev/input/event3 + + + ... + +:: + + ... + + + eth0 + + + ... + +``hostdev`` + The ``hostdev`` element is the main container for describing host devic= es. + For block/character device passthrough ``mode`` is always "capabilities= " and + ``type`` is "storage" for a block device, "misc" for a character device= and + "net" for a host network interface. +``source`` + The source element describes the device as seen from the host. For block + devices, the path to the block device in the host OS is provided in the + nested "block" element, while for character devices the "char" element = is + used. For network interfaces, the name of the interface is provided in = the + "interface" element. diff --git a/docs/formatdomain-devices.rst.in b/docs/formatdomain-devices.r= st.in index c7cc190918..ad24410ecb 100644 --- a/docs/formatdomain-devices.rst.in +++ b/docs/formatdomain-devices.rst.in @@ -706,343 +706,7 @@ acquired. The offset specifies where the lease is stored within the file. If the = lock manager does not require an offset, just pass 0. -:anchor:`` - -Host device assignment -~~~~~~~~~~~~~~~~~~~~~~ - -:anchor:`` - -USB / PCI / SCSI devices -^^^^^^^^^^^^^^^^^^^^^^^^ - -USB, PCI and SCSI devices attached to the host can be passed through to the -guest using the ``hostdev`` element. :since:`since after 0.4.4 for USB, 0.= 6.0 -for PCI (KVM only) and 1.0.6 for SCSI (KVM only)` : - -:: - - ... - - - - - - - - - - ... - -or: - -:: - - ... - - - -
- - - - - - ... - -or: - -:: - - ... - - - - -
- - -
- - - ... - -or: - -:: - - ... - - - - - - - - -
- - - ... - -or: - -:: - - ... - - - - - - ... - -or: - -:: - - ... - - - -
- - - - -
- -
- - - ... - -``hostdev`` - The ``hostdev`` element is the main container for describing host devic= es. - For each device, the ``mode`` is always "subsystem" and the ``type`` is= one - of the following values with additional attributes noted. - - ``usb`` - USB devices are detached from the host on guest startup and reattach= ed - after the guest exits or the device is hot-unplugged. - ``pci`` - For PCI devices, when ``managed`` is "yes" it is detached from the h= ost - before being passed on to the guest and reattached to the host after= the - guest exits. If ``managed`` is omitted or "no", the user is responsi= ble to - call ``virNodeDeviceDetachFlags`` (or ``virsh nodedev-detach`` before - starting the guest or hot-plugging the device and - ``virNodeDeviceReAttach`` (or ``virsh nodedev-reattach``) after hot-= unplug - or stopping the guest. - ``scsi`` - For SCSI devices, user is responsible to make sure the device is not= used - by host. If supported by the hypervisor and OS, the optional ``sgio`= ` ( - :since:`since 1.0.6` ) attribute indicates whether unprivileged SG_IO - commands are filtered for the disk. Valid settings are "filtered" or - "unfiltered", where the default is "filtered". The optional ``rawio`= ` ( - :since:`since 1.2.9` ) attribute indicates whether the lun needs the= rawio - capability. Valid settings are "yes" or "no". See the rawio descript= ion - within the `disk <#elementsDisks>`__ section. If a disk lun in the d= omain - already has the rawio capability, then this setting not required. - ``scsi_host`` - :since:`since 2.5.0` For SCSI devices, user is responsible to make s= ure - the device is not used by host. This ``type`` passes all LUNs presen= ted by - a single HBA to the guest. :since:`Since 5.2.0,` the ``model`` attri= bute - can be specified further with "virtio-transitional", - "virtio-non-transitional", or "virtio". See `Virtio transitional - devices <#elementsVirtioTransitional>`__ for more details. - ``mdev`` - For mediated devices ( :since:`Since 3.2.0` ) the ``model`` attribute - specifies the device API which determines how the host's vfio driver= will - expose the device to the guest. Currently, ``model=3D'vfio-pci'``, - ``model=3D'vfio-ccw'`` ( :since:`Since 4.4.0` ) and ``model=3D'vfio-= ap'`` ( - :since:`Since 4.9.0` ) is supported. `MDEV `__ - section provides more information about mediated devices as well as = how to - create mediated devices on the host. :since:`Since 4.6.0 (QEMU 2.12)= ` an - optional ``display`` attribute may be used to enable or disable supp= ort - for an accelerated remote desktop backed by a mediated device (such = as - NVIDIA vGPU or Intel GVT-g) as an alternative to emulated `video - devices <#elementsVideo>`__. This attribute is limited to - ``model=3D'vfio-pci'`` only. Supported values are either ``on`` or `= `off`` - (default is 'off'). It is required to use a `graphical - framebuffer <#elementsGraphics>`__ in order to use this attribute, - currently only supported with VNC, Spice and egl-headless graphics - devices. :since:`Since version 5.10.0` , there is an optional ``ramf= b`` - attribute for devices with ``model=3D'vfio-pci'``. Supported values = are - either ``on`` or ``off`` (default is 'off'). When enabled, this attr= ibute - provides a memory framebuffer device to the guest. This framebuffer = will - be used as a boot display when a vgpu device is the primary display. - - Note: There are also some implications on the usage of guest's addre= ss - type depending on the ``model`` attribute, see the ``address`` eleme= nt - below. - - Note: The ``managed`` attribute is only used with ``type=3D'pci'`` and = is - ignored by all the other device types, thus setting ``managed`` explici= tly - with other than a PCI device has the same effect as omitting it. Simila= rly, - ``model`` attribute is only supported by mediated devices and ignored b= y all - other device types. - -``source`` - The source element describes the device as seen from the host using the - following mechanism to describe: - - ``usb`` - The USB device can either be addressed by vendor / product id using = the - ``vendor`` and ``product`` elements or by the device's address on th= e host - using the ``address`` element. - - :since:`Since 1.0.0` , the ``source`` element of USB devices may con= tain - ``startupPolicy`` attribute which can be used to define policy what = to do - if the specified host USB device is not found. The attribute accepts= the - following values: - - =3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D - mandatory fail if missing for any reason (the default) - requisite fail if missing on boot up, drop if missing on migrate/res= tore/revert - optional drop if missing at any start attempt - =3D=3D=3D=3D=3D=3D=3D=3D=3D =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D - - ``pci`` - PCI devices can only be described by their ``address``. - ``scsi`` - SCSI devices are described by both the ``adapter`` and ``address`` - elements. The ``address`` element includes a ``bus`` attribute (a 2-= digit - bus number), a ``target`` attribute (a 10-digit target number), and a - ``unit`` attribute (a 20-digit unit number on the bus). Not all - hypervisors support larger ``target`` and ``unit`` values. It is up = to - each hypervisor to determine the maximum value supported for the ada= pter. - - :since:`Since 1.2.8` , the ``source`` element of a SCSI device may c= ontain - the ``protocol`` attribute. When the attribute is set to "iscsi", th= e host - device XML follows the network `disk <#elementsDisks>`__ device usin= g the - same ``name`` attribute and optionally using the ``auth`` element to - provide the authentication credentials to the iSCSI server. - - ``scsi_host`` - :since:`Since 2.5.0` , multiple LUNs behind 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. - ``mdev`` - Mediated devices ( :since:`Since 3.2.0` ) are described by the ``add= ress`` - element. The ``address`` element contains a single mandatory attribu= te - ``uuid``. - -``vendor``, ``product`` - The ``vendor`` and ``product`` elements each have an ``id`` attribute t= hat - specifies the USB vendor and product id. The ids can be given in decima= l, - hexadecimal (starting with 0x) or octal (starting with 0) form. -``boot`` - Specifies that the device is bootable. The ``order`` attribute determin= es the - order in which devices will be tried during boot sequence. The per-devi= ce - ``boot`` elements cannot be used together with general boot elements in= `BIOS - bootloader <#elementsOSBIOS>`__ section. :since:`Since 0.8.8` for PCI - devices, :since:`Since 1.0.1` for USB devices. -``rom`` - The ``rom`` element is used to change how a PCI device's ROM is present= ed to - the guest. The optional ``bar`` attribute can be set to "on" or "off", = and - determines whether or not the device's ROM will be visible in the guest= 's - memory map. (In PCI documentation, the "rombar" setting controls the pr= esence - of the Base Address Register for the ROM). If no rom bar is specified, = the - qemu default will be used (older versions of qemu used a default of "of= f", - while newer qemus have a default of "on"). :since:`Since 0.9.7 (QEMU an= d KVM - only)` . The optional ``file`` attribute contains an absolute path to a - binary file to be presented to the guest as the device's ROM BIOS. This= can - be useful, for example, to provide a PXE boot ROM for a virtual functio= n of - an sr-iov capable ethernet device (which has no boot ROMs for the VFs). - :since:`Since 0.9.10 (QEMU and KVM only)` . The optional ``enabled`` - attribute can be set to ``no`` to disable PCI ROM loading completely fo= r the - device; if PCI ROM loading is disabled through this attribute, attempts= to - tweak the loading process further using the ``bar`` or ``file`` attribu= tes - will be rejected. :since:`Since 4.3.0 (QEMU and KVM only)` . -``address`` - The ``address`` element for USB devices has a ``bus`` and ``device`` - attribute to specify the USB bus and device number the device appears a= t on - the host. The values of these attributes can be given in decimal, hexad= ecimal - (starting with 0x) or octal (starting with 0) form. For PCI devices the - element carries 4 attributes allowing to designate the device as can be= found - with the ``lspci`` or with ``virsh nodedev-list``. For SCSI devices a '= drive' - address type must be used. For mediated devices, which are software-only - devices defining an allocation of resources on the physical parent devi= ce, - the address type used must conform to the ``model`` attribute of element - ``hostdev``, e.g. any address type other than PCI for ``vfio-pci`` devi= ce API - or any address type other than CCW for ``vfio-ccw`` device API will res= ult in - an error. `See above <#elementsAddress>`__ for more details on the addr= ess - element. -``driver`` - PCI devices can have an optional ``driver`` subelement that specifies w= hich - backend driver to use for PCI device assignment. Use the ``name`` attri= bute - to select either "vfio" (for the new VFIO device assignment backend, wh= ich is - compatible with UEFI SecureBoot) or "kvm" (the legacy device assignment - handled directly by the KVM kernel module) :since:`Since 1.0.5 (QEMU an= d KVM - only, requires kernel 3.6 or newer)` . When specified, device assignmen= t will - fail if the requested method of device assignment isn't available on the - host. When not specified, the default is "vfio" on systems where the VF= IO - driver is available and loaded, and "kvm" on older systems, or those wh= ere - the VFIO driver hasn't been loaded :since:`Since 1.1.3` (prior to that = the - default was always "kvm"). -``readonly`` - Indicates that the device is readonly, only supported by SCSI host devi= ce - now. :since:`Since 1.0.6 (QEMU and KVM only)` -``shareable`` - If present, this indicates the device is expected to be shared between - domains (assuming the hypervisor and OS support this). Only supported b= y SCSI - host device. :since:`Since 1.0.6` - - Note: Although ``shareable`` was introduced :since:`in 1.0.6` , it did = not - work as as expected until :since:`1.2.2` . - -:anchor:`` - -Block / character devices -^^^^^^^^^^^^^^^^^^^^^^^^^ - -Block / character devices from the host can be passed through to the guest= using -the ``hostdev`` element. This is only possible with container based -virtualization. Devices are specified by a fully qualified path. :since:`s= ince -after 1.0.1 for LXC` : - -:: - - ... - - - /dev/sdf1 - - - ... - -:: - - ... - - - /dev/input/event3 - - - ... - -:: - - ... - - - eth0 - - - ... - -``hostdev`` - The ``hostdev`` element is the main container for describing host devic= es. - For block/character device passthrough ``mode`` is always "capabilities= " and - ``type`` is "storage" for a block device, "misc" for a character device= and - "net" for a host network interface. -``source`` - The source element describes the device as seen from the host. For block - devices, the path to the block device in the host OS is provided in the - nested "block" element, while for character devices the "char" element = is - used. For network interfaces, the name of the interface is provided in = the - "interface" element. +.. include:: formatdomain-devices-hostdev.rst.in :anchor:`` --=20 2.26.2 From nobody Fri May 3 12:35:26 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1594749680; cv=none; d=zohomail.com; s=zohoarc; b=RgDfO8yBVliA82GEYgzHpJyonkrHxW/R7YJiAjLDAul4VRJkKkIPtRduCH/cK4xP1p6P75wponQbCqIiUG0BH9setYdhM0yFJBdCpL1HIvaqkZtQ1hbvST9T1ECysJxx+oj3dbRVbVD3zGMnLEoRUUnK24SBTBQYz5PzrCrjWJU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1594749680; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=MZF+JtzqB7T/XTjEmdo/O+lu2ad7hEeCSkl99Bj9+pM=; b=CBXJ94ZcMFlKx0uwlzNWngzGmA0rDFZcjA5oPzRwntRl74P03JSiLZBzQhN6QIAJpEuO+B7lojM4sHOBZnySvCFHc69oWzCM3A6kSQRD2nybLTKO8Z/3O5ks4Rr8fnTtfJNFZyEVfORAbvZSWwRk7tkwJTuYbISGVot0GXmMI1M= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1594749680031827.718542936144; Tue, 14 Jul 2020 11:01:20 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-145-Sde9TOruMTS-gY_s__Lrgg-1; Tue, 14 Jul 2020 14:01:15 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 52AF494BDA; Tue, 14 Jul 2020 18:00:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 30081710AD; Tue, 14 Jul 2020 18:00:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id EF55D94EFA; Tue, 14 Jul 2020 18:00:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 06EI0Vqr024040 for ; Tue, 14 Jul 2020 14:00:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id A470A5C6DD; Tue, 14 Jul 2020 18:00:31 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB9815FC31 for ; Tue, 14 Jul 2020 18:00:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594749678; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=MZF+JtzqB7T/XTjEmdo/O+lu2ad7hEeCSkl99Bj9+pM=; b=Rtll/ApNgDaGyG6Zo/2GYuN7GL0VSOV/7nOkHUIFclvUJxxEA1jQq8XKHU9deCvHX/OY7v YwK7n7AwHaAz9hbK5RFzGB5y4eUDcZtv15rJ5eQYQsSLNvlSjPyf9y3iiOUGCkvyrb7jZU UXAER8Oq09jrpoSGWbxJEHSPOGOPHoc= X-MC-Unique: Sde9TOruMTS-gY_s__Lrgg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/11] conf: Add support for initiator IQN setting for iSCSI hostdevs Date: Tue, 14 Jul 2020 20:00:16 +0200 Message-Id: <8ffec1af83a26bf311cd0c25d7ad7ef3a347d3ed.1594749375.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We already allow controlling the initiator IQN for iSCSI based disks. Add the same for host devices. Signed-off-by: Peter Krempa --- docs/formatdomain-devices-hostdev.rst.in | 7 +++++++ docs/schemas/domaincommon.rng | 3 +++ src/conf/domain_conf.c | 5 +++++ .../hostdev-scsi-virtio-scsi.x86_64-4.1.0.args | 3 ++- .../hostdev-scsi-virtio-scsi.x86_64-latest.args | 1 + tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml | 3 +++ tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml | 3 +++ 7 files changed, 24 insertions(+), 1 deletion(-) diff --git a/docs/formatdomain-devices-hostdev.rst.in b/docs/formatdomain-d= evices-hostdev.rst.in index 859c4b4ec5..1221627818 100644 --- a/docs/formatdomain-devices-hostdev.rst.in +++ b/docs/formatdomain-devices-hostdev.rst.in @@ -68,6 +68,9 @@ or: + + + @@ -210,6 +213,10 @@ or: same ``name`` attribute and optionally using the ``auth`` element to provide the authentication credentials to the iSCSI server. + :since:`Since 6.6.0`, the optional ``initiator`` sub-element control= s the + IQN of the initiator ran by the hypervisor via it's `` + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5988a13986..5c23a52031 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8349,6 +8349,8 @@ virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodePtr= sourcenode, iscsisrc->src->auth =3D g_steal_pointer(&authdef); } + virStorageSourceInitiatorParseXML(ctxt, &iscsisrc->src->initiator); + if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) && xmlopt && xmlopt->privateData.storageParse) { if ((ctxt->node =3D virXPathNode("./privateData", ctxt)) && @@ -26128,6 +26130,9 @@ virDomainHostdevDefFormatSubsysSCSI(virBufferPtr bu= f, if (iscsisrc->src->auth) virStorageAuthDefFormat(&sourceChildBuf, iscsisrc->src->auth); + + virStorageSourceInitiatorFormatXML(&iscsisrc->src->initiator, + &sourceChildBuf); } else { virBufferAsprintf(&sourceChildBuf, "\n", scsihostsrc->adapter); diff --git a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-4.1.0.a= rgs b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-4.1.0.args index de4047000e..f2591d6956 100644 --- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-4.1.0.args +++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-4.1.0.args @@ -60,7 +60,8 @@ data=3D9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8w= BYM91uEHCn6j/1,\ keyid=3DmasterKey0,iv=3DAAECAwQFBgcICQoLDA0ODw=3D=3D,format=3Dbase64 \ -drive file.driver=3Discsi,file.portal=3Dexample.org:3260,\ file.target=3Diqn.1992-01.com.example:storage,file.lun=3D2,file.transport= =3Dtcp,\ -file.user=3Dmyname,file.password-secret=3Dhostdev5-secret0,if=3Dnone,forma= t=3Draw,\ +file.user=3Dmyname,file.password-secret=3Dhostdev5-secret0,\ +file.initiator-name=3Diqn.2020-07.com.example:test,if=3Dnone,format=3Draw,\ id=3Ddrive-hostdev5 \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D3,lun=3D5,\ drive=3Ddrive-hostdev5,id=3Dhostdev5 \ diff --git a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.= args b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args index 72980d58b8..f86cbd7314 100644 --- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args @@ -67,6 +67,7 @@ keyid=3DmasterKey0,iv=3DAAECAwQFBgcICQoLDA0ODw=3D=3D,form= at=3Dbase64 \ -blockdev '{"driver":"iscsi","portal":"example.org:3260",\ "target":"iqn.1992-01.com.example:storage","lun":2,"transport":"tcp",\ "user":"myname","password-secret":"hostdev5-secret0",\ +"initiator-name":"iqn.2020-07.com.example:test",\ "node-name":"libvirt-hostdev5-backend","read-only":false}' \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D3,lun=3D5,\ drive=3Dlibvirt-hostdev5-backend,id=3Dhostdev5 \ diff --git a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml b/tests/qe= muxml2argvdata/hostdev-scsi-virtio-scsi.xml index 775b678b36..f1caf80644 100644 --- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml +++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml @@ -67,6 +67,9 @@ + + +
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml b/tests/= qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml index 9c823809ab..6c7e22d0c3 100644 --- a/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml +++ b/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml @@ -74,6 +74,9 @@ + + +
--=20 2.26.2