[pve-devel] [PATCH v5 storage 1/3] storage_migrate_snapshot: skip for btrfs without snapshots
Fabian Grünbichler
f.gruenbichler at proxmox.com
Wed Feb 9 14:07:48 CET 2022
this allows migrating from btrfs to other raw+size accepting storages,
provided no snapshots exist.
Signed-off-by: Fabian Grünbichler <f.gruenbichler at proxmox.com>
---
Notes:
new in v5
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;
}
--
2.30.2
More information about the pve-devel
mailing list