From d0ff75d9b4acecbea6352a182b3e4f882e1a924e Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Mon, 22 Mar 2021 15:32:43 +0100 Subject: [PATCH] filter by content type when using vdisk_list except for migration, where it would be subtly backwards-incompatible. Since there is a scan_volids call for migration, we can't default to filtering in scan_volids just yet. Also allows to get rid of the existing filtering hack in rescan(). Signed-off-by: Fabian Ebner --- PVE/QemuServer.pm | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index 72a4d46d..8aea0631 100644 --- a/PVE/QemuServer.pm +++ b/PVE/QemuServer.pm @@ -2156,7 +2156,7 @@ sub destroy_vm { }); if ($purge_unreferenced) { # also remove unreferenced disk - my $vmdisks = PVE::Storage::vdisk_list($storecfg, undef, $vmid); + my $vmdisks = PVE::Storage::vdisk_list($storecfg, undef, $vmid, undef, 'images'); PVE::Storage::foreach_volid($vmdisks, sub { my ($volid, $sid, $volname, $d) = @_; eval { PVE::Storage::vdisk_free($storecfg, $volid) }; @@ -6070,10 +6070,11 @@ my $restore_destroy_volumes = sub { } }; +# FIXME For PVE 7.0, remove $content_type and always use 'images' sub scan_volids { - my ($cfg, $vmid) = @_; + my ($cfg, $vmid, $content_type) = @_; - my $info = PVE::Storage::vdisk_list($cfg, undef, $vmid); + my $info = PVE::Storage::vdisk_list($cfg, undef, $vmid, undef, $content_type); my $volid_hash = {}; foreach my $storeid (keys %$info) { @@ -6166,14 +6167,8 @@ sub rescan { my $cfg = PVE::Storage::config(); - # FIXME: Remove once our RBD plugin can handle CT and VM on a single storage - # see: https://pve.proxmox.com/pipermail/pve-devel/2018-July/032900.html - foreach my $stor (keys %{$cfg->{ids}}) { - delete($cfg->{ids}->{$stor}) if ! $cfg->{ids}->{$stor}->{content}->{images}; - } - print "rescan volumes...\n"; - my $volid_hash = scan_volids($cfg, $vmid); + my $volid_hash = scan_volids($cfg, $vmid, 'images'); my $updatefn = sub { my ($vmid) = @_; -- 2.39.5