all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Michal Fox <me@dualfroz.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH qemu-server v2 1/2] test: migration: support volumes other than images
Date: Thu,  8 Oct 2026 09:46:49 +0000	[thread overview]
Message-ID: <20261008094650.7-2-me@dualfroz.com> (raw)
In-Reply-To: <20261008094650.7-1-me@dualfroz.com>

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>
---
 src/test/MigrationTest/QemuMigrateMock.pm | 5 +++--
 src/test/run_qemu_migrate_tests.pl        | 5 +++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/test/MigrationTest/QemuMigrateMock.pm b/src/test/MigrationTest/QemuMigrateMock.pm
index 3a483817..c715a60e 100644
--- a/src/test/MigrationTest/QemuMigrateMock.pm
+++ b/src/test/MigrationTest/QemuMigrateMock.pm
@@ -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";
     },
 );
 
diff --git a/src/test/run_qemu_migrate_tests.pl b/src/test/run_qemu_migrate_tests.pl
index 05eed1d9..13962f72 100755
--- a/src/test/run_qemu_migrate_tests.pl
+++ b/src/test/run_qemu_migrate_tests.pl
@@ -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 = {
     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};
-- 
2.43.0




  reply	other threads:[~2026-10-08  9:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08  9:46 [PATCH qemu-server v2 0/2] fix #4012: migrate: mention snapshots referencing a local ISO image Michal Fox
2026-10-08  9:46 ` Michal Fox [this message]
2026-10-08  9:46 ` [PATCH qemu-server v2 2/2] " Michal Fox
2026-10-09 14:37 ` applied: [PATCH qemu-server v2 0/2] " Fiona Ebner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261008094650.7-2-me@dualfroz.com \
    --to=me@dualfroz.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal