so it fails when something bad comes in.

Signed-off-by: Fabian Ebner <f.eb...@proxmox.com>
---

New in v2, added because I ran into a problem with an early version of patch #12
which wasn't detected by the tests. See patch #12 for the details.

 test/MigrationTest/QemuMigrateMock.pm | 3 +++
 test/MigrationTest/QmMock.pm          | 2 ++
 test/MigrationTest/Shared.pm          | 4 ++++
 3 files changed, 9 insertions(+)

diff --git a/test/MigrationTest/QemuMigrateMock.pm 
b/test/MigrationTest/QemuMigrateMock.pm
index efd6130..2d424e0 100644
--- a/test/MigrationTest/QemuMigrateMock.pm
+++ b/test/MigrationTest/QemuMigrateMock.pm
@@ -221,6 +221,8 @@ $MigrationTest::Shared::storage_module->mock(
     vdisk_free => sub {
        my ($scfg, $volid) = @_;
 
+       PVE::Storage::parse_volume_id($volid);
+
        die "vdisk_free '$volid' error\n" if defined($fail_config->{vdisk_free})
                                          && $fail_config->{vdisk_free} eq 
$volid;
 
@@ -292,6 +294,7 @@ $MigrationTest::Shared::tools_module->mock(
                    $cmd = shift @{$cmd_tail};
                    if ($cmd eq 'free') {
                        my $volid = shift @{$cmd_tail};
+                       PVE::Storage::parse_volume_id($volid);
                        return 1 if $fail_config->{ssh_pvesm_free}
                                 && $fail_config->{ssh_pvesm_free} eq $volid;
                        MigrationTest::Shared::remove_target_volid($volid);
diff --git a/test/MigrationTest/QmMock.pm b/test/MigrationTest/QmMock.pm
index 2f1fffc..2d5d5c6 100644
--- a/test/MigrationTest/QmMock.pm
+++ b/test/MigrationTest/QmMock.pm
@@ -86,6 +86,8 @@ $MigrationTest::Shared::storage_module->mock(
            $volid = "${storeid}:${name_without_extension}";
        }
 
+       PVE::Storage::parse_volume_id($volid);
+
        die "vdisk_alloc '$volid' error\n" if $fail_config->{vdisk_alloc}
                                           && $fail_config->{vdisk_alloc} eq 
$volid;
 
diff --git a/test/MigrationTest/Shared.pm b/test/MigrationTest/Shared.pm
index d7aeb36..e48b82c 100644
--- a/test/MigrationTest/Shared.pm
+++ b/test/MigrationTest/Shared.pm
@@ -23,6 +23,8 @@ my $test_vmid = $migrate_params->{vmid};
 sub add_target_volid {
     my ($volid) = @_;
 
+    PVE::Storage::parse_volume_id($volid);
+
     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"));
        die "target volid already present " if 
defined($target_volids->{$volid});
@@ -35,6 +37,8 @@ sub add_target_volid {
 sub remove_target_volid {
     my ($volid) = @_;
 
+    PVE::Storage::parse_volume_id($volid);
+
     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"));
        die "target volid does not exist " if 
!defined($target_volids->{$volid});
-- 
2.20.1



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to