From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 447E21FF15C for ; Fri, 17 Oct 2025 13:34:46 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A916427DED; Fri, 17 Oct 2025 13:35:07 +0200 (CEST) To: pve-devel@lists.proxmox.com Date: Fri, 17 Oct 2025 12:25:33 +0100 In-Reply-To: <20251017112539.26471-1-joao.sousa@eurotux.com> References: <20251017112539.26471-1-joao.sousa@eurotux.com> MIME-Version: 1.0 Message-ID: List-Id: Proxmox VE development discussion List-Post: From: Tiago Sousa via pve-devel Precedence: list Cc: Tiago Sousa X-Mailman-Version: 2.1.29 X-BeenThere: pve-devel@lists.proxmox.com List-Subscribe: , List-Unsubscribe: , List-Archive: Reply-To: Proxmox VE development discussion List-Help: Subject: [pve-devel] [PATCH qemu-server 8/8] blockdev: add underlay resize Content-Type: multipart/mixed; boundary="===============0871904220043590095==" Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" --===============0871904220043590095== Content-Type: message/rfc822 Content-Disposition: inline Return-Path: X-Original-To: pve-devel@lists.proxmox.com Delivered-To: pve-devel@lists.proxmox.com Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id C62C6D0F18 for ; Fri, 17 Oct 2025 13:35:04 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AC0C227C5C for ; Fri, 17 Oct 2025 13:35:04 +0200 (CEST) Received: from eurotux.com (mail.eurotux.com [185.98.249.9]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS for ; Fri, 17 Oct 2025 13:35:03 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by eurotux.com (Postfix) with ESMTP id DC74430D17A1; Fri, 17 Oct 2025 12:26:03 +0100 (WEST) Authentication-Results: mail.prd.eurotux.pt (amavisd-new); dkim=pass (2048-bit key) reason="pass (just generated, assumed good)" header.d=eurotux.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eurotux.com; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from; s= default; t=1760700362; x=1762514763; bh=7HULJkjR2eSZh9fzqXGY6g40 Bd/yxyQLE68p1G4rnNw=; b=kZ8lm9a2gA8n2EeNPMTaTc7cnxM2pkOrPk9GDPeF xnAs3LWVfQdsm0AdT9bO393X1nJMTN893YKhr4m++U+eH7VOER5AuaZNYWITm36r tVOLEPW2q0BZcqlsdeWQ8TgFTr4BSWGv8syToKLeMXKuR5FwK2Nun41wuQpXQ3Os ZULgjmFCemcawJj2gwyHXrX3yWk2kX5wZwRX4tw4tcArZ8zByipwJA4IUOz90Jue c/fs75aJ+YBVi8dZRahXS3Dax3QpzSsK5265ywCDN+qF28bqI9N4I5IzlKzwl2bW FOIaB6WbAhDJ3dEdpAdWttUXDksWH0G1fFFo7CZojvI76g== X-Virus-Scanned: amavisd-new at mail.prd.eurotux.pt Received: from eurotux.com ([127.0.0.1]) by localhost (mail.prd.eurotux.pt [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 7kJGaUJ_gEr9; Fri, 17 Oct 2025 12:26:02 +0100 (WEST) Received: from proxmox.example (184.137.90.149.rev.vodafone.pt [149.90.137.184]) (Authenticated sender: joao.sousa@eurotux.com) by eurotux.com (Postfix) with ESMTPSA id 6E4D930D17C1; Fri, 17 Oct 2025 12:26:02 +0100 (WEST) From: Tiago Sousa To: pve-devel@lists.proxmox.com Subject: [PATCH qemu-server 8/8] blockdev: add underlay resize Date: Fri, 17 Oct 2025 12:25:33 +0100 Message-ID: <20251017112539.26471-9-joao.sousa@eurotux.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251017112539.26471-1-joao.sousa@eurotux.com> References: <20251017112539.26471-1-joao.sousa@eurotux.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL -0.001 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DKIM_SIGNED 0.1 Message has a DKIM or DK signature, not necessarily valid DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's domain DKIM_VALID_EF -0.1 Message has a valid DKIM or DK signature from envelope-from domain DMARC_PASS -0.1 DMARC pass policy RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) SPF_HELO_PASS -0.001 SPF: HELO matches SPF record SPF_PASS -0.001 SPF: sender matches SPF record Signed-off-by: Tiago Sousa --- src/PVE/QemuServer/Blockdev.pm | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/PVE/QemuServer/Blockdev.pm b/src/PVE/QemuServer/Blockdev= .pm index 78769198..5da1abd9 100644 --- a/src/PVE/QemuServer/Blockdev.pm +++ b/src/PVE/QemuServer/Blockdev.pm @@ -725,6 +725,24 @@ sub resize { ); } =20 +sub underlay_resize { + my ($storecfg, $vmid, $drive_id, $volid) =3D @_; + + my $running =3D PVE::QemuServer::Helpers::vm_running_locally($vmid); + + # get backing_snap + my $snapshots =3D PVE::Storage::volume_snapshot_info($storecfg, $vol= id); + my $backing_snap =3D $snapshots->{current}->{parent}; + my $size =3D PVE::Storage::volume_underlay_resize($storecfg, $volid,= $backing_snap); + + return if !$running; + my $block_info =3D get_block_info($vmid); + my $inserted =3D $block_info->{$drive_id}->{inserted} + or die "no block node inserted for drive '$drive_id'\n"; + + set_write_threshold($storecfg, $vmid, $drive_id, $volid); +} + my sub blockdev_change_medium { my ($storecfg, $vmid, $qdev_id, $drive) =3D @_; =20 @@ -861,7 +879,7 @@ sub block_set_write_threshold { sub compute_write_threshold { my ($storecfg, $scfg, $volid) =3D @_; =20 - my $lv_size =3D PVE::Storage::volume_size_info($storecfg, $volid, 5)= ; + my $lv_size =3D PVE::Storage::volume_underlay_size_info($storecfg, $= volid, 5); =20 my $write_threshold =3D $lv_size - $scfg->{chunksize} * $scfg->{'chu= nk-percentage'}; =20 --=20 2.47.3 --===============0871904220043590095== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel --===============0871904220043590095==--