From nobody Thu Apr 25 00:51:37 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=1599835178; cv=none; d=zohomail.com; s=zohoarc; b=m2rJoK5xAS6lJvB8TqBL7iierlkvSqDkgPXfduqPHPoZjoK9dAlnArW+/RtzB71p5z5gKQszWWWYDxfsMSrHmCe+w22ENtg15dLDQbe4E/+QnnWq8oOdqDNCeBI+xaaxpUOmOKXZm5d/KXypLVYVJEg2f7duNH5ynQtD5JuWhEY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835178; 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=xm+XdK0WpjsnpbmSJQ07xu6R4856/OuDFVOOXRjnleE=; b=VGDKqSM40vZu5s5ElBhW42HolMBaz65dNZVZ+DF4fHKjUTSBFjJ6HictkqgrgtPJIgrKHgGwNu62TA5XNkmlBsqEC+shOaApbWu+M8ksxeG5tllFTdLsD4+TTL+mE54J7fR1757MJW12MgCtmctOlpZVeMTWrdjE4jbUnrs83Fk= 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-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1599835178333766.7200058415867; Fri, 11 Sep 2020 07:39:38 -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-284-xC1X5GgBP1C7k9tJZppRvw-1; Fri, 11 Sep 2020 10:39:35 -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 CF00F18B9F4B; Fri, 11 Sep 2020 14:39: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 A54E71002D49; Fri, 11 Sep 2020 14:39:29 +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 264AD9230F; Fri, 11 Sep 2020 14:39:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEbhTC002309 for ; Fri, 11 Sep 2020 10:37:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7E9188FCA3; Fri, 11 Sep 2020 14:37:43 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id EA9EA8FCA1 for ; Fri, 11 Sep 2020 14:37:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835177; 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=xm+XdK0WpjsnpbmSJQ07xu6R4856/OuDFVOOXRjnleE=; b=Bui4OFZokGXdMueBnNmKSJJMXZOu+52iGvG8Z5u6+CvSHkF7iVDCsiQvEM/9RoWiEHDtHU vklXkiA6JTSoWdakUTWyzXjQt18rQSKCvUQ/Wu3q6BxccnOoI8vDUcfg5KKlfJ2yVOUn2L tQFAIaEVOwTEj3r9m41Neh4aPKKhis8= X-MC-Unique: xC1X5GgBP1C7k9tJZppRvw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 01/17] virDomainHostdevSubsysSCSIiSCSIClear: Inline contents into only caller Date: Fri, 11 Sep 2020 16:37:19 +0200 Message-Id: <15734d6a2439aa34bd4816bb23c143811cc9db52.1599834862.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" There's just one caller for the function. Move the code into the caller. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 72ac4f4191..acbc3f1c1e 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3011,24 +3011,15 @@ virDomainHostdevDefNew(void) } -static void -virDomainHostdevSubsysSCSIiSCSIClear(virDomainHostdevSubsysSCSIiSCSIPtr is= csisrc) -{ - if (!iscsisrc) - return; - - virObjectUnref(iscsisrc->src); - iscsisrc->src =3D NULL; -} - - static void virDomainHostdevSubsysSCSIClear(virDomainHostdevSubsysSCSIPtr scsisrc) { - if (scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI) - virDomainHostdevSubsysSCSIiSCSIClear(&scsisrc->u.iscsi); - else + if (scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI) { + virObjectUnref(scsisrc->u.iscsi.src); + scsisrc->u.iscsi.src =3D NULL; + } else { VIR_FREE(scsisrc->u.host.adapter); + } } --=20 2.26.2 From nobody Thu Apr 25 00:51:37 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=1599835185; cv=none; d=zohomail.com; s=zohoarc; b=VADJpu5UC3qu93DzHwP7BXgyZmyOgsJqSOYo3XkT7fQ3TSZWilQGDkE3YpYAAyLe50T0eMO+djfpCAOCBAk8gknpW1dcF8WeF1x46cvENQb+zxD0djEiPmdayTiCpB3UBcbZEymQ+jhwItn/Euqt65+MiRki6OIIJUEpBjnCrDw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835185; 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=A+nP97bSHz7hpxDZvxTBQD0lh4508/TzXEDP+yhw7ec=; b=J0mPbyt5UTxtptMOaau7jBNtuVmBE1c1FlisqySNw+8H7bYcLlnuYuPIjlV2v6viY48hrECXWhGK4t7bHfbcfemKWWfzMW48yxf05HT6d6MkPio3MDqexuS+RobQ84hXD68c3dZntIWwOPjYSfiaum5Hg01ikJOEAXH94S6ruaE= 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 1599835185180985.8971914061092; Fri, 11 Sep 2020 07:39:45 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-427-oCyOceLHNpimgebLRXb6OA-1; Fri, 11 Sep 2020 10:39:38 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 28BE518B9F40; Fri, 11 Sep 2020 14:39:33 +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 04F5127CC8; Fri, 11 Sep 2020 14:39: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 99CE7181A270; Fri, 11 Sep 2020 14:39:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEbiDO002319 for ; Fri, 11 Sep 2020 10:37:44 -0400 Received: by smtp.corp.redhat.com (Postfix) id 72D948FCA1; Fri, 11 Sep 2020 14:37:44 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id DBBEA8FCA5 for ; Fri, 11 Sep 2020 14:37:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835180; 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=A+nP97bSHz7hpxDZvxTBQD0lh4508/TzXEDP+yhw7ec=; b=WFaVdyhIz60q+Jf2d/aHx4uuJuAR5jwSPVYahtW9sWY1hcLeUGtNRYDJp4SIc8Tne8nxCH M2ciBxvU9sGRuVwJsDU5xIZgk5SOe+kl4IZzd6sfrJzijWIL3D9bl60whmpjSXsdul/Bq7 NWgKBDjLUiiBBDrr16hWB/r1z9yf+qg= X-MC-Unique: oCyOceLHNpimgebLRXb6OA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 02/17] virDomainStorageNetworkParseHosts: Switch to a more modern XML parsing approach Date: Fri, 11 Sep 2020 16:37:20 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 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 XPath to get the host list instead of iterating through the nodes. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index acbc3f1c1e..ae7cb1e1c5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8234,23 +8234,26 @@ virDomainStorageNetworkParseHost(xmlNodePtr hostnod= e, static int virDomainStorageNetworkParseHosts(xmlNodePtr node, + xmlXPathContextPtr ctxt, virStorageNetHostDefPtr *hosts, size_t *nhosts) { - xmlNodePtr child; + g_autofree xmlNodePtr *hostnodes =3D NULL; + ssize_t nhostnodes; + size_t i; + VIR_XPATH_NODE_AUTORESTORE(ctxt); - for (child =3D node->children; child; child =3D child->next) { - if (child->type =3D=3D XML_ELEMENT_NODE && - virXMLNodeNameEqual(child, "host")) { - virStorageNetHostDef host; + ctxt->node =3D node; - if (virDomainStorageNetworkParseHost(child, &host) < 0) - return -1; - if (VIR_APPEND_ELEMENT(*hosts, *nhosts, host) < 0) { - virStorageNetHostDefClear(&host); - return -1; - } - } + if ((nhostnodes =3D virXPathNodeSet("./host", ctxt, &hostnodes)) <=3D = 0) + return nhostnodes; + + *hosts =3D g_new0(virStorageNetHostDef, nhostnodes); + *nhosts =3D nhostnodes; + + for (i =3D 0; i < nhostnodes; i++) { + if (virDomainStorageNetworkParseHost(hostnodes[i], *hosts + i) < 0) + return -1; } return 0; @@ -8370,7 +8373,7 @@ virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodePtr= sourcenode, return -1; } - if (virDomainStorageNetworkParseHosts(sourcenode, &iscsisrc->src->host= s, + if (virDomainStorageNetworkParseHosts(sourcenode, ctxt, &iscsisrc->src= ->hosts, &iscsisrc->src->nhosts) < 0) return -1; @@ -9643,7 +9646,7 @@ virDomainDiskSourceNetworkParse(xmlNodePtr node, src->protocol =3D=3D VIR_STORAGE_NET_PROTOCOL_HTTPS) src->query =3D virXMLPropString(node, "query"); - if (virDomainStorageNetworkParseHosts(node, &src->hosts, &src->nhosts)= < 0) + if (virDomainStorageNetworkParseHosts(node, ctxt, &src->hosts, &src->n= hosts) < 0) return -1; virStorageSourceNetworkAssignDefaultPorts(src); --=20 2.26.2 From nobody Thu Apr 25 00:51:37 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=1599835186; cv=none; d=zohomail.com; s=zohoarc; b=UR31cFIxKNa9LmtwVZdt2FafmUwz0dsJM11cr4o/cJeh3KTMGZNPNjByHnnM+xi5NDxDZWKs1qK43PgqLkVyeLVUtm/X2R1AqPKQ9M/BVuacNDsFYr4dG6KRL7LfEXaRs7QQUXfWnO5gFNtGLMbkUnim3lVTcSd2f6NWSh0azm8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835186; 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=4s5as1A5vUCadr0MpzjODB3hZaW4T3gLJtgqzFIV++Q=; b=SdglSl/QQZUKdljPkiWSUvNUhwmHfnjPxqBiOAmW+XHXQj3i3/9gNqzzS58ZzUyupE5KQ+uk3brxdUbdDhuSGqTEt9rlSGFmQfvBix7s9UeypVUjC9B351GHcc09tIjh8+H7t+JrnYEccTsp3BKqMoD516VylKwtr0ow1ol0onM= 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 1599835186770281.7561280849411; Fri, 11 Sep 2020 07:39:46 -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-571-L22uSPYLPNGVu026tV0Tfg-1; Fri, 11 Sep 2020 10:39:41 -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 922178030D2; Fri, 11 Sep 2020 14:39:35 +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 6FAE55C22A; Fri, 11 Sep 2020 14:39:35 +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 3C26092310; Fri, 11 Sep 2020 14:39:35 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEbjFh002327 for ; Fri, 11 Sep 2020 10:37:45 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6C1468FCA3; Fri, 11 Sep 2020 14:37:45 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id CF9318FCA1 for ; Fri, 11 Sep 2020 14:37:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835183; 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=4s5as1A5vUCadr0MpzjODB3hZaW4T3gLJtgqzFIV++Q=; b=fzdV9upiVvQUWl18bWyds03+p90v19j4qniYSwsf4xoVFq01IjRrb9wW8tAK3W2JC2aHjz ydc+f8deOBlDKj1cI0/o1ymASCPVDffuT71cVyhYl87Dsgv3xpLSptUH2Lax94CV18iJsh 3bnzGbzTQqUxWFoebhX1MflNMq7w49w= X-MC-Unique: L22uSPYLPNGVu026tV0Tfg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 03/17] virDomainHostdevSubsysSCSIHostDefParseXML: Switch to a more modern XML parsing approach Date: Fri, 11 Sep 2020 16:37:21 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.001 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 XPath instead of iterating through the nodes. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 98 +++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 63 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ae7cb1e1c5..05c2c63f58 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8262,89 +8262,61 @@ virDomainStorageNetworkParseHosts(xmlNodePtr node, static int virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode, + xmlXPathContextPtr ctxt, virDomainHostdevSubsysSCSIPtr sc= sisrc) { - bool got_address =3D false, got_adapter =3D false; - xmlNodePtr cur; virDomainHostdevSubsysSCSIHostPtr scsihostsrc =3D &scsisrc->u.host; g_autofree char *bus =3D NULL; g_autofree char *target =3D NULL; g_autofree char *unit =3D NULL; + xmlNodePtr addressnode =3D NULL; + VIR_XPATH_NODE_AUTORESTORE(ctxt); - cur =3D sourcenode->children; - while (cur !=3D NULL) { - if (cur->type =3D=3D XML_ELEMENT_NODE) { - if (virXMLNodeNameEqual(cur, "address")) { - if (got_address) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("more than one source addresses is " - "specified for scsi hostdev")); - return -1; - } - - if (!(bus =3D virXMLPropString(cur, "bus")) || - !(target =3D virXMLPropString(cur, "target")) || - !(unit =3D virXMLPropString(cur, "unit"))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("'bus', 'target', and 'unit' must be = specified " - "for scsi hostdev source address")); - return -1; - } + ctxt->node =3D sourcenode; - if (virStrToLong_uip(bus, NULL, 0, &scsihostsrc->bus) < 0)= { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse bus '%s'"), bus); - return -1; - } + if (!(addressnode =3D virXPathNode("./address", ctxt))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("'address' must be specified for scsi hostdev sou= rce")); + return -1; + } - if (virStrToLong_uip(target, NULL, 0, - &scsihostsrc->target) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse target '%s'"), target); - return -1; - } + if (!(bus =3D virXMLPropString(addressnode, "bus")) || + !(target =3D virXMLPropString(addressnode, "target")) || + !(unit =3D virXMLPropString(addressnode, "unit"))) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("'bus', 'target', and 'unit' must be specified " + "for scsi hostdev source address")); + return -1; + } - if (virStrToLong_ullp(unit, NULL, 0, &scsihostsrc->unit) <= 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("cannot parse unit '%s'"), unit); - return -1; - } + if (virStrToLong_uip(bus, NULL, 0, &scsihostsrc->bus) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse bus '%s'"), bus); + return -1; + } - got_address =3D true; - } else if (virXMLNodeNameEqual(cur, "adapter")) { - if (got_adapter) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("more than one adapters is specified " - "for scsi hostdev source")); - return -1; - } - if (!(scsihostsrc->adapter =3D virXMLPropString(cur, "name= "))) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("'adapter' must be specified for scsi= hostdev source")); - return -1; - } + if (virStrToLong_uip(target, NULL, 0, &scsihostsrc->target) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse target '%s'"), target); + return -1; + } - got_adapter =3D true; - } else { - virReportError(VIR_ERR_XML_ERROR, - _("unsupported element '%s' of scsi hostdev= source"), - cur->name); - return -1; - } - } - cur =3D cur->next; + if (virStrToLong_ullp(unit, NULL, 0, &scsihostsrc->unit) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot parse unit '%s'"), unit); + return -1; } - if (!got_address || !got_adapter) { + if (!(scsihostsrc->adapter =3D virXPathString("string(./adapter/@name)= ", ctxt))) { virReportError(VIR_ERR_XML_ERROR, "%s", - _("'adapter' and 'address' must be specified for sc= si " - "hostdev source")); + _("'adapter' name must be specified for scsi hostde= v source")); return -1; } return 0; } + static int virDomainHostdevSubsysSCSIiSCSIDefParseXML(xmlNodePtr sourcenode, virDomainHostdevSubsysSCSIPtr d= ef, @@ -8441,7 +8413,7 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sour= cenode, switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: - return virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, scsis= rc); + return virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, ctxt,= scsisrc); case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: return virDomainHostdevSubsysSCSIiSCSIDefParseXML(sourcenode, scsi= src, ctxt, --=20 2.26.2 From nobody Thu Apr 25 00:51:37 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=1599835082; cv=none; d=zohomail.com; s=zohoarc; b=AAzfqQur8gl8I+USQYCtC185u/LvxaYvoX94UrZ9k3/T+J9wy+6CNkNWQTsFCnJVjZesSlrLhSsItGja5L2OntrQJAPEoUv6YBzq0a45hzJXrALyKfjyDdKDi/osp3Oy5t6gBCnTtFmQ9XlS7zHn64FOeSCNiCqMA8qZnUqfSAA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835082; 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=FxheRcKLg4ADamOYLv0ZsjJwRDTCT+Q/axsjxS5pOUo=; b=Av3XSm9SrpeB97yZ+PAjl0348LcJ03jtNoaJsFMxQ3Z5I2R8nXYt+G0E6OS8eFKob0ORBCGkHwCl9xlWTTwtfJmVoPmRvkP4+JoxldKRqDJBcosurj7Q/7zCBoQTbgaMpXzeZ/AOsWiHAHkemtRP0ZigFl4r++y4tuzYf5TZ+6k= 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 15998350828246.6527155996142255; Fri, 11 Sep 2020 07:38:02 -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-124-VQ7OTpKLPuGHS3FD3ARH8w-1; Fri, 11 Sep 2020 10:37:59 -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 A282D1091066; Fri, 11 Sep 2020 14:37:53 +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 455C360C07; Fri, 11 Sep 2020 14:37:52 +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 EA22F181A06B; Fri, 11 Sep 2020 14:37:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEbkV4002332 for ; Fri, 11 Sep 2020 10:37:46 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5F9EE8FCA3; Fri, 11 Sep 2020 14:37:46 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id C9A748FCA1 for ; Fri, 11 Sep 2020 14:37:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835081; 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=FxheRcKLg4ADamOYLv0ZsjJwRDTCT+Q/axsjxS5pOUo=; b=OXnDWWDNddeJaYZ66oVHrDJ6BQp7m5Hz0jgd68TTHlYShbtZcecHXKaXCe0IhoMIIElGVz UnEwl2ZsJQreE5Gbfm9cXuN3tLTtKbkS4Y2KOVQvXtCnKIEL7HK+69Fau2UFbVjb28Ap3r oeqFzzCzvOBNPV46ianngUe0zcXDZwc= X-MC-Unique: VQ7OTpKLPuGHS3FD3ARH8w-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 04/17] syntax-check: Don't forbid curly braces around single line condition body Date: Fri, 11 Sep 2020 16:37:22 +0200 Message-Id: <27d635e06ff4524c7a918ec74b701b791ea0f241.1599834862.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.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" This syntax rule doesn't make much sense, especially if there are so much exceptions to it. Just remove it and adjust the coding style. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- build-aux/check-spacing.pl | 36 ------------------------------------ docs/coding-style.rst | 8 ++++---- 2 files changed, 4 insertions(+), 40 deletions(-) diff --git a/build-aux/check-spacing.pl b/build-aux/check-spacing.pl index 33377f3dd3..72901b75f9 100755 --- a/build-aux/check-spacing.pl +++ b/build-aux/check-spacing.pl @@ -24,11 +24,6 @@ my $ret =3D 0; my $incomment =3D 0; foreach my $file (@ARGV) { - # Per-file variables for multiline Curly Bracket (cb_) check - my $cb_linenum =3D 0; - my $cb_code =3D ""; - my $cb_scolon =3D 0; - open FILE, $file; while (defined (my $line =3D )) { @@ -160,37 +155,6 @@ foreach my $file (@ARGV) { print "$file:$.: $line"; $ret =3D 1; } - - # One line conditional statements with one line bodies should - # not use curly brackets. - if ($data =3D~ /^\s*(if|while|for)\b.*\{$/) { - $cb_linenum =3D $.; - $cb_code =3D $line; - $cb_scolon =3D 0; - } - - # We need to check for exactly one semicolon inside the body, - # because empty statements (e.g. with comment only) are - # allowed - if ($cb_linenum =3D=3D $. - 1 && $data =3D~ /^[^;]*;[^;]*$/) { - $cb_code .=3D $line; - $cb_scolon =3D 1; - } - - if ($data =3D~ /^\s*}\s*$/ && - $cb_linenum =3D=3D $. - 2 && - $cb_scolon) { - - print "Curly brackets around single-line body:\n"; - print "$file:$cb_linenum-$.:\n$cb_code$line"; - $ret =3D 1; - - # There _should_ be no need to reset the values; but to - # keep my inner peace... - $cb_linenum =3D 0; - $cb_scolon =3D 0; - $cb_code =3D ""; - } } close FILE; } diff --git a/docs/coding-style.rst b/docs/coding-style.rst index 942caf4e09..44e5265a60 100644 --- a/docs/coding-style.rst +++ b/docs/coding-style.rst @@ -258,15 +258,15 @@ comment, although use of a semicolon is not currently= rejected. Curly braces ------------ -Omit the curly braces around an ``if``, ``while``, ``for`` etc. -body only when both that body and the condition itself occupy a -single line. In every other case we require the braces. This +Curly braces around an ``if``, ``while``, ``for`` etc. can be omitted if t= he +body and the condition itself occupy only a single line. +In every other case we require the braces. This ensures that it is trivially easy to identify a single-\ *statement* loop: each has only one *line* in its body. :: - while (expr) // single line body; {} is forbidden + while (expr) // single line body; {} is optional single_line_stmt(); :: --=20 2.26.2 From nobody Thu Apr 25 00:51:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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=1599835186; cv=none; d=zohomail.com; s=zohoarc; b=RmIOhVp4Ec4fJ9antG4L0KMuqJepe4COaXt1vBfgWaFtchu7zcLRECU/aH3W+bVVej+5Li2pNgRqmrD6/jpmXiEdyH027B0iK63Xz7K/gbmUvDSA7JVaGeO3sQEOvGDz9Dkj5AaX7SV2H4YScgvwYxW781STUkLUP8s9W2H9og8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835186; 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=oCuMD+DM3w9X62CB5jF9SGOW1fWeiN1Mv1YafiM8i7k=; b=ScCNUvr+vfPwF9qV2WGPsaD2yVDLuZIyF2fqNYYQY5tFN4py8FQFVlMr2UE1teEAE75PArERmwlyOT2GjyY2bKr5P6SLhFEeVmasNG0FNrwPYp5LWfAca98EYEx5iZOPjAy7luHns00V4TcfwfIU1I4V476gP6PkYij5T2wkBxU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1599835186364597.0443012630216; Fri, 11 Sep 2020 07:39:46 -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-26-1GDdxI8RNxuR1ogEvcStKQ-1; Fri, 11 Sep 2020 10:39:43 -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 DB6738030BA; Fri, 11 Sep 2020 14:39:37 +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 BB8018FCB0; Fri, 11 Sep 2020 14:39:37 +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 89A99181A2E5; Fri, 11 Sep 2020 14:39:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEblZA002346 for ; Fri, 11 Sep 2020 10:37:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id 538178FCA3; Fri, 11 Sep 2020 14:37:47 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id BD21F8FCA1 for ; Fri, 11 Sep 2020 14:37:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835185; 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=oCuMD+DM3w9X62CB5jF9SGOW1fWeiN1Mv1YafiM8i7k=; b=bvwzkPNqBCEfPN+XkTBxvE5BpboCyVvJBzWOEBUdlYwQC9FlAUq0C4b10zhua1+2p1Pu1p 5dtX7XXciOl9MhvS3gEEaQ9MBjhjG1T34web2AVDN6uYI/p/G+ttK0gtsiR+xJq6akyD8m K6TOwMl79yvBjXPIcvEVha/Ox6YvmB4= X-MC-Unique: 1GDdxI8RNxuR1ogEvcStKQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 05/17] qemuxml2argvtest: hostdev-scsi-virtio-scsi: Add hostdev with useralias Date: Fri, 11 Sep 2020 16:37:23 +0200 Message-Id: <7104d7bb3663b8228e813625540560461ba1cc79.1599834862.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.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" Add a SCSI host device with a user-specified alias to illustrate the upcoming changes. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- .../hostdev-scsi-virtio-scsi.x86_64-2.8.0.args | 3 +++ .../hostdev-scsi-virtio-scsi.x86_64-4.1.0.args | 3 +++ .../hostdev-scsi-virtio-scsi.x86_64-latest.args | 4 ++++ tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml | 8 ++++++++ tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml | 8 ++++++++ 5 files changed, 26 insertions(+) diff --git a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-2.8.0.a= rgs b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-2.8.0.args index c5a3c0ce61..07b7a5b113 100644 --- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-2.8.0.args +++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-2.8.0.args @@ -37,6 +37,9 @@ drive=3Ddrive-hostdev0,id=3Dhostdev0 \ -drive file=3D/dev/sg0,if=3Dnone,format=3Draw,id=3Ddrive-hostdev1,readonly= =3Don \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D7,\ drive=3Ddrive-hostdev1,id=3Dhostdev1 \ +-drive file=3D/dev/sg0,if=3Dnone,format=3Draw,id=3Ddrive-ua-test \ +-device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D6,drive= =3Ddrive-ua-test,\ +id=3Dua-test \ -drive file=3Discsi://example.org:3260/iqn.1992-01.com.example/0,if=3Dnone= ,\ format=3Draw,id=3Ddrive-hostdev2 \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D2,lun=3D4,\ 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 f2591d6956..421edf90d0 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 @@ -36,6 +36,9 @@ drive=3Ddrive-hostdev0,id=3Dhostdev0 \ -drive file=3D/dev/sg0,if=3Dnone,format=3Draw,id=3Ddrive-hostdev1,readonly= =3Don \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D7,\ drive=3Ddrive-hostdev1,id=3Dhostdev1 \ +-drive file=3D/dev/sg0,if=3Dnone,format=3Draw,id=3Ddrive-ua-test \ +-device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D6,drive= =3Ddrive-ua-test,\ +id=3Dua-test \ -drive file.driver=3Discsi,file.portal=3Dexample.org:3260,\ file.target=3Diqn.1992-01.com.example,file.lun=3D0,file.transport=3Dtcp,if= =3Dnone,\ format=3Draw,id=3Ddrive-hostdev2 \ 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 f86cbd7314..a2302d1089 100644 --- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args @@ -42,6 +42,10 @@ drive=3Dlibvirt-hostdev0-backend,id=3Dhostdev0 \ "node-name":"libvirt-hostdev1-backend","read-only":true}' \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D7,\ drive=3Dlibvirt-hostdev1-backend,id=3Dhostdev1 \ +-blockdev '{"driver":"host_device","filename":"/dev/sg0",\ +"node-name":"libvirt-ua-test-backend","read-only":false}' \ +-device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D6,\ +drive=3Dlibvirt-ua-test-backend,id=3Dua-test \ -blockdev '{"driver":"iscsi","portal":"example.org:3260",\ "target":"iqn.1992-01.com.example","lun":0,"transport":"tcp",\ "node-name":"libvirt-hostdev2-backend","read-only":false}' \ diff --git a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml b/tests/qe= muxml2argvdata/hostdev-scsi-virtio-scsi.xml index f1caf80644..8da3fb1bfc 100644 --- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml +++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml @@ -40,6 +40,14 @@
+ + + +
+ + +
+ diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml b/tests/= qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml index 6c7e22d0c3..733d1d72a0 100644 --- a/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml +++ b/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml @@ -47,6 +47,14 @@
+ + + +
+ + +
+ --=20 2.26.2 From nobody Thu Apr 25 00:51:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1599835095; cv=none; d=zohomail.com; s=zohoarc; b=Soc7d9rXamOnB+EY4NFnKGkeb+AmkK3Th/YxlqJhpF575r/YDi4fn24W1mlZESmgOoHblAoVY5DKIVdVA8ZYfLMaOl31G0bRE/Fb4Dn0IspeIIpNSjXUeqmTSMBf3aljs4zj1tMydSl2Dnc7UBUhQchhCQl9v4+HEYzrRVhslTY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835095; 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=YlUDBjMdjzerXgerSKm1e9U+KLXB+oGygtgtD43pHAw=; b=JZSvOSC1uMsrgAekd21Z1tUuXQvvEJz2dppl3Xn3eu3r9wFWK0dBH8fIXbY7lgTrbBuCJUbcDQYAqTpURhC1M4cYqWXsddsMM5DYgX1xv9EzIVHpkdqDtf1tK3FN6W78Y3EOUY/WTNpOZSPupaU4TYRCLxEbaL46YJajSccEg9Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1599835095472591.2365118156991; Fri, 11 Sep 2020 07:38:15 -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-105-ifR04VPXOyOtGbM8t2_lxg-1; Fri, 11 Sep 2020 10:38:11 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C76798030A2; Fri, 11 Sep 2020 14:38:05 +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 A76177C544; Fri, 11 Sep 2020 14:38:05 +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 71A579230C; Fri, 11 Sep 2020 14:38:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEbmOZ002356 for ; Fri, 11 Sep 2020 10:37:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3F1968FCA3; Fri, 11 Sep 2020 14:37:48 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id B0DB18FCA1 for ; Fri, 11 Sep 2020 14:37:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835093; 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=YlUDBjMdjzerXgerSKm1e9U+KLXB+oGygtgtD43pHAw=; b=HIszvL6OlBLksP/BqxtOnZVFsU+Rq9kUCgh5NfPUBDEf7+qtY1/INLd00Lx2SQlhx/AgJy G2mmbwK8q/KVe+b6b8XFC10zCJzeR+1QGsZmnKSH7c+coQQEn24zBO11SQz+apzgF4aMiF DcXzRhF/ZVwxAroi00vzHm9Vab2ixG0= X-MC-Unique: ifR04VPXOyOtGbM8t2_lxg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 06/17] conf: Add virStorageSource member for SCSI host device config data Date: Fri, 11 Sep 2020 16:37:24 +0200 Message-Id: <3e333a7f2bf2b800f0c4602dd757b652c4ee256d.1599834862.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The backend for the SCSI host device is a storage source. While the definition doesn't look like that it's converted to a storage source when the VM is running. Add the storage source to the definition object and also parse/format it's private data which will be used for internal state storage while the VM is running. Note that the virStorageSourcePtr may not be allocated all the time so the private data parser allocates it if there is any private data present. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 24 ++++++++++++++++++++++-- src/conf/domain_conf.h | 1 + 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 05c2c63f58..f93cd60c2b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3019,6 +3019,8 @@ virDomainHostdevSubsysSCSIClear(virDomainHostdevSubsy= sSCSIPtr scsisrc) scsisrc->u.iscsi.src =3D NULL; } else { VIR_FREE(scsisrc->u.host.adapter); + virObjectUnref(scsisrc->u.host.src); + scsisrc->u.host.src =3D NULL; } } @@ -8263,7 +8265,9 @@ virDomainStorageNetworkParseHosts(xmlNodePtr node, static int virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr sourcenode, xmlXPathContextPtr ctxt, - virDomainHostdevSubsysSCSIPtr sc= sisrc) + virDomainHostdevSubsysSCSIPtr sc= sisrc, + unsigned int flags, + virDomainXMLOptionPtr xmlopt) { virDomainHostdevSubsysSCSIHostPtr scsihostsrc =3D &scsisrc->u.host; g_autofree char *bus =3D NULL; @@ -8313,6 +8317,16 @@ virDomainHostdevSubsysSCSIHostDefParseXML(xmlNodePtr= sourcenode, return -1; } + if (flags & VIR_DOMAIN_DEF_PARSE_STATUS && + xmlopt && xmlopt->privateData.storageParse) { + if ((ctxt->node =3D virXPathNode("./privateData", ctxt))) { + if (!scsihostsrc->src && + !(scsihostsrc->src =3D virStorageSourceNew())) + return -1; + if (xmlopt->privateData.storageParse(ctxt, scsihostsrc->src) <= 0) + return -1; + } + } return 0; } @@ -8413,7 +8427,8 @@ virDomainHostdevSubsysSCSIDefParseXML(xmlNodePtr sour= cenode, switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: - return virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, ctxt,= scsisrc); + return virDomainHostdevSubsysSCSIHostDefParseXML(sourcenode, ctxt,= scsisrc, + flags, xmlopt); case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: return virDomainHostdevSubsysSCSIiSCSIDefParseXML(sourcenode, scsi= src, ctxt, @@ -26305,6 +26320,11 @@ virDomainHostdevDefFormatSubsysSCSI(virBufferPtr b= uf, virBufferAsprintf(&sourceChildBuf, " bus=3D'%u' target=3D'%u' unit= =3D'%llu'", scsihostsrc->bus, scsihostsrc->target, scsihosts= rc->unit); virBufferAddLit(&sourceChildBuf, "/>\n"); + + if (scsihostsrc->src && + virDomainDiskSourceFormatPrivateData(&sourceChildBuf, scsihost= src->src, + flags, xmlopt) < 0) + return -1; } virXMLFormatElement(buf, "source", &sourceAttrBuf, &sourceChildBuf); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 14a376350c..cf76f340ee 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -245,6 +245,7 @@ struct _virDomainHostdevSubsysSCSIHost { unsigned bus; unsigned target; unsigned long long unit; + virStorageSourcePtr src; }; struct _virDomainHostdevSubsysSCSIiSCSI { --=20 2.26.2 From nobody Thu Apr 25 00:51:37 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=1599835190; cv=none; d=zohomail.com; s=zohoarc; b=cidYd4VJdUYDv4Ju5lfkVP4BULM+dsbOxgWIQS0E4hpqyWfMX6TsQtsRg6sEtKfuiOrSpIGTg/XMWqDbeTnfAheArBtMp2fCS1ZKLUx8UnEpi0OJCkehItP3Zb2eNMIUf46GTjL/caFllpG3cuvthZVcj+U7RnL+UHPc+rwEKrg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835190; 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=aMEz/L5/hxM3LxSqYNrjgPA0dvb2I0KxreF4jjt/LxE=; b=e1hoCT1DztJlq/HxastyzIEjCvBVwuuYMXrPRW01Z9a0g4sM0fd9zc2F9tKDrGMLQhuOdMgjWXXnmYdsTulbGeN7ntDqg/6cp6Nn+LP30NqtFlIYrGoBnf3/OwvzkwQCxgXv6OHAa939zybpLIpFx+Rd/4qlIY4i/6BMFexBHm0= 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 1599835190322427.52315341251347; Fri, 11 Sep 2020 07:39:50 -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-168-1lrnQ61OMnqXt8tu3ExIqA-1; Fri, 11 Sep 2020 10:39:47 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D345B802B6D; Fri, 11 Sep 2020 14:39:40 +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 B41397E8F0; Fri, 11 Sep 2020 14:39:40 +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 81FD5181A55A; Fri, 11 Sep 2020 14:39:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEbnXL002365 for ; Fri, 11 Sep 2020 10:37:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1EB9C8FCA3; Fri, 11 Sep 2020 14:37:49 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 924048FCA1 for ; Fri, 11 Sep 2020 14:37:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835189; 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=aMEz/L5/hxM3LxSqYNrjgPA0dvb2I0KxreF4jjt/LxE=; b=N/PAdI7aZkrq77bnNIhBCocBUW9ZwBlu5Egoi6RzAf3QgAzLuFqqo0JvMyrfUYGVgiVnog iNpGpF8mNVIxqxSN80vmvoeh+kOt4ZzdsiqDYFdtP69e5844KClgR4toEITnixkBPFxDxt r4XDnXxgXWz/mHPlrock9yCiuNoMS50= X-MC-Unique: 1lrnQ61OMnqXt8tu3ExIqA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 07/17] tests: qemustatusxml2xmldata: Rename 'disk-secinfo-upgrade' case to 'upgrade' Date: Fri, 11 Sep 2020 16:37:25 +0200 Message-Id: <32c0b63bb9fc2849a4cebfd8ab3855451c40e927.1599834862.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The test case tests other things besides disk secinfos, so we can make it more universal. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- .../{disk-secinfo-upgrade-in.xml =3D> upgrade-in.xml} | 0 .../{disk-secinfo-upgrade-out.xml =3D> upgrade-out.xml} | 0 tests/qemuxml2xmltest.c | 2 +- 3 files changed, 1 insertion(+), 1 deletion(-) rename tests/qemustatusxml2xmldata/{disk-secinfo-upgrade-in.xml =3D> upgra= de-in.xml} (100%) rename tests/qemustatusxml2xmldata/{disk-secinfo-upgrade-out.xml =3D> upgr= ade-out.xml} (100%) diff --git a/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-in.xml b/test= s/qemustatusxml2xmldata/upgrade-in.xml similarity index 100% rename from tests/qemustatusxml2xmldata/disk-secinfo-upgrade-in.xml rename to tests/qemustatusxml2xmldata/upgrade-in.xml diff --git a/tests/qemustatusxml2xmldata/disk-secinfo-upgrade-out.xml b/tes= ts/qemustatusxml2xmldata/upgrade-out.xml similarity index 100% rename from tests/qemustatusxml2xmldata/disk-secinfo-upgrade-out.xml rename to tests/qemustatusxml2xmldata/upgrade-out.xml diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 39a9da874f..2bf8dd5b14 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1435,7 +1435,7 @@ mymain(void) DO_TEST_STATUS("migration-in-params"); DO_TEST_STATUS("migration-out-params"); DO_TEST_STATUS("migration-out-nbd-tls"); - DO_TEST_STATUS("disk-secinfo-upgrade"); + DO_TEST_STATUS("upgrade"); DO_TEST_STATUS("blockjob-blockdev"); --=20 2.26.2 From nobody Thu Apr 25 00:51:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1599835092; cv=none; d=zohomail.com; s=zohoarc; b=PfMywkZX20YrmldYR/aS2ng1mgVljyX/h/JBRtZPAcRxGtCizUjzMw6ceCitEnKzhA02iEk6sBXWER/YQc/jhCYwSui1S0N1cBxpqdMgG36A1ULE0zs8Es55X1NEN1pIt3vUdMmCvIx1a5tqwy6OjfWNYlxhthG9FmDebS7ZTnE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835092; 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=Hi6CIHsSHYtQFXiz9cIs5TjYUJnmnyfd4N7Es7Orcaw=; b=arLN5uOEMvaCTAq5+Io+ht1x3mfO/N56IDgMmvpsGByGYbKnTxfFhGc32uU3HbOeV+VQf9pIj6hZLX5vCdiPb32KzYdyTyZJp+9124Q3mw4+t6pzRoBj+LqstCFXOuxYjvJKsLO/cQ7k+BiqodVoC+m5NHwd5i4IAuKUgJMtelg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 159983509291276.67028509818067; Fri, 11 Sep 2020 07:38:12 -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-419-hTWNsTfdOKew5DsBQlkBzg-1; Fri, 11 Sep 2020 10:38:07 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E8C62805723; Fri, 11 Sep 2020 14:38:01 +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 C40E57EB96; Fri, 11 Sep 2020 14:38:01 +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 67393181A07B; Fri, 11 Sep 2020 14:38:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEboDv002377 for ; Fri, 11 Sep 2020 10:37:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 08A668FCA3; Fri, 11 Sep 2020 14:37:50 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BE5C8FCA1 for ; Fri, 11 Sep 2020 14:37:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835090; 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=Hi6CIHsSHYtQFXiz9cIs5TjYUJnmnyfd4N7Es7Orcaw=; b=ekvu1tYyeomjAhFDREueJNk1cVpfo5Gm/YCkgHuTxRuwQMfYPdXQzDj846PQy1KqbcRIhU Cjzm604eTLze6HFAsjfRtybOz3PRhE+PYXG1mjkcskVtTek4m5ycJ3iDlKhc+9jiR1sPhF RJGZxHuN1m7mF1tRN+cyroIMBW1b2sY= X-MC-Unique: hTWNsTfdOKew5DsBQlkBzg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 08/17] tests: qemustatusxml2xmldata: Add local SCSI hostdev to 'upgrade' case Date: Fri, 11 Sep 2020 16:37:26 +0200 Message-Id: <4433a2ccd33bd12069f6e929bd066dbb95da7823.1599834862.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Add a local SCSI host device to validate upcoming generated data. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemustatusxml2xmldata/upgrade-in.xml | 8 ++++++++ tests/qemustatusxml2xmldata/upgrade-out.xml | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/tests/qemustatusxml2xmldata/upgrade-in.xml b/tests/qemustatusx= ml2xmldata/upgrade-in.xml index 8023857ffe..1942eacfa4 100644 --- a/tests/qemustatusxml2xmldata/upgrade-in.xml +++ b/tests/qemustatusxml2xmldata/upgrade-in.xml @@ -511,6 +511,14 @@
+ + + +
+ + +
+
diff --git a/tests/qemustatusxml2xmldata/upgrade-out.xml b/tests/qemustatus= xml2xmldata/upgrade-out.xml index d5534fb0f5..ee3c1b49b0 100644 --- a/tests/qemustatusxml2xmldata/upgrade-out.xml +++ b/tests/qemustatusxml2xmldata/upgrade-out.xml @@ -543,6 +543,14 @@
+ + + +
+ + +
+
--=20 2.26.2 From nobody Thu Apr 25 00:51:37 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=1599835099; cv=none; d=zohomail.com; s=zohoarc; b=i/NV11CxMj0cv4apAG4n8c8xMjjrMmjn1/4bQiRHNnJgDhXXRob7FK+yoztl56dacOKTFJ4xjRgsDs2Sy0zq5vqlqXq1Wepd+iGu96FlBi+Z5G+zhxALg0/Jusvc696DEZT6RdGZkOhpv2Kxm5VObzRqFg9WJZvglESG6nONa3w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835099; 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=p3+FtCzDJ+iqmkVPowuzyonftenz0vd7jBuW8cORCbw=; b=M3AAxSDVibWI8zc9EmvofpT/Bj3xRRjdjjjJFiurabADd/tSI0+JCra0qIhN2ZLiDekoX0Tr5dXQzfqcT5Q/QDt6jI6OzrPHeriP6hMHh1tdPr6N/L75BOvG+oZEHKjeYt0bB+cibBCiT9rLn6Lk10R9gNAtz0zSIRJMtgFHqmk= 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 1599835099780822.1628978179377; Fri, 11 Sep 2020 07:38: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-395-zmeOrcHsOVGBiMTnA4x2jg-1; Fri, 11 Sep 2020 10:38:13 -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 2282F8030DD; Fri, 11 Sep 2020 14:38:08 +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 0396C5C22B; Fri, 11 Sep 2020 14:38:08 +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 C43F79230F; Fri, 11 Sep 2020 14:38:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEbovf002390 for ; Fri, 11 Sep 2020 10:37:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id E77768FCA1; Fri, 11 Sep 2020 14:37:50 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5C2CF8FCA5 for ; Fri, 11 Sep 2020 14:37:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835097; 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=p3+FtCzDJ+iqmkVPowuzyonftenz0vd7jBuW8cORCbw=; b=R7prsciqQ2hyVq55zsA/9ItL8exjFk2NHZwZoPBWgxZ5fR80QDKA1i37CgCvyLHFdy8GlC b4GPiQwZbvYySO0ODGqKi/Q7nRjf0IZXX3oryG74GAROu9x+ZhTNck6bDuvzYUOH1QszPB cRwPX0VBa50KoXTHIh65sU3hYlKRhpc= X-MC-Unique: zmeOrcHsOVGBiMTnA4x2jg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 09/17] qemu: domain: Fill in (i)SCSI backend nodename if it is not present in status XML Date: Fri, 11 Sep 2020 16:37:27 +0200 Message-Id: <3a1fa0ad6460449554b998431d4c96b967c7192c.1599834862.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" For upgrade reasons so that we can modify the used nodename we must generate the old version for all status XMLs which don't have it stored explicitly. The change will be required as using the user-provided alias may result in too-long nodenames which will be rejected by qemu. Add code which fills in the appropriate old value and add test cases to validate that it's added and also that existing nodenames are not overwritten. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 55 +++++++++++++++++++++ tests/qemustatusxml2xmldata/modern-in.xml | 1 + tests/qemustatusxml2xmldata/upgrade-in.xml | 1 + tests/qemustatusxml2xmldata/upgrade-out.xml | 12 +++++ 4 files changed, 69 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 0ed132a829..89f2c2c09b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5301,6 +5301,57 @@ qemuDomainDeviceHostdevDefPostParseRestoreSecAlias(v= irDomainHostdevDefPtr hostde } +/** + * qemuDomainDeviceHostdevDefPostParseRestoreBackendAlias: + * + * Re-generate backend alias if it wasn't stored in the status XML by an o= lder + * libvirtd. + * + * Note that qemuCaps should be always present for a status XML. + */ +static int +qemuDomainDeviceHostdevDefPostParseRestoreBackendAlias(virDomainHostdevDef= Ptr hostdev, + virQEMUCapsPtr qemu= Caps, + unsigned int parseF= lags) +{ + virDomainHostdevSubsysSCSIPtr scsisrc =3D &hostdev->source.subsys.u.sc= si; + virStorageSourcePtr src; + + if (!(parseFlags & VIR_DOMAIN_DEF_PARSE_STATUS)) + return 0; + + if (!qemuCaps || + hostdev->mode !=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS || + hostdev->source.subsys.type !=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_SC= SI || + !virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI)) + return 0; + + switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: + if (!scsisrc->u.host.src && + !(scsisrc->u.host.src =3D virStorageSourceNew())) + return -1; + + src =3D scsisrc->u.host.src; + break; + + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: + src =3D scsisrc->u.iscsi.src; + break; + + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST: + default: + virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsisrc-= >protocol); + return -1; + } + + if (!src->nodestorage) + src->nodestorage =3D g_strdup_printf("libvirt-%s-backend", hostdev= ->info->alias); + + return 0; +} + + static int qemuDomainHostdevDefMdevPostParse(virDomainHostdevSubsysMediatedDevPtr mde= vsrc, virQEMUCapsPtr qemuCaps) @@ -5327,6 +5378,10 @@ qemuDomainHostdevDefPostParse(virDomainHostdevDefPtr= hostdev, parseFlags) < 0) return -1; + if (qemuDomainDeviceHostdevDefPostParseRestoreBackendAlias(hostdev, qe= muCaps, + parseFlags)= < 0) + return -1; + if (hostdev->mode =3D=3D VIR_DOMAIN_HOSTDEV_MODE_SUBSYS && hostdev->source.subsys.type =3D=3D VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_= MDEV && qemuDomainHostdevDefMdevPostParse(&subsys->u.mdev, qemuCaps) < 0) diff --git a/tests/qemustatusxml2xmldata/modern-in.xml b/tests/qemustatusxm= l2xmldata/modern-in.xml index 0a3990bd3e..5a5d5b8983 100644 --- a/tests/qemustatusxml2xmldata/modern-in.xml +++ b/tests/qemustatusxml2xmldata/modern-in.xml @@ -234,6 +234,7 @@ + diff --git a/tests/qemustatusxml2xmldata/upgrade-in.xml b/tests/qemustatusx= ml2xmldata/upgrade-in.xml index 1942eacfa4..7fa56429f4 100644 --- a/tests/qemustatusxml2xmldata/upgrade-in.xml +++ b/tests/qemustatusxml2xmldata/upgrade-in.xml @@ -232,6 +232,7 @@ + diff --git a/tests/qemustatusxml2xmldata/upgrade-out.xml b/tests/qemustatus= xml2xmldata/upgrade-out.xml index ee3c1b49b0..962d25ce2e 100644 --- a/tests/qemustatusxml2xmldata/upgrade-out.xml +++ b/tests/qemustatusxml2xmldata/upgrade-out.xml @@ -232,6 +232,7 @@ + @@ -517,6 +518,9 @@ + + + @@ -532,6 +536,9 @@ + + + @@ -547,6 +554,11 @@
+ + + + +
--=20 2.26.2 From nobody Thu Apr 25 00:51:37 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=1599835222; cv=none; d=zohomail.com; s=zohoarc; b=LfVzCLSpCqDoNGFgWpP0ykr2tBLn+xysGwQ6dibZ+4c1BkGtBPMlflqxmx5xezoSzzKhqZ8fTYXU5GqqD6E0pX1Mpeb0yoilLDwYndag1ILRXABYEkIiPL/5IeBclGSa1W0UAudFbGmXccC0CRnsyG9vB68wd3c6ZgP4sBIQXfE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835222; 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=LWS9GkxZD6dxCvDig1Jy1kwcLyqpH+OsKK5J6cJl3KI=; b=kYaInB3xD+MgHRvaspU/gG75gU3T6AVa8ODtSyMumD3MBB3CjscbHnTqiyB2ZhZftUByh1X1hQQrgbehNWApHsklCIP2rJo5lh8TMm+KIf0t50BY3xEdzM48lGqhmxr83BCoG9kjTA7/KmaX76Fl6erz1unaL4U50MMLp1YqsxY= 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 1599835222281418.22456651959; Fri, 11 Sep 2020 07:40:22 -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-393-6HcqMy64OCmARLSOnlspsw-1; Fri, 11 Sep 2020 10:39:49 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 57B0418B9F92; Fri, 11 Sep 2020 14:39:43 +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 35D285DA33; Fri, 11 Sep 2020 14:39:43 +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 003B8181A869; Fri, 11 Sep 2020 14:39:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEbswB002405 for ; Fri, 11 Sep 2020 10:37:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4FAFF8FCA1; Fri, 11 Sep 2020 14:37:54 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id BDDF78FCA5 for ; Fri, 11 Sep 2020 14:37:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835221; 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=LWS9GkxZD6dxCvDig1Jy1kwcLyqpH+OsKK5J6cJl3KI=; b=iqYwsZDO3lw3NMSi5GAS3+0lCk8MaGm5xiPX45YGSiccPrvKJaFUxQQhf2eIhO5g16Jl/j epxP0A3FLOb8i6aun5n7KmHKUjczxMnCYLVOzxNE3oTx1NMsdXL0TIkAercdvfTDjxN+m8 VDrgYmsCBV9i12qBdDTspYAP9G6c6nY= X-MC-Unique: 6HcqMy64OCmARLSOnlspsw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/17] qemuBuildHostdevSCSI(A|De)tachPrepare: Use virStorageSource in def for SCSI hostdevs Date: Fri, 11 Sep 2020 16:37:28 +0200 Message-Id: <48f45ddb478e1db39248215b7c6a94f2e2a2f5fa.1599834862.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Modify the attach/detach data generators to actually use the virStorageSourceStructure embedded in the SCSI config data rather than creating an ad-hoc internal one. The modification will allow us to properly store the nodename used for the backend in the status XML rather than re-generating it all the time. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 71 +++++++++++++++++++++++++++-------------- 1 file changed, 47 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index bd98b0a97c..d92b967419 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5053,24 +5053,35 @@ qemuBuildHostdevSCSIDetachPrepare(virDomainHostdevD= efPtr hostdev, virQEMUCapsPtr qemuCaps) { virDomainHostdevSubsysSCSIPtr scsisrc =3D &hostdev->source.subsys.u.sc= si; - virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc =3D &scsisrc->u.iscsi; g_autoptr(qemuBlockStorageSourceAttachData) ret =3D g_new0(qemuBlockSt= orageSourceAttachData, 1); if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI)) { - if (scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE= _ISCSI) { - qemuDomainStorageSourcePrivatePtr srcpriv =3D QEMU_DOMAIN_STOR= AGE_SOURCE_PRIVATE(iscsisrc->src); + virStorageSourcePtr src; + qemuDomainStorageSourcePrivatePtr srcpriv; - ret->storageNodeName =3D iscsisrc->src->nodestorage; + switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: + src =3D scsisrc->u.host.src; + break; - if (srcpriv && srcpriv->secinfo && - srcpriv->secinfo->type =3D=3D VIR_DOMAIN_SECRET_INFO_TYPE_= AES) - ret->authsecretAlias =3D g_strdup(srcpriv->secinfo->s.aes.= alias); - } else { - ret->storageNodeNameCopy =3D g_strdup_printf("libvirt-%s-backe= nd", hostdev->info->alias); - ret->storageNodeName =3D ret->storageNodeNameCopy; + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: + src =3D scsisrc->u.iscsi.src; + break; + + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST: + default: + virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsi= src->protocol); + return NULL; } + srcpriv =3D QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src); + ret->storageNodeName =3D src->nodestorage; ret->storageAttached =3D true; + + if (srcpriv && srcpriv->secinfo && + srcpriv->secinfo->type =3D=3D VIR_DOMAIN_SECRET_INFO_TYPE_AES) + ret->authsecretAlias =3D g_strdup(srcpriv->secinfo->s.aes.alia= s); + } else { ret->driveAlias =3D qemuAliasFromHostdev(hostdev); ret->driveAdded =3D true; @@ -5086,45 +5097,57 @@ qemuBuildHostdevSCSIAttachPrepare(virDomainHostdevD= efPtr hostdev, virQEMUCapsPtr qemuCaps) { virDomainHostdevSubsysSCSIPtr scsisrc =3D &hostdev->source.subsys.u.sc= si; - virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc =3D &scsisrc->u.iscsi; - virStorageSourcePtr src; - g_autoptr(virStorageSource) localsrc =3D NULL; g_autoptr(qemuBlockStorageSourceAttachData) ret =3D g_new0(qemuBlockSt= orageSourceAttachData, 1); + virStorageSourcePtr src =3D NULL; if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_SCSI)) { - if (scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE= _ISCSI) { - src =3D iscsisrc->src; - } else { - g_autofree char *devstr =3D qemuBuildSCSIHostHostdevDrvStr(hos= tdev); + g_autofree char *devstr =3D NULL; - if (!devstr) + switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: + if (!scsisrc->u.host.src && + !(scsisrc->u.host.src =3D virStorageSourceNew())) return NULL; - if (!(src =3D localsrc =3D virStorageSourceNew())) + if (!(devstr =3D qemuBuildSCSIHostHostdevDrvStr(hostdev))) return NULL; + src =3D scsisrc->u.host.src; + src->type =3D VIR_STORAGE_TYPE_BLOCK; src->readonly =3D hostdev->readonly; src->path =3D g_strdup_printf("/dev/%s", devstr); + + break; + + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: + src =3D scsisrc->u.iscsi.src; + break; + + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST: + default: + virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsi= src->protocol); + return NULL; } src->nodestorage =3D g_strdup_printf("libvirt-%s-backend", hostdev= ->info->alias); - ret->storageNodeNameCopy =3D g_strdup(src->nodestorage); - ret->storageNodeName =3D ret->storageNodeNameCopy; - *backendAlias =3D ret->storageNodeNameCopy; + ret->storageNodeName =3D src->nodestorage; + *backendAlias =3D src->nodestorage; if (!(ret->storageProps =3D qemuBlockStorageSourceGetBackendProps(= src, QE= MU_BLOCK_STORAGE_SOURCE_BACKEND_PROPS_SKIP_UNMAP))) return NULL; } else { + if (scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE= _ISCSI) + src =3D scsisrc->u.iscsi.src; ret->driveCmd =3D qemuBuildSCSIHostdevDrvStr(hostdev, qemuCaps); ret->driveAlias =3D qemuAliasFromHostdev(hostdev); *backendAlias =3D ret->driveAlias; } - if (scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISC= SI && - qemuBuildStorageSourceAttachPrepareCommon(iscsisrc->src, ret, qemu= Caps) < 0) + if (src && + qemuBuildStorageSourceAttachPrepareCommon(src, ret, qemuCaps) < 0) return NULL; return g_steal_pointer(&ret); --=20 2.26.2 From nobody Thu Apr 25 00:51:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1599835267; cv=none; d=zohomail.com; s=zohoarc; b=ItDnjQ1qG5a4mkMIWhjCRmYLp8w9riDrt/iCyLKTf7PLbxFFqIPxkbQZcE+ChoDA+vlSbij1+brSeQro/32ERH4QCEW0JLt7ogCuLHJec+QCKGf45q9554oA7KnhYSvGKhHH4Z4pGjTWclT7rn5wWpfL5vflOKJ7+V77Ez5uMhY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835267; 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=tifONuuj0AINC2BmDc8JGr4SycotJAT8XkbSYHvtra8=; b=InvK2/G3Gh0dWcCT2KwXHG/hOzriNaIq5VCCot7OnxwWgKl2PqPenNi08aBNnyU8i3qTZeHp1jvjrDqHkrjh44k/DhAQiVIEvhdb4tPazNcxeJLo+LvGIzLgs7oDqKa0mUJujkFZg/2+kiNmXTnH19Uu7GIWMF32nMwKrJ8YIcc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1599835267129220.8355969020471; Fri, 11 Sep 2020 07:41: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-16-58L_JNW1ORKhShMvkHyQyA-1; Fri, 11 Sep 2020 10:39:51 -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 BF41856ADE; Fri, 11 Sep 2020 14:39:45 +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 A03025C1BD; Fri, 11 Sep 2020 14:39:45 +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 6EB9392311; Fri, 11 Sep 2020 14:39:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEbtth002421 for ; Fri, 11 Sep 2020 10:37:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 407238FCA3; Fri, 11 Sep 2020 14:37:55 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA59C8FCA1 for ; Fri, 11 Sep 2020 14:37:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835263; 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=tifONuuj0AINC2BmDc8JGr4SycotJAT8XkbSYHvtra8=; b=X6ABm6uqeARVul94pRM5V+obVUSY9/ZSINNRTh30wKaXKUY48fPJziBL+qhcMD8S5tgmuL VlivAezuUMZkgSulgWgIzhlsEbp+jz75E2hkAeeuJfSgaKMtCGFZTdPeVs2HbkO5nZyvXU qxTg4iUHuLX+GEA/ZiblAEEKCunY484= X-MC-Unique: 58L_JNW1ORKhShMvkHyQyA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 11/17] qemuBlockStorageSourceAttachData: remove 'storageNodeNameCopy' Date: Fri, 11 Sep 2020 16:37:29 +0200 Message-Id: <36299dababa7e780dbb23dba059aa8f0b40bd9e0.1599834862.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This was a hack when we were locally regenerating the nodename so that it's not leaked. Now that we use proper virStorageSource with persistence it's no longer required. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_block.c | 1 - src/qemu/qemu_block.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index 9095986f73..487b0a72e7 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -1557,7 +1557,6 @@ qemuBlockStorageSourceAttachDataFree(qemuBlockStorage= SourceAttachDataPtr data) virJSONValueFree(data->encryptsecretProps); virJSONValueFree(data->tlsProps); virJSONValueFree(data->tlsKeySecretProps); - VIR_FREE(data->storageNodeNameCopy); VIR_FREE(data->tlsAlias); VIR_FREE(data->tlsKeySecretAlias); VIR_FREE(data->authsecretAlias); diff --git a/src/qemu/qemu_block.h b/src/qemu/qemu_block.h index 9aab620947..0701fc18d1 100644 --- a/src/qemu/qemu_block.h +++ b/src/qemu/qemu_block.h @@ -85,7 +85,6 @@ struct qemuBlockStorageSourceAttachData { virJSONValuePtr storageProps; const char *storageNodeName; - char *storageNodeNameCopy; /* in some cases we don't have the correspo= nding storage source */ bool storageAttached; virJSONValuePtr storageSliceProps; --=20 2.26.2 From nobody Thu Apr 25 00:51:37 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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=1599835100; cv=none; d=zohomail.com; s=zohoarc; b=mtpZUR963oGG939L6mwNiP/Hczc/XvyOUC1CsJKrmrvppTXq9Q12N4aRIzNiijilUAJ5ZE147uhP8+m6Vm0yqwhpSWwaaPkA8wOzyhMbVSlQ986LqaaKRW87DQTrhPRyqJ0oj5NfD/Yds0NTqVVaq+rQXaUcI6IF6HzwS4zLzdA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835100; 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=fvJyj5aJAZgNBirmt+6oTdd+XyM/kkSxvvOc3MzfmPg=; b=GenBrYV2oE3+/MngDD+eF5//nQAd7p1XWWQ6bNe91rkip1qmsAtZtgAtaTgAmXIttuW6Ry+wA+i2UOsVZ/JKVyrTsHwc0hRwOcklmOldwslmloNTihVlw7zKNTB7Rv+03s8B5EvwjTScvikUe4C45bzdedgLjZLerqmbxSLYK+4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1599835100170563.4269778101334; Fri, 11 Sep 2020 07:38: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-137-Lo8qIFPWO7e4Uks9iMgm6Q-1; Fri, 11 Sep 2020 10:38:16 -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 94F5C81C463; Fri, 11 Sep 2020 14:38:10 +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 730CA8FCA3; Fri, 11 Sep 2020 14:38:10 +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 4063D92311; Fri, 11 Sep 2020 14:38:10 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEbufw002427 for ; Fri, 11 Sep 2020 10:37:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2BF4A8FCA3; Fri, 11 Sep 2020 14:37:56 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9F2A78FCA1 for ; Fri, 11 Sep 2020 14:37:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835099; 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=fvJyj5aJAZgNBirmt+6oTdd+XyM/kkSxvvOc3MzfmPg=; b=JDqEx/c5FFu/SZ6pAeFQ+ke+KhOEmNK9IZM1tU7D8k6sNDYrRW4cA3DeqoQ1GCCwTBaVb9 9wVVQdHgN5+ob+SyrIn8askFeCvc+oBi5aaqbwCoBL7BpsbiPSyfocD5dZn5tejpJ/4PJr 5mKPrhXmPuLe8l+Y65LaX0MkA9z1JfU= X-MC-Unique: Lo8qIFPWO7e4Uks9iMgm6Q-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 12/17] qemu: domain: Extract preparation of hostdev specific data to a separate function Date: Fri, 11 Sep 2020 16:37:30 +0200 Message-Id: <07365fdfcda8b84e6c94f626d23363169a77ae66.1599834862.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Historically we've prepared secrets for all objects in one place. This doesn't make much sense and it's semantically more appealing to prepare everything for a single device type in one place. Move the setup of the (iSCSI|SCSI) hostdev secrets into a new function which will be used to setup other things as well in the future. This is a similar approach we do for disks. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 59 ++++++++++++++++++++++++++++++++++++----- src/qemu/qemu_domain.h | 4 +++ src/qemu/qemu_hotplug.c | 2 +- src/qemu/qemu_process.c | 21 +++++++++++++++ 4 files changed, 78 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 89f2c2c09b..1289201764 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1596,13 +1596,7 @@ qemuDomainSecretPrepare(virQEMUDriverPtr driver, g_autoptr(virQEMUDriverConfig) cfg =3D virQEMUDriverGetConfig(driver); size_t i; - /* disk secrets are prepared when preparing disks */ - - for (i =3D 0; i < vm->def->nhostdevs; i++) { - if (qemuDomainSecretHostdevPrepare(priv, - vm->def->hostdevs[i]) < 0) - return -1; - } + /* disk and hostdev secrets are prepared when preparing internal data = */ for (i =3D 0; i < vm->def->nserials; i++) { if (qemuDomainSecretChardevPrepare(cfg, priv, @@ -10455,6 +10449,57 @@ qemuDomainPrepareDiskSource(virDomainDiskDefPtr di= sk, } +int +qemuDomainPrepareHostdev(virDomainHostdevDefPtr hostdev, + qemuDomainObjPrivatePtr priv) +{ + if (virHostdevIsSCSIDevice(hostdev)) { + virDomainHostdevSubsysSCSIPtr scsisrc =3D &hostdev->source.subsys.= u.scsi; + virStorageSourcePtr src =3D NULL; + + switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: + break; + + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: + src =3D scsisrc->u.iscsi.src; + break; + + case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_LAST: + default: + virReportEnumRangeError(virDomainHostdevSCSIProtocolType, scsi= src->protocol); + return -1; + } + + if (src) { + if (src->auth) { + bool iscsiHasPS =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CA= PS_ISCSI_PASSWORD_SECRET); + virSecretUsageType usageType =3D VIR_SECRET_USAGE_TYPE_ISC= SI; + qemuDomainStorageSourcePrivatePtr srcPriv =3D qemuDomainSt= orageSourcePrivateFetch(src); + + if (!qemuDomainSupportsEncryptedSecret(priv) || !iscsiHasP= S) { + srcPriv->secinfo =3D qemuDomainSecretInfoNewPlain(usag= eType, + src->a= uth->username, + &src->= auth->seclookupdef); + } else { + srcPriv->secinfo =3D qemuDomainSecretAESSetupFromSecre= t(priv, + = hostdev->info->alias, + = NULL, + = usageType, + = src->auth->username, + = &src->auth->seclookupdef); + } + + if (!srcPriv->secinfo) + return -1; + } + } + } + + return 0; +} + + /** * qemuDomainDiskCachemodeFlags: * diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index adba79aded..6abd896119 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -970,6 +970,10 @@ qemuDomainDiskCachemodeFlags(int cachemode, bool *direct, bool *noflush); +int +qemuDomainPrepareHostdev(virDomainHostdevDefPtr hostdev, + qemuDomainObjPrivatePtr priv); + char * qemuDomainGetManagedPRSocketPath(qemuDomainObjPrivatePtr priv); bool qemuDomainDefHasManagedPR(virDomainObjPtr vm); diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index e2c6e14c2e..f20b8e9a56 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -2604,7 +2604,7 @@ qemuDomainAttachHostSCSIDevice(virQEMUDriverPtr drive= r, if (qemuAssignDeviceHostdevAlias(vm->def, &hostdev->info->alias, -1) <= 0) goto cleanup; - if (qemuDomainSecretHostdevPrepare(priv, hostdev) < 0) + if (qemuDomainPrepareHostdev(hostdev, priv) < 0) goto cleanup; if (!(data =3D qemuBuildHostdevSCSIAttachPrepare(hostdev, &backendalia= s, diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index dd60fb0ddf..79e72aaf2a 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -6213,6 +6213,23 @@ qemuProcessPrepareDomainStorage(virQEMUDriverPtr dri= ver, } +static int +qemuProcessPrepareDomainHostdevs(virDomainObjPtr vm, + qemuDomainObjPrivatePtr priv) +{ + size_t i; + + for (i =3D 0; i < vm->def->nhostdevs; i++) { + virDomainHostdevDefPtr hostdev =3D vm->def->hostdevs[i]; + + if (qemuDomainPrepareHostdev(hostdev, priv) < 0) + return -1; + } + + return 0; +} + + static void qemuProcessPrepareAllowReboot(virDomainObjPtr vm) { @@ -6315,6 +6332,10 @@ qemuProcessPrepareDomain(virQEMUDriverPtr driver, if (qemuProcessPrepareDomainStorage(driver, vm, priv, cfg, flags) < 0) return -1; + VIR_DEBUG("Setting up host devices"); + if (qemuProcessPrepareDomainHostdevs(vm, priv) < 0) + return -1; + VIR_DEBUG("Prepare chardev source backends for TLS"); qemuDomainPrepareChardevSource(vm->def, cfg); --=20 2.26.2 From nobody Thu Apr 25 00:51:37 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=1599835148; cv=none; d=zohomail.com; s=zohoarc; b=DQQlYpVwCcM9fTWgJxBZHOZQ9p3J2++hLKR96066pVkuiVSy59kpo6R5wYkhDXdlA5p3ZThmMfysuNKG+uKvBnagNjMl9MTfvqdkBj3Cbx2mJw/vpa9LnuDzQ+rsjAC6tzt0WaGdADSNVEsriRAVulKh5h7rmcv9adzp5d9sg84= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835148; 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=xWuuspcq1xzNwq01mUCmljSanBCNU9mCr9KRMXDF9Lo=; b=aMLb8wjxNSMLBkJOC2OR8DTKw+mCFhdSVbJiMA7TVmOnr7jv6mGbI4N23g2plEEq832lrIFGa6Ry11SMknJtCsJAtfI20RoCDWFNC5Rr1O84IYILZ0IqD9C2xeUJbAbfr/L/w3Ba9LvE9ABYF+eA+AwOQgKShzyqe1ovtI4SfIA= 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 159983514848739.81061242313115; Fri, 11 Sep 2020 07:39:08 -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-144-HGSz8JsnP02YokEtUA13RQ-1; Fri, 11 Sep 2020 10:38:23 -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 80D078030BA; Fri, 11 Sep 2020 14:38:17 +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 5FBAC60C04; Fri, 11 Sep 2020 14:38:17 +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 2F8A092315; Fri, 11 Sep 2020 14:38:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEbvOH002432 for ; Fri, 11 Sep 2020 10:37:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id 15ED38FCA1; Fri, 11 Sep 2020 14:37:57 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7F4448FCA5 for ; Fri, 11 Sep 2020 14:37:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835147; 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=xWuuspcq1xzNwq01mUCmljSanBCNU9mCr9KRMXDF9Lo=; b=OfZsni8KHvo7R1M21L5/bkEeeYMccqwh3hHlDnwypc4fDTsVee2Is97Yo/HA2Dncy+96oK 1Kc1CJp8aJGyQB9Q6mWeUhFRsIQ6qU+PiWBapJlSMSJDE61yRP0Il9cGII2lxzPGCctvZ1 e2OorED77LRpvJSgleiqOffftX8XOQk= X-MC-Unique: HGSz8JsnP02YokEtUA13RQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 13/17] qemuDomainSecretHostdevPrepare: remove Date: Fri, 11 Sep 2020 16:37:31 +0200 Message-Id: <560c3f5b276391b271e9c2dd113263d1ef264aba.1599834862.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The function is no longer used once we setup per-hostdev data. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 50 ------------------------------------------ src/qemu/qemu_domain.h | 4 ---- 2 files changed, 54 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 1289201764..a751d0c205 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1381,56 +1381,6 @@ qemuDomainSecretHostdevDestroy(virDomainHostdevDefPt= r hostdev) } -/* qemuDomainSecretHostdevPrepare: - * @priv: pointer to domain private object - * @hostdev: Pointer to a hostdev definition - * - * For the right host device, generate the qemuDomainSecretInfo structure. - * - * Returns 0 on success, -1 on failure - */ -int -qemuDomainSecretHostdevPrepare(qemuDomainObjPrivatePtr priv, - virDomainHostdevDefPtr hostdev) -{ - if (virHostdevIsSCSIDevice(hostdev)) { - virDomainHostdevSubsysSCSIPtr scsisrc =3D &hostdev->source.subsys.= u.scsi; - virDomainHostdevSubsysSCSIiSCSIPtr iscsisrc =3D &scsisrc->u.iscsi; - virStorageSourcePtr src =3D iscsisrc->src; - - if (scsisrc->protocol =3D=3D VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE= _ISCSI && - src->auth) { - bool iscsiHasPS =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_I= SCSI_PASSWORD_SECRET); - virSecretUsageType usageType =3D VIR_SECRET_USAGE_TYPE_ISCSI; - qemuDomainStorageSourcePrivatePtr srcPriv; - - if (!(src->privateData =3D qemuDomainStorageSourcePrivateNew()= )) - return -1; - - srcPriv =3D QEMU_DOMAIN_STORAGE_SOURCE_PRIVATE(src); - - if (!qemuDomainSupportsEncryptedSecret(priv) || !iscsiHasPS) { - srcPriv->secinfo =3D qemuDomainSecretInfoNewPlain(usageTyp= e, - src->auth-= >username, - &src->auth= ->seclookupdef); - } else { - srcPriv->secinfo =3D qemuDomainSecretAESSetupFromSecret(pr= iv, - host= dev->info->alias, - NULL, - usag= eType, - src-= >auth->username, - &src= ->auth->seclookupdef); - } - - if (!srcPriv->secinfo) - return -1; - } - } - - return 0; -} - - void qemuDomainSecretChardevDestroy(virDomainChrSourceDefPtr dev) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index 6abd896119..77d6bfc810 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -851,10 +851,6 @@ qemuDomainSecretInfoTLSNew(qemuDomainObjPrivatePtr pri= v, void qemuDomainSecretHostdevDestroy(virDomainHostdevDefPtr disk) ATTRIBUTE_NONNULL(1); -int qemuDomainSecretHostdevPrepare(qemuDomainObjPrivatePtr priv, - virDomainHostdevDefPtr hostdev) - ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); - void qemuDomainSecretChardevDestroy(virDomainChrSourceDefPtr dev) ATTRIBUTE_NONNULL(1); --=20 2.26.2 From nobody Thu Apr 25 00:51:37 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=1599835197; cv=none; d=zohomail.com; s=zohoarc; b=VZe0XgwYMyJ0gc+bkwLPCpdiJpG0bpnsEwW86Vkk5UcvcCgCIFfJnTu2e2cW/2MT8tleVISJRS1nGTLUVa9L9WMUFZxYZj5jZomd8s7CQqwJDFbsWaxLdehoy4vJHvQeMqnhbeHU71icb+Rej+pRAnEsPGzyu9Ui+W20h2EVt40= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835197; 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=TqzUMMj6s1QE5Rb33a3qIImNruBpcSHGNuMGk2jQQS4=; b=TaNuCkRS5zdroKNQFi+S0fmN9fK7LMvaaO357uaR1YoZbmkdHK3uuYHbiwYsMzP+v06XHVG7Td3u0ECaYj1nMXwhizq2wp1oXboRJ3AHSqbfVGsWJgGz0UNW9h2xczLHoaeiJgxlWz3h1vUL/lDGo+xluMz9L6YqrQJjVqSBsfs= 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 1599835197672162.40016658640843; Fri, 11 Sep 2020 07:39:57 -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-283--tGexHVgPS-XufWExcCRpw-1; Fri, 11 Sep 2020 10:39:53 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 13137109106D; Fri, 11 Sep 2020 14:39:48 +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 E8BEB7EB97; Fri, 11 Sep 2020 14:39:47 +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 B80B5181A872; Fri, 11 Sep 2020 14:39:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEbwUD002446 for ; Fri, 11 Sep 2020 10:37:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 002708FCA3; Fri, 11 Sep 2020 14:37:58 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 733328FCA1 for ; Fri, 11 Sep 2020 14:37:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835196; 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=TqzUMMj6s1QE5Rb33a3qIImNruBpcSHGNuMGk2jQQS4=; b=fIyeCsjyDhRI+lfP52eIbJjmyG74+9T3fQpa1PdGEv+XE6Z5WPrCj3MeErN+g8lbYCDhUQ JhN6D2ZaFGL2jE8cqGuQuCCKzOsLXeiPucGXWDD9hlz5CrlxGs5/hOzlCI6R8V25u/s9g+ Vq6YoSY8Y6ioVustCRw9nuSyZufNl/M= X-MC-Unique: -tGexHVgPS-XufWExcCRpw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 14/17] qemuDomainPrepareHostdev: Allocate backend nodenames in the prepare function Date: Fri, 11 Sep 2020 16:37:32 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Allocate the nodename in the setup function rather than in the command line generator. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 7 ++++--- src/qemu/qemu_domain.c | 8 ++++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d92b967419..c5c587b97d 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -5105,9 +5105,11 @@ qemuBuildHostdevSCSIAttachPrepare(virDomainHostdevDe= fPtr hostdev, switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: - if (!scsisrc->u.host.src && - !(scsisrc->u.host.src =3D virStorageSourceNew())) + if (!scsisrc->u.host.src) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("SCSI host device data structure was not = initialized")); return NULL; + } if (!(devstr =3D qemuBuildSCSIHostHostdevDrvStr(hostdev))) return NULL; @@ -5130,7 +5132,6 @@ qemuBuildHostdevSCSIAttachPrepare(virDomainHostdevDef= Ptr hostdev, return NULL; } - src->nodestorage =3D g_strdup_printf("libvirt-%s-backend", hostdev= ->info->alias); ret->storageNodeName =3D src->nodestorage; *backendAlias =3D src->nodestorage; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index a751d0c205..d570ba892b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10409,6 +10409,10 @@ qemuDomainPrepareHostdev(virDomainHostdevDefPtr ho= stdev, switch ((virDomainHostdevSCSIProtocolType) scsisrc->protocol) { case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_NONE: + virObjectUnref(scsisrc->u.host.src); + if (!(scsisrc->u.host.src =3D virStorageSourceNew())) + return -1; + src =3D scsisrc->u.host.src; break; case VIR_DOMAIN_HOSTDEV_SCSI_PROTOCOL_TYPE_ISCSI: @@ -10422,6 +10426,10 @@ qemuDomainPrepareHostdev(virDomainHostdevDefPtr ho= stdev, } if (src) { + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_= SCSI)) { + src->nodestorage =3D g_strdup_printf("libvirt-%s-backend",= hostdev->info->alias); + } + if (src->auth) { bool iscsiHasPS =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CA= PS_ISCSI_PASSWORD_SECRET); virSecretUsageType usageType =3D VIR_SECRET_USAGE_TYPE_ISC= SI; --=20 2.26.2 From nobody Thu Apr 25 00:51:37 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=1599835109; cv=none; d=zohomail.com; s=zohoarc; b=AX9LuJOEAOofxYUPpuzk9XoyOgzOOMr2HNK4/qIrrCnyGEHRqE4IwD8OgCOZIfSa014g1iNxv3gR4mLFUG8/ganEn0GKBB1MLKb1LqgtMF8dVawA59bknPrlFT4S5owBvhaLDkkX8lzh1Ntn8Vcibqvz+Ns/0H65EBRbT/SsuVU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835109; 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=XD/OqMgdfwBU3l6faJgX0xfuAzYMRlsUu6qx3QrXI2I=; b=eDgeoFX9d1pXGDl6hIYd6MsrEgtDj5Js+TcaozgVU4gfTQTNUayHOfiIWL4hEBrI4GS6KV2HK184yuJZZhDQZN9DXaLuoeOLlkkvCXyJ41VUHMBB7beKjACCmJw5oaN9D6uFLbIMgiJ9Ra3EMtldCQKIxCF5YyfBPVA3/++6U+g= 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 159983510958342.384584652599074; Fri, 11 Sep 2020 07:38:29 -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-549-w7cBtMVfPqGAwO1cG4lyxw-1; Fri, 11 Sep 2020 10:38:25 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 05D7585C731; Fri, 11 Sep 2020 14:38:20 +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 DA4F37EB97; Fri, 11 Sep 2020 14:38:19 +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 A7CEA181A06B; Fri, 11 Sep 2020 14:38:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEc1Yh002480 for ; Fri, 11 Sep 2020 10:38:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id C076A8FCA1; Fri, 11 Sep 2020 14:38:01 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 361058FCA6 for ; Fri, 11 Sep 2020 14:37:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835107; 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=XD/OqMgdfwBU3l6faJgX0xfuAzYMRlsUu6qx3QrXI2I=; b=FP+VLbVQPe2QNoKpQQ2x7QUiVQZC6VBWtjJCRGwQkS5unVnZ4WcvHn5QLOf9aNzuaOUJ51 E3Gn7xoEMgF5OpG76EZLQOURuotv8D0p7xnBYKh3duXJ7xnLh673M10KHDgScmQLTTlmLK zTz86bugsFfqTQBz09M4HTt8+3v7fSo= X-MC-Unique: w7cBtMVfPqGAwO1cG4lyxw-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 15/17] qemuDomainPrepareHostdev: base hostdev secret object names on backend alias Date: Fri, 11 Sep 2020 16:37:33 +0200 Message-Id: <5d180c4867563aed5a0623e137011eb1ab97b307.1599834862.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The secret object is used to pass data to the backend so it's better fitting to base the secret object name on the SCSI host device backend name. Since we store the object alias in the status XML this modification is safe in regards to existing guests. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 5 ++++- .../qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args | 8 ++++---- .../hostdev-scsi-virtio-scsi.x86_64-latest.args | 8 ++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index d570ba892b..46f7caeb09 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10426,8 +10426,11 @@ qemuDomainPrepareHostdev(virDomainHostdevDefPtr ho= stdev, } if (src) { + const char *backendalias =3D hostdev->info->alias; + if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_= SCSI)) { src->nodestorage =3D g_strdup_printf("libvirt-%s-backend",= hostdev->info->alias); + backendalias =3D src->nodestorage; } if (src->auth) { @@ -10441,7 +10444,7 @@ qemuDomainPrepareHostdev(virDomainHostdevDefPtr hos= tdev, &src->= auth->seclookupdef); } else { srcPriv->secinfo =3D qemuDomainSecretAESSetupFromSecre= t(priv, - = hostdev->info->alias, + = backendalias, = NULL, = usageType, = src->auth->username, diff --git a/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args b/t= ests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args index d4599f6002..f768c2471b 100644 --- a/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args @@ -52,21 +52,21 @@ id=3Dhostdev2 \ "node-name":"libvirt-hostdev3-backend","read-only":false}' \ -device scsi-generic,bus=3Dscsi0.0,scsi-id=3D5,drive=3Dlibvirt-hostdev3-ba= ckend,\ id=3Dhostdev3 \ --object secret,id=3Dhostdev4-secret0,\ +-object secret,id=3Dlibvirt-hostdev4-backend-secret0,\ data=3D9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\ keyid=3DmasterKey0,iv=3DAAECAwQFBgcICQoLDA0ODw=3D=3D,format=3Dbase64 \ -blockdev '{"driver":"iscsi","portal":"example.org:3260",\ "target":"iqn.1992-01.com.example:storage","lun":1,"transport":"tcp",\ -"user":"myname","password-secret":"hostdev4-secret0",\ +"user":"myname","password-secret":"libvirt-hostdev4-backend-secret0",\ "node-name":"libvirt-hostdev4-backend","read-only":false}' \ -device scsi-generic,bus=3Dscsi0.0,scsi-id=3D3,drive=3Dlibvirt-hostdev4-ba= ckend,\ id=3Dhostdev4 \ --object secret,id=3Dhostdev5-secret0,\ +-object secret,id=3Dlibvirt-hostdev5-backend-secret0,\ data=3D9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\ keyid=3DmasterKey0,iv=3DAAECAwQFBgcICQoLDA0ODw=3D=3D,format=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",\ +"user":"myname","password-secret":"libvirt-hostdev5-backend-secret0",\ "node-name":"libvirt-hostdev5-backend","read-only":false}' \ -device scsi-generic,bus=3Dscsi0.0,scsi-id=3D2,drive=3Dlibvirt-hostdev5-ba= ckend,\ 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 a2302d1089..0beefabd27 100644 --- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args @@ -56,21 +56,21 @@ drive=3Dlibvirt-hostdev2-backend,id=3Dhostdev2 \ "node-name":"libvirt-hostdev3-backend","read-only":false}' \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D2,lun=3D5,\ drive=3Dlibvirt-hostdev3-backend,id=3Dhostdev3 \ --object secret,id=3Dhostdev4-secret0,\ +-object secret,id=3Dlibvirt-hostdev4-backend-secret0,\ data=3D9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\ keyid=3DmasterKey0,iv=3DAAECAwQFBgcICQoLDA0ODw=3D=3D,format=3Dbase64 \ -blockdev '{"driver":"iscsi","portal":"example.org:3260",\ "target":"iqn.1992-01.com.example:storage","lun":1,"transport":"tcp",\ -"user":"myname","password-secret":"hostdev4-secret0",\ +"user":"myname","password-secret":"libvirt-hostdev4-backend-secret0",\ "node-name":"libvirt-hostdev4-backend","read-only":false}' \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D3,lun=3D4,\ drive=3Dlibvirt-hostdev4-backend,id=3Dhostdev4 \ --object secret,id=3Dhostdev5-secret0,\ +-object secret,id=3Dlibvirt-hostdev5-backend-secret0,\ data=3D9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\ keyid=3DmasterKey0,iv=3DAAECAwQFBgcICQoLDA0ODw=3D=3D,format=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",\ +"user":"myname","password-secret":"libvirt-hostdev5-backend-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,\ --=20 2.26.2 From nobody Thu Apr 25 00:51:37 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=1599835097; cv=none; d=zohomail.com; s=zohoarc; b=XyQD9prf+mPetaAO/yD0xJx2k+Ub46/b6MEnm8IuskLkG6qIiSFWRVLouPND1G34jkhMv1eAo6ZXJHESMtCZwlrahQ8brYe4x9GjpmIlbswUl7WXLfzt0vLCKwnDqsPA5JF4SI22wJ2S+PF1XQWpSfOHRnbY06CdRu6QluUDorc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835097; 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=L4sOWJnKMEjdp3mZQ+Opc+c/nChzEXouFwgr1/swXyg=; b=VY45Y5dMws9JWBI6qa+pW8XwFS/OyV7+kteMiyfoJwyX0eL1+XpHJYgXYjAcF6z89eq0FlmHfby72aN8alBTTcaGCcFR+Zgj8gCMiqULsXp8+KIbImk+6xSWJxgihyXvWbjM7AU7EXsJI7muwJ3i8qp1t5LnWNkNOWeQMtliJLU= 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 1599835097820950.5123950286999; Fri, 11 Sep 2020 07:38:17 -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-288-YYtoPTMVNMq4ke88PxJOVA-1; Fri, 11 Sep 2020 10:38:14 -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 54FB2100747B; Fri, 11 Sep 2020 14:38:08 +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 33C3760C07; Fri, 11 Sep 2020 14:38:08 +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 F2FE7181A06B; Fri, 11 Sep 2020 14:38:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEc2pQ002485 for ; Fri, 11 Sep 2020 10:38:02 -0400 Received: by smtp.corp.redhat.com (Postfix) id AB0008FCA3; Fri, 11 Sep 2020 14:38:02 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2A7A98FCA1 for ; Fri, 11 Sep 2020 14:38:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835096; 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=L4sOWJnKMEjdp3mZQ+Opc+c/nChzEXouFwgr1/swXyg=; b=buzeGtFXFCMUhocS/VzudTvKI0jD3SvOt1EtwUYrFAHnw8wlClIKq7lPLr4oY8i0f415ym 56r2mLGvTKvoGmT4FZML3dvs9DfAbGwtArf+KspwDm0NCp64xLEW+E4h+Ah/59/TGaJsOK oj1mYGDQ3VI7pDpStdEpNRYDPHBrejk= X-MC-Unique: YYtoPTMVNMq4ke88PxJOVA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 16/17] qemuDomainPrepareHostdev: Don't base backend nodename on device alias Date: Fri, 11 Sep 2020 16:37:34 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.002 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" QEMU's blockdev nodenames which are used to back SCSI/iSCSI hostdevs are limited to 32 characters. If a user passes a very long user alias as name of the host device it's easy to end up with a too-long nodename. To prevent this from happening don't base the nodename on the possibly user-specified alias but on the normal sequential node name generator. We then store the name in the status XML for further use. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 3 +- .../hostdev-scsi-lsi.x86_64-latest.args | 38 ++++++++----------- ...ostdev-scsi-virtio-scsi.x86_64-latest.args | 36 +++++++++--------- 3 files changed, 36 insertions(+), 41 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 46f7caeb09..2444e47173 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -10429,7 +10429,8 @@ qemuDomainPrepareHostdev(virDomainHostdevDefPtr hos= tdev, const char *backendalias =3D hostdev->info->alias; if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_HOSTDEV_= SCSI)) { - src->nodestorage =3D g_strdup_printf("libvirt-%s-backend",= hostdev->info->alias); + src->id =3D qemuDomainStorageIdNew(priv); + src->nodestorage =3D g_strdup_printf("libvirt-%d-backend",= src->id); backendalias =3D src->nodestorage; } diff --git a/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args b/t= ests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args index f768c2471b..a5b200543a 100644 --- a/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/hostdev-scsi-lsi.x86_64-latest.args @@ -35,41 +35,35 @@ file=3D/tmp/lib/domain--1-QEMUGuest2/master-key.aes \ "file":"libvirt-1-storage"}' \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Dlibvirt-1-format,id=3Dide0-0-0= ,bootindex=3D1 \ -blockdev '{"driver":"host_device","filename":"/dev/sg0",\ -"node-name":"libvirt-hostdev0-backend","read-only":false}' \ --device scsi-generic,bus=3Dscsi0.0,scsi-id=3D7,drive=3Dlibvirt-hostdev0-ba= ckend,\ -id=3Dhostdev0 \ +"node-name":"libvirt-2-backend","read-only":false}' \ +-device scsi-generic,bus=3Dscsi0.0,scsi-id=3D7,drive=3Dlibvirt-2-backend,i= d=3Dhostdev0 \ -blockdev '{"driver":"host_device","filename":"/dev/sg0",\ -"node-name":"libvirt-hostdev1-backend","read-only":true}' \ --device scsi-generic,bus=3Dscsi0.0,scsi-id=3D6,drive=3Dlibvirt-hostdev1-ba= ckend,\ -id=3Dhostdev1 \ +"node-name":"libvirt-3-backend","read-only":true}' \ +-device scsi-generic,bus=3Dscsi0.0,scsi-id=3D6,drive=3Dlibvirt-3-backend,i= d=3Dhostdev1 \ -blockdev '{"driver":"iscsi","portal":"example.org:3260",\ "target":"iqn.1992-01.com.example","lun":0,"transport":"tcp",\ -"node-name":"libvirt-hostdev2-backend","read-only":false}' \ --device scsi-generic,bus=3Dscsi0.0,scsi-id=3D4,drive=3Dlibvirt-hostdev2-ba= ckend,\ -id=3Dhostdev2 \ +"node-name":"libvirt-4-backend","read-only":false}' \ +-device scsi-generic,bus=3Dscsi0.0,scsi-id=3D4,drive=3Dlibvirt-4-backend,i= d=3Dhostdev2 \ -blockdev '{"driver":"iscsi","portal":"example.org:3260",\ "target":"iqn.1992-01.com.example","lun":1,"transport":"tcp",\ -"node-name":"libvirt-hostdev3-backend","read-only":false}' \ --device scsi-generic,bus=3Dscsi0.0,scsi-id=3D5,drive=3Dlibvirt-hostdev3-ba= ckend,\ -id=3Dhostdev3 \ --object secret,id=3Dlibvirt-hostdev4-backend-secret0,\ +"node-name":"libvirt-5-backend","read-only":false}' \ +-device scsi-generic,bus=3Dscsi0.0,scsi-id=3D5,drive=3Dlibvirt-5-backend,i= d=3Dhostdev3 \ +-object secret,id=3Dlibvirt-6-backend-secret0,\ data=3D9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\ keyid=3DmasterKey0,iv=3DAAECAwQFBgcICQoLDA0ODw=3D=3D,format=3Dbase64 \ -blockdev '{"driver":"iscsi","portal":"example.org:3260",\ "target":"iqn.1992-01.com.example:storage","lun":1,"transport":"tcp",\ -"user":"myname","password-secret":"libvirt-hostdev4-backend-secret0",\ -"node-name":"libvirt-hostdev4-backend","read-only":false}' \ --device scsi-generic,bus=3Dscsi0.0,scsi-id=3D3,drive=3Dlibvirt-hostdev4-ba= ckend,\ -id=3Dhostdev4 \ --object secret,id=3Dlibvirt-hostdev5-backend-secret0,\ +"user":"myname","password-secret":"libvirt-6-backend-secret0",\ +"node-name":"libvirt-6-backend","read-only":false}' \ +-device scsi-generic,bus=3Dscsi0.0,scsi-id=3D3,drive=3Dlibvirt-6-backend,i= d=3Dhostdev4 \ +-object secret,id=3Dlibvirt-7-backend-secret0,\ data=3D9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\ keyid=3DmasterKey0,iv=3DAAECAwQFBgcICQoLDA0ODw=3D=3D,format=3Dbase64 \ -blockdev '{"driver":"iscsi","portal":"example.org:3260",\ "target":"iqn.1992-01.com.example:storage","lun":2,"transport":"tcp",\ -"user":"myname","password-secret":"libvirt-hostdev5-backend-secret0",\ -"node-name":"libvirt-hostdev5-backend","read-only":false}' \ --device scsi-generic,bus=3Dscsi0.0,scsi-id=3D2,drive=3Dlibvirt-hostdev5-ba= ckend,\ -id=3Dhostdev5 \ +"user":"myname","password-secret":"libvirt-7-backend-secret0",\ +"node-name":"libvirt-7-backend","read-only":false}' \ +-device scsi-generic,bus=3Dscsi0.0,scsi-id=3D2,drive=3Dlibvirt-7-backend,i= d=3Dhostdev5 \ -device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ resourcecontrol=3Ddeny \ 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 0beefabd27..147ab40c9a 100644 --- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args @@ -35,46 +35,46 @@ file=3D/tmp/lib/domain--1-QEMUGuest2/master-key.aes \ "file":"libvirt-1-storage"}' \ -device ide-hd,bus=3Dide.0,unit=3D0,drive=3Dlibvirt-1-format,id=3Dide0-0-0= ,bootindex=3D1 \ -blockdev '{"driver":"host_device","filename":"/dev/sg0",\ -"node-name":"libvirt-hostdev0-backend","read-only":false}' \ +"node-name":"libvirt-2-backend","read-only":false}' \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D8,\ -drive=3Dlibvirt-hostdev0-backend,id=3Dhostdev0 \ +drive=3Dlibvirt-2-backend,id=3Dhostdev0 \ -blockdev '{"driver":"host_device","filename":"/dev/sg0",\ -"node-name":"libvirt-hostdev1-backend","read-only":true}' \ +"node-name":"libvirt-3-backend","read-only":true}' \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D7,\ -drive=3Dlibvirt-hostdev1-backend,id=3Dhostdev1 \ +drive=3Dlibvirt-3-backend,id=3Dhostdev1 \ -blockdev '{"driver":"host_device","filename":"/dev/sg0",\ -"node-name":"libvirt-ua-test-backend","read-only":false}' \ +"node-name":"libvirt-4-backend","read-only":false}' \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D6,\ -drive=3Dlibvirt-ua-test-backend,id=3Dua-test \ +drive=3Dlibvirt-4-backend,id=3Dua-test \ -blockdev '{"driver":"iscsi","portal":"example.org:3260",\ "target":"iqn.1992-01.com.example","lun":0,"transport":"tcp",\ -"node-name":"libvirt-hostdev2-backend","read-only":false}' \ +"node-name":"libvirt-5-backend","read-only":false}' \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D2,lun=3D4,\ -drive=3Dlibvirt-hostdev2-backend,id=3Dhostdev2 \ +drive=3Dlibvirt-5-backend,id=3Dhostdev2 \ -blockdev '{"driver":"iscsi","portal":"example.org:3260",\ "target":"iqn.1992-01.com.example","lun":1,"transport":"tcp",\ -"node-name":"libvirt-hostdev3-backend","read-only":false}' \ +"node-name":"libvirt-6-backend","read-only":false}' \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D2,lun=3D5,\ -drive=3Dlibvirt-hostdev3-backend,id=3Dhostdev3 \ --object secret,id=3Dlibvirt-hostdev4-backend-secret0,\ +drive=3Dlibvirt-6-backend,id=3Dhostdev3 \ +-object secret,id=3Dlibvirt-7-backend-secret0,\ data=3D9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\ keyid=3DmasterKey0,iv=3DAAECAwQFBgcICQoLDA0ODw=3D=3D,format=3Dbase64 \ -blockdev '{"driver":"iscsi","portal":"example.org:3260",\ "target":"iqn.1992-01.com.example:storage","lun":1,"transport":"tcp",\ -"user":"myname","password-secret":"libvirt-hostdev4-backend-secret0",\ -"node-name":"libvirt-hostdev4-backend","read-only":false}' \ +"user":"myname","password-secret":"libvirt-7-backend-secret0",\ +"node-name":"libvirt-7-backend","read-only":false}' \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D3,lun=3D4,\ -drive=3Dlibvirt-hostdev4-backend,id=3Dhostdev4 \ --object secret,id=3Dlibvirt-hostdev5-backend-secret0,\ +drive=3Dlibvirt-7-backend,id=3Dhostdev4 \ +-object secret,id=3Dlibvirt-8-backend-secret0,\ data=3D9eao5F8qtkGt+seB1HYivWIxbtwUu6MQtg1zpj/oDtUsPr1q8wBYM91uEHCn6j/1,\ keyid=3DmasterKey0,iv=3DAAECAwQFBgcICQoLDA0ODw=3D=3D,format=3Dbase64 \ -blockdev '{"driver":"iscsi","portal":"example.org:3260",\ "target":"iqn.1992-01.com.example:storage","lun":2,"transport":"tcp",\ -"user":"myname","password-secret":"libvirt-hostdev5-backend-secret0",\ +"user":"myname","password-secret":"libvirt-8-backend-secret0",\ "initiator-name":"iqn.2020-07.com.example:test",\ -"node-name":"libvirt-hostdev5-backend","read-only":false}' \ +"node-name":"libvirt-8-backend","read-only":false}' \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D3,lun=3D5,\ -drive=3Dlibvirt-hostdev5-backend,id=3Dhostdev5 \ +drive=3Dlibvirt-8-backend,id=3Dhostdev5 \ -device virtio-balloon-pci,id=3Dballoon0,bus=3Dpci.0,addr=3D0x3 \ -sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ resourcecontrol=3Ddeny \ --=20 2.26.2 From nobody Thu Apr 25 00:51:37 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=1599835112; cv=none; d=zohomail.com; s=zohoarc; b=DwvP7O7yk8pVhtUB2osFrd6pk27HXWIRyxeUBtC2wvVb3LzLDDwArUPlilmPgXz2LBeEQQMhGqjkisz7MvChRvicyjWUSxd8pju3dr2I+EpU83dSNfKii/xYO8tKR0b11KO4T8Uzq3sBcrQEim53ZhsfpCHuRwR/80YEL5Lc3zI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599835112; 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=l3VRPnQnGtQigNrQe0288L64iBx7F7QDLZv+xP/YNCY=; b=dhbnbhFvWQlAPaGGwj1Zb5LGKCJ96Y21c0VpXNrK4C8inJGpCxRIHT+MsQCHAhtGRnqZFBtNqJeEOzq8P4MkaQAFo1hE/MPtKcHfmiD2tQuOAQsdMFAwtDRh9IVfo/uhsnQY0zgBAdw62CLo4x7LPNag1XRrQ+gVgEn2lfpq8P4= 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 1599835112692839.1452280496087; Fri, 11 Sep 2020 07:38:32 -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-595-E5hX65reOi-Y875D81MjIA-1; Fri, 11 Sep 2020 10:38:28 -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 6D1CEAF208; Fri, 11 Sep 2020 14:38:22 +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 4F67B60C04; Fri, 11 Sep 2020 14:38: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 1E02F92317; Fri, 11 Sep 2020 14:38:22 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 08BEc3Xj002494 for ; Fri, 11 Sep 2020 10:38:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id 95B308FCA1; Fri, 11 Sep 2020 14:38:03 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.92]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0AD8A8FCA6 for ; Fri, 11 Sep 2020 14:38:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599835109; 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=l3VRPnQnGtQigNrQe0288L64iBx7F7QDLZv+xP/YNCY=; b=Sucqngm2GYWiCOvRt8KIs4RirJx56WBvMOhSEdRAa2TblDiVYoHtMB8J7DTQMRpC818wTC GMxwXNa1OYxqZpklCaZbEk9hZz5eoqyZjxBdxvlNPrPout0AIMHTnOqDYB4QjJkpHo17NR a+MK9z+1efSk0l5KnGrMPR0qD2NIzTU= X-MC-Unique: E5hX65reOi-Y875D81MjIA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 17/17] qemuxml2argvtest: hostdev-scsi-virtio-scsi: Use longer user-alias for SCSI hostdev Date: Fri, 11 Sep 2020 16:37:35 +0200 Message-Id: <08a011f640dd067ae1f015a4c81151842ed77958.1599834862.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 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.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" Test that we can cope with a long useralias when generating SCSI hostdev commandline. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- .../hostdev-scsi-virtio-scsi.x86_64-2.8.0.args | 8 +++++--- .../hostdev-scsi-virtio-scsi.x86_64-4.1.0.args | 8 +++++--- .../hostdev-scsi-virtio-scsi.x86_64-latest.args | 2 +- tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml | 2 +- tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml | 2 +- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-2.8.0.a= rgs b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-2.8.0.args index 07b7a5b113..3f007db2c3 100644 --- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-2.8.0.args +++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-2.8.0.args @@ -37,9 +37,11 @@ drive=3Ddrive-hostdev0,id=3Dhostdev0 \ -drive file=3D/dev/sg0,if=3Dnone,format=3Draw,id=3Ddrive-hostdev1,readonly= =3Don \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D7,\ drive=3Ddrive-hostdev1,id=3Dhostdev1 \ --drive file=3D/dev/sg0,if=3Dnone,format=3Draw,id=3Ddrive-ua-test \ --device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D6,drive= =3Ddrive-ua-test,\ -id=3Dua-test \ +-drive file=3D/dev/sg0,if=3Dnone,format=3Draw,\ +id=3Ddrive-ua-7996c8dc-a4fa-4012-b76f-043d20144263 \ +-device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D6,\ +drive=3Ddrive-ua-7996c8dc-a4fa-4012-b76f-043d20144263,\ +id=3Dua-7996c8dc-a4fa-4012-b76f-043d20144263 \ -drive file=3Discsi://example.org:3260/iqn.1992-01.com.example/0,if=3Dnone= ,\ format=3Draw,id=3Ddrive-hostdev2 \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D2,lun=3D4,\ 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 421edf90d0..eb11d8f733 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 @@ -36,9 +36,11 @@ drive=3Ddrive-hostdev0,id=3Dhostdev0 \ -drive file=3D/dev/sg0,if=3Dnone,format=3Draw,id=3Ddrive-hostdev1,readonly= =3Don \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D7,\ drive=3Ddrive-hostdev1,id=3Dhostdev1 \ --drive file=3D/dev/sg0,if=3Dnone,format=3Draw,id=3Ddrive-ua-test \ --device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D6,drive= =3Ddrive-ua-test,\ -id=3Dua-test \ +-drive file=3D/dev/sg0,if=3Dnone,format=3Draw,\ +id=3Ddrive-ua-7996c8dc-a4fa-4012-b76f-043d20144263 \ +-device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D6,\ +drive=3Ddrive-ua-7996c8dc-a4fa-4012-b76f-043d20144263,\ +id=3Dua-7996c8dc-a4fa-4012-b76f-043d20144263 \ -drive file.driver=3Discsi,file.portal=3Dexample.org:3260,\ file.target=3Diqn.1992-01.com.example,file.lun=3D0,file.transport=3Dtcp,if= =3Dnone,\ format=3Draw,id=3Ddrive-hostdev2 \ 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 147ab40c9a..47c3f09db5 100644 --- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args +++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.x86_64-latest.args @@ -45,7 +45,7 @@ drive=3Dlibvirt-3-backend,id=3Dhostdev1 \ -blockdev '{"driver":"host_device","filename":"/dev/sg0",\ "node-name":"libvirt-4-backend","read-only":false}' \ -device scsi-generic,bus=3Dscsi0.0,channel=3D0,scsi-id=3D4,lun=3D6,\ -drive=3Dlibvirt-4-backend,id=3Dua-test \ +drive=3Dlibvirt-4-backend,id=3Dua-7996c8dc-a4fa-4012-b76f-043d20144263 \ -blockdev '{"driver":"iscsi","portal":"example.org:3260",\ "target":"iqn.1992-01.com.example","lun":0,"transport":"tcp",\ "node-name":"libvirt-5-backend","read-only":false}' \ diff --git a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml b/tests/qe= muxml2argvdata/hostdev-scsi-virtio-scsi.xml index 8da3fb1bfc..4903a75d13 100644 --- a/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml +++ b/tests/qemuxml2argvdata/hostdev-scsi-virtio-scsi.xml @@ -45,7 +45,7 @@
- +
diff --git a/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml b/tests/= qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml index 733d1d72a0..3a2b10d815 100644 --- a/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml +++ b/tests/qemuxml2xmloutdata/hostdev-scsi-virtio-scsi.xml @@ -52,7 +52,7 @@
- +
--=20 2.26.2