From nobody Sun Sep 7 23:51:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1756454736; cv=none; d=zohomail.com; s=zohoarc; b=K6HrxhPvtHaPF+05ArrmCkOtN2Iq6/ygYEN57B2hXsDY/KcG53aBB1D+6LOYmiYqj0S9+n1XNi4obCN8PJB5r3RI0V5knnXxJ8h0qAbz43fZDKedxwRp8KFntvQnVzhxJrYedBYfnzmlvnEghfBrHDt9ln5ZA7DKCLcBptFtbWM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756454736; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=n+fK2dOy7uyZB6wrJNNAQHcdKcnhq4f8uEQ/qqw4RGE=; b=mXzUkUtwhdlkK9Gn6Ht/6cYjxnzNujdBP91wvE71B+bXP45dXsk2YtqC/q+tYZZ51Pz5ULmSTyt3F562OTk8ENYZJmnkodWUljp1HO7ZRGDQY9g/VdXeeFnrlcgPAw3QOxmen+wd5QKTeHXbp+2RbVtM33WKoTDklVi7Je35I+o= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1756454736093549.957990264999; Fri, 29 Aug 2025 01:05:36 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 1B7504416D; Fri, 29 Aug 2025 04:05:35 -0400 (EDT) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id B3CB044225; Fri, 29 Aug 2025 04:03:20 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id E398844073; Fri, 29 Aug 2025 04:03:01 -0400 (EDT) Received: from relay.virtuozzo.com (relay.virtuozzo.com [130.117.225.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id CC67444082 for ; Fri, 29 Aug 2025 04:02:57 -0400 (EDT) Received: from [130.117.225.5] (helo=dev012.ch-qa.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1urtZt-0064Cb-30; Fri, 29 Aug 2025 10:02:53 +0200 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=n+fK2dOy7uyZB6wrJNNAQHcdKcnhq4f8uEQ/qqw4RGE=; b=Xqprs24dBkmZ pzQXC0J5bbwxI2Xb62Pe3u33zaDbR+z8+gRgz5xHicFItuWy4aRok+cZSMGqJ+1nSf64koSiLvUhC RZ0cPimHoUgn7wz9L/bo32cSH2hF+ANQXhEat75SMTeIwNwSF2Ph8SboM8mGap3EV+9kJXG2Aj4/Q 1b/QZGQ75GbWwVpm25XNcnJYd4ahfDy2wP6KF7VR8Z23oCHnCaFtwv2HOAoZhh8+dFaeFIoIPXxL3 2xxN+em3P3VrFmABxhqQrLkB3lSQ4ZNQGpInSIgv3YYGY9Yc7dCMg+C0Gqji/S32FZy968IZPzu+R 6IWc+n2OVmQbM4si4qPQ7w==; To: devel@lists.libvirt.org Subject: [PATCH 1/2] api: remote: introduce virDomainBlockRebase2 API Date: Fri, 29 Aug 2025 10:55:29 +0300 Message-ID: <20250829080240.229601-2-nikolai.barybin@virtuozzo.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250829080240.229601-1-nikolai.barybin@virtuozzo.com> References: <20250829080240.229601-1-nikolai.barybin@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: 2P2XRMZSWNONSJ4ZNXB5GFQ7R5YET2KL X-Message-ID-Hash: 2P2XRMZSWNONSJ4ZNXB5GFQ7R5YET2KL X-MailFrom: nikolai.barybin@virtuozzo.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: den@openvz.org X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Nikolai Barybin via Devel Reply-To: Nikolai Barybin X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1756454739534116600 Content-Type: text/plain; charset="utf-8" This new API is a combination of virDomainBlockPull and virDomainBlockRebase (without copy mode) which supports extendable list of virTypedParameterPtr params. It is designed to allow more configurable use of underlying 'block-stream' QMP command. If "base" =3D=3D NULL and flags =3D=3D 0 it is equivalent to virDomainBlock= Pull. Signed-off-by: Nikolai Barybin --- include/libvirt/libvirt-domain.h | 43 +++++++++++++++++++++ src/driver-hypervisor.h | 8 ++++ src/libvirt-domain.c | 65 ++++++++++++++++++++++++++++++++ src/libvirt_public.syms | 5 +++ src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 17 ++++++++- src/remote_protocol-structs | 10 +++++ 7 files changed, 148 insertions(+), 1 deletion(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 71bb49fe6c..1124c9d58f 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -4459,6 +4459,49 @@ int virDomainBlockRebase(virDomainPtr dom, const cha= r *disk, const char *base, unsigned long bandwidth, unsigned int flags); =20 +/** + * VIR_DOMAIN_BLOCK_REBASE_PARAM_BASE: + * Macro for the virDomainBlockRebase2 parameter 'base'. + * Expects string specifying new base block device. + * + * Since: 11.8.0 + */ +#define VIR_DOMAIN_BLOCK_REBASE_PARAM_BASE "base" + +/** + * VIR_DOMAIN_BLOCK_REBASE_PARAM_BANDWIDTH_MIB: + * Macro for the virDomainBlockRebase2 parameter 'bandwidth-mib'. + * Expects desired bandwidth in MiB/s. + * + * Since: 11.8.0 + */ +#define VIR_DOMAIN_BLOCK_REBASE_PARAM_BANDWIDTH_MIB "bandwidth-mib" + +/** + * VIR_DOMAIN_BLOCK_REBASE_PARAM_BANDWIDTH_BYTES: + * Macro for the virDomainBlockRebase2 parameter 'bandwidth-bytes'. + * Expects desired bandwidth in Bytes/s. + * + * Since: 11.8.0 + */ +#define VIR_DOMAIN_BLOCK_REBASE_PARAM_BANDWIDTH_BYTES "bandwidth-bytes" + +/** + * virDomainBlockRebase2Flags: + * + * Flags available for virDomainBlockRebase2(). + * + * Since: 11.8.0 + */ +typedef enum { + /* Keep backing chain referenced using relative names (Since: 11.8.0)= */ + VIR_DOMAIN_BLOCK_REBASE_2_RELATIVE =3D 1 << 4, +} virDomainBlockRebase2Flags; + +int virDomainBlockRebase2(virDomainPtr dom, const char *disk, + virTypedParameterPtr params, int nparams, + unsigned int flags); + /** * virDomainBlockCopyFlags: * diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index 6a43688b0c..e64e00674c 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -1089,6 +1089,13 @@ typedef int unsigned long bandwidth, unsigned int flags); =20 +typedef int +(*virDrvDomainBlockRebase2)(virDomainPtr dom, + const char *path, + virTypedParameterPtr params, + int nparams, + unsigned int flags); + typedef int (*virDrvDomainBlockCopy)(virDomainPtr dom, const char *path, @@ -1681,6 +1688,7 @@ struct _virHypervisorDriver { virDrvDomainBlockJobSetSpeed domainBlockJobSetSpeed; virDrvDomainBlockPull domainBlockPull; virDrvDomainBlockRebase domainBlockRebase; + virDrvDomainBlockRebase2 domainBlockRebase2; virDrvDomainBlockCopy domainBlockCopy; virDrvDomainBlockCommit domainBlockCommit; virDrvConnectSetKeepAlive connectSetKeepAlive; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index ca110bdf85..58e3746a09 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -11197,6 +11197,71 @@ virDomainBlockRebase(virDomainPtr dom, const char = *disk, } =20 =20 +/** + * virDomainBlockRebase2: + * @dom: pointer to domain object + * @disk: path to the block device, or device shorthand + * @params: pointer to block rebase parameter + * @nparams: number of block rebase parameters + * @flags: bitwise-OR of virDomainBlockRebase2Flags + * + * Generelized version of virDomainBlockPull with more precise params sett= ing + * for underlying QMP 'block-stream'. + * + * VIR_DOMAIN_BLOCK_REBASE_PARAM_BASE in @params specifies intermidiate bl= ock device + * in a disk backing chain which will result in a new base for a given dis= k. If ommitted + * or NULL it is equavivalent to normal block pull, when whole backing cha= in is pulled + * into top image. + * + * VIR_DOMAIN_BLOCK_REBASE_PARAM_BANDWIDTH_MIB and VIR_DOMAIN_BLOCK_REBASE= _PARAM_BANDWIDTH_BYTES + * in @params specify bandwidth in MiB/s or Bytes/s respectively. + * + * If @flags contains VIR_DOMAIN_BLOCK_REBASE_2_RELATIVE, the name recorded + * into the active disk as the location for @base will be kept relative. + * The operation will fail if libvirt can't infer the name. + * + * Returns 0 if the operation has started, -1 on failure. + * + * Since: 11.8.0 + */ +int +virDomainBlockRebase2(virDomainPtr dom, + const char *disk, + virTypedParameterPtr params, + int nparams, + unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(dom, "disk=3D%s, params=3D%p, nparams=3D%u, flags=3D0= x%x", + disk, params, nparams, flags); + VIR_TYPED_PARAMS_DEBUG(params, nparams); + + virResetLastError(); + + virCheckDomainReturn(dom, -1); + conn =3D dom->conn; + + virCheckReadOnlyGoto(conn->flags, error); + virCheckNonNullArgGoto(disk, error); + + if (conn->driver->domainBlockRebase2) { + int ret; + ret =3D conn->driver->domainBlockRebase2(dom, disk, params, nparam= s, + flags); + if (ret < 0) + goto error; + return ret; + } + + virReportUnsupportedError(); + + error: + virDispatchError(dom->conn); + return -1; +} + + /** * virDomainBlockCopy: * @dom: pointer to domain object diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index c506acd2ed..aba336c6c3 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -956,4 +956,9 @@ LIBVIRT_11.2.0 { virDomainDelThrottleGroup; } LIBVIRT_10.2.0; =20 +LIBVIRT_11.8.0 { + global: + virDomainBlockRebase2; +} LIBVIRT_11.2.0; + # .... define new API here using predicted next version number .... diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index ec71eaed87..efda3255c0 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -7865,6 +7865,7 @@ static virHypervisorDriver hypervisor_driver =3D { .domainBlockJobSetSpeed =3D remoteDomainBlockJobSetSpeed, /* 0.9.4 */ .domainBlockPull =3D remoteDomainBlockPull, /* 0.9.4 */ .domainBlockRebase =3D remoteDomainBlockRebase, /* 0.9.10 */ + .domainBlockRebase2 =3D remoteDomainBlockRebase2, /* 11.8.0 */ .domainBlockCopy =3D remoteDomainBlockCopy, /* 1.2.9 */ .domainBlockCommit =3D remoteDomainBlockCommit, /* 0.10.2 */ .connectSetKeepAlive =3D remoteConnectSetKeepAlive, /* 0.9.8 */ diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 3c93203210..506cd146ad 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -119,6 +119,9 @@ const REMOTE_DOMAIN_NUMA_PARAMETERS_MAX =3D 16; /* Upper limit on list of perf events. */ const REMOTE_DOMAIN_PERF_EVENTS_MAX =3D 64; =20 +/* Upper limit on block rebase2 tunable parameters. */ +const REMOTE_DOMAIN_BLOCK_REBASE2_PARAMETERS_MAX =3D 16; + /* Upper limit on block copy tunable parameters. */ const REMOTE_DOMAIN_BLOCK_COPY_PARAMETERS_MAX =3D 16; =20 @@ -1440,6 +1443,12 @@ struct remote_domain_block_rebase_args { unsigned hyper bandwidth; unsigned int flags; }; +struct remote_domain_block_rebase2_args { + remote_nonnull_domain dom; + remote_nonnull_string path; + remote_typed_param params; + unsigned int flags; +}; struct remote_domain_block_copy_args { remote_nonnull_domain dom; remote_nonnull_string path; @@ -7119,5 +7128,11 @@ enum remote_procedure { * @generate: both * @acl: none */ - REMOTE_PROC_DOMAIN_EVENT_NIC_MAC_CHANGE =3D 453 + REMOTE_PROC_DOMAIN_EVENT_NIC_MAC_CHANGE =3D 453, + + /** + * @generate: both + * @acl: domain:block_write + */ + REMOTE_PROC_DOMAIN_BLOCK_REBASE2 =3D 454 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 0f87d13a5a..9cfb476fd9 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -1010,6 +1010,15 @@ struct remote_domain_block_rebase_args { uint64_t bandwidth; u_int flags; }; +struct remote_domain_block_rebase2_args { + remote_nonnull_domain dom; + remote_nonnull_string path; + struct { + u_int params_len; + remote_typed_param * params_val; + } params; + u_int flags; +}; struct remote_domain_block_copy_args { remote_nonnull_domain dom; remote_nonnull_string path; @@ -3791,4 +3800,5 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_SET_THROTTLE_GROUP =3D 451, REMOTE_PROC_DOMAIN_DEL_THROTTLE_GROUP =3D 452, REMOTE_PROC_DOMAIN_EVENT_NIC_MAC_CHANGE =3D 453, + REMOTE_PROC_DOMAIN_BLOCK_REBASE2 =3D 454, }; --=20 2.43.5 From nobody Sun Sep 7 23:51:09 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1756454814; cv=none; d=zohomail.com; s=zohoarc; b=HDHnsl5kJlZ9978cbxu+zHh3ktYmr0miBW/XiZy8fJianYBS/iZ0e/s37G+8RbgBEBeT8fhuCya6Q4cqYQTdG8MRh4k4GGjIn8J6HBi6mLNqFm20am2zCZ8f0ZJS4OMWwVJ6LhfCFRHnVpdxEz/pvu356V79xZFOTDRdA3YNFGo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1756454814; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id; bh=U/74ASfoROQcfqvXSrZrsKV+OOs2EZaHNsgNdvXJNnY=; b=lvghLWDc6SnaVs2JkRnvcseH9Ht/l/KqX6ysPzfahMcpgkYQsP8rkJxx6Wwl12BKkF2FqhWR0YaLsvHHv73PZ8q0k1JbCKVWbAKUibBqaDJ8ogGPNP0pa9sXRrYdS2s7J8frGpt4L0ZwNWNJeferH4ZsfqIL2oXGD0+nYTNEeJg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1756454814733292.24312100567874; Fri, 29 Aug 2025 01:06:54 -0700 (PDT) Received: by lists.libvirt.org (Postfix, from userid 993) id B1588440B1; Fri, 29 Aug 2025 04:06:52 -0400 (EDT) Received: from [172.19.199.3] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 09AF04426B; Fri, 29 Aug 2025 04:03:29 -0400 (EDT) Received: by lists.libvirt.org (Postfix, from userid 993) id 675A844073; Fri, 29 Aug 2025 04:03:04 -0400 (EDT) Received: from relay.virtuozzo.com (relay.virtuozzo.com [130.117.225.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 171E644088 for ; Fri, 29 Aug 2025 04:02:59 -0400 (EDT) Received: from [130.117.225.5] (helo=dev012.ch-qa.vzint.dev) by relay.virtuozzo.com with esmtp (Exim 4.96) (envelope-from ) id 1urtZv-0064Cb-0l; Fri, 29 Aug 2025 10:02:55 +0200 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-1.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=virtuozzo.com; s=relay; h=MIME-Version:Message-ID:Date:Subject:From: Content-Type; bh=U/74ASfoROQcfqvXSrZrsKV+OOs2EZaHNsgNdvXJNnY=; b=Q95agiOFtywY UjJ303wY2e8dBQVqLZwIf5kzIQylfIe/eQhjfTrxnbfIaJEdgpXQb79hdXE2lRoPp/Oc5mt8oGHn8 kUHrQPvygSnCJyzZ4Yw7j1tLYvY5Nz65TzW0OcYYRwAYne0F5YSnVKt0QtyiT66Ufn6279JGpCf35 gZv6EI6+xeSsbrr1LB/FrXoStUvPgDw+DmEbYlP24EWMtyfdIUc4D7T2vzvSVZ3noPgoXrbHbB4kx q4CMIv5a+71uMVH7LOGamSCLbGQy+/hEGBW/YaIMOolF9hSF+BpUfH8UIFMGtfg/IQGkLkCO/kM2H lTxfS+jZuVPoXIkx3qcJbQ==; To: devel@lists.libvirt.org Subject: [PATCH 2/2] qemu: implement driver support for domainBlockRebase2 API Date: Fri, 29 Aug 2025 10:55:30 +0300 Message-ID: <20250829080240.229601-3-nikolai.barybin@virtuozzo.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20250829080240.229601-1-nikolai.barybin@virtuozzo.com> References: <20250829080240.229601-1-nikolai.barybin@virtuozzo.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-ID-Hash: P2A5JCNOLFOQGS3LB3GT4MO3U65ND3SD X-Message-ID-Hash: P2A5JCNOLFOQGS3LB3GT4MO3U65ND3SD X-MailFrom: nikolai.barybin@virtuozzo.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: den@openvz.org X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Nikolai Barybin via Devel Reply-To: Nikolai Barybin X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1756454816293116601 Content-Type: text/plain; charset="utf-8" Parse params list and pass arguments to underlying call to qemuDomainBlockPullCommon. Now bandwidth unit of messurement is passed as param and passed further with a use of VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES flag. virDomainBlockRebase2 doesn't use equavivalent external flag. Signed-off-by: Nikolai Barybin --- src/qemu/qemu_driver.c | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ac72ea5cb0..b5ca195bfe 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14634,6 +14634,53 @@ qemuDomainBlockRebase(virDomainPtr dom, return ret; } =20 +static int +qemuDomainBlockRebase2(virDomainPtr dom, + const char *path, + virTypedParameterPtr params, + int nparams, + unsigned int flags) +{ + virDomainObj *vm; + size_t i =3D 0; + unsigned long long bandwidth =3D 0; + const char *base =3D NULL; + + virCheckFlags(VIR_DOMAIN_BLOCK_REBASE_2_RELATIVE, -1); + + if (virTypedParamsValidate(params, nparams, + VIR_DOMAIN_BLOCK_REBASE_PARAM_BASE, + VIR_TYPED_PARAM_STRING, + VIR_DOMAIN_BLOCK_REBASE_PARAM_BANDWIDTH_MIB, + VIR_TYPED_PARAM_ULLONG, + VIR_DOMAIN_BLOCK_REBASE_PARAM_BANDWIDTH_BYT= ES, + VIR_TYPED_PARAM_ULLONG, + NULL) < 0) + return -1; + + if (!(vm =3D qemuDomainObjFromDomain(dom))) + return -1; + + if (virDomainBlockRebase2EnsureACL(dom->conn, vm->def) < 0) + return -1; + + for (i =3D 0; i < nparams; i++) { + virTypedParameterPtr param =3D ¶ms[i]; + + if (STREQ(param->field, VIR_DOMAIN_BLOCK_REBASE_PARAM_BANDWIDTH_MI= B)) { + bandwidth =3D param->value.ul; + } else if (STREQ(param->field, VIR_DOMAIN_BLOCK_REBASE_PARAM_BANDW= IDTH_BYTES)) { + bandwidth =3D param->value.ul; + flags |=3D VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES; + } else if (STREQ(param->field, VIR_DOMAIN_BLOCK_REBASE_PARAM_BASE)= ) { + base =3D param->value.s; + } + } + + return qemuDomainBlockPullCommon(vm, path, base, bandwidth, flags); +} + + =20 static int qemuDomainBlockCopy(virDomainPtr dom, @@ -20579,6 +20626,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .domainBlockJobSetSpeed =3D qemuDomainBlockJobSetSpeed, /* 0.9.4 */ .domainBlockPull =3D qemuDomainBlockPull, /* 0.9.4 */ .domainBlockRebase =3D qemuDomainBlockRebase, /* 0.9.10 */ + .domainBlockRebase2 =3D qemuDomainBlockRebase2, /* 11.8.0 */ .domainBlockCopy =3D qemuDomainBlockCopy, /* 1.2.9 */ .domainBlockCommit =3D qemuDomainBlockCommit, /* 1.0.0 */ .connectIsAlive =3D qemuConnectIsAlive, /* 0.9.8 */ --=20 2.43.5