[pve-devel] [PATCH qemu-server 4/4] filter by content type when using vdisk_list

Fabian Ebner f.ebner at proxmox.com
Mon Mar 22 15:32:43 CET 2021


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 <f.ebner at proxmox.com>
---

Dependency bump for pve-storage is needed.

 PVE/QemuServer.pm | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 1c0b5c2..9fa5546 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -2111,7 +2111,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) };
@@ -5998,10 +5998,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) {
@@ -6094,14 +6095,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.20.1






More information about the pve-devel mailing list