mirror of
https://git.proxmox.com/git/qemu-server
synced 2025-05-02 16:35:30 +00:00
test: migration: add parse_volume_id calls
so it fails when something bad comes in. Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
parent
eabac302ba
commit
93a1c63f4c
@ -221,6 +221,8 @@ $MigrationTest::Shared::storage_module->mock(
|
|||||||
vdisk_free => sub {
|
vdisk_free => sub {
|
||||||
my ($scfg, $volid) = @_;
|
my ($scfg, $volid) = @_;
|
||||||
|
|
||||||
|
PVE::Storage::parse_volume_id($volid);
|
||||||
|
|
||||||
die "vdisk_free '$volid' error\n" if defined($fail_config->{vdisk_free})
|
die "vdisk_free '$volid' error\n" if defined($fail_config->{vdisk_free})
|
||||||
&& $fail_config->{vdisk_free} eq $volid;
|
&& $fail_config->{vdisk_free} eq $volid;
|
||||||
|
|
||||||
@ -292,6 +294,7 @@ $MigrationTest::Shared::tools_module->mock(
|
|||||||
$cmd = shift @{$cmd_tail};
|
$cmd = shift @{$cmd_tail};
|
||||||
if ($cmd eq 'free') {
|
if ($cmd eq 'free') {
|
||||||
my $volid = shift @{$cmd_tail};
|
my $volid = shift @{$cmd_tail};
|
||||||
|
PVE::Storage::parse_volume_id($volid);
|
||||||
return 1 if $fail_config->{ssh_pvesm_free}
|
return 1 if $fail_config->{ssh_pvesm_free}
|
||||||
&& $fail_config->{ssh_pvesm_free} eq $volid;
|
&& $fail_config->{ssh_pvesm_free} eq $volid;
|
||||||
MigrationTest::Shared::remove_target_volid($volid);
|
MigrationTest::Shared::remove_target_volid($volid);
|
||||||
|
@ -86,6 +86,8 @@ $MigrationTest::Shared::storage_module->mock(
|
|||||||
$volid = "${storeid}:${name_without_extension}";
|
$volid = "${storeid}:${name_without_extension}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PVE::Storage::parse_volume_id($volid);
|
||||||
|
|
||||||
die "vdisk_alloc '$volid' error\n" if $fail_config->{vdisk_alloc}
|
die "vdisk_alloc '$volid' error\n" if $fail_config->{vdisk_alloc}
|
||||||
&& $fail_config->{vdisk_alloc} eq $volid;
|
&& $fail_config->{vdisk_alloc} eq $volid;
|
||||||
|
|
||||||
|
@ -23,6 +23,8 @@ my $test_vmid = $migrate_params->{vmid};
|
|||||||
sub add_target_volid {
|
sub add_target_volid {
|
||||||
my ($volid) = @_;
|
my ($volid) = @_;
|
||||||
|
|
||||||
|
PVE::Storage::parse_volume_id($volid);
|
||||||
|
|
||||||
lock_file_full("${RUN_DIR_PATH}/target_volids.lock", undef, 0, sub {
|
lock_file_full("${RUN_DIR_PATH}/target_volids.lock", undef, 0, sub {
|
||||||
my $target_volids = decode_json(file_get_contents("${RUN_DIR_PATH}/target_volids"));
|
my $target_volids = decode_json(file_get_contents("${RUN_DIR_PATH}/target_volids"));
|
||||||
die "target volid already present " if defined($target_volids->{$volid});
|
die "target volid already present " if defined($target_volids->{$volid});
|
||||||
@ -35,6 +37,8 @@ sub add_target_volid {
|
|||||||
sub remove_target_volid {
|
sub remove_target_volid {
|
||||||
my ($volid) = @_;
|
my ($volid) = @_;
|
||||||
|
|
||||||
|
PVE::Storage::parse_volume_id($volid);
|
||||||
|
|
||||||
lock_file_full("${RUN_DIR_PATH}/target_volids.lock", undef, 0, sub {
|
lock_file_full("${RUN_DIR_PATH}/target_volids.lock", undef, 0, sub {
|
||||||
my $target_volids = decode_json(file_get_contents("${RUN_DIR_PATH}/target_volids"));
|
my $target_volids = decode_json(file_get_contents("${RUN_DIR_PATH}/target_volids"));
|
||||||
die "target volid does not exist " if !defined($target_volids->{$volid});
|
die "target volid does not exist " if !defined($target_volids->{$volid});
|
||||||
|
Loading…
Reference in New Issue
Block a user