[pve-devel] [PATCH qemu-server 05/10] tests: update QmMock to support vtypes

Wolfgang Bumiller
2025-07-29T11:23:41Z

This currently breaks the tests.
The accompanying test case fixes happen automated via shell commands
in the next commit.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
---
src/test/MigrationTest/QmMock.pm | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/test/MigrationTest/QmMock.pm b/src/test/MigrationTest/QmMock.pm
index 78be47d3..e98b38d6 100644
--- a/src/test/MigrationTest/QmMock.pm
+++ b/src/test/MigrationTest/QmMock.pm
@@ -89,12 +89,14 @@ my $disk_counter = 10;

$MigrationTest::Shared::storage_module->mock(
vdisk_alloc => sub {
- my ($cfg, $storeid, $vmid, $fmt, $name, $size) = @_;
+ my ($cfg, $storeid, $vmid, $fmt, $name, $size, $vtype) = @_;

die "vdisk_alloc (mocked) - name is not expected to be set - implement me\n"
if defined($name);

- my $name_without_extension = "vm-${vmid}-disk-${disk_counter}";
+ my $prefix = ($vtype && $vtype eq 'vm-vol') ? 'vol-vm' : 'vm';
+
+ my $name_without_extension = "${prefix}-${vmid}-disk-${disk_counter}";
$disk_counter++;

my $volid;