From: Wolfgang Bumiller <w.bumiller@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>
Cc: "t.lamprecht@proxmox.com" <t.lamprecht@proxmox.com>
Subject: Re: [pve-devel] [PATCH pve-storage 09/13] storage: add volume_support_qemu_snapshot
Date: Wed, 16 Jul 2025 12:21:26 +0200 [thread overview]
Message-ID: <emdqzknarkqepndppfcfawfrzsiczdcxf3a2csze6vyhn6qgoj@uklzftkql7w3> (raw)
In-Reply-To: <mailman.1472.1752593942.395.pve-devel@lists.proxmox.com>
On Tue, Jul 15, 2025 at 03:38:57PM +0000, DERUMIER, Alexandre via pve-devel wrote:
> From: "DERUMIER, Alexandre" <alexandre.derumier@groupe-cyllene.com>
> To: "w.bumiller@proxmox.com" <w.bumiller@proxmox.com>
> CC: "pve-devel@lists.proxmox.com" <pve-devel@lists.proxmox.com>,
> "t.lamprecht@proxmox.com" <t.lamprecht@proxmox.com>,
> "f.gruenbichler@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
next prev parent reply other threads:[~2025-07-16 10:20 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20250709162202.2952597-1-alexandre.derumier@groupe-cyllene.com>
2025-07-09 16:21 ` [pve-devel] [PATCH pve-storage 01/13] plugin: add qemu_img_create Alexandre Derumier via pve-devel
2025-07-09 16:21 ` [pve-devel] [PATCH qemu-server 1/4] qemu_img convert : add external snapshot support Alexandre Derumier via pve-devel
2025-07-09 16:21 ` [pve-devel] [PATCH qemu-server 2/4] blockdev: add backing_chain support Alexandre Derumier via pve-devel
2025-07-15 9:02 ` Wolfgang Bumiller
2025-07-09 16:21 ` [pve-devel] [PATCH pve-storage 02/13] plugin: add qemu_img_create_qcow2_backed Alexandre Derumier via pve-devel
2025-07-09 16:21 ` [pve-devel] [PATCH pve-storage 03/13] plugin: add qemu_img_info Alexandre Derumier via pve-devel
2025-07-09 16:21 ` [pve-devel] [PATCH qemu-server 3/4] qcow2: add external snapshot support Alexandre Derumier via pve-devel
2025-07-15 13:21 ` Wolfgang Bumiller
2025-07-15 14:21 ` DERUMIER, Alexandre via pve-devel
2025-07-15 14:31 ` Wolfgang Bumiller
2025-07-09 16:21 ` [pve-devel] [PATCH pve-storage 04/13] plugin: add qemu_img_measure Alexandre Derumier via pve-devel
2025-07-09 16:21 ` [pve-devel] [PATCH qemu-server 4/4] tests: fix efi vm-disk-100-0.raw -> vm-100-disk-0.raw Alexandre Derumier via pve-devel
2025-07-09 16:21 ` [pve-devel] [PATCH pve-storage 05/13] plugin: add qemu_img_resize Alexandre Derumier via pve-devel
2025-07-09 16:21 ` [pve-devel] [PATCH pve-storage 06/13] rbd && zfs : create_base : remove $running param from volume_snapshot Alexandre Derumier via pve-devel
2025-07-09 16:21 ` [pve-devel] [PATCH pve-storage 07/13] storage: volume_snapshot: add $running param Alexandre Derumier via pve-devel
2025-07-09 16:21 ` [pve-devel] [PATCH pve-storage 08/13] storage: add rename_snapshot method Alexandre Derumier via pve-devel
2025-07-09 16:21 ` [pve-devel] [PATCH pve-storage 09/13] storage: add volume_support_qemu_snapshot Alexandre Derumier via pve-devel
2025-07-15 11:33 ` Wolfgang Bumiller
2025-07-15 13:59 ` DERUMIER, Alexandre via pve-devel
[not found] ` <4756bd155509ba20a3a6bf16191f1a539ee5b23e.camel@groupe-cyllene.com>
2025-07-15 14:49 ` Wolfgang Bumiller
2025-07-15 15:38 ` DERUMIER, Alexandre via pve-devel
2025-07-16 10:21 ` Wolfgang Bumiller [this message]
2025-07-09 16:21 ` [pve-devel] [PATCH pve-storage 10/13] plugin: fix volname parsing Alexandre Derumier via pve-devel
2025-07-09 16:22 ` [pve-devel] [PATCH pve-storage 11/13] qcow2: add external snapshot support Alexandre Derumier via pve-devel
2025-07-09 16:22 ` [pve-devel] [PATCH pve-storage 12/13] lvmplugin: add qcow2 snapshot Alexandre Derumier via pve-devel
2025-07-09 16:22 ` [pve-devel] [PATCH pve-storage 13/13] tests: add lvmplugin test Alexandre Derumier via pve-devel
2025-07-16 15:15 ` [pve-devel] [PATCH-SERIES v8 pve-storage/qemu-server] add external qcow2 snapshot support Thomas Lamprecht
2025-07-17 8:01 ` DERUMIER, Alexandre via pve-devel
2025-07-17 14:49 ` Tiago Sousa via pve-devel
[not found] ` <1fddff1a-b806-475a-ac75-1dd0107d1013@eurotux.com>
2025-07-17 15:08 ` DERUMIER, Alexandre via pve-devel
[not found] ` <47b76678f969ba97926c85af4bf8e50c9dda161d.camel@groupe-cyllene.com>
2025-07-17 15:42 ` Tiago Sousa via pve-devel
[not found] ` <58c2db18-c2c2-4c91-9521-bdb42a302e93@eurotux.com>
2025-07-17 15:53 ` DERUMIER, Alexandre via pve-devel
2025-07-17 16:05 ` DERUMIER, Alexandre via pve-devel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=emdqzknarkqepndppfcfawfrzsiczdcxf3a2csze6vyhn6qgoj@uklzftkql7w3 \
--to=w.bumiller@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
--cc=t.lamprecht@proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox