test: migration: support volumes other than images

The mocked vdisk_list() is based on $source_vdisks, but the real one
only returns images. Add a separate list for other volumes on the
source, e.g. ISO images, which is only considered by the mocked
volume_size_info(). This is in preparation for a test with an ISO
image that is only referenced by a snapshot.

Suggested-by: Fiona Ebner <f.ebner@proxmox.com>
Signed-off-by: Michal Fox <me@dualfroz.com>
Link: https://lore.proxmox.com/20261008094650.7-2-me@dualfroz.com
[FE: avoid ambiguous term 'format' in comment]
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
This commit is contained in:
dualfroz committed 2026-10-09 16:20:38 +02:00
1 parent b5d4ad6a33
commit ac29cc9716
2 files changed
+8 -2

No files matched your search

+3 -2
View File
@@ -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";
},
);
+5
View File
@@ -436,6 +436,10 @@ my $source_vdisks = {
],
};
# Non-image volumes on the source, e.g. ISO images, with the same structure 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};