[pve-devel] [PATCH qemu-server v4 12/12] migration: show vfio state transferred too

Dominik Csapak d.csapak at proxmox.com
Thu Jun 6 11:22:13 CEST 2024


there is no total here, so we can't show any, just what was transferred
up until now (if any).

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
new in v4
 PVE/API2/Qemu.pm   |  2 +-
 PVE/QemuMigrate.pm | 12 +++++++++++-
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
index 0a999006..34bfcdf4 100644
--- a/PVE/API2/Qemu.pm
+++ b/PVE/API2/Qemu.pm
@@ -4541,7 +4541,7 @@ __PACKAGE__->register_method({
 	    }
 
 	    # if nothing came up, add it to the allowed nodes
-	    if (!$res->{not_allowed_nodes}->{$node}) {
+	    if (scalar($res->{not_allowed_nodes}->{$node}->%*) == 0) {
 		push $res->{allowed_nodes}->@*, $node;
 	    }
 	}
diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 41ff12c2..bd65558c 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -1242,6 +1242,7 @@ sub phase2 {
     $self->log('info', "migrate uri => $migrate_uri failed: $merr") if $merr;
 
     my $last_mem_transferred = 0;
+    my $last_vfio_transferred = 0;
     my $usleep = 1000000;
     my $i = 0;
     my $err_count = 0;
@@ -1301,8 +1302,11 @@ sub phase2 {
 	    last;
 	}
 
-	if ($memstat->{transferred} ne $last_mem_transferred) {
+	if ($memstat->{transferred} ne $last_mem_transferred ||
+	    $stat->{vfio}->{transferred} ne $last_vfio_transferred
+	) {
 	    my $trans = $memstat->{transferred} || 0;
+	    my $vfio_transferred = $stat->{vfio}->{transferred} || 0;
 	    my $rem = $memstat->{remaining} || 0;
 	    my $total = $memstat->{total} || 0;
 	    my $speed = ($memstat->{'pages-per-second'} // 0) * ($memstat->{'page-size'} // 0);
@@ -1320,6 +1324,11 @@ sub phase2 {
 
 	    my $progress = "transferred $transferred_h of $total_h VM-state, ${speed_h}/s";
 
+	    if ($vfio_transferred > 0) {
+		my $vfio_h = render_bytes($vfio_transferred, 1);
+		$progress .= " (+ $vfio_h VFIO-state)";
+	    }
+
 	    if ($dirty_rate > $speed) {
 		my $dirty_rate_h = render_bytes($dirty_rate, 1);
 		$progress .= ", VM dirties lots of memory: $dirty_rate_h/s";
@@ -1361,6 +1370,7 @@ sub phase2 {
 	}
 
 	$last_mem_transferred = $memstat->{transferred};
+	$last_vfio_transferred = $stat->{vfio}->{transferred};
     }
 
     if ($self->{storage_migration}) {
-- 
2.39.2





More information about the pve-devel mailing list