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 4BEAF1FF183 for ; Wed, 16 Jul 2025 12:20:57 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6E331C823; Wed, 16 Jul 2025 12:22:01 +0200 (CEST) Date: Wed, 16 Jul 2025 12:21:26 +0200 From: Wolfgang Bumiller To: Proxmox VE development discussion Message-ID: References: <20250709162202.2952597-1-alexandre.derumier@groupe-cyllene.com> <46hm62jbunky6a53hid6fh6honfkncoccimej7iidh52gr34hy@xumdyi4czqoi> <4756bd155509ba20a3a6bf16191f1a539ee5b23e.camel@groupe-cyllene.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-SPAM-LEVEL: Spam detection results: 0 AWL 0.078 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pve-devel] [PATCH pve-storage 09/13] storage: add volume_support_qemu_snapshot X-BeenThere: pve-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox VE development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox VE development discussion Cc: "t.lamprecht@proxmox.com" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pve-devel-bounces@lists.proxmox.com Sender: "pve-devel" On Tue, Jul 15, 2025 at 03:38:57PM +0000, DERUMIER, Alexandre via pve-devel wrote: > From: "DERUMIER, Alexandre" > To: "w.bumiller@proxmox.com" > CC: "pve-devel@lists.proxmox.com" , > "t.lamprecht@proxmox.com" , > "f.gruenbichler@proxmox.com" > Subject: Re: [pve-devel] [PATCH pve-storage 09/13] storage: add > volume_support_qemu_snapshot > Date: Tue, 15 Jul 2025 15:38:57 +0000 > Message-ID: <82c18a632e730b7c18a93aacd9f4d623d56061be.camel@groupe-cyllene.com> > > >>Yeah I tried some quick tests and it seems to be a bit tricky. Or > >>maybe > >>I just missed something. > > Just have done fast tests, I think I have found a way. > (I'll do more test tomorrow to see if everything is ok in guest) > > > > sub qemu_volume_snapshot { > my ($vmid, $deviceid, $storecfg, $drive, $snap) = @_; > ..... > > } elsif ($do_snapshots_type eq 'external') { > my $storeid = (PVE::Storage::parse_volume_id($volid))[0]; > my $scfg = PVE::Storage::storage_config($storecfg, $storeid); > print "external qemu snapshot\n"; > my $snapshots = PVE::Storage::volume_snapshot_info($storecfg, > $volid); > my $parent_snap = $snapshots->{'current'}->{parent}; > my $machine_version = > PVE::QemuServer::Machine::get_current_qemu_machine($vmid); > > #no rename here anymore > > PVE::QemuServer::Blockdev::blockdev_external_snapshot( > $storecfg, $vmid, $machine_version, $deviceid, $drive, > $snap, $parent_snap > ); > ... > } > > > sub blockdev_external_snapshot { > my ($storecfg, $vmid, $machine_version, $deviceid, $drive, $snap, > $parent_snap) = @_; > > print "Creating a new current volume with $snap as backing snap\n"; > > my $volid = $drive->{file}; > > #rename current to snap && preallocate add a new current file with > reference to snapbacking-file, we can remove the $running param > > my $running = undef > PVE::Storage::volume_snapshot($storecfg, $volid, $snap, undef); > > #call the blockdev_rename, only to reopen internal blockdev current > active image to snap volname > > my $skip_volume_rename=1; > #reopen current to snap > PVE::QemuServer::Blockdev::blockdev_rename( > $storecfg, > $vmid, > $machine_version, > $deviceid, > $drive, > 'current', > $snap, > $parent_snap, > $skip_volume_rename > ); > > ###the rest is the same than before > > #be sure to add drive in write mode > delete($drive->{ro}); > > my $new_file_blockdev = generate_file_blockdev($storecfg, $drive); > my $new_fmt_blockdev = generate_format_blockdev($storecfg, $drive, > $new_file_blockdev); > > my $snap_file_blockdev = generate_file_blockdev($storecfg, $drive, > $snap); > my $snap_fmt_blockdev = generate_format_blockdev( > $storecfg, > $drive, > $snap_file_blockdev, > { 'snapshot-name' => $snap }, > ); > > > #backing need to be forced to undef in blockdev, to avoid reopen of > backing-file on blockdev-add > $new_fmt_blockdev->{backing} = undef; > > mon_cmd($vmid, 'blockdev-add', %$new_fmt_blockdev); > > mon_cmd( > $vmid, 'blockdev-snapshot', > node => $snap_fmt_blockdev->{'node-name'}, > overlay => $new_fmt_blockdev->{'node-name'}, > ); > } seems to work - at least on my lvm tests _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel