From nobody Mon May 6 22:15:40 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=1635778084; cv=none; d=zohomail.com; s=zohoarc; b=iqNcXFZ4+nj9OOOx/EkjZP253v3sbiVd4oHg9VU9ARK/9o6dBXM5VP2RHZfVmq4kSFyC+iJEyjxpkscIWPfRdxPwpHiA5pf8fuYmMbQel74Hv5swFrC6Wswl8UYHhAhMW6ij15ES1wLksTm6VNr79mjVBt8AG/tf1R9tzA4n2/c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635778084; 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=Ek3MYRHZI/GeI9GCPG5vEgZRmlRYRCaZZWT8q0WHnvE=; b=TQG6rlTQW+Qvyv19+LpkVBABFALS5WWmIPgBcjRX4lXslqP6010myk+ES27JTjN4tJupcSQdgNNTSxIs8YCGQ+p9Z7Cmn0M8Op2RGbKPbVwtj37rj9S9VtOnMX8L0q+mtatXLNX2CsCYS0LVpUGIKkZpwD8j5wA2EhcWUeHc750= 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) 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 1635778084650392.1789190487367; Mon, 1 Nov 2021 07:48:04 -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-389-KFW0cx1HPYOSRjXeXEzFnA-1; Mon, 01 Nov 2021 10:48:02 -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 4F9101006AA2; Mon, 1 Nov 2021 14:47:57 +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 310FA60C17; Mon, 1 Nov 2021 14:47:57 +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 005024EA37; Mon, 1 Nov 2021 14:47:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1A1ElpMY026259 for ; Mon, 1 Nov 2021 10:47:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id F1C6A60C17; Mon, 1 Nov 2021 14:47:51 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4C66060C0F for ; Mon, 1 Nov 2021 14:47:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635778083; 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=Ek3MYRHZI/GeI9GCPG5vEgZRmlRYRCaZZWT8q0WHnvE=; b=bOI2C1B8dZtg6J0ElQ1pj7errQRhTg0OPaNAy/J8wuUbBx8BArIP8E6WmGfOMI58nccCIQ DyB/V5D5RwzN8cYRFO41Jov5BVoVDszTK/zLyF4UsrZJkDIFnQvISflh7rDsLVterds2jA I6z+CWa4mHRBfmT5HRAphcjBYk3y/bc= X-MC-Unique: KFW0cx1HPYOSRjXeXEzFnA-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 1/4] virDomainBackupDefFormat: Propagate private data callbacks Date: Mon, 1 Nov 2021 15:47:45 +0100 Message-Id: <644712d647d8ccaf6f2777e6f3077d6ed8491b18.1635777907.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635778085389100001 Content-Type: text/plain; charset="utf-8" The formatter for the backup job data didn't pass the virDomainXMLOption struct to the disk formatter which meant that the private data of the disk source were not formatted. This didn't pose a problem for now as the blockjob list remembered the nodenames for the jobs, but the backup source lost them. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/backup_conf.c | 10 ++++++---- src/conf/backup_conf.h | 3 ++- src/qemu/qemu_backup.c | 4 +++- src/qemu/qemu_domain.c | 2 +- tests/genericxml2xmltest.c | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/conf/backup_conf.c b/src/conf/backup_conf.c index 694553a544..2a7fa95e0c 100644 --- a/src/conf/backup_conf.c +++ b/src/conf/backup_conf.c @@ -318,7 +318,8 @@ static int virDomainBackupDiskDefFormat(virBuffer *buf, virDomainBackupDiskDef *disk, bool push, - bool internal) + bool internal, + virDomainXMLOption *xmlopt) { g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); @@ -358,7 +359,7 @@ virDomainBackupDiskDefFormat(virBuffer *buf, if (virDomainDiskSourceFormat(&childBuf, disk->store, sourcename, 0, false, storageSourceFormatFlags, - false, false, NULL) < 0) + false, false, xmlopt) < 0) return -1; } @@ -390,7 +391,8 @@ virDomainBackupDefFormatPrivate(virBuffer *buf, int virDomainBackupDefFormat(virBuffer *buf, virDomainBackupDef *def, - bool internal) + bool internal, + virDomainXMLOption *xmlopt) { g_auto(virBuffer) attrBuf =3D VIR_BUFFER_INITIALIZER; g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); @@ -418,7 +420,7 @@ virDomainBackupDefFormat(virBuffer *buf, for (i =3D 0; i < def->ndisks; i++) { if (virDomainBackupDiskDefFormat(&disksChildBuf, &def->disks[i], def->type =3D=3D VIR_DOMAIN_BACKU= P_TYPE_PUSH, - internal) < 0) + internal, xmlopt) < 0) return -1; } diff --git a/src/conf/backup_conf.h b/src/conf/backup_conf.h index b682da1c95..dc66b75892 100644 --- a/src/conf/backup_conf.h +++ b/src/conf/backup_conf.h @@ -123,7 +123,8 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC(virDomainBackupDef, virDo= mainBackupDefFree); int virDomainBackupDefFormat(virBuffer *buf, virDomainBackupDef *def, - bool internal); + bool internal, + virDomainXMLOption *xmlopt); int virDomainBackupAlignDisks(virDomainBackupDef *backup, virDomainDef *dom, diff --git a/src/qemu/qemu_backup.c b/src/qemu/qemu_backup.c index abbfcf3682..9fa8d2f02e 100644 --- a/src/qemu/qemu_backup.c +++ b/src/qemu/qemu_backup.c @@ -954,6 +954,8 @@ char * qemuBackupGetXMLDesc(virDomainObj *vm, unsigned int flags) { + qemuDomainObjPrivate *priv =3D vm->privateData; + g_auto(virBuffer) buf =3D VIR_BUFFER_INITIALIZER; virDomainBackupDef *backup; @@ -962,7 +964,7 @@ qemuBackupGetXMLDesc(virDomainObj *vm, if (!(backup =3D qemuDomainGetBackup(vm))) return NULL; - if (virDomainBackupDefFormat(&buf, backup, false) < 0) + if (virDomainBackupDefFormat(&buf, backup, false, priv->driver->xmlopt= ) < 0) return NULL; return virBufferContentAndReset(&buf); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 209337404a..fb203bc830 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -2152,7 +2152,7 @@ qemuDomainObjPrivateXMLFormatBackups(virBuffer *buf, g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); if (priv->backup && - virDomainBackupDefFormat(&childBuf, priv->backup, true) < 0) + virDomainBackupDefFormat(&childBuf, priv->backup, true, priv->driv= er->xmlopt) < 0) return -1; virXMLFormatElement(buf, "backups", &attrBuf, &childBuf); diff --git a/tests/genericxml2xmltest.c b/tests/genericxml2xmltest.c index a6f974e758..34ccaff615 100644 --- a/tests/genericxml2xmltest.c +++ b/tests/genericxml2xmltest.c @@ -114,7 +114,7 @@ testCompareBackupXML(const void *opaque) return -1; } - if (virDomainBackupDefFormat(&buf, backup, data->internal) < 0) { + if (virDomainBackupDefFormat(&buf, backup, data->internal, NULL) < 0) { VIR_TEST_VERBOSE("failed to format backup def '%s'", file_in); return -1; } --=20 2.31.1 From nobody Mon May 6 22:15:40 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=1635778084; cv=none; d=zohomail.com; s=zohoarc; b=JmwgeGtNpF6L2rtyb4U4dM0WiRmxYb9EOoPGaZckBnCydGy3eigUkiCmSMThjgix33ZQouT/v38l7r85fNHAFZ1HxiCwasceKIAyMsXCYHOzdeR9259nMjn8iE1egR3nGNlRWpQHSI/UtrPnjapU+wl2AJWXSNGNWXfJ+4d9Dls= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635778084; 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=rIV5MQpkjU0ntWGZgmzpuAffr7UehOOcsrsH9VixcKM=; b=ef/zSmnrC3Xo8CkTkeGEZb3MVAT0hwOJIyrHc1lxcwY+92Q4VCUalRPR5mksmlwBocNmfdZF2s+JQjhUsE/opf+0SWHBkUIhuQXzEAro7G2edltEZ50Fzq9QmyVUgLgYcohINSXhqx+EvCvTfKor0QES6w9zaq2aTCmvnNfWCtY= 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) 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 1635778084944298.3668851620307; Mon, 1 Nov 2021 07:48:04 -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-479-hWjKz_W2NKC1xzfyTqpQXg-1; Mon, 01 Nov 2021 10:48:02 -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 E5B3110A8E0B; Mon, 1 Nov 2021 14:47:56 +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 A44F160C0F; Mon, 1 Nov 2021 14:47:56 +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 6FB361806D03; Mon, 1 Nov 2021 14:47:56 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1A1Elrs2026273 for ; Mon, 1 Nov 2021 10:47:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1AF1960C17; Mon, 1 Nov 2021 14:47:53 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6A03F60C0F for ; Mon, 1 Nov 2021 14:47:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635778083; 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=rIV5MQpkjU0ntWGZgmzpuAffr7UehOOcsrsH9VixcKM=; b=i9Di8/cyxp2Wrs7KeWo2ctEovMGwLc4qRcwC/Jyou4JZPSd6EKymS7Zo8An9AGOwYndvu7 WFuj7pFXtlBVkMqg7ygwef9I6aoi8k0/DJxE0T6AoO2uOBrL8mlimfFkl7KCvDLejyblFQ k8GI+BvUGXSwxkmZTOkJI7KRVD44qAc= X-MC-Unique: hWjKz_W2NKC1xzfyTqpQXg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/4] qemustatusxml2xmldata: backup-pull: Add private data for scratch image Date: Mon, 1 Nov 2021 15:47:46 +0100 Message-Id: <84f3d50a544e0126bc4d19d17bf91edf9736839c.1635777907.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635779000312100001 Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- tests/qemustatusxml2xmldata/backup-pull-in.xml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/qemustatusxml2xmldata/backup-pull-in.xml b/tests/qemusta= tusxml2xmldata/backup-pull-in.xml index 95afd3a51f..59c934d4f7 100644 --- a/tests/qemustatusxml2xmldata/backup-pull-in.xml +++ b/tests/qemustatusxml2xmldata/backup-pull-in.xml @@ -257,7 +257,14 @@ - + + + + + + + + --=20 2.31.1 From nobody Mon May 6 22:15:40 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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.129.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=1635778156; cv=none; d=zohomail.com; s=zohoarc; b=dZ/NpPJoMmsSL3roOquLQkHaO0d5AuHqnOI17eAkICL7/5E6K7EiwAsHDR+TxQM13DZuF1eIWsgoU7BUPVJ6RPIc8/05D0F4oFF7VHovLuckzTcZuP87+A5BAMxO8V7YejeXqVdY4zd/+3V96Hs8fh2kFpCu4ZEivd+xZEt3yZk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635778156; 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=JR0iZMmnbK4+ultWvPYFnSS8+VFhWoY6tp+fCReNNK4=; b=ReqQmM8hIZNyjqCmBo/O8l3DTl0e4fEcQnZ7W197Rh6tkffMNeaMImDYgups00w/0GtM1Hb9CiBqEVYL2tc90HZJvqeJRvoR9HYUKxNualBfzxLmX1Rmi2Y7wW4Xpjti0a0OOKE2mxZOjmq7hm1WZeW2HATJdAOLl6NYnEbMJ/s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1635778156443768.815763262046; Mon, 1 Nov 2021 07:49:16 -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-139-4aiUUW9CNEiwkwmtJIqKSg-1; Mon, 01 Nov 2021 10:48:07 -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 D1F8D80A5DB; Mon, 1 Nov 2021 14:47:59 +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 AEB393AA2; Mon, 1 Nov 2021 14:47:59 +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 7AFA41818480; Mon, 1 Nov 2021 14:47:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1A1ElsAG026279 for ; Mon, 1 Nov 2021 10:47:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id 2A6D360C17; Mon, 1 Nov 2021 14:47:54 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 872F160C0F for ; Mon, 1 Nov 2021 14:47:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635778155; 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=JR0iZMmnbK4+ultWvPYFnSS8+VFhWoY6tp+fCReNNK4=; b=I7QqcoDea5pFAlsBYO6npCNlYrePkhETW7C2R+NH2RmxvUrWB6FjwR9v7hme7X58zuzkjK +DmCUU6Q3Og9dXCEhiSW7N33l/+qYE4O1LKd355l1lf/BDY+zonZ3DysNvFgjAJPxgDMiF UYT05x6wK+wgDmFSsET9oX8hHdJ1O5s= X-MC-Unique: 4aiUUW9CNEiwkwmtJIqKSg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 3/4] qemuMonitorJSONQueryBlockstats: query stats for helper images Date: Mon, 1 Nov 2021 15:47:47 +0100 Message-Id: <22ec6938d60af71ba1d50677275424dfa1a01527.1635777907.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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) X-ZM-MESSAGEID: 1635778157111100001 Content-Type: text/plain; charset="utf-8" Use the 'query-nodes' flag to return all stats. The flag was introduced prior to qemu-2.11 so we can always use it, but we invoke it only when querying stats. The other invocation is used for detecting the nodenames which is fragile code. The images without a frontend don't have the device field so the extraction code checks need to be relaxed. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_monitor.c | 4 ++-- src/qemu/qemu_monitor_json.c | 20 +++++++++----------- src/qemu/qemu_monitor_json.h | 3 ++- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 908ee0d302..1fbf1eb5c7 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -2038,14 +2038,14 @@ qemuMonitorGetBlockInfo(qemuMonitor *mon) * qemuMonitorQueryBlockstats: * @mon: monitor object * - * Returns data from a call to 'query-blockstats'. + * Returns data from a call to 'query-blockstats' without using 'query-nod= es' */ virJSONValue * qemuMonitorQueryBlockstats(qemuMonitor *mon) { QEMU_CHECK_MONITOR_NULL(mon); - return qemuMonitorJSONQueryBlockstats(mon); + return qemuMonitorJSONQueryBlockstats(mon, false); } diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index e9be9bdabd..7f5d9f7cad 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -2435,12 +2435,15 @@ qemuMonitorJSONGetOneBlockStatsInfo(virJSONValue *d= ev, virJSONValue * -qemuMonitorJSONQueryBlockstats(qemuMonitor *mon) +qemuMonitorJSONQueryBlockstats(qemuMonitor *mon, + bool queryNodes) { g_autoptr(virJSONValue) cmd =3D NULL; g_autoptr(virJSONValue) reply =3D NULL; - if (!(cmd =3D qemuMonitorJSONMakeCommand("query-blockstats", NULL))) + if (!(cmd =3D qemuMonitorJSONMakeCommand("query-blockstats", + "B:query-nodes", queryNodes, + NULL))) return NULL; if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0) @@ -2462,7 +2465,7 @@ qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitor *mon, size_t i; g_autoptr(virJSONValue) devices =3D NULL; - if (!(devices =3D qemuMonitorJSONQueryBlockstats(mon))) + if (!(devices =3D qemuMonitorJSONQueryBlockstats(mon, true))) return -1; for (i =3D 0; i < virJSONValueArraySize(devices); i++) { @@ -2476,16 +2479,11 @@ qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitor *mo= n, return -1; } - if (!(dev_name =3D virJSONValueObjectGetString(dev, "device"))) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("blockstats device entry was not " - "in expected format")); - return -1; + if ((dev_name =3D virJSONValueObjectGetString(dev, "device"))) { + if (*dev_name =3D=3D '\0') + dev_name =3D NULL; } - if (*dev_name =3D=3D '\0') - dev_name =3D NULL; - rc =3D qemuMonitorJSONGetOneBlockStatsInfo(dev, dev_name, 0, hash); if (rc < 0) diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index f9e01e5bf5..aa70d35bfb 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -75,7 +75,8 @@ int qemuMonitorJSONSetMemoryStatsPeriod(qemuMonitor *mon, int qemuMonitorJSONGetBlockInfo(qemuMonitor *mon, GHashTable *table); -virJSONValue *qemuMonitorJSONQueryBlockstats(qemuMonitor *mon); +virJSONValue *qemuMonitorJSONQueryBlockstats(qemuMonitor *mon, + bool queryNodes); int qemuMonitorJSONGetAllBlockStatsInfo(qemuMonitor *mon, GHashTable *hash); int qemuMonitorJSONBlockStatsUpdateCapacity(qemuMonitor *mon, --=20 2.31.1 From nobody Mon May 6 22:15:40 2024 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=1635778089; cv=none; d=zohomail.com; s=zohoarc; b=WDe6Ap9pgTqckCAX+LTP1+/B5B9a10Pn2QH9dwsQfkEF2RVsWtiCrboy9Xq+tCpPHJIyoYBBnRqtBxWshns7o+jIw4ssg2Tz6qfdRpPSCkU+kug3+2s6G95iQBsbNHFufLNGTJaz33VmGVmv/LU5dyq8vDQ0JxbI/xV6ojpDQ2o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1635778089; 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=iCFjdD1rwg6gqfvpyCkHnb1RxOxY6OeEQEv2mfD5dDk=; b=TjRaI98DMyrw04ibccI1x2HxfLzlUXtbSnhoUM4hSAwYZxlQf9IYqBVvZihg7xeFaZAqbHsWSyeH6LekTeF5LFFXVoOtWmRV+6tMg8Sk6eagWvUmYIGmMt3lHS5LZG/x2mjQUIw5GVfbfVuwQdXH21BzXoFcETGcdVQ1XM9m0pk= 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) 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 1635778089936899.3763157535494; Mon, 1 Nov 2021 07:48:09 -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-554-Cs6DYa7nOe2R0ksKioTh6A-1; Mon, 01 Nov 2021 10:48:07 -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 4F03E8030A0; Mon, 1 Nov 2021 14:48:00 +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 28BF75F4F7; Mon, 1 Nov 2021 14:48:00 +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 DAC844EA39; Mon, 1 Nov 2021 14:47:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1A1EltZs026284 for ; Mon, 1 Nov 2021 10:47:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5032B60C17; Mon, 1 Nov 2021 14:47:55 +0000 (UTC) Received: from speedmetal.lan (unknown [10.40.208.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E3F360C0F for ; Mon, 1 Nov 2021 14:47:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1635778088; 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=iCFjdD1rwg6gqfvpyCkHnb1RxOxY6OeEQEv2mfD5dDk=; b=g0Va2l0B3PdDPwk4jQVT9o2nzh6i0QcJ04g8D9FLgXiG90umsQnnQKtsv5T3f4RJ1RETWK gZNzQiZTWRXWNLCiN3sikfSsYhPK+mSKDnJZGRRq2iO4VsMzIgjRQTHDkus+dQ0fF2pekK hMDHj4L1dNvPoKVRJEUJm8B/N/f9DfA= X-MC-Unique: Cs6DYa7nOe2R0ksKioTh6A-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/4] qemuDomainGetStatsBlockExportDisk: Report stats also for helper images Date: Mon, 1 Nov 2021 15:47:48 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 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 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1635778091718100001 Content-Type: text/plain; charset="utf-8" Add stat entries also for the mirror destination and the backup job scratch/target file. This is possible with '-blockdev' as we use unique index for the entries. The stats are reported when the VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING is used. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2017928 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 61 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 70b5f37e6b..7d13ae9754 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -113,6 +113,7 @@ #include "virdomaincheckpointobjlist.h" #include "virsocket.h" #include "virutil.h" +#include "backup_conf.h" #define VIR_FROM_THIS VIR_FROM_QEMU @@ -18453,6 +18454,66 @@ qemuDomainGetStatsBlockExportDisk(virDomainDiskDef= *disk, break; } + /* in blockdev mode where we can properly and uniquely identify images= we + * can also report stats for the mirror target or the scratch image or= target + * of a backup operation */ + if (visitBacking && blockdev) { + qemuDomainObjPrivate *priv =3D dom->privateData; + + if (disk->mirror && + disk->mirrorJob =3D=3D VIR_DOMAIN_BLOCK_JOB_TYPE_COPY) { + if (qemuDomainGetStatsBlockExportHeader(disk, disk->mirror, *r= ecordnr, params) < 0) + return -1; + + if (qemuDomainGetStatsOneBlock(driver, cfg, dom, params, + disk->mirror->nodeformat, + disk->mirror, + *recordnr, + stats) < 0) + return -1; + + if (qemuDomainGetStatsBlockExportBackendStorage(disk->mirror->= nodestorage, + stats, *record= nr, + params) < 0) + return -1; + + (*recordnr)++; + } + + if (priv->backup) { + size_t i; + + for (i =3D 0; i < priv->backup->ndisks; i++) { + virDomainBackupDiskDef *backupdisk =3D priv->backup->disks= + i; + + if (STRNEQ(disk->dst, priv->backup->disks[i].name)) + continue; + + if (backupdisk->store) { + if (qemuDomainGetStatsBlockExportHeader(disk, backupdi= sk->store, + *recordnr, par= ams) < 0) + return -1; + + if (qemuDomainGetStatsOneBlock(driver, cfg, dom, param= s, + backupdisk->store->node= format, + backupdisk->store, + *recordnr, + stats) < 0) + return -1; + + if (qemuDomainGetStatsBlockExportBackendStorage(backup= disk->store->nodestorage, + stats,= *recordnr, + params= ) < 0) + return -1; + + (*recordnr)++; + } + + break; + } + } + } + return 0; } --=20 2.31.1