From nobody Wed May 14 12:46:54 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 1523372468017126.25026708848395; Tue, 10 Apr 2018 08:01:08 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 26B49D5983; Tue, 10 Apr 2018 15:01:06 +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 2C4A26AFE0; Tue, 10 Apr 2018 15:01: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 F2D2B4CABD; Tue, 10 Apr 2018 15:00:22 +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 w3AEwLp0013394 for ; Tue, 10 Apr 2018 10:58:21 -0400 Received: by smtp.corp.redhat.com (Postfix) id B84062024CA4; Tue, 10 Apr 2018 14:58:21 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.192]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5FDA42024CA7 for ; Tue, 10 Apr 2018 14:58:21 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Tue, 10 Apr 2018 16:58:07 +0200 Message-Id: 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 Subject: [libvirt] [PATCH v4 05/14] qemu: Store pr runtime data in status XML 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.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 10 Apr 2018 15:01:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Now that we generate pr-manager alias and socket path store them in status XML so that they are preserved across daemon restarts. Signed-off-by: Michal Privoznik --- src/qemu/qemu_domain.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++= ++++ 1 file changed, 64 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 361a80be84..0856f04406 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1961,13 +1961,74 @@ qemuDomainObjPrivateFree(void *data) } =20 =20 +static int +qemuStorageSourcePrivateDataParsePR(xmlXPathContextPtr ctxt, + virStorageSourcePtr src) +{ + qemuDomainStorageSourcePrivatePtr srcPriv =3D QEMU_DOMAIN_STORAGE_SOUR= CE_PRIVATE(src); + qemuDomainDiskPRDPtr prd =3D NULL; + int rc; + int ret =3D -1; + + if ((rc =3D virXPathBoolean("boolean(./prd)", ctxt)) =3D=3D 0) { + return 0; + } else if (rc < 0) { + return ret; + } + + if (VIR_ALLOC(prd) < 0) + return ret; + + if (!(prd->alias =3D virXPathString("string(./prd/alias)", ctxt)) || + !(prd->path =3D virXPathString("string(./prd/path)", ctxt))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("malformed ")); + goto cleanup; + } + + VIR_STEAL_PTR(srcPriv->prd, prd); + ret =3D 0; + cleanup: + qemuDomainDiskPRDFree(prd); + return ret; +} + + +static int +qemuStorageSourcePrivateDataFormatPR(virStorageSourcePtr src, + virBufferPtr buf) +{ + qemuDomainStorageSourcePrivatePtr srcPriv =3D QEMU_DOMAIN_STORAGE_SOUR= CE_PRIVATE(src); + qemuDomainDiskPRDPtr prd; + + if (!srcPriv || !srcPriv->prd) + return 0; + + prd =3D srcPriv->prd; + + virBufferAddLit(buf, "\n"); + virBufferAdjustIndent(buf, 2); + virBufferAsprintf(buf, "%s\n", prd->alias); + virBufferEscapeString(buf, "%s\n", prd->path); + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); + return 0; +} + + static int qemuStorageSourcePrivateDataParse(xmlXPathContextPtr ctxt, virStorageSourcePtr src) { + if (!(src->privateData =3D qemuDomainStorageSourcePrivateNew())) + return -1; + if (virStorageSourcePrivateDataParseRelPath(ctxt, src) < 0) return -1; =20 + if (qemuStorageSourcePrivateDataParsePR(ctxt, src) < 0) + return -1; + return 0; } =20 @@ -1979,6 +2040,9 @@ qemuStorageSourcePrivateDataFormat(virStorageSourcePt= r src, if (virStorageSourcePrivateDataFormatRelPath(src, buf) < 0) return -1; =20 + if (qemuStorageSourcePrivateDataFormatPR(src, buf) < 0) + return -1; + return 0; } =20 --=20 2.16.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list