[pve-devel] [PATCH storage v4 07/12] Fix: path_to_volume_id returned wrong content

Alwin Antreich a.antreich at proxmox.com
Wed Apr 22 16:58:03 CEST 2020


type for backup files. Patch includes changes of the test as well.

Signed-off-by: Alwin Antreich <a.antreich at proxmox.com>
---
 PVE/Storage.pm                 | 2 +-
 test/path_to_volume_id_test.pm | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/PVE/Storage.pm b/PVE/Storage.pm
index bdd6ebc..1ef5ed2 100755
--- a/PVE/Storage.pm
+++ b/PVE/Storage.pm
@@ -536,7 +536,7 @@ sub path_to_volume_id {
 	    return ('rootdir', "$sid:rootdir/$vmid");
 	} elsif ($path =~ m!^$backupdir/([^/]+\.(tar|tar\.gz|tar\.lzo|tgz|vma|vma\.gz|vma\.lzo))$!) {
 	    my $name = $1;
-	    return ('iso', "$sid:backup/$name");
+	    return ('backup', "$sid:backup/$name");
 	}
     }
 
diff --git a/test/path_to_volume_id_test.pm b/test/path_to_volume_id_test.pm
index 744c3ee..7d69869 100644
--- a/test/path_to_volume_id_test.pm
+++ b/test/path_to_volume_id_test.pm
@@ -72,7 +72,7 @@ my @tests = (
 	description => 'Backup, vma.gz',
 	volname     => "$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_11_40.vma.gz",
 	expected    => [
-	    'iso',
+	    'backup',
 	    'local:backup/vzdump-qemu-16110-2020_03_30-21_11_40.vma.gz',
 	],
     },
@@ -80,7 +80,7 @@ my @tests = (
 	description => 'Backup, vma.lzo',
 	volname     => "$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_12_45.vma.lzo",
 	expected    => [
-	    'iso',
+	    'backup',
 	    'local:backup/vzdump-qemu-16110-2020_03_30-21_12_45.vma.lzo',
 	],
     },
@@ -88,7 +88,7 @@ my @tests = (
 	description => 'Backup, vma',
 	volname     => "$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_13_55.vma",
 	expected    => [
-	    'iso',
+	    'backup',
 	    'local:backup/vzdump-qemu-16110-2020_03_30-21_13_55.vma',
 	],
     },
@@ -96,7 +96,7 @@ my @tests = (
 	description => 'Backup, tar.lzo',
 	volname     => "$storage_dir/dump/vzdump-lxc-16112-2020_03_30-21_39_30.tar.lzo",
 	expected    => [
-	    'iso',
+	    'backup',
 	    'local:backup/vzdump-lxc-16112-2020_03_30-21_39_30.tar.lzo',
 	],
     },
-- 
2.20.1





More information about the pve-devel mailing list