From nobody Wed May 14 10:06:23 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1526294565181228.717962353477; Mon, 14 May 2018 03:42:45 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 58FECECFBC; Mon, 14 May 2018 10:42: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 E1E351001914; Mon, 14 May 2018 10:42:42 +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 72EA61808841; Mon, 14 May 2018 10:42:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w4EAgKj6003658 for ; Mon, 14 May 2018 06:42:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id C62C02026DEF; Mon, 14 May 2018 10:42:20 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4E11A2026E0E; Mon, 14 May 2018 10:42:20 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Mon, 14 May 2018 12:41:58 +0200 Message-Id: <9d42c701efd198d86b65b10c5370b036f85be551.1526294432.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 07/13] util: storage: Allow passing also for managed PR case X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 14 May 2018 10:42:44 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" To allow storing status information in the XML move the validation that the 'path' is not valid for managed PR daemon case into qemuDomainValidateStorageSource and allow parsing of the data even in case when managed=3D'yes'. Signed-off-by: Peter Krempa --- src/qemu/qemu_domain.c | 18 +++++++++++++----- src/util/virstoragefile.c | 37 ++++++++++++++++++------------------- 2 files changed, 31 insertions(+), 24 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index c8d2daa26f..eaa796260c 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4204,11 +4204,19 @@ qemuDomainValidateStorageSource(virStorageSourcePtr= src, } } - if (src->pr && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("reservations not supported with this QEMU binary= ")); - return -1; + if (src->pr) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_PR_MANAGER_HELPER)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("reservations not supported with this QEMU bi= nary")); + return -1; + } + + if (virStoragePRDefIsManaged(src->pr) && src->pr->path) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("'path' attribute should not be provided for " + "managed reservations")); + return -1; + } } return 0; diff --git a/src/util/virstoragefile.c b/src/util/virstoragefile.c index c89bdb9e49..dbbe758f30 100644 --- a/src/util/virstoragefile.c +++ b/src/util/virstoragefile.c @@ -1928,11 +1928,11 @@ virStoragePRDefParseXML(xmlXPathContextPtr ctxt) goto cleanup; } - if (prd->managed =3D=3D VIR_TRISTATE_BOOL_NO) { - type =3D virXPathString("string(./source[1]/@type)", ctxt); - path =3D virXPathString("string(./source[1]/@path)", ctxt); - mode =3D virXPathString("string(./source[1]/@mode)", ctxt); + type =3D virXPathString("string(./source[1]/@type)", ctxt); + path =3D virXPathString("string(./source[1]/@path)", ctxt); + mode =3D virXPathString("string(./source[1]/@mode)", ctxt); + if (prd->managed =3D=3D VIR_TRISTATE_BOOL_NO || type || path || mode) { if (!type) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing connection type for "= )); @@ -1950,24 +1950,23 @@ virStoragePRDefParseXML(xmlXPathContextPtr ctxt) _("missing connection mode for "= )); goto cleanup; } + } - if (STRNEQ(type, "unix")) { - virReportError(VIR_ERR_XML_ERROR, - _("unsupported connection type for : %s"), - type); - goto cleanup; - } - - if (STRNEQ(mode, "client")) { - virReportError(VIR_ERR_XML_ERROR, - _("unsupported connection mode for : %s"), - mode); - goto cleanup; - } + if (type && STRNEQ(type, "unix")) { + virReportError(VIR_ERR_XML_ERROR, + _("unsupported connection type for := %s"), + type); + goto cleanup; + } - VIR_STEAL_PTR(prd->path, path); + if (mode && STRNEQ(mode, "client")) { + virReportError(VIR_ERR_XML_ERROR, + _("unsupported connection mode for := %s"), + mode); + goto cleanup; } + VIR_STEAL_PTR(prd->path, path); VIR_STEAL_PTR(ret, prd); cleanup: @@ -1986,7 +1985,7 @@ virStoragePRDefFormat(virBufferPtr buf, { virBufferAsprintf(buf, "managed)); - if (prd->managed =3D=3D VIR_TRISTATE_BOOL_NO) { + if (prd->path) { virBufferAddLit(buf, ">\n"); virBufferAdjustIndent(buf, 2); virBufferAddLit(buf, "