From: "Michael Köppl" <m.koeppl@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH e2e-tests 38/38] tests: migration: verify migrating guests in bulk
Date: Wed, 4 Nov 2026 20:03:45 +0100 [thread overview]
Message-ID: <20261104190345.2573464-39-m.koeppl@proxmox.com> (raw)
In-Reply-To: <20261104190345.2573464-1-m.koeppl@proxmox.com>
Start a VM and a container that are not Ha-managed on one node and
migrate both to another node with a single bulk migration. Check that
both run on the target node afterwards.
Signed-off-by: Michael Köppl <m.koeppl@proxmox.com>
---
tests/pve_bulk_migration.pl | 111 ++++++++++++++++++++++++++++++++++++
tests/testcases.ron | 11 ++++
2 files changed, 122 insertions(+)
create mode 100755 tests/pve_bulk_migration.pl
diff --git a/tests/pve_bulk_migration.pl b/tests/pve_bulk_migration.pl
new file mode 100755
index 0000000..3b5c493
--- /dev/null
+++ b/tests/pve_bulk_migration.pl
@@ -0,0 +1,111 @@
+#!/usr/bin/perl
+
+=head1 NAME
+
+C<pve_bulk_migration> - Test migrating several guests between cluster nodes at once.
+
+=head1 DESCRIPTION
+
+This testcase starts a VM and a container that are not HA-managed on the first
+cluster node and migrates both to the second node in bulk. Afterwards, both must
+run on the second node.
+
+=cut
+
+use strict;
+use warnings;
+
+use Test::More;
+
+use lib '.';
+use Proxmox::Test::Helper qw(CONTAINER_TEMPLATE get_pve_instance);
+use Proxmox::Test::Testcase;
+use Proxmox::Test::Util qw(poll_until);
+
+my $pve_a = get_pve_instance('pve1-cluster');
+my $pve_b = get_pve_instance('pve2-cluster');
+my $node_a = $pve_a->get_nodename();
+my $node_b = $pve_b->get_nodename();
+my $client = $pve_a->client();
+
+my $vmid;
+my $ctid;
+
+# The node and status of a guest according to the cluster resources.
+my $resource = sub {
+ my ($id) = @_;
+ my $resources = $client->get('/cluster/resources', { type => 'vm' });
+ my ($entry) = grep { ($_->{vmid} // 0) == $id } $resources->@*;
+ return $entry // {};
+};
+
+my $wait_for_guest = sub {
+ my ($id, $node, $timeout) = @_;
+ poll_until(
+ sub {
+ my $entry = $resource->($id);
+ return ($entry->{node} // '') eq $node && ($entry->{status} // '') eq 'running';
+ },
+ timeout => $timeout,
+ interval => 5,
+ description => "guest $id to run on node $node",
+ );
+};
+
+my $destroy = sub {
+ my ($type, $id) = @_;
+ my $node = $resource->($id)->{node};
+ $pve_a->destroy_guest_on($node, $type, $id) if defined($node);
+};
+
+Proxmox::Test::Testcase->new('pve_bulk_migration')->with([{}])->step(
+ 'start VM and container',
+ sub {
+ $vmid = $client->get('/cluster/nextid');
+ my $upid = $client->post(
+ "/nodes/$node_a/qemu",
+ { vmid => $vmid, name => 'vm-bulk-migrate', memory => 256 },
+ );
+ $pve_a->task_ok($upid, "created VM $vmid on node $node_a")
+ or die "creating VM $vmid failed\n";
+ $pve_a->start_guest('qemu', $vmid);
+
+ $ctid = $client->get('/cluster/nextid');
+ $upid = $client->post(
+ "/nodes/$node_a/lxc",
+ {
+ vmid => $ctid,
+ ostemplate => CONTAINER_TEMPLATE,
+ rootfs => 'local-lvm:2',
+ memory => 256,
+ unprivileged => 1,
+ features => 'nesting=1',
+ hostname => 'ct-bulk-migrate',
+ },
+ );
+ $pve_a->task_ok($upid, "created container $ctid on node $node_a")
+ or die "creating container $ctid failed\n";
+ $pve_a->start_guest('lxc', $ctid);
+ },
+ sub {
+ $destroy->('lxc', $ctid) if defined($ctid);
+ $destroy->('qemu', $vmid) if defined($vmid);
+ },
+)->step(
+ 'migrate guests in bulk',
+ sub {
+ my $upid = $client->post(
+ "/nodes/$node_a/migrateall",
+ { target => $node_b, vms => "$vmid,$ctid", maxworkers => 2 },
+ );
+ $pve_a->task_ok($upid, "migrated guests from node $node_a to node $node_b")
+ or die "bulk migration failed\n";
+
+ $wait_for_guest->($vmid, $node_b, 60);
+ pass("VM $vmid runs on node $node_b");
+ $wait_for_guest->($ctid, $node_b, 60);
+ pass("container $ctid runs on node $node_b");
+ },
+)->run();
+
+done_testing();
diff --git a/tests/testcases.ron b/tests/testcases.ron
index 0e4cea0..7522ef2 100644
--- a/tests/testcases.ron
+++ b/tests/testcases.ron
@@ -304,6 +304,17 @@ TestcaseConfig(
],
tag: "ha",
),
+ Testcase(
+ name: "pve_bulk_migration",
+ run: "./tests/pve_bulk_migration.pl",
+ timeout: 600,
+ instances: [
+ "pve1-cluster",
+ "pve2-cluster",
+ "pve3-cluster",
+ ],
+ tag: "extended",
+ ),
Testcase(
name: "pbs_s3_datastore",
run: "./tests/pbs/test_pbs_s3_datastore.pl",
--
2.47.3
next prev parent reply other threads:[~2026-11-04 19:08 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 19:03 [PATCH e2e-tests/test-tools 00/38] tests: add tests for guests, Ceph, PBS and cluster workflows Michael Köppl
2026-11-04 19:03 ` [PATCH test-tools 01/38] ansible: rename snd_test bridge to tt_test as multi-purpose bridge Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 02/38] plans: rename sdn_test bridge to tt_test Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 03/38] debian: add missing jq dependency Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 04/38] test framework: move the default container template to the helper Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 05/38] lib: instance: add helper to check if an address answers ping Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 06/38] lib: pveinstance: look up disks by their SCSI serial Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 07/38] lib: pveinstance: add helper to find a task started by another task Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 08/38] lib: pveinstance: add helpers to start and stop guests Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 09/38] lib: pveinstance: add helper to run commands in containers Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 10/38] lib: pveinstance: add helper to wait for qmeventd's cleanup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 11/38] lib: pveinstance: add helper to check if guest exists Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 12/38] lib: add helpers to use a PBS datastore as PVE storage Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 13/38] scripts: retry container template download, fail if it fails Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 14/38] tests: container: verify lifecycle and guest setup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 15/38] tests: container: verify volume and bind mountpoints Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 16/38] tests: container: verify snapshots, clones, templates Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 17/38] tests: container: verify device passthrough Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 18/38] plans,scripts: build a minimal OCI image onto pve1 Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 19/38] tests: container: verify application containers from OCI images Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 20/38] tests: vm: verify snapshots, clones, templates Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 21/38] tests: vm: verify adding, resizing, and removing disks Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 22/38] plans,scripts: download a Debian cloud image onto pve1 Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 23/38] tests: vm: verify lifecycle operations and cloud-init guest setup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 24/38] plans,scripts: install Ceph Tentacle on the cluster nodes Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 25/38] test framework: add Ceph test helpers Michael Köppl
2026-11-06 12:24 ` Kefu Chai
2026-11-06 13:04 ` Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 26/38] tests: ceph: verify setting up a hyper-converged cluster Michael Köppl
2026-11-06 12:50 ` Kefu Chai
2026-11-06 13:05 ` Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 27/38] tests: ceph: verify guests on RBD storage Michael Köppl
2026-11-06 13:01 ` Kefu Chai
2026-11-06 13:07 ` Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 28/38] tests: ceph: verify setting up, using and destroying a CephFS Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 29/38] tests: ceph: verify replacing an OSD Michael Köppl
2026-11-06 13:14 ` Kefu Chai
2026-11-04 19:03 ` [PATCH e2e-tests 30/38] tests: ceph: drop the outdated Ceph setup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 31/38] tests: pbs: verify container backup and restore Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 32/38] tests: backup: verify VM backup and restore, locally and on PBS Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 33/38] tests: pbs: verify single file restore from a container backup Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 34/38] tests: storage: verify moving guest volumes between storages Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 35/38] tests: migration: verify container migration between nodes Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 36/38] tests: migration: verify VM migration with local disks Michael Köppl
2026-11-04 19:03 ` [PATCH e2e-tests 37/38] tests: ha: verify moving guests off a node for maintenance Michael Köppl
2026-11-04 19:03 ` Michael Köppl [this message]
2026-11-06 13:25 ` [PATCH e2e-tests/test-tools 00/38] tests: add tests for guests, Ceph, PBS and cluster workflows Kefu Chai
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=20261104190345.2573464-39-m.koeppl@proxmox.com \
--to=m.koeppl@proxmox.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox