diff --git a/src/test/MigrationTest/QemuMigrateMock.pm b/src/test/MigrationTest/QemuMigrateMock.pm index 3a48381..c715a60 100644 --- a/src/test/MigrationTest/QemuMigrateMock.pm +++ b/src/test/MigrationTest/QemuMigrateMock.pm @@ -21,6 +21,7 @@ my $QM_LIB_PATH = $ENV{QM_LIB_PATH} or die "no QM_LIB_PATH set\n"; my $source_volids = decode_json(file_get_contents("${RUN_DIR_PATH}/source_volids")); my $source_vdisks = decode_json(file_get_contents("${RUN_DIR_PATH}/source_vdisks")); +my $source_other_volumes = decode_json(file_get_contents("${RUN_DIR_PATH}/source_other_volumes")); my $vm_status = decode_json(file_get_contents("${RUN_DIR_PATH}/vm_status")); my $expected_calls = decode_json(file_get_contents("${RUN_DIR_PATH}/expected_calls")); my $fail_config = decode_json(file_get_contents("${RUN_DIR_PATH}/fail_config")); @@ -304,11 +305,11 @@ $MigrationTest::Shared::storage_module->mock( my ($scfg, $volid) = @_; my ($storeid, $volname) = PVE::Storage::parse_volume_id($volid); - for my $v ($source_vdisks->{$storeid}->@*) { + for my $v ($source_vdisks->{$storeid}->@*, $source_other_volumes->{$storeid}->@*) { return wantarray ? ($v->{size}, $v->{format}, $v->{used}, $v->{parent}) : $v->{size} if $v->{volid} eq $volid; } - die "could not find '$volid' in mock 'source_vdisks'\n"; + die "could not find '$volid' in mock 'source_vdisks' or 'source_other_volumes'\n"; }, ); diff --git a/src/test/run_qemu_migrate_tests.pl b/src/test/run_qemu_migrate_tests.pl index 05eed1d..13962f7 100644 --- a/src/test/run_qemu_migrate_tests.pl +++ b/src/test/run_qemu_migrate_tests.pl @@ -436,6 +436,10 @@ my $source_vdisks = { ], }; +# non-image volumes on the source, e.g. ISO images, in the same format as $source_vdisks. They +# are only used for the mocked volume_size_info(), because vdisk_list() only returns images. +my $source_other_volumes = {}; + my $default_expected_calls_online = { move_config_to_node => 1, ssh_qm_start => 1, @@ -1732,6 +1736,7 @@ foreach my $test (@{$tests}) { file_set_contents("${run_dir}/replication_config", to_json($replication_config)); file_set_contents("${run_dir}/storage_config", to_json($storage_config)); file_set_contents("${run_dir}/source_vdisks", to_json($source_vdisks)); + file_set_contents("${run_dir}/source_other_volumes", to_json($source_other_volumes)); my $expect_die = $test->{expect_die}; my $expected = $test->{expected};