From nobody Sun Feb 8 23:05:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.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=1622125467; cv=none; d=zohomail.com; s=zohoarc; b=ahEzLEKvZwf33Iz0HD2Y8kx1BCwrAOMhc8nZ9T50dSFvmaxaV+jipht0vGeQW0B9xAd4xsAy1yvPVlRuhl/3LVAmAOfMAIcFRLcTdrQPuSregREk1rNZtJSqzRqIxsHyO+OG5eVCh+hQz4PteUSUcTRQkCSwL06prfp6TSFXN00= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1622125467; 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=AYEAzAXEXBkYoZNUVKTiR226SJ1YNs6Tvpkc3jDSd5w=; b=ZJnyGR5DpHZG4TlDBLtx6lszGu0EjGf7ZVg1jsnU4yu0af0sr3vO0wtXS2Ucc305TuhaWHU7fHrUkqfynGBJLIcNgeslSdju4TqOlWOCvXPitChP2faDlN2u2cX3QFQypxDAKHyguMpC9CeV7q0lgr/AKmH7s9ikPNwqu+bbSLI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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 [170.10.133.124]) by mx.zohomail.com with SMTPS id 1622125466776126.07261554218269; Thu, 27 May 2021 07:24:26 -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-376-ffjEVndIN_StbjED1mh1RQ-1; Thu, 27 May 2021 10:24:21 -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 598231009461; Thu, 27 May 2021 14:24:15 +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 2EB0419C66; Thu, 27 May 2021 14:24:15 +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 E7278180B463; Thu, 27 May 2021 14:24:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14RENVYu028348 for ; Thu, 27 May 2021 10:23:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id EDFC910023AF; Thu, 27 May 2021 14:23:31 +0000 (UTC) Received: from antique-work.redhat.com (unknown [10.40.193.112]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6DB8E100EBB0 for ; Thu, 27 May 2021 14:23:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1622125463; 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=AYEAzAXEXBkYoZNUVKTiR226SJ1YNs6Tvpkc3jDSd5w=; b=hAiBMUB5vBM0LF0adD8N5n5AKmMB39SSU/bRr8Ai/J9+JGgj+r2NvlU0WOzCLe5PSe962g V8gYTQn+A31rVefNcqiN4bs8ECeMzJuCvft6bOY/ROT6raFJaaXAWiecn2k5iAB9WppIaZ NOexiZ5qQSRZn3ljgCuS/oOF9AoGjM4= X-MC-Unique: ffjEVndIN_StbjED1mh1RQ-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 1/2] domain_conf: extract disk driver source bits to its own function Date: Thu, 27 May 2021 16:23:25 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 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 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Attribute `type` and sub-element `metadata_cache` are internally stored in the `virStorageSource` structure. Sometimes we only care about the disk source bits so we need a dedicated helper for that. Signed-off-by: Pavel Hrdina --- src/conf/domain_conf.c | 46 ++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 6d90041bf8..f7920bce2c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8849,7 +8849,6 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def, xmlNodePtr cur, xmlXPathContextPtr ctxt) { - g_autofree char *tmp =3D NULL; VIR_XPATH_NODE_AUTORESTORE(ctxt) =20 ctxt->node =3D cur; @@ -8900,19 +8899,6 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def, if (virXMLPropUInt(cur, "iothread", 10, VIR_XML_PROP_NONZERO, &def->io= thread) < 0) return -1; =20 - if ((tmp =3D virXMLPropString(cur, "type"))) { - if (STREQ(tmp, "aio")) { - /* Xen back-compat */ - def->src->format =3D VIR_STORAGE_FILE_RAW; - } else { - if ((def->src->format =3D virStorageFileFormatTypeFromString(t= mp)) <=3D 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("unknown driver format value '%s'"), tmp); - return -1; - } - } - } - if (virXMLPropEnum(cur, "detect_zeroes", virDomainDiskDetectZeroesTypeFromString, VIR_XML_PROP_NONZERO, &def->detect_zeroes) < 0) @@ -8921,9 +8907,36 @@ virDomainDiskDefDriverParseXML(virDomainDiskDef *def, if (virXMLPropUInt(cur, "queues", 10, VIR_XML_PROP_NONE, &def->queues)= < 0) return -1; =20 + return 0; +} + + +static int +virDomainDiskDefDriverSourceParseXML(virStorageSource *src, + xmlNodePtr cur, + xmlXPathContextPtr ctxt) +{ + g_autofree char *tmp =3D NULL; + VIR_XPATH_NODE_AUTORESTORE(ctxt) + + ctxt->node =3D cur; + + if ((tmp =3D virXMLPropString(cur, "type"))) { + if (STREQ(tmp, "aio")) { + /* Xen back-compat */ + src->format =3D VIR_STORAGE_FILE_RAW; + } else { + if ((src->format =3D virStorageFileFormatTypeFromString(tmp)) = <=3D 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unknown driver format value '%s'"), tmp); + return -1; + } + } + } + if (virParseScaledValue("./metadata_cache/max_size", NULL, ctxt, - &def->src->metadataCacheMaxSize, + &src->metadataCacheMaxSize, 1, ULLONG_MAX, false) < 0) return -1; =20 @@ -9129,6 +9142,9 @@ virDomainDiskDefParseXML(virDomainXMLOption *xmlopt, =20 if (virDomainDiskDefDriverParseXML(def, driverNode, ctxt) < 0) return NULL; + + if (virDomainDiskDefDriverSourceParseXML(def->src, driverNode, ctx= t) < 0) + return NULL; } =20 if ((mirrorNode =3D virXPathNode("./mirror", ctxt))) { --=20 2.31.1