[pve-devel] [RFC v2 container 3/5] deactivate volumes after storage_migrate

Fabian Ebner f.ebner at proxmox.com
Fri Nov 6 15:30:57 CET 2020


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

This is probably not worth it, for two reasons:
1. only local unused volumes are not already deactivated by the existing code
2. if nothing else goes wrong, the volumes migrated with storage_migrate
will be deleted anyways

 src/PVE/LXC/Migrate.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/PVE/LXC/Migrate.pm b/src/PVE/LXC/Migrate.pm
index 94a78c5..7c3536f 100644
--- a/src/PVE/LXC/Migrate.pm
+++ b/src/PVE/LXC/Migrate.pm
@@ -294,6 +294,11 @@ sub phase1 {
 	if (my $err = $@) {
 	    die "storage migration for '$volid' to storage '$sid' failed - $err\n";
 	}
+
+	eval { PVE::Storage::deactivate_volumes($self->{storecfg}, [$volid]); };
+	if (my $err = $@) {
+	    $self->log('warn', $err);
+	}
     }
 
     my $conffile = PVE::LXC::Config->config_file($vmid);
-- 
2.20.1






More information about the pve-devel mailing list