[pve-devel] [PATCH storage 25/26] update tests
Max R. Carrara
m.carrara at proxmox.com
Tue Jul 29 18:33:01 CEST 2025
On Tue Jul 29, 2025 at 1:15 PM CEST, Wolfgang Bumiller wrote:
> Signed-off-by: Wolfgang Bumiller <w.bumiller at proxmox.com>
> ---
There are a couple tests for LVM and ZFS that seem to fail; relevant
logs are below.
I've also added some comments inline further below where possible.
==========
./run_test_zfspoolplugin.pl
pool: test-pool
state: ONLINE
status: Some supported and requested features are not enabled on the pool.
The pool can still be used, but some features are unavailable.
action: Enable all features using 'zpool upgrade'. Once this is done,
the pool may no longer be accessible by software that does not support
the features. See zpool-features(7) for details.
config:
NAME STATE READ WRITE CKSUM
test-pool ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
scsi-0QEMU_QEMU_HARDDISK_drive-scsi1 ONLINE 0 0 0
scsi-0QEMU_QEMU_HARDDISK_drive-scsi2 ONLINE 0 0 0
errors: No known data errors
Start tests for ZFSPoolPlugin
run test1 "volume_size_info"
run test2 "volume_resize"
run test3 "volume_has_feature"
run test4 "volume_snapshot"
run test5 "volume_snapshot_delete"
######Ignore Output if no Test5 g: is included######
cannot destroy 'regressiontest/base-100-disk-1 at __base__': snapshot has dependent clones
use '-R' to destroy the following datasets:
######End Ignore#######
run test6 "volume_rollback_is_possible"
run test7 "volume_rollback"
run test8 "parse_volname"
Test8 a: parsing wrong at ./run_test_zfspoolplugin.pl line 1044.
Test8 b: parsing wrong at ./run_test_zfspoolplugin.pl line 1067.
Test8 c: parsing wrong at ./run_test_zfspoolplugin.pl line 1089.
Test8 d: parsing wrong at ./run_test_zfspoolplugin.pl line 1111.
Test8 e: parsing wrong at ./run_test_zfspoolplugin.pl line 1133.
Test8 f: parsing wrong at ./run_test_zfspoolplugin.pl line 1155.
run test9 "parse_volume_id"
run test10 "volume_is_base"
Use of uninitialized value in numeric eq (==) at ./run_test_zfspoolplugin.pl line 863.
Argument "base" isn't numeric in numeric eq (==) at ./run_test_zfspoolplugin.pl line 875.
Test10 b: is base at ./run_test_zfspoolplugin.pl line 877.
Use of uninitialized value in numeric eq (==) at ./run_test_zfspoolplugin.pl line 887.
Use of uninitialized value in numeric eq (==) at ./run_test_zfspoolplugin.pl line 899.
Argument "basevol" isn't numeric in numeric eq (==) at ./run_test_zfspoolplugin.pl line 911.
Test10 e: is base at ./run_test_zfspoolplugin.pl line 913.
Use of uninitialized value in numeric eq (==) at ./run_test_zfspoolplugin.pl line 923.
run test11 "volume_is_base"
Test11 b at ./run_test_zfspoolplugin.pl line 795.
cannot open 'regressiontest/vm-110-disk-0': dataset does not exist
Test11 b: command 'zfs list -H -o volsize regressiontest/vm-110-disk-0' failed: exit code 1
Test11 e at ./run_test_zfspoolplugin.pl line 831.
cannot open 'regressiontest/subvol-210-disk-0': dataset does not exist
Test11 e: command 'zfs list -H -o refquota regressiontest/subvol-210-disk-0' failed: exit code 1
run test12 "vdisk_create_base"
run test13 "vdisk_alloc"
Test13 a: vdisk_alloc without vtype not allowed anymore
Test13 b: volname:zfstank99:vol-vm-112-disk-0 don't match
Test13 c: vdisk_alloc without vtype not allowed anymore
Test13 d: volname:zfstank99:subvol-ct-113-disk-0 don't match
run test14 "vdisk_free"
run test15 "template_list and vdisk_list"
Test 15 d failed
Test 15 g failed
Test 15 h failed
Test 15 i failed
run test16 "activate_storage"
run test17 "deactivate_storage"
run test18 "scan_zfs"
run test19 "path"
Test 19 a: owner is not correct: expected 'images' get 'vm-vol' at ./run_test_zfspoolplugin.pl line 77.
Test 19 b: owner is not correct: expected 'images' get 'vm-vol' at ./run_test_zfspoolplugin.pl line 107.
Test 19 c: owner is not correct: expected 'images' get 'vm-vol' at ./run_test_zfspoolplugin.pl line 137.
Test 19 d: owner is not correct: expected 'images' get 'ct-vol' at ./run_test_zfspoolplugin.pl line 167.
Test 19 e: owner is not correct: expected 'images' get 'ct-vol' at ./run_test_zfspoolplugin.pl line 197.
Test 19 f: owner is not correct: expected 'images' get 'ct-vol' at ./run_test_zfspoolplugin.pl line 227.
Stop tests for ZFSPoolPlugin
26 tests failed
Time: 14s
==========
./run_test_lvmplugin.pl
Start tests for LVMPlugin
8000+0 records in
8000+0 records out
8388608000 bytes (8.4 GB, 7.8 GiB) copied, 4.04047 s, 2.1 GB/s
Physical volume "/dev/loop1" successfully created.
Volume group "regressiontest" successfully created
Logical volume "vm-102-disk-1" created.
run test1 "volume_size_info"
Logical volume "vm-102-disk-1" successfully removed.
Volume group "regressiontest" successfully removed
Volume group "regressiontest" successfully created
Logical volume "vm-102-disk-1" created.
run test2 "volume_resize"
Size of logical volume regressiontest/vm-102-disk-1 changed from 1.00 GiB (256 extents) to 2.00 GiB (512 extents).
Logical volume regressiontest/vm-102-disk-1 successfully resized.
Logical volume "vm-102-disk-1" successfully removed.
Volume group "regressiontest" successfully removed
Volume group "regressiontest" successfully created
Logical volume "vm-102-disk-1" created.
run test3 "volume_has_feature"
Logical volume "vm-102-disk-1" successfully removed.
Volume group "regressiontest" successfully removed
Volume group "regressiontest" successfully created
Logical volume "vm-102-disk-1" created.
run test4 "volume_rollback_is_possible"
Logical volume "vm-102-disk-1" successfully removed.
Volume group "regressiontest" successfully removed
Volume group "regressiontest" successfully created
Logical volume "vm-102-disk-1" created.
run test5 "parse_volname"
Logical volume "vm-102-disk-1" successfully removed.
Volume group "regressiontest" successfully removed
Volume group "regressiontest" successfully created
Logical volume "vm-102-disk-1" created.
run test6 "parse_volume_id"
Logical volume "vm-102-disk-1" successfully removed.
Volume group "regressiontest" successfully removed
Volume group "regressiontest" successfully created
Logical volume "vm-102-disk-1" created.
run test7 "vdisk_alloc"
Test7 a: vdisk_alloc without vtype not allowed anymore
Logical volume "vol-vm-112-disk-0" created.
Test7 b: volname:lvmregression:vol-vm-112-disk-0 don't match
Logical volume "vm-102-disk-1" successfully removed.
Logical volume "vol-vm-112-disk-0" successfully removed.
Volume group "regressiontest" successfully removed
Volume group "regressiontest" successfully created
Logical volume "vm-102-disk-1" created.
run test8 "vdisk_free"
Logical volume "vm-102-disk-1" successfully removed.
Volume group "regressiontest" successfully removed
Volume group "regressiontest" successfully created
Logical volume "vm-102-disk-1" created.
run test15 "template_list and vdisk_list"
Logical volume "vm-102-disk-1" successfully removed.
Volume group "regressiontest" successfully removed
Volume group "regressiontest" successfully created
Logical volume "vm-102-disk-1" created.
run test10 "activate_storage"
Logical volume "vm-102-disk-1" successfully removed.
Volume group "regressiontest" successfully removed
Volume group "regressiontest" successfully created
Logical volume "vm-102-disk-1" created.
run test11 "deactivate_storage"
0 logical volume(s) in volume group "regressiontest" now active
Logical volume "vm-102-disk-1" successfully removed.
Volume group "regressiontest" successfully removed
Volume group "regressiontest" successfully created
Logical volume "vm-102-disk-1" created.
run test12 "path"
Logical volume "vm-102-disk-1" successfully removed.
Volume group "regressiontest" successfully removed
Labels on physical volume "/dev/loop1" successfully wiped.
Stop tests for LVMPlugin
2 tests failed
Time: 11s
==========
> src/test/list_volumes_test.pm | 73 ++++++++++++++++++++----------
> src/test/parse_volname_test.pm | 34 ++++++++++++--
> src/test/path_to_volume_id_test.pm | 27 +++++++----
> src/test/run_test_lvmplugin.pl | 11 +++--
> src/test/run_test_zfspoolplugin.pl | 45 ++++++++++--------
> 5 files changed, 129 insertions(+), 61 deletions(-)
>
> diff --git a/src/test/list_volumes_test.pm b/src/test/list_volumes_test.pm
> index e528fc3..fcc7beb 100644
> --- a/src/test/list_volumes_test.pm
> +++ b/src/test/list_volumes_test.pm
> @@ -71,6 +71,8 @@ my $scfg = {
> 'rootdir' => 1,
> 'vztmpl' => 1,
> 'images' => 1,
> + 'vm-vol' => 1,
> + 'ct-vol' => 1,
> 'snippets' => 1,
> 'backup' => 1,
> },
> @@ -87,9 +89,9 @@ my @tests = (
> description => 'VMID: 16110, VM, qcow2, backup, snippets',
> vmid => '16110',
> files => [
> - "$storage_dir/images/16110/vm-16110-disk-0.qcow2",
> - "$storage_dir/images/16110/vm-16110-disk-1.raw",
> - "$storage_dir/images/16110/vm-16110-disk-2.vmdk",
> + "$storage_dir/vms/16110/vol-vm-16110-disk-0.qcow2",
> + "$storage_dir/vms/16110/vol-vm-16110-disk-1.raw",
> + "$storage_dir/vms/16110/vol-vm-16110-disk-2.vmdk",
> "$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_11_40.vma.gz",
> "$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_12_45.vma.lzo",
> "$storage_dir/dump/vzdump-qemu-16110-2020_03_30-21_13_55.vma",
> @@ -99,34 +101,37 @@ my @tests = (
> ],
> expected => [
> {
> - 'content' => 'images',
> + 'content' => 'vm-vol',
> + 'vtype' => 'vm-vol',
> 'ctime' => DEFAULT_CTIME,
> 'format' => 'qcow2',
> 'parent' => undef,
> 'size' => DEFAULT_SIZE,
> 'used' => DEFAULT_USED,
> 'vmid' => '16110',
> - 'volid' => 'local:16110/vm-16110-disk-0.qcow2',
> + 'volid' => 'local:16110/vol-vm-16110-disk-0.qcow2',
> },
> {
> - 'content' => 'images',
> + 'content' => 'vm-vol',
> + 'vtype' => 'vm-vol',
> 'ctime' => DEFAULT_CTIME,
> 'format' => 'raw',
> 'parent' => undef,
> 'size' => DEFAULT_SIZE,
> 'used' => DEFAULT_USED,
> 'vmid' => '16110',
> - 'volid' => 'local:16110/vm-16110-disk-1.raw',
> + 'volid' => 'local:16110/vol-vm-16110-disk-1.raw',
> },
> {
> - 'content' => 'images',
> + 'content' => 'vm-vol',
> + 'vtype' => 'vm-vol',
> 'ctime' => DEFAULT_CTIME,
> 'format' => 'vmdk',
> 'parent' => undef,
> 'size' => DEFAULT_SIZE,
> 'used' => DEFAULT_USED,
> 'vmid' => '16110',
> - 'volid' => 'local:16110/vm-16110-disk-2.vmdk',
> + 'volid' => 'local:16110/vol-vm-16110-disk-2.vmdk',
> },
> {
> 'content' => 'backup',
> @@ -184,7 +189,8 @@ my @tests = (
> description => 'VMID: 16112, lxc, raw, backup',
> vmid => '16112',
> files => [
> - "$storage_dir/images/16112/vm-16112-disk-0.raw",
> + "$storage_dir/cts/16112/vol-ct-16112-disk-0.raw",
> + "$storage_dir/images/16112/vm-16112-disk-1.raw",
> "$storage_dir/dump/vzdump-lxc-16112-2020_03_30-21_39_30.tar.lzo",
> "$storage_dir/dump/vzdump-lxc-16112-2020_03_30-21_49_30.tar.gz",
> "$storage_dir/dump/vzdump-lxc-16112-2020_03_30-21_49_30.tar.zst",
> @@ -192,6 +198,17 @@ my @tests = (
> "$storage_dir/dump/vzdump-openvz-16112-2020_03_30-21_39_30.tar.bz2",
> ],
> expected => [
> + {
> + 'content' => 'ct-vol',
> + 'vtype' => 'ct-vol',
> + 'ctime' => DEFAULT_CTIME,
> + 'format' => 'raw',
> + 'parent' => undef,
> + 'size' => DEFAULT_SIZE,
> + 'used' => DEFAULT_USED,
> + 'vmid' => '16112',
> + 'volid' => 'local:16112/vol-ct-16112-disk-0.raw',
> + },
> {
> 'content' => 'rootdir',
> 'ctime' => DEFAULT_CTIME,
> @@ -200,7 +217,7 @@ my @tests = (
> 'size' => DEFAULT_SIZE,
> 'used' => DEFAULT_USED,
> 'vmid' => '16112',
> - 'volid' => 'local:16112/vm-16112-disk-0.raw',
> + 'volid' => 'local:16112/vm-16112-disk-1.raw',
> },
> {
> 'content' => 'backup',
> @@ -254,7 +271,7 @@ my @tests = (
> vmid => '16114',
> files => [
> "$storage_dir/images/16114/vm-16114-disk-0.qcow2",
> - "$storage_dir/images/16114/vm-16114-disk-1.qcow2",
> + "$storage_dir/vms/16114/vol-vm-16114-disk-1.qcow2",
> ],
> parent => [
> "../9004/base-9004-disk-0.qcow2", "../9004/base-9004-disk-1.qcow2",
> @@ -271,14 +288,15 @@ my @tests = (
> 'volid' => 'local:9004/base-9004-disk-0.qcow2/16114/vm-16114-disk-0.qcow2',
> },
> {
> - 'content' => 'images',
> + 'content' => 'vm-vol',
> + 'vtype' => 'vm-vol',
> 'ctime' => DEFAULT_CTIME,
> 'format' => 'qcow2',
> 'parent' => '../9004/base-9004-disk-1.qcow2',
> 'size' => DEFAULT_SIZE,
> 'used' => DEFAULT_USED,
> 'vmid' => '16114',
> - 'volid' => 'local:9004/base-9004-disk-1.qcow2/16114/vm-16114-disk-1.qcow2',
> + 'volid' => 'local:9004/base-9004-disk-1.qcow2/16114/vol-vm-16114-disk-1.qcow2',
> },
> ],
> },
> @@ -287,7 +305,7 @@ my @tests = (
> vmid => '9004',
> files => [
> "$storage_dir/images/9004/base-9004-disk-0.qcow2",
> - "$storage_dir/images/9004/base-9004-disk-1.qcow2",
> + "$storage_dir/vms/9004/base-vol-vm-9004-disk-1.qcow2",
> ],
> expected => [
> {
> @@ -301,14 +319,15 @@ my @tests = (
> 'volid' => 'local:9004/base-9004-disk-0.qcow2',
> },
> {
> - 'content' => 'images',
> + 'content' => 'vm-vol',
> + 'vtype' => 'vm-vol',
> 'ctime' => DEFAULT_CTIME,
> 'format' => 'qcow2',
> 'parent' => undef,
> 'size' => DEFAULT_SIZE,
> 'used' => DEFAULT_USED,
> 'vmid' => '9004',
> - 'volid' => 'local:9004/base-9004-disk-1.qcow2',
> + 'volid' => 'local:9004/base-vol-vm-9004-disk-1.qcow2',
> },
> ],
> },
> @@ -428,21 +447,22 @@ my @tests = (
> #"$storage_dir/images/ssss/base-4321-disk-0.qcow2/1234/vm-1234-disk-0.qcow2",
> vmid => undef,
> files => [
> - "$storage_dir/images/1234/vm-1234-disk-0.qcow2",
> + "$storage_dir/vms/1234/vol-vm-1234-disk-0.qcow2",
> ],
> parent => [
> - "../ssss/base-4321-disk-0.qcow2",
> + "../ssss/base-vol-vm-4321-disk-0.qcow2",
> ],
> expected => [
> {
> - 'content' => 'images',
> + 'content' => 'vm-vol',
> + 'vtype' => 'vm-vol',
> 'ctime' => DEFAULT_CTIME,
> 'format' => 'qcow2',
> - 'parent' => '../ssss/base-4321-disk-0.qcow2',
> + 'parent' => '../ssss/base-vol-vm-4321-disk-0.qcow2',
> 'size' => DEFAULT_SIZE,
> 'used' => DEFAULT_USED,
> 'vmid' => '1234',
> - 'volid' => 'local:1234/vm-1234-disk-0.qcow2',
> + 'volid' => 'local:1234/vol-vm-1234-disk-0.qcow2',
> },
> ],
> },
> @@ -521,7 +541,7 @@ plan tests => $plan + 1;
>
> {
> my $sid = 'local';
> - my $types = ['rootdir', 'images', 'vztmpl', 'iso', 'backup', 'snippets'];
> + my $types = ['images', 'rootdir', 'vm-vol', 'ct-vol', 'vztmpl', 'iso', 'backup', 'snippets'];
> my @suffixes = ('qcow2', 'raw', 'vmdk', 'vhdx');
>
> # run through test cases
> @@ -555,6 +575,13 @@ plan tests => $plan + 1;
> eval { $got = PVE::Storage::Plugin->list_volumes($sid, $scfg, $vmid, $types) };
> $got = $@ if $@;
>
> + sub sort_by_volid {
> + my ($data) = @_;
> + return [sort { $a->{volid} cmp $b->{volid} } @$data];
> + }
> +
> + $got = sort_by_volid($got) if ref($got) && ref($got) eq 'ARRAY';
> + $expected = sort_by_volid($expected);
> is_deeply($got, $expected, $description) || diag(explain($got));
>
> # clean up after each test case, otherwise
> diff --git a/src/test/parse_volname_test.pm b/src/test/parse_volname_test.pm
> index 0d077a9..297e280 100644
> --- a/src/test/parse_volname_test.pm
> +++ b/src/test/parse_volname_test.pm
> @@ -20,6 +20,19 @@ my $tests = [
> #
> {
> description => 'VM disk image, linked, qcow2, vm- as base-',
> + volname => "$vmid/vol-vm-$vmid-disk-0.qcow2/$vmid/vol-vm-$vmid-disk-0.qcow2",
> + expected => [
> + 'vm-vol',
> + "vol-vm-$vmid-disk-0.qcow2",
> + "$vmid",
> + "vol-vm-$vmid-disk-0.qcow2",
> + "$vmid",
> + !!0,
> + 'qcow2',
> + ],
> + },
> + {
> + description => 'VM disk image, legacy, linked, qcow2, vm- as base-',
> volname => "$vmid/vm-$vmid-disk-0.qcow2/$vmid/vm-$vmid-disk-0.qcow2",
> expected => [
> 'images',
> @@ -27,11 +40,21 @@ my $tests = [
> "$vmid",
> "vm-$vmid-disk-0.qcow2",
> "$vmid",
> - undef,
> + !!0,
> 'qcow2',
> ],
> },
> #
> + # Container volumes
> + #
> + {
> + description => 'CT rootdir image',
> + volname => "$vmid/vol-ct-$vmid-disk-0.raw",
> + expected => [
> + 'ct-vol', "vol-ct-$vmid-disk-0.raw", "$vmid", undef, undef, !!0, 'raw',
> + ],
> + },
> + #
> # iso
> #
> {
> @@ -94,7 +117,7 @@ my $tests = [
> description => 'Container rootdir, subvol',
> volname => "$vmid/subvol-$vmid-disk-0.subvol",
> expected =>
> - ['images', "subvol-$vmid-disk-0.subvol", "$vmid", undef, undef, undef, 'subvol'],
> + ['images', "subvol-$vmid-disk-0.subvol", "$vmid", undef, undef, !!0, 'subvol'],
> },
> {
> description => 'Backup archive, no virtualization type',
> @@ -209,7 +232,7 @@ foreach my $s (@$disk_suffix) {
> description => "VM disk image, $s",
> volname => "$vmid/vm-$vmid-disk-1.$s",
> expected => [
> - 'images', "vm-$vmid-disk-1.$s", "$vmid", undef, undef, undef, "$s",
> + 'images', "vm-$vmid-disk-1.$s", "$vmid", undef, undef, !!0, "$s",
> ],
> },
> {
> @@ -221,7 +244,7 @@ foreach my $s (@$disk_suffix) {
> "$vmid",
> "base-$vmid-disk-0.$s",
> "$vmid",
> - undef,
> + !!0,
> "$s",
> ],
> },
> @@ -229,7 +252,7 @@ foreach my $s (@$disk_suffix) {
> description => "VM disk image, base, $s",
> volname => "$vmid/base-$vmid-disk-0.$s",
> expected => [
> - 'images', "base-$vmid-disk-0.$s", "$vmid", undef, undef, 'base-', "$s",
> + 'images', "base-$vmid-disk-0.$s", "$vmid", undef, undef, !!1, "$s",
> ],
> },
> );
> @@ -295,6 +318,7 @@ plan tests => scalar @$tests + 1;
>
> my $seen_vtype;
> my $vtype_subdirs = { map { $_ => 1 } keys %{ PVE::Storage::Plugin::get_vtype_subdirs() } };
> +delete $vtype_subdirs->{rootdir}; # this one cannot be observed, it maps to the 'ct-vol' type.
>
> foreach my $t (@$tests) {
> my $description = $t->{description};
> diff --git a/src/test/path_to_volume_id_test.pm b/src/test/path_to_volume_id_test.pm
> index ab7e276..bb2d47f 100644
> --- a/src/test/path_to_volume_id_test.pm
> +++ b/src/test/path_to_volume_id_test.pm
> @@ -25,8 +25,9 @@ my $scfg = {
> 'maxfiles' => 0,
> 'content' => {
> 'snippets' => 1,
> - 'rootdir' => 1,
> 'images' => 1,
> + 'vm-vol' => 1,
> + 'ct-vol' => 1,
> 'iso' => 1,
> 'backup' => 1,
> 'vztmpl' => 1,
> @@ -44,24 +45,31 @@ my $scfg = {
> # expected => the result that path_to_volume_id should return
> my @tests = (
> {
> - description => 'Image, qcow2',
> + description => 'Image, qcow2, legacy naming',
> volname => "$storage_dir/images/16110/vm-16110-disk-0.qcow2",
> expected => [
> 'images', 'local:16110/vm-16110-disk-0.qcow2',
> ],
> },
> + {
> + description => 'Image, qcow2',
> + volname => "$storage_dir/vms/16110/vol-vm-16110-disk-0.qcow2",
> + expected => [
> + 'vm-vol', 'local:16110/vol-vm-16110-disk-0.qcow2',
> + ],
> + },
> {
> description => 'Image, raw',
> - volname => "$storage_dir/images/16112/vm-16112-disk-0.raw",
> + volname => "$storage_dir/vms/16112/vol-vm-16112-disk-0.raw",
> expected => [
> - 'images', 'local:16112/vm-16112-disk-0.raw',
> + 'vm-vol', 'local:16112/vol-vm-16112-disk-0.raw',
> ],
> },
> {
> description => 'Image template, qcow2',
> - volname => "$storage_dir/images/9004/base-9004-disk-0.qcow2",
> + volname => "$storage_dir/vms/9004/base-vol-vm-9004-disk-0.qcow2",
> expected => [
> - 'images', 'local:9004/base-9004-disk-0.qcow2',
> + 'vm-vol', 'local:9004/base-vol-vm-9004-disk-0.qcow2',
> ],
> },
>
> @@ -141,14 +149,14 @@ my @tests = (
> description => 'Rootdir, folder subvol, legacy naming',
> volname => "$storage_dir/images/1234/subvol-1234-disk-0.subvol/", # fileparse needs / at the end
> expected => [
> - 'ct-vol', 'local:1234/subvol-1234-disk-0.subvol',
> + 'images', 'local:1234/subvol-1234-disk-0.subvol',
> ],
> },
> {
> description => 'Rootdir, folder subvol',
> - volname => "$storage_dir/images/1234/subvol-1234-disk-0.subvol/", # fileparse needs / at the end
> + volname => "$storage_dir/cts/1234/vol-ct-1234-disk-0.subvol/", # fileparse needs / at the end
> expected => [
> - 'images', 'local:1234/subvol-1234-disk-0.subvol',
> + 'ct-vol', 'local:1234/vol-ct-1234-disk-0.subvol',
> ],
> },
> {
> @@ -239,6 +247,7 @@ plan tests => scalar @tests + 1;
>
> my $seen_vtype;
> my $vtype_subdirs = { map { $_ => 1 } keys %{ PVE::Storage::Plugin::get_vtype_subdirs() } };
> +delete $vtype_subdirs->{rootdir}; # this one cannot be observed, it maps to the 'ct-vol' type.
>
> foreach my $tt (@tests) {
> my $file = $tt->{volname};
> diff --git a/src/test/run_test_lvmplugin.pl b/src/test/run_test_lvmplugin.pl
> index e87a3de..92e8d6e 100755
> --- a/src/test/run_test_lvmplugin.pl
> +++ b/src/test/run_test_lvmplugin.pl
> @@ -159,7 +159,7 @@ my $test7 = sub {
>
> eval {
> my $tmp_volid =
> - PVE::Storage::vdisk_alloc($cfg, $storagename, "112", "raw", undef, 1024 * 1024);
> + PVE::Storage::vdisk_alloc($cfg, $storagename, "112", "raw", undef, 1024 * 1024, undef);
^ Assuming that this should be "images" instead of undef above, since
vdisk_alloc now throws when undef is passed.
Should probably also add a test that expects `vdisk_alloc()` to throw
when undef is passed.
>
> if ($tmp_volid ne "$storagename:vm-112-disk-0") {
> die "volname:$tmp_volid don't match\n";
> @@ -186,15 +186,16 @@ my $test7 = sub {
> }
>
> eval {
> - my $tmp_volid =
> - PVE::Storage::vdisk_alloc($cfg, $storagename, "112", "raw", undef, 2048 * 1024);
> + my $tmp_volid = PVE::Storage::vdisk_alloc(
> + $cfg, $storagename, "112", "raw", undef, 2048 * 1024, 'vm-vol',
> + );
>
> - if ($tmp_volid ne "$storagename:vm-112-disk-1") {
> + if ($tmp_volid ne "$storagename:vol-vm-112-disk-1") {
> die "volname:$tmp_volid don't match\n";
> }
^ This here also trips up; see the following output:
run test7 "vdisk_alloc"
Logical volume "vm-112-disk-0" created.
Logical volume "vol-vm-112-disk-2" created.
Test7 b: volname:lvmregression:vol-vm-112-disk-2 don't match
Logical volume "vm-102-disk-1" successfully removed.
Logical volume "vm-112-disk-0" successfully removed.
Logical volume "vol-vm-112-disk-2" successfully removed.
Volume group "regressiontest" successfully removed
Haven't fully investigated yet, but at a quick glance this seems
related to the changes to `my $get_vm_disk_number = sub { ... }`
and `get_next_vm_diskname()` done in patch 17.
> eval {
> run_command(
> - "lvs --noheadings -o lv_size $vgname/vm-112-disk-1",
> + "lvs --noheadings -o lv_size $vgname/vol-vm-112-disk-1",
> outfunc => sub {
> my $tmp = shift;
> if ($tmp !~ m/2\.00g/) {
> diff --git a/src/test/run_test_zfspoolplugin.pl b/src/test/run_test_zfspoolplugin.pl
> index 9bd70a8..99ab6e2 100755
> --- a/src/test/run_test_zfspoolplugin.pl
> +++ b/src/test/run_test_zfspoolplugin.pl
> @@ -580,7 +580,7 @@ my $test13 = sub {
>
> eval {
> my $tmp_volid =
> - PVE::Storage::vdisk_alloc($cfg, $storagename, "112", "raw", undef, 1024 * 1024);
> + PVE::Storage::vdisk_alloc($cfg, $storagename, "112", "raw", undef, 1024 * 1024, undef);
^ Trips up; assuming this also takes "images" instead of undef due to
the changes made to `vdisk_alloc()`.
>
> if ($tmp_volid ne "$storagename:vm-112-disk-0") {
> die "volname:$tmp_volid don't match\n";
> @@ -607,18 +607,19 @@ my $test13 = sub {
> }
>
> eval {
> - my $tmp_volid =
> - PVE::Storage::vdisk_alloc($cfg, $storagename, "112", "raw", undef, 2048 * 1024);
> + my $tmp_volid = PVE::Storage::vdisk_alloc(
> + $cfg, $storagename, "112", "raw", undef, 2048 * 1024, 'vm-vol',
> + );
>
> - if ($tmp_volid ne "$storagename:vm-112-disk-1") {
> + if ($tmp_volid ne "$storagename:vol-vm-112-disk-1") {
> die "volname:$tmp_volid don't match\n";
^ Also trips up; probably due to the changes related to disk-number
fetching as mentioned above.
> }
> eval {
> run_command(
> - "zfs get -H volsize $zpath\/vm-112-disk-1",
> + "zfs get -H volsize $zpath\/vol-vm-112-disk-1",
> outfunc => sub {
> my $tmp = shift;
> - if ($tmp !~ m/^$zpath\/vm-112-disk-1.*volsize.*2G.*$/) {
> + if ($tmp !~ m/^$zpath\/vol-vm-112-disk-1.*volsize.*2G.*$/) {
> die "size don't match\n";
> }
> },
> @@ -635,8 +636,9 @@ my $test13 = sub {
> }
>
> eval {
> - my $tmp_volid =
> - PVE::Storage::vdisk_alloc($cfg, $storagename, "113", "subvol", undef, 1024 * 1024);
> + my $tmp_volid = PVE::Storage::vdisk_alloc(
> + $cfg, $storagename, "113", "subvol", undef, 1024 * 1024, undef,
> + );
^ Trips up as well; see above.
>
> if ($tmp_volid ne "$storagename:subvol-113-disk-0") {
> die "volname:$tmp_volid don't match\n";
> @@ -663,18 +665,19 @@ my $test13 = sub {
> }
>
> eval {
> - my $tmp_volid =
> - PVE::Storage::vdisk_alloc($cfg, $storagename, "113", "subvol", undef, 2048 * 1024);
> + my $tmp_volid = PVE::Storage::vdisk_alloc(
> + $cfg, $storagename, "113", "subvol", undef, 2048 * 1024, 'ct-vol',
> + );
>
> - if ($tmp_volid ne "$storagename:subvol-113-disk-1") {
> + if ($tmp_volid ne "$storagename:subvol-ct-113-disk-1") {
> die "volname:$tmp_volid don't match\n";
^ Trips up as well; see above.
> }
> eval {
> run_command(
> - "zfs get -H refquota $zpath\/subvol-113-disk-1",
> + "zfs get -H refquota $zpath\/subvol-ct-113-disk-1",
> outfunc => sub {
> my $tmp = shift;
> - if ($tmp !~ m/^$zpath\/subvol-113-disk-1.*refquota.*G.*$/) {
> + if ($tmp !~ m/^$zpath\/subvol-ct-113-disk-1.*refquota.*G.*$/) {
> die "size don't match\n";
> }
> },
> @@ -778,7 +781,7 @@ my $test11 = sub {
^ Bunch of things for this test fail; at a quick glance this also seems
related to the changes to `my $get_vm_disk_number = sub { ... }`
and `get_next_vm_diskname()` done in patch 17.
>
> print "\nrun test11 \"volume_is_base\"\n";
>
> - eval { PVE::Storage::vdisk_clone($cfg, "$storagename:$vmdisk", 110); };
> + eval { PVE::Storage::vdisk_clone($cfg, "$storagename:$vmdisk", 110, undef, undef); };
> if (!$@) {
> $count++;
> warn "Test11 a: clone_image only works on base images";
> @@ -786,7 +789,7 @@ my $test11 = sub {
>
> eval {
> if ("$storagename:$vmbase\/vm-110-disk-0" ne
> - PVE::Storage::vdisk_clone($cfg, "$storagename:$vmbase", 110, '__base__')
> + PVE::Storage::vdisk_clone($cfg, "$storagename:$vmbase", 110, '__base__', undef)
> ) {
> $count++;
> warn "Test11 b";
> @@ -806,13 +809,15 @@ my $test11 = sub {
> warn "Test11 b: $@";
> }
>
> - eval { PVE::Storage::vdisk_clone($cfg, "$storagename:$vmbase\/$vmlinked", 111); };
> + eval {
> + PVE::Storage::vdisk_clone($cfg, "$storagename:$vmbase\/$vmlinked", 111, undef, undef);
> + };
> if (!$@) {
> $count++;
> warn "Test11 c: clone_image only works on base images";
> }
>
> - eval { PVE::Storage::vdisk_clone($cfg, "$storagename:$ctdisk", 110); };
> + eval { PVE::Storage::vdisk_clone($cfg, "$storagename:$ctdisk", 110, undef, undef); };
> if (!$@) {
> $count++;
> warn "Test11 d: clone_image only works on base images";
> @@ -820,7 +825,7 @@ my $test11 = sub {
>
> eval {
> if ("$storagename:$ctbase\/subvol-210-disk-0" ne
> - PVE::Storage::vdisk_clone($cfg, "$storagename:$ctbase", 210, '__base__')
> + PVE::Storage::vdisk_clone($cfg, "$storagename:$ctbase", 210, '__base__', undef)
> ) {
> $count++;
> warn "Test11 e";
> @@ -840,7 +845,9 @@ my $test11 = sub {
> warn "Test11 e: $@";
> }
>
> - eval { PVE::Storage::vdisk_clone($cfg, "$storagename:$ctbase\/$ctlinked", 211); };
> + eval {
> + PVE::Storage::vdisk_clone($cfg, "$storagename:$ctbase\/$ctlinked", 211, undef, undef);
> + };
> if (!$@) {
> $count++;
> warn "Test11 f: clone_image only works on base images";
More information about the pve-devel
mailing list