public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH qemu-server 4/4] filter by content type when using vdisk_list
Date: Mon, 22 Mar 2021 15:32:43 +0100	[thread overview]
Message-ID: <20210322143243.6606-4-f.ebner@proxmox.com> (raw)
In-Reply-To: <20210322143243.6606-1-f.ebner@proxmox.com>

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@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





  parent reply	other threads:[~2021-03-22 14:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 14:32 [pve-devel] [PATCH storage 1/4] Revert "vdisk list: only collect images from storages with an appropriate content type" Fabian Ebner
2021-03-22 14:32 ` [pve-devel] [PATCH storage 2/4] vdisk list: allow specifying content type Fabian Ebner
2021-03-31  8:26   ` [pve-devel] applied: " Thomas Lamprecht
2021-03-22 14:32 ` [pve-devel] [PATCH container 3/4] filter by content type when using vdisk_list Fabian Ebner
2021-04-18 16:05   ` [pve-devel] applied: " Thomas Lamprecht
2021-03-22 14:32 ` Fabian Ebner [this message]
2021-04-18 16:05   ` [pve-devel] applied: [PATCH qemu-server 4/4] " Thomas Lamprecht
2021-03-31  8:26 ` [pve-devel] applied: [PATCH storage 1/4] Revert "vdisk list: only collect images from storages with an appropriate content type" Thomas Lamprecht

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=20210322143243.6606-4-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pve-devel@lists.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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal