Currently, all volumes with a 'media=cdrom' marker are excluded from
backup. For owned volumes, this is very surprising. Treat owned CD-ROM
volumes like other volumes and consider the 'backup' marker instead.

Cloud-init volumes are owned, but still skipped, because they are
generated from the configuration/snippets.

Stay compatible with old callers avoiding the need for a versioned
breaks.

Signed-off-by: Fiona Ebner <f.eb...@proxmox.com>
---
 PVE/QemuConfig.pm | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/PVE/QemuConfig.pm b/PVE/QemuConfig.pm
index 43967b43..92b21259 100644
--- a/PVE/QemuConfig.pm
+++ b/PVE/QemuConfig.pm
@@ -172,12 +172,20 @@ sub get_replicatable_volumes {
 sub get_backup_volumes {
     my ($class, $conf, $vmid) = @_;
 
+    my $storecfg = PVE::Storage::config();
+
     my $return_volumes = [];
 
     my $test_volume = sub {
        my ($key, $drive) = @_;
 
-       return if PVE::QemuServer::drive_is_cdrom($drive);
+       if (PVE::QemuServer::Drive::drive_is_cdrom($drive)) {
+           return if !defined($vmid); # for compat - TODO PVE 9 - remove
+           my $owned = PVE::QemuServer::Drive::vm_is_volid_owner($storecfg, 
$vmid, $drive->{file});
+           my $is_cloudinit = 
PVE::QemuServer::Drive::drive_is_cloudinit($drive);
+
+           return if !$owned || $is_cloudinit;
+       }
 
        my $included = $drive->{backup} // 1;
        my $reason = "backup=";
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to