5 use Data
::Dumper
qw(Dumper);
8 use PVE
::Tools
qw(run_command);
10 $Data::Dumper
::Sortkeys
= 1;
14 my $storagename = "zfstank99";
15 my $subvol = 'regressiontest';
19 my $vmdisk = "vm-102-disk-1";
20 my $vmbase = "base-100-disk-1";
21 my $vmlinked = "vm-101-disk-1";
22 my $ctdisk = "subvol-202-disk-1";
23 my $ctbase = "basevol-200-disk-1";
24 my $ctlinked = "subvol-201-disk-1";
26 my $basesnap = '@__base__';
29 #create zfs suvol for testing
36 my $end_test = $testnum;
41 $start_test = $ARGV[0];
42 } elsif (@ARGV == 1) {
43 $start_test = $ARGV[0];
49 print "\nrun test19 \"path\"\n";
54 @res = PVE
::Storage
::path
($cfg, "$storagename:$vmdisk");
55 if ($res[0] ne "\/dev\/zvol\/regressiontest\/$vmdisk") {
58 warn "Test 19 a: path is not correct: expected \'\/dev\/zvol\/regressiontest\/$vmdisk'\ get \'$res[0]\'";
60 if ($res[1] ne "102") {
65 warn "Test 19 a: owner is not correct: expected \'102\' get \'$res[1]\'";
67 if ($res[2] ne "images") {
72 warn "Test 19 a: owner is not correct: expected \'images\' get \'$res[2]\'";
83 @res = PVE
::Storage
::path
($cfg, "$storagename:$vmbase");
84 if ($res[0] ne "\/dev\/zvol\/regressiontest\/$vmbase") {
87 warn "Test 19 b: path is not correct: expected \'\/dev\/zvol\/regressiontest\/$vmbase'\ get \'$res[0]\'";
89 if ($res[1] ne "100") {
94 warn "Test 19 b: owner is not correct: expected \'100\' get \'$res[1]\'";
96 if ($res[2] ne "images") {
101 warn "Test 19 b: owner is not correct: expected \'images\' get \'$res[2]\'";
106 warn "Test 19 b: $@";
112 @res = PVE
::Storage
::path
($cfg, "$storagename:$vmbase\/$vmlinked");
113 if ($res[0] ne "\/dev\/zvol\/regressiontest\/$vmlinked") {
116 warn "Test 19 c: path is not correct: expected \'\/dev\/zvol\/regressiontest\/$vmlinked'\ get \'$res[0]\'";
118 if ($res[1] ne "101") {
123 warn "Test 19 c: owner is not correct: expected \'101\' get \'$res[1]\'";
125 if ($res[2] ne "images") {
130 warn "Test 19 c: owner is not correct: expected \'images\' get \'$res[2]\'";
135 warn "Test 19 c: $@";
141 @res = PVE
::Storage
::path
($cfg, "$storagename:$ctdisk");
142 if ($res[0] ne "\/regressiontest\/$ctdisk") {
145 warn "Test 19 d: path is not correct: expected \'/regressiontest\/$ctdisk'\ get \'$res[0]\'";
147 if ($res[1] ne "202") {
152 warn "Test 19 d: owner is not correct: expected \'202\' get \'$res[1]\'";
154 if ($res[2] ne "images") {
159 warn "Test 19 d: owner is not correct: expected \'images\' get \'$res[2]\'";
164 warn "Test 19 d: $@";
170 @res = PVE
::Storage
::path
($cfg, "$storagename:$ctbase");
171 if ($res[0] ne "\/regressiontest\/$ctbase") {
174 warn "Test 19 e: path is not correct: expected \'\/regressiontest\/$ctbase'\ get \'$res[0]\'";
176 if ($res[1] ne "200") {
181 warn "Test 19 e: owner is not correct: expected \'200\' get \'$res[1]\'";
183 if ($res[2] ne "images") {
188 warn "Test 19 e: owner is not correct: expected \'images\' get \'$res[2]\'";
193 warn "Test 19 e: $@";
199 @res = PVE
::Storage
::path
($cfg, "$storagename:$ctbase\/$ctlinked");
200 if ($res[0] ne "\/regressiontest\/$ctlinked") {
203 warn "Test 19 f: path is not correct: expected \'\/regressiontest\/$ctlinked'\ get \'$res[0]\'";
205 if ($res[1] ne "201") {
210 warn "Test 19 f: owner is not correct: expected \'201\' get \'$res[1]\'";
212 if ($res[2] ne "images") {
217 warn "Test 19 f: owner is not correct: expected \'images\' get \'$res[2]\'";
222 warn "Test 19 f: $@";
225 $tests->{19} = $test19;
229 print "\nrun test17 \"scan_zfs\"\n";
233 $res = PVE
::Storage
::scan_zfs
($cfg, $storagename);
236 foreach my $subvol (@$res){
237 if ($subvol->{pool
} eq 'regressiontest') {
243 warn "Test 18 a: not pool";
248 warn "Test 18 a: $@";
253 $res = PVE
::Storage
::scan_zfs
($cfg, $storagename);
255 foreach my $subvol (@$res){
256 if ($subvol->{pool
} eq 'zfspool/subvol') {
262 foreach my $subvol (@$res){
263 if ($subvol->{pool
} eq 'zfspool/basevol') {
271 warn "Test 18 a: $@";
274 $tests->{18} = $test18;
278 print "\nrun test17 \"deactivate_storage\"\n";
281 PVE
::Storage
::activate_storage
($cfg, $storagename);
285 warn "Test 17 a: $@";
288 $tests->{17} = $test17;
292 print "\nrun test16 \"activate_storage\"\n";
295 PVE
::Storage
::activate_storage
($cfg, $storagename);
299 warn "Test 16 a: $@";
302 $tests->{16} = $test16;
306 print "\nrun test15 \"template_list and vdisk_list\"\n";
308 my $hash = Dumper
{};
310 my $res = Dumper PVE
::Storage
::template_list
($cfg, $storagename, "vztmpl");
311 if ( $hash ne $res ) {
313 warn "Test 15 a failed\n";
317 $res = Dumper PVE
::Storage
::template_list
($cfg, $storagename, "iso");
318 if ( $hash ne $res ) {
320 warn "Test 15 b failed\n";
324 $res = Dumper PVE
::Storage
::template_list
($cfg, $storagename, "backup");
325 if ( $hash ne $res ) {
327 warn "Test 15 c failed\n";
331 $hash = Dumper
{'zfstank99' => [
334 'volid' => 'zfstank99:base-100-disk-1',
335 'name' => 'base-100-disk-1',
337 'size' => 1073741824,
342 $res = Dumper PVE
::Storage
::vdisk_list
($cfg, $storagename, 100, ["$storagename:$vmbase"]);
344 if ( $hash ne $res ) {
346 warn "Test 15 d failed\n";
350 $hash = Dumper
{'zfstank99' => [
353 'volid' => 'zfstank99:vm-102-disk-1',
354 'name' => 'vm-102-disk-1',
356 'size' => 1073741824,
361 $res = Dumper PVE
::Storage
::vdisk_list
($cfg, $storagename, 102, ["$storagename:$vmdisk"]);
362 if ( $hash ne $res ) {
364 warn "Test 15 e failed\n";
368 $hash = Dumper
{'zfstank99' => [
370 'parent' => 'base-100-disk-1@__base__',
371 'volid' => "$storagename:$vmbase\/$vmlinked",
372 'name' => 'vm-101-disk-1',
374 'size' => 1073741824,
379 $res = Dumper PVE
::Storage
::vdisk_list
($cfg, $storagename, 101, ["$storagename:$vmbase\/$vmlinked"]);
380 if ( $hash ne $res ) {
382 warn "Test 15 f failed\n";
386 $hash = Dumper
{'zfstank99' => [
389 'volid' => 'zfstank99:basevol-200-disk-1',
390 'name' => 'basevol-200-disk-1',
392 'size' => 1073741824,
397 $res = Dumper PVE
::Storage
::vdisk_list
($cfg, $storagename, 200, ["$storagename:$ctbase"]);
398 if ( $hash ne $res ) {
400 warn "Test 15 g failed\n";
404 $hash = Dumper
{'zfstank99' => [
407 'volid' => 'zfstank99:subvol-202-disk-1',
408 'name' => 'subvol-202-disk-1',
410 'size' => 1073741824,
415 $res = Dumper PVE
::Storage
::vdisk_list
($cfg, $storagename, 202, ["$storagename:$ctdisk"]);
416 if ( $hash ne $res ) {
418 warn "Test 15 h failed\n";
422 $hash = Dumper
{'zfstank99' => [
424 'parent' => 'basevol-200-disk-1@__base__',
425 'volid' => "$storagename:$ctbase\/$ctlinked",
426 'name' => 'subvol-201-disk-1',
428 'size' => 1073741824,
432 $res = Dumper PVE
::Storage
::vdisk_list
($cfg, $storagename, 201, ["$storagename:$ctbase\/$ctlinked"]);
433 if ( $hash ne $res ) {
435 warn "Test 15 i failed\n";
438 $tests->{15} = $test15;
442 print "\nrun test14 \"vdisk_free\"\n";
445 PVE
::Storage
::vdisk_free
($cfg, "$storagename:$vmdisk");
448 run_command
("zfs list $zpath\/$vmdisk", outfunc
=> sub {}, errfunc
=> sub {});
452 warn "Test14 a: vdisk still exists\n";
461 PVE
::Storage
::vdisk_free
($cfg, "$storagename:$vmbase");
465 warn "Test14 b: free vdisk should not work\n";
469 PVE
::Storage
::vdisk_free
($cfg, "$storagename:$vmbase\/$vmlinked");
472 run_command
("zfs list $zpath\/$vmlinked", outfunc
=> sub {}, errfunc
=> sub {});
476 warn "Test14 c: vdisk still exists\n";
485 PVE
::Storage
::vdisk_free
($cfg, "$storagename:$ctdisk");
488 run_command
("zfs list $zpath\/$ctdisk", outfunc
=> sub {}, errfunc
=> sub {});
492 warn "Test14 d: vdisk still exists\n";
501 PVE
::Storage
::vdisk_free
($cfg, "$storagename:$ctbase");
505 warn "Test14 e: free vdisk should not work\n";
509 PVE
::Storage
::vdisk_free
($cfg, "$storagename:$ctbase\/$ctlinked");
512 run_command
("zfs list $zpath\/$ctlinked", outfunc
=> sub {}, errfunc
=> sub {});
516 warn "Test14 f: vdisk still exists\n";
525 PVE
::Storage
::vdisk_free
($cfg, "$storagename:$vmbase");
528 run_command
("zfs list $zpath\/$vmbase", outfunc
=> sub {}, errfunc
=> sub {});
532 warn "Test14 g: vdisk still exists\n";
541 PVE
::Storage
::vdisk_free
($cfg, "$storagename:$ctbase");
544 run_command
("zfs list $zpath\/$ctbase", outfunc
=> sub {}, errfunc
=> sub {});
548 warn "Test14 h: vdisk still exists\n";
556 $tests->{14} = $test14;
560 print "\nrun test13 \"vdisk_alloc\"\n";
563 my $tmp_volid = PVE
::Storage
::vdisk_alloc
($cfg, $storagename, "112", "raw", undef ,1024 * 1024);
565 if ($tmp_volid ne "$storagename:vm-112-disk-1") {
566 die "volname:$tmp_volid don't match\n";
569 run_command
("zfs get -H volsize $zpath\/vm-112-disk-1", outfunc
=>
570 sub { my $tmp = shift;
571 if ($tmp !~ m/^$zpath\/vm-112-disk-1
.*volsize
.*1G
.*$/) {
572 die "size don't match\n";
587 my $tmp_volid = PVE
::Storage
::vdisk_alloc
($cfg, $storagename, "112", "raw", undef ,2048 * 1024);
589 if ($tmp_volid ne "$storagename:vm-112-disk-2") {
590 die "volname:$tmp_volid don't match\n";
593 run_command
("zfs get -H volsize $zpath\/vm-112-disk-2", outfunc
=>
594 sub { my $tmp = shift;
595 if ($tmp !~ m/^$zpath\/vm-112-disk-2
.*volsize
.*2G
.*$/) {
596 die "size don't match\n";
611 my $tmp_volid = PVE
::Storage
::vdisk_alloc
($cfg, $storagename, "113", "subvol", undef ,1024 * 1024);
613 if ($tmp_volid ne "$storagename:subvol-113-disk-1") {
614 die "volname:$tmp_volid don't match\n";
617 run_command
("zfs get -H refquota $zpath\/subvol-113-disk-1", outfunc
=>
618 sub { my $tmp = shift;
619 if ($tmp !~ m/^$zpath\/subvol
-113-disk
-1.*refquota
.*1G
.*$/) {
620 die "size don't match\n";
635 my $tmp_volid = PVE
::Storage
::vdisk_alloc
($cfg, $storagename, "113", "subvol", undef ,2048 * 1024);
637 if ($tmp_volid ne "$storagename:subvol-113-disk-2") {
638 die "volname:$tmp_volid don't match\n";
641 run_command
("zfs get -H refquota $zpath\/subvol-113-disk-2", outfunc
=>
642 sub { my $tmp = shift;
643 if ($tmp !~ m/^$zpath\/subvol
-113-disk
-2.*refquota
.*G
.*$/) {
644 die "size don't match\n";
658 $tests->{13} = $test13;
662 print "\nrun test12 \"vdisk_create_base\"\n";
665 my $tmp_volid = PVE
::Storage
::vdisk_create_base
($cfg, "$storagename:$vmdisk");
667 if ($tmp_volid ne "$storagename:base-102-disk-1") {
671 run_command
("zfs list $zpath\/base-102-disk-1", outfunc
=> sub {});
684 my $tmp_volid = PVE
::Storage
::vdisk_create_base
($cfg, "$storagename:$vmlinked");
686 if ($tmp_volid ne "$storagename:base-101-disk-1") {
690 run_command
("zfs list $zpath\/base-101-disk-1", outfunc
=> sub {});
703 my $tmp_volid = PVE
::Storage
::vdisk_create_base
($cfg, "$storagename:$ctdisk");
705 if ($tmp_volid ne "$storagename:basevol-202-disk-1") {
709 run_command
("zfs list $zpath\/basevol-202-disk-1", outfunc
=> sub {});
722 my $tmp_volid = PVE
::Storage
::vdisk_create_base
($cfg, "$storagename:$ctlinked");
724 if ($tmp_volid ne "$storagename:basevol-201-disk-1") {
728 run_command
("zfs list $zpath\/basevol-201-disk-1", outfunc
=> sub {});
740 $tests->{12} = $test12;
744 print "\nrun test11 \"volume_is_base\"\n";
747 PVE
::Storage
::vdisk_clone
($cfg, "$storagename:$vmdisk", 110);
751 warn "Test11 a: clone_image only works on base images";
755 if ("$storagename:$vmbase\/vm-110-disk-1" ne
756 PVE
::Storage
::vdisk_clone
($cfg, "$storagename:$vmbase", 110, '__base__')){
760 run_command
("zfs list -H -o volsize $zpath\/vm-110-disk-1", outfunc
=> sub {
764 warn "Test11 b not correct volsize" if $line !~ m/$volsize/;
773 PVE
::Storage
::vdisk_clone
($cfg, "$storagename:$vmbase\/$vmlinked", 111);
777 warn "Test11 c: clone_image only works on base images";
781 PVE
::Storage
::vdisk_clone
($cfg, "$storagename:$ctdisk", 110);
785 warn "Test11 d: clone_image only works on base images";
789 if ( "$storagename:$ctbase\/subvol-210-disk-1" ne
790 PVE
::Storage
::vdisk_clone
($cfg, "$storagename:$ctbase", 210, '__base__')){
794 run_command
("zfs list -H -o refquota $zpath\/subvol-210-disk-1", outfunc
=> sub {
798 warn "Test11 e not correct volsize" if $line !~ m/$volsize/;
807 PVE
::Storage
::vdisk_clone
($cfg, "$storagename:$ctbase\/$ctlinked", 211);
811 warn "Test11 f: clone_image only works on base images";
814 $tests->{11} = $test11;
818 print "\nrun test10 \"volume_is_base\"\n";
821 if (1 == PVE
::Storage
::volume_is_base
($cfg, "$storagename:$vmdisk")) {
823 warn "Test10 a: is no base";
833 if (0 == PVE
::Storage
::volume_is_base
($cfg, "$storagename:$vmbase")) {
835 warn "Test10 b: is base";
845 if (1 == PVE
::Storage
::volume_is_base
($cfg, "$storagename:$vmbase\/$vmlinked")) {
847 warn "Test10 c: is no base";
857 if (1 == PVE
::Storage
::volume_is_base
($cfg, "$storagename:$ctdisk")) {
859 warn "Test10 d: is no base";
869 if (0 == PVE
::Storage
::volume_is_base
($cfg, "$storagename:$ctbase")) {
871 warn "Test10 e: is base";
881 if (1 == PVE
::Storage
::volume_is_base
($cfg, "$storagename:$ctbase\/$ctlinked")) {
883 warn "Test10 f: is no base";
892 $tests->{10} = $test10;
896 print "\nrun test9 \"parse_volname\"\n";
899 my ($store, $disk) = PVE
::Storage
::parse_volume_id
("$storagename:$vmdisk");
901 if ($store ne $storagename || $disk ne $vmdisk) {
903 warn "Test9 a: parsing wrong";
913 my ($store, $disk) = PVE
::Storage
::parse_volume_id
("$storagename:$vmbase");
915 if ($store ne $storagename || $disk ne $vmbase) {
917 warn "Test9 b: parsing wrong";
927 my ($store, $disk) = PVE
::Storage
::parse_volume_id
("$storagename:$vmbase\/$vmlinked");
929 if ($store ne $storagename || $disk ne "$vmbase\/$vmlinked") {
931 warn "Test9 c: parsing wrong";
941 my ($store, $disk) = PVE
::Storage
::parse_volume_id
("$storagename:$ctdisk");
943 if ($store ne $storagename || $disk ne $ctdisk) {
945 warn "Test9 d: parsing wrong";
955 my ($store, $disk) = PVE
::Storage
::parse_volume_id
("$storagename:$ctbase");
957 if ($store ne $storagename || $disk ne $ctbase) {
959 warn "Test9 e: parsing wrong";
969 my ($store, $disk) = PVE
::Storage
::parse_volume_id
("$storagename:$ctbase\/$ctlinked");
971 if ($store ne $storagename || $disk ne "$ctbase\/$ctlinked") {
973 warn "Test9 f: parsing wrong";
982 $tests->{9} = $test9;
986 print "\nrun test8 \"parse_volname\"\n";
989 my ($vtype, $name, $vmid, $basename, $basevmid, $isBase, $format) = PVE
::Storage
::parse_volname
($cfg, "$storagename:$vmdisk");
991 if ($vtype ne 'images' || $vmid ne '102' || $name ne $vmdisk ||
992 defined($basename) || defined($basevmid) || $isBase ||
995 warn "Test8 a: parsing wrong";
1005 my ($vtype, $name, $vmid, $basename, $basevmid, $isBase, $format) = PVE
::Storage
::parse_volname
($cfg, "$storagename:$vmbase");
1007 if ($vtype ne 'images' || $vmid ne '100' || $name ne $vmbase ||
1008 defined($basename) || defined($basevmid) || !$isBase ||
1011 warn "Test8 b: parsing wrong";
1020 my ($vtype, $name, $vmid, $basename, $basevmid, $isBase, $format) = PVE
::Storage
::parse_volname
($cfg, "$storagename:$vmbase\/$vmlinked");
1022 if ($vtype ne 'images' || $name ne $vmlinked || $vmid ne '101' ||
1023 $basename ne $vmbase || $basevmid ne '100' || $isBase ||
1026 warn "Test8 c: parsing wrong";
1035 my ($vtype, $name, $vmid, $basename, $basevmid, $isBase, $format) = PVE
::Storage
::parse_volname
($cfg, "$storagename:$ctdisk");
1037 if ($vtype ne 'images' || $vmid ne '202' || $name ne $ctdisk ||
1038 defined($basename) || defined($basevmid) || $isBase ||
1039 $format ne 'subvol') {
1041 warn "Test8 d: parsing wrong";
1051 my ($vtype, $name, $vmid, $basename, $basevmid, $isBase, $format) = PVE
::Storage
::parse_volname
($cfg, "$storagename:$ctbase");
1052 if ($vtype ne 'images' || $vmid ne '200' || $name ne $ctbase ||
1053 defined($basename) || defined($basevmid) || !$isBase ||
1054 $format ne 'subvol') {
1056 warn "Test8 e: parsing wrong";
1065 my ($vtype, $name, $vmid, $basename, $basevmid, $isBase, $format) = PVE
::Storage
::parse_volname
($cfg, "$storagename:$ctbase\/$ctlinked");
1067 if ($vtype ne 'images' || $name ne $ctlinked || $vmid ne '201' ||
1068 $basename ne $ctbase || $basevmid ne '200' || $isBase ||
1069 $format ne 'subvol') {
1071 warn "Test8 f: parsing wrong";
1079 $tests->{8} = $test8;
1083 print "\nrun test7 \"volume_rollback\"\n";
1086 my $parse_guid = sub {
1089 if ( $line =~ m/^Disk identifier \(GUID\)\: (.*)$/ ) {
1095 run_command
("sgdisk --randomize-guids \/dev\/zvol\/$zpath\/$vmdisk", outfunc
=> $parse_guid);
1096 run_command
("sgdisk -p \/dev\/zvol\/$zpath\/$vmdisk", outfunc
=> $parse_guid);
1098 my $old_guid = $tmp_guid;
1099 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmdisk", 'snap1');
1101 run_command
("sgdisk --randomize-guids \/dev\/zvol\/$zpath\/$vmdisk", outfunc
=> $parse_guid);
1103 PVE
::Storage
::volume_snapshot_rollback
($cfg, "$storagename:$vmdisk", 'snap1');
1105 run_command
("sgdisk -p \/dev\/zvol\/$zpath\/$vmdisk", outfunc
=> $parse_guid);
1106 if ($old_guid ne $tmp_guid) {
1108 warn "Test7 a: Zvol makes no rollback";
1123 run_command
("sgdisk --randomize-guids \/dev\/zvol\/$zpath\/$vmbase", outfunc
=> $parse_guid);
1124 run_command
("sgdisk -p \/dev\/zvol\/$zpath\/$vmbase", outfunc
=> $parse_guid);
1126 my $old_guid = $tmp_guid;
1127 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmbase", 'snap1');
1129 run_command
("sgdisk --randomize-guids \/dev\/zvol\/$zpath\/$vmbase", outfunc
=> $parse_guid);
1131 PVE
::Storage
::volume_snapshot_rollback
($cfg, "$storagename:$vmbase", 'snap1');
1133 run_command
("sgdisk -p \/dev\/zvol\/$zpath\/$vmbase", outfunc
=> $parse_guid);
1134 if ($old_guid ne $tmp_guid) {
1136 warn "Test7 b: Zvol makes no rollback";
1151 run_command
("sgdisk --randomize-guids \/dev\/zvol\/$zpath\/$vmlinked", outfunc
=> $parse_guid);
1152 run_command
("sgdisk -p \/dev\/zvol\/$zpath\/$vmlinked", outfunc
=> $parse_guid);
1154 my $old_guid = $tmp_guid;
1155 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmbase\/$vmlinked", 'snap1');
1157 run_command
("sgdisk --randomize-guids \/dev\/zvol\/$zpath\/$vmlinked", outfunc
=> $parse_guid);
1159 PVE
::Storage
::volume_snapshot_rollback
($cfg, "$storagename:$vmbase\/$vmlinked", 'snap1');
1161 run_command
("sgdisk -p \/dev\/zvol\/$zpath\/$vmlinked", outfunc
=> $parse_guid);
1162 if ($old_guid ne $tmp_guid) {
1164 warn "Test7 c: Zvol makes no rollback";
1179 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctdisk", 'snap1');
1181 run_command
("touch \/$zpath\/$ctdisk\/test.txt", outfunc
=> $parse_guid);
1183 PVE
::Storage
::volume_snapshot_rollback
($cfg, "$storagename:$ctdisk", 'snap1');
1185 run_command
("ls \/$zpath\/$ctdisk\/test.txt", errofunc
=> sub {});
1203 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctbase", 'snap1');
1205 run_command
("touch \/$zpath\/$ctbase\/test.txt", outfunc
=> $parse_guid);
1207 PVE
::Storage
::volume_snapshot_rollback
($cfg, "$storagename:$ctbase", 'snap1');
1209 run_command
("ls \/$zpath\/$ctbase\/test.txt", errofunc
=> sub {});
1227 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctbase/$ctlinked", 'snap1');
1229 run_command
("touch \/$zpath\/$ctlinked\/test.txt", outfunc
=> $parse_guid);
1231 PVE
::Storage
::volume_snapshot_rollback
($cfg, "$storagename:$ctbase/$ctlinked", 'snap1');
1233 run_command
("ls \/$zpath\/$ctlinked\/test.txt", errofunc
=> sub {});
1251 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmdisk", 'snap2');
1254 PVE
::Storage
::volume_snapshot_rollback
($cfg, "$storagename:$vmdisk", 'snap1');
1258 warn "Test7 h: Not allowed to rollback";
1267 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmbase", 'snap2');
1270 PVE
::Storage
::volume_snapshot_rollback
($cfg, "$storagename:$vmbase", 'snap1');
1274 warn "Test7 i: Not allowed to rollback";
1283 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmbase\/$vmlinked", 'snap2');
1286 PVE
::Storage
::volume_snapshot_rollback
($cfg, "$storagename:$vmbase\/$vmlinked", 'snap1');
1290 warn "Test7 j: Not allowed to rollback";
1299 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctdisk", 'snap2');
1302 PVE
::Storage
::volume_snapshot_rollback
($cfg, "$storagename:$ctdisk", 'snap1');
1306 warn "Test7 k: Not allowed to rollback";
1315 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctbase", 'snap2');
1318 PVE
::Storage
::volume_snapshot_rollback
($cfg, "$storagename:$ctbase", 'snap1');
1322 warn "Test7 l: Not allowed to rollback";
1331 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctbase/$ctlinked", 'snap2');
1334 PVE
::Storage
::volume_snapshot_rollback
($cfg, "$storagename:$ctbase/$ctlinked", 'snap1');
1338 warn "Test7 m: Not allowed to rollback";
1346 $tests->{7} = $test7;
1350 print "\nrun test6 \"volume_rollback_is_possible\"\n";
1353 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmdisk", 'snap1');
1355 PVE
::Storage
::volume_rollback_is_possible
($cfg, "$storagename:$vmdisk", 'snap1')) {
1357 warn "Test6 a: Rollback sould possible"
1366 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmbase", 'snap1');
1368 PVE
::Storage
::volume_rollback_is_possible
($cfg, "$storagename:$vmbase", 'snap1')) {
1370 warn "Test6 b: Rollback sould possible"
1379 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmlinked", 'snap1');
1381 PVE
::Storage
::volume_rollback_is_possible
($cfg, "$storagename:$vmbase\/$vmlinked", 'snap1')) {
1383 warn "Test6 c: Rollback sould possible"
1392 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctdisk", 'snap1');
1394 PVE
::Storage
::volume_rollback_is_possible
($cfg, "$storagename:$ctdisk", 'snap1')) {
1396 warn "Test6 d: Rollback sould possible"
1405 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctbase", 'snap1');
1407 PVE
::Storage
::volume_rollback_is_possible
($cfg, "$storagename:$ctbase", 'snap1')) {
1409 warn "Test6 e: Rollback sould possible"
1418 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctlinked", 'snap1');
1420 PVE
::Storage
::volume_rollback_is_possible
($cfg, "$storagename:$ctbase\/$ctlinked", 'snap1')) {
1422 warn "Test6 f: Rollback sould possible"
1431 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmdisk", 'snap2');
1432 PVE
::Storage
::volume_rollback_is_possible
($cfg, "$storagename:$vmdisk", 'snap1');
1436 warn "Test6 g: Rollback should not possible";
1440 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmbase", 'snap2');
1441 PVE
::Storage
::volume_rollback_is_possible
($cfg, "$storagename:$vmbase", 'snap1');
1445 warn "Test6 h: Rollback should not possible";
1449 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmlinked", 'snap2');
1450 PVE
::Storage
::volume_rollback_is_possible
($cfg, "$storagename:$vmbase\/$vmlinked", 'snap1');
1454 warn "Test6 j: Rollback should not possible";
1458 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctdisk", 'snap2');
1459 PVE
::Storage
::volume_rollback_is_possible
($cfg, "$storagename:$ctdisk", 'snap1');
1463 warn "Test6 k: Rollback should not possible";
1467 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctbase", 'snap2');
1468 PVE
::Storage
::volume_rollback_is_possible
($cfg, "$storagename:$ctbase", 'snap1');
1472 warn "Test6 l: Rollback should not possible";
1476 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctlinked", 'snap2');
1477 PVE
::Storage
::volume_rollback_is_possible
($cfg, "$storagename:$ctbase\/$ctlinked", 'snap1');
1481 warn "Test6 m: Rollback should not possible";
1484 $tests->{6} = $test6;
1488 print "\nrun test5 \"volume_snapshot_delete\"\n";
1489 my $out = sub{my $tmp = shift;};
1492 run_command
("zfs snapshot $zpath\/$vmdisk\@snap");
1494 PVE
::Storage
::volume_snapshot_delete
($cfg, "$storagename:$vmdisk", 'snap');
1496 run_command
("zfs list $zpath\/$vmdisk\@snap", errfunc
=> $out, outfunc
=> $out);
1500 warn "Test5 a: snapshot still exists";
1505 warn "Test5 PVE a: $@";
1514 run_command
("zfs snapshot $zpath\/$vmbase\@snap");
1516 PVE
::Storage
::volume_snapshot_delete
($cfg, "$storagename:$vmbase", 'snap');
1518 run_command
("zfs list $zpath\/$vmbase\@snap", errmsg
=> $out, outfunc
=> $out);
1522 warn "Test5 b: snapshot still exists";
1527 warn "Test5 PVE b: $@";
1536 run_command
("zfs snapshot $zpath\/$vmlinked\@snap");
1538 PVE
::Storage
::volume_snapshot_delete
($cfg, "$storagename:$vmbase\/$vmlinked", 'snap');
1540 run_command
("zfs list $zpath\/$vmlinked\@snap", errmsg
=> $out, outfunc
=> $out);
1544 warn "Test5 c: snapshot still exists";
1549 warn "Test5 PVE c: $@";
1558 run_command
("zfs snapshot $zpath\/$ctdisk\@snap");
1560 PVE
::Storage
::volume_snapshot_delete
($cfg, "$storagename:$ctdisk", 'snap');
1562 run_command
("zfs list $zpath\/$ctdisk\@snap", errmsg
=> $out, outfunc
=> $out);
1566 warn "Test5 d: snapshot still exists";
1571 warn "Test5 PVE d: $@";
1580 run_command
("zfs snapshot $zpath\/$ctbase\@snap");
1582 PVE
::Storage
::volume_snapshot_delete
($cfg, "$storagename:$ctbase", 'snap');
1584 run_command
("zfs list $zpath\/$ctbase\@snap", errmsg
=> $out, outfunc
=> $out);
1588 warn "Test5 e: snapshot still exists";
1593 warn "Test5 PVE e: $@";
1602 run_command
("zfs snapshot $zpath\/$ctlinked\@snap");
1604 PVE
::Storage
::volume_snapshot_delete
($cfg, "$storagename:$ctbase\/$ctlinked", 'snap');
1606 run_command
("zfs list $zpath\/$ctlinked\@snap", errmsg
=> $out, outfunc
=> $out);
1610 warn "Test5 f: snapshot still exists";
1615 warn "Test5 PVE f: $@";
1622 print "######Ignore Output if no Test5 g: is includet######\n";
1624 PVE
::Storage
::volume_snapshot_delete
($cfg, "$storagename:$vmbase", '__base__');
1626 run_command
("zfs list $zpath\/$vmbase\@__base__", outfunc
=> $out);
1635 warn "Test5 PVE g: snapshot __base__ can be erased";
1637 print "######End Ignroe#######\n";
1639 $tests->{5} = $test5;
1643 print "\nrun test4 \"volume_snapshot\"\n";
1647 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmdisk", 'snap');
1649 run_command
("zfs list $zpath\/$vmdisk\@snap", errmsg
=> $out, outfunc
=> $out);
1662 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmbase", 'snap');
1664 run_command
("zfs list $zpath\/$vmbase\@snap", errmsg
=> $out, outfunc
=> $out);
1677 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$vmbase\/$vmlinked", 'snap');
1679 run_command
("zfs list $zpath\/$vmdisk\@snap", errmsg
=> $out, outfunc
=> $out);
1692 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctdisk", 'snap');
1694 run_command
("zfs list $zpath\/$ctdisk\@snap", errmsg
=> $out, outfunc
=> $out);
1707 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctbase", 'snap');
1709 run_command
("zfs list $zpath\/$ctbase\@snap", errmsg
=> $out, outfunc
=> $out);
1722 PVE
::Storage
::volume_snapshot
($cfg, "$storagename:$ctbase\/$ctlinked", 'snap');
1724 run_command
("zfs list $zpath\/$ctdisk\@snap", errmsg
=> $out, outfunc
=> $out);
1736 $tests->{4} = $test4;
1740 print "\nrun test3 \"volume_has_feature\"\n";
1743 if (!PVE
::Storage
::volume_has_feature
($cfg, 'snapshot', "$storagename:$vmdisk", undef, 0)) {
1745 warn "Test3 a failed";
1754 if (PVE
::Storage
::volume_has_feature
($cfg, 'snapshot', "$storagename:$vmbase", undef, 0)) {
1756 warn "Test3 b failed";
1765 if (!PVE
::Storage
::volume_has_feature
($cfg, 'snapshot', "$storagename:$vmbase\/$vmlinked", undef, 0)) {
1767 warn "Test3 c failed";
1776 if (!PVE
::Storage
::volume_has_feature
($cfg, 'snapshot', "$storagename:$ctdisk", undef, 0)) {
1778 warn "Test3 d failed";
1787 if (PVE
::Storage
::volume_has_feature
($cfg, 'snapshot', "$storagename:$ctbase", undef, 0)) {
1789 warn "Test3 e failed";
1798 if (!PVE
::Storage
::volume_has_feature
($cfg, 'snapshot', "$storagename:$ctbase\/$ctlinked", undef, 0)) {
1800 warn "Test3 f failed";
1809 if (PVE
::Storage
::volume_has_feature
($cfg, 'clone', "$storagename:$vmdisk", undef, 0)) {
1811 warn "Test3 g failed";
1820 if (!PVE
::Storage
::volume_has_feature
($cfg, 'clone', "$storagename:$vmbase", undef, 0)) {
1822 warn "Test3 h failed";
1831 if (PVE
::Storage
::volume_has_feature
($cfg, 'clone', "$storagename:$vmbase\/$vmlinked", undef, 0)) {
1833 warn "Test3 h failed";
1842 if (PVE
::Storage
::volume_has_feature
($cfg, 'clone', "$storagename:$ctdisk", undef, 0)) {
1844 warn "Test3 i failed";
1853 if (!PVE
::Storage
::volume_has_feature
($cfg, 'clone', "$storagename:$ctbase", undef, 0)) {
1855 warn "Test3 j failed";
1864 if (PVE
::Storage
::volume_has_feature
($cfg, 'clone', "$storagename:$ctbase\/$ctlinked", undef, 0)) {
1866 warn "Test3 k failed";
1875 if (!PVE
::Storage
::volume_has_feature
($cfg, 'template', "$storagename:$vmdisk", undef, 0)) {
1877 warn "Test3 l failed";
1886 if (PVE
::Storage
::volume_has_feature
($cfg, 'template', "$storagename:$vmbase", undef, 0)) {
1888 warn "Test3 m failed";
1897 if (!PVE
::Storage
::volume_has_feature
($cfg, 'template', "$storagename:$vmbase\/$vmlinked", undef, 0)) {
1899 warn "Test3 n failed";
1908 if (!PVE
::Storage
::volume_has_feature
($cfg, 'template', "$storagename:$ctdisk", undef, 0)) {
1910 warn "Test3 o failed";
1919 if (PVE
::Storage
::volume_has_feature
($cfg, 'template', "$storagename:$ctbase", undef, 0)) {
1921 warn "Test3 p failed";
1930 if (!PVE
::Storage
::volume_has_feature
($cfg, 'template', "$storagename:$ctbase\/$ctlinked", undef, 0)) {
1932 warn "Test3 q failed";
1941 if (!PVE
::Storage
::volume_has_feature
($cfg, 'copy', "$storagename:$vmdisk", undef, 0)) {
1943 warn "Test3 r failed";
1952 if (!PVE
::Storage
::volume_has_feature
($cfg, 'copy', "$storagename:$vmbase", undef, 0)) {
1954 warn "Test3 s failed";
1963 if (!PVE
::Storage
::volume_has_feature
($cfg, 'copy', "$storagename:$vmbase\/$vmlinked", undef, 0)) {
1965 warn "Test3 t failed";
1974 if (!PVE
::Storage
::volume_has_feature
($cfg, 'copy', "$storagename:$ctdisk", undef, 0)) {
1976 warn "Test3 u failed";
1985 if (!PVE
::Storage
::volume_has_feature
($cfg, 'copy', "$storagename:$ctbase", undef, 0)) {
1987 warn "Test3 v failed";
1996 if (!PVE
::Storage
::volume_has_feature
($cfg, 'copy', "$storagename:$ctbase\/$ctlinked", undef, 0)) {
1998 warn "Test3 w failed";
2007 if (!PVE
::Storage
::volume_has_feature
($cfg, 'sparseinit', "$storagename:$vmdisk", undef, 0)) {
2009 warn "Test3 x failed";
2018 if (!PVE
::Storage
::volume_has_feature
($cfg, 'sparseinit', "$storagename:$vmbase", undef, 0)) {
2020 warn "Test3 y failed";
2029 if (!PVE
::Storage
::volume_has_feature
($cfg, 'sparseinit', "$storagename:$vmbase\/$vmlinked", undef, 0)) {
2031 warn "Test3 z failed";
2040 if (!PVE
::Storage
::volume_has_feature
($cfg, 'sparseinit', "$storagename:$ctdisk", undef, 0)) {
2042 warn "Test3 A failed";
2051 if (!PVE
::Storage
::volume_has_feature
($cfg, 'sparseinit', "$storagename:$ctbase", undef, 0)) {
2053 warn "Test3 B failed";
2062 if (!PVE
::Storage
::volume_has_feature
($cfg, 'sparseinit', "$storagename:$ctbase\/$ctlinked", undef, 0)) {
2064 warn "Test3 C failed";
2073 if (!PVE
::Storage
::volume_has_feature
($cfg, 'snapshot', "$storagename:$vmdisk", 'test', 0)) {
2075 warn "Test3 a1 failed";
2080 warn "Test3 a1: $@";
2084 if (!PVE
::Storage
::volume_has_feature
($cfg, 'snapshot', "$storagename:$vmbase", 'test', 0)) {
2086 warn "Test3 b1 failed";
2091 warn "Test3 b1: $@";
2095 if (!PVE
::Storage
::volume_has_feature
($cfg, 'snapshot', "$storagename:$vmbase\/$vmlinked", 'test', 0)) {
2097 warn "Test3 c1 failed";
2102 warn "Test3 c1: $@";
2106 if (!PVE
::Storage
::volume_has_feature
($cfg, 'snapshot', "$storagename:$ctdisk", 'test', 0)) {
2108 warn "Test3 d1 failed";
2113 warn "Test3 d1: $@";
2117 if (!PVE
::Storage
::volume_has_feature
($cfg, 'snapshot', "$storagename:$ctbase", 'test', 0)) {
2119 warn "Test3 e1 failed";
2124 warn "Test3 e1: $@";
2128 if (!PVE
::Storage
::volume_has_feature
($cfg, 'snapshot', "$storagename:$ctbase\/$ctlinked", 'test', 0)) {
2130 warn "Test3 f1 failed";
2135 warn "Test3 f1: $@";
2139 if (PVE
::Storage
::volume_has_feature
($cfg, 'clone', "$storagename:$vmdisk", 'test', 0)) {
2141 warn "Test3 g1 failed";
2146 warn "Test3 g1: $@";
2150 if (PVE
::Storage
::volume_has_feature
($cfg, 'clone', "$storagename:$vmbase", 'test', 0)) {
2152 warn "Test3 h1 failed";
2157 warn "Test3 h1: $@";
2161 if (PVE
::Storage
::volume_has_feature
($cfg, 'clone', "$storagename:$vmbase\/$vmlinked", 'test', 0)) {
2163 warn "Test3 h1 failed";
2168 warn "Test3 h1: $@";
2172 if (PVE
::Storage
::volume_has_feature
($cfg, 'clone', "$storagename:$ctdisk", 'test', 0)) {
2174 warn "Test3 i1 failed";
2179 warn "Test3 i1: $@";
2183 if (PVE
::Storage
::volume_has_feature
($cfg, 'clone', "$storagename:$ctbase", 'test', 0)) {
2185 warn "Test3 j1 failed";
2190 warn "Test3 j1: $@";
2194 if (PVE
::Storage
::volume_has_feature
($cfg, 'clone', "$storagename:$ctbase\/$ctlinked", 'test', 0)) {
2196 warn "Test3 k1 failed";
2201 warn "Test3 k1: $@";
2205 if (PVE
::Storage
::volume_has_feature
($cfg, 'template', "$storagename:$vmdisk", 'test', 0)) {
2207 warn "Test3 l1 failed";
2212 warn "Test3 l1: $@";
2216 if (PVE
::Storage
::volume_has_feature
($cfg, 'template', "$storagename:$vmbase", 'test', 0)) {
2218 warn "Test3 m1 failed";
2223 warn "Test3 m1: $@";
2227 if (PVE
::Storage
::volume_has_feature
($cfg, 'template', "$storagename:$vmbase\/$vmlinked", 'test', 0)) {
2229 warn "Test3 n1 failed";
2234 warn "Test3 n1: $@";
2238 if (PVE
::Storage
::volume_has_feature
($cfg, 'template', "$storagename:$ctdisk", 'test', 0)) {
2240 warn "Test3 o1 failed";
2245 warn "Test3 o1: $@";
2249 if (PVE
::Storage
::volume_has_feature
($cfg, 'template', "$storagename:$ctbase", 'test', 0)) {
2251 warn "Test3 p1 failed";
2256 warn "Test3 p1: $@";
2260 if (PVE
::Storage
::volume_has_feature
($cfg, 'template', "$storagename:$ctbase\/$ctlinked", 'test', 0)) {
2262 warn "Test3 q1 failed";
2267 warn "Test3 q1: $@";
2271 if (PVE
::Storage
::volume_has_feature
($cfg, 'copy', "$storagename:$vmdisk", 'test', 0)) {
2273 warn "Test3 r1 failed";
2278 warn "Test3 r1: $@";
2282 if (PVE
::Storage
::volume_has_feature
($cfg, 'copy', "$storagename:$vmbase", 'test', 0)) {
2284 warn "Test3 s1 failed";
2289 warn "Test3 s1: $@";
2293 if (PVE
::Storage
::volume_has_feature
($cfg, 'copy', "$storagename:$vmbase\/$vmlinked", 'test', 0)) {
2295 warn "Test3 t1 failed";
2300 warn "Test3 t1: $@";
2304 if (PVE
::Storage
::volume_has_feature
($cfg, 'copy', "$storagename:$ctdisk", 'test', 0)) {
2306 warn "Test3 u1 failed";
2311 warn "Test3 u1: $@";
2315 if (PVE
::Storage
::volume_has_feature
($cfg, 'copy', "$storagename:$ctbase", 'test', 0)) {
2317 warn "Test3 v1 failed";
2322 warn "Test3 v1: $@";
2326 if (PVE
::Storage
::volume_has_feature
($cfg, 'copy', "$storagename:$ctbase\/$ctlinked", 'test', 0)) {
2328 warn "Test3 w1 failed";
2333 warn "Test3 w1: $@";
2337 if (PVE
::Storage
::volume_has_feature
($cfg, 'sparseinit', "$storagename:$vmdisk", 'test', 0)) {
2339 warn "Test3 x1 failed";
2344 warn "Test3 x1: $@";
2348 if (PVE
::Storage
::volume_has_feature
($cfg, 'sparseinit', "$storagename:$vmbase", 'test', 0)) {
2350 warn "Test3 y1 failed";
2355 warn "Test3 y1: $@";
2359 if (PVE
::Storage
::volume_has_feature
($cfg, 'sparseinit', "$storagename:$vmbase\/$vmlinked", 'test', 0)) {
2361 warn "Test3 z1 failed";
2366 warn "Test3 z1: $@";
2370 if (PVE
::Storage
::volume_has_feature
($cfg, 'sparseinit', "$storagename:$ctdisk", 'test', 0)) {
2372 warn "Test3 A1 failed";
2377 warn "Test3 A1: $@";
2381 if (PVE
::Storage
::volume_has_feature
($cfg, 'sparseinit', "$storagename:$ctbase", 'test', 0)) {
2383 warn "Test3 B1 failed";
2388 warn "Test3 B1: $@";
2392 if (PVE
::Storage
::volume_has_feature
($cfg, 'sparseinit', "$storagename:$ctbase\/$ctlinked", 'test', 0)) {
2394 warn "Test3 C1 failed";
2399 warn "Test3 C1: $@";
2402 $tests->{3} = $test3;
2406 print "\nrun test2 \"volume_resize\"\n";
2407 my $newsize = ($volsize + 1) * 1024 * 1024 * 1024;
2410 if (($newsize/1024) !=
2411 PVE
::Storage
::volume_resize
($cfg, "$storagename:$vmdisk", $newsize, 0)) {
2413 warn "Test2 a failed";
2416 PVE
::Storage
::volume_size_info
($cfg, "$storagename:$vmdisk")) {
2418 warn "Test2 a failed";
2427 warn "Test2 b failed" if ($newsize/1024) != PVE
::Storage
::volume_resize
($cfg, "$storagename:$vmbase", $newsize, 0);
2428 warn "Test2 b failed" if $newsize !=
2429 PVE
::Storage
::volume_size_info
($cfg, "$storagename:$vmbase");
2437 if (($newsize/1024) != PVE
::Storage
::volume_resize
($cfg, "$storagename:$vmbase\/$vmlinked", $newsize, 0)) {
2439 warn "Test2 c failed";
2442 PVE
::Storage
::volume_size_info
($cfg, "$storagename:$vmbase\/$vmlinked")) {
2444 warn "Test2 c failed";
2453 if (($newsize/1024) != PVE
::Storage
::volume_resize
($cfg, "$storagename:$ctdisk", $newsize, 0)) {
2455 warn "Test2 d failed";
2458 PVE
::Storage
::volume_size_info
($cfg, "$storagename:$ctdisk")) {
2460 warn "Test2 d failed"
2469 if (($newsize/1024) !=
2470 PVE
::Storage
::volume_resize
($cfg, "$storagename:$ctbase", $newsize, 0)) {
2472 warn "Test2 e failed";
2475 PVE
::Storage
::volume_size_info
($cfg, "$storagename:$ctbase")) {
2477 warn "Test2 e failed";
2486 if (($newsize/1024) !=
2487 PVE
::Storage
::volume_resize
($cfg, "$storagename:$ctbase\/$ctlinked", $newsize, 0)) {
2489 warn "Test2 f failed";
2492 PVE
::Storage
::volume_size_info
($cfg, "$storagename:$ctbase\/$ctlinked")) {
2494 warn "Test2 f failed";
2502 $tests->{2} = $test2;
2506 print "\nrun test1 \"volume_size_info\"\n";
2507 my $size = ($volsize * 1024 * 1024 * 1024);
2510 if ($size != PVE
::Storage
::volume_size_info
($cfg, "$storagename:$vmdisk")) {
2512 warn "Test1 a failed";
2517 warn "Test1 a : $@";
2521 if ($size != PVE
::Storage
::volume_size_info
($cfg, "$storagename:$vmbase")) {
2523 warn "Test1 b failed";
2529 warn "Test1 b : $@";
2534 PVE
::Storage
::volume_size_info
($cfg, "$storagename:$vmbase\/$vmlinked")) {
2536 warn "Test1 c failed";
2541 warn "Test1 c : $@";
2546 PVE
::Storage
::volume_size_info
($cfg, "$storagename:$ctdisk")) {
2548 warn "Test1 d failed";
2553 warn "Test1 d : $@";
2558 PVE
::Storage
::volume_size_info
($cfg, "$storagename:$ctbase")) {
2560 warn "Test1 e failed";
2565 warn "Test1 e : $@";
2570 PVE
::Storage
::volume_size_info
($cfg, "$storagename:$vmbase\/$vmlinked")) {
2572 warn "Test1 f failed"
2577 warn "Test1 f : $@";
2581 $tests->{1} = $test1;
2588 print "create zvol $vmdisk\n" if $verbose;
2589 run_command
("zfs create -V${volsize}G $zpath\/$vmdisk");
2591 print "create zvol $vmbase\n" if $verbose;
2592 run_command
("zfs create -V${volsize}G $zpath\/$vmbase");
2593 run_command
("zfs snapshot $zpath\/$vmbase$basesnap");
2595 print "create linked clone $vmlinked\n" if $verbose;
2596 run_command
("zfs clone $zpath\/$vmbase$basesnap $zpath\/$vmlinked");
2599 print "create subvol $ctdisk\n" if $verbose;
2600 run_command
("zfs create -o refquota=${volsize}G $zpath\/$ctdisk");
2602 print "create subvol $vmbase\n" if $verbose;
2603 run_command
("zfs create -o refquota=${volsize}G $zpath\/$ctbase");
2604 run_command
("zfs snapshot $zpath\/$ctbase$basesnap");
2606 print "create linked clone $vmlinked\n" if $verbose;
2607 run_command
("zfs clone $zpath\/$ctbase$basesnap $zpath\/$ctlinked -o refquota=${volsize}G");
2612 print "destroy $pool\/$subvol\n" if $verbose;
2613 run_command
("zfs destroy $zpath -r");
2619 run_command
("dd if=/dev/zero of=zpool.img bs=1M count=8000 ");
2626 run_command
("zpool create $subvol $pwd\/zpool.img");
2633 sub clean_up_zpool
{
2636 run_command
("zpool destroy $subvol");
2646 print "Start tests for ZFSPoolPlugin\n";
2658 'order' => {'zfstank99' => 1,}
2663 for (my $i = $start_test; $i <= $end_test; $i++) {
2675 $time = time - $time;
2677 print "Stop tests for ZFSPoolPlugin\n";
2678 print "$count tests failed\n";
2679 print "Time: ${time}s\n";