From nobody Sun Feb 8 20:53:42 2026 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