plugin: qemu block device: add support for snapshot option

This is mostly in preparation for external qcow2 snapshot support.

For internal qcow2 snapshots, which currently are the only supported
variant, it is not possible to attach the snapshot only. If access to
that is required it will need to be handled differently, e.g. via a
FUSE/NBD export.

Such accesses are currently not done for running VMs via '-drive'
either, so there still is feature parity.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fiona Ebner
2025-07-02 18:27:45 +02:00
committed by Fabian Grünbichler
parent 590fb76238
commit 2d874037f3
5 changed files with 20 additions and 1 deletions

View File

@ -169,6 +169,8 @@ sub qemu_blockdev_options {
die "volume '$volname' not usable as VM image\n" if $format ne 'raw';
die "cannot attach only the snapshot of a zvol\n" if $options->{'snapshot-name'};
my ($path) = $class->path($scfg, $volname, $storeid);
my $blockdev = { driver => 'host_device', filename => $path };