From 686b07376f758e95156e2cc3ec9a60c0162e4b72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Wed, 9 Feb 2022 14:07:48 +0100 Subject: [PATCH] storage_migrate_snapshot: skip for btrfs without snapshots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this allows migrating from btrfs to other raw+size accepting storages, provided no snapshots exist. Signed-off-by: Fabian Grünbichler --- PVE/Storage.pm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PVE/Storage.pm b/PVE/Storage.pm index 93ae3ac..866b5cd 100755 --- a/PVE/Storage.pm +++ b/PVE/Storage.pm @@ -645,10 +645,10 @@ my $volname_for_storage = sub { # whether a migration snapshot is needed for a given storage sub storage_migrate_snapshot { - my ($cfg, $storeid) = @_; + my ($cfg, $storeid, $existing_snapshots) = @_; my $scfg = storage_config($cfg, $storeid); - return $scfg->{type} eq 'zfspool' || $scfg->{type} eq 'btrfs'; + return $scfg->{type} eq 'zfspool' || ($scfg->{type} eq 'btrfs' && $existing_snapshots); } sub storage_migrate { @@ -696,7 +696,7 @@ sub storage_migrate { my $migration_snapshot; if (!defined($snapshot)) { - $migration_snapshot = storage_migrate_snapshot($cfg, $storeid); + $migration_snapshot = storage_migrate_snapshot($cfg, $storeid, $opts->{with_snapshots}); $snapshot = '__migration__' if $migration_snapshot; }