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>
This commit is contained in:
1 parent
a6c6b6e0f2
commit
23657b8b24
2 files changed
+8
-2
No files matched your search
@@ -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_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_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 $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 $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"));
|
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 ($scfg, $volid) = @_;
|
||||||
my ($storeid, $volname) = PVE::Storage::parse_volume_id($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}
|
return wantarray ? ($v->{size}, $v->{format}, $v->{used}, $v->{parent}) : $v->{size}
|
||||||
if $v->{volid} eq $volid;
|
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";
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -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 = {
|
my $default_expected_calls_online = {
|
||||||
move_config_to_node => 1,
|
move_config_to_node => 1,
|
||||||
ssh_qm_start => 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}/replication_config", to_json($replication_config));
|
||||||
file_set_contents("${run_dir}/storage_config", to_json($storage_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_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 $expect_die = $test->{expect_die};
|
||||||
my $expected = $test->{expected};
|
my $expected = $test->{expected};
|
||||||
|
|||||||
Reference in new issue
Block a user