> 虚拟化 Virtualization > Proxmox >

PVE Nvidia-vGPU在线迁移

diff -ur a/QemuMigrate.pm b/QemuMigrate.pm
--- a/QemuMigrate.pm 2023-02-09 16:38:26.955570284 +0800
+++ b/QemuMigrate.pm 2023-02-09 16:38:40.591473539 +0800
@@ -210,14 +210,14 @@
  $self->{vm_was_paused} = 1 if PVE::QemuServer::vm_is_paused($vmid);
     }

-    my $loc_res = PVE::QemuServer::check_local_resources($conf, 1);
-    if (scalar @$loc_res) {
- if ($self->{running} || !$self->{opts}->{force}) {
-     die "can't migrate VM which uses local devices: " . join(", ", @$loc_res) . "\n";
- } else {
-     $self->log('info', "migrating VM which uses local devices");
- }
-    }
+    #my $loc_res = PVE::QemuServer::check_local_resources($conf, 1);
+    #if (scalar @$loc_res) {
+    # if ($self->{running} || !$self->{opts}->{force}) {
+    #     die "can't migrate VM which uses local devices: " . join(", ", @$loc_res) . "\n";
+    # } else {
+    #     $self->log('info', "migrating VM which uses local devices");
+    # }
+    #}

     my $vollist = PVE::QemuServer::get_vm_volumes($conf);

@@ -1271,8 +1271,7 @@
  }

  if ($status eq 'failed' || $status eq 'cancelled') {
-     my $message = $stat->{'error-desc'} ? "$status - $stat->{'error-desc'}" : $status;
-     $self->log('info', "migration status error: $message");
+     $self->log('info', "migration status error: $status");
      die "aborting\n"
  }

diff -ur a/QemuServer/PCI.pm b/QemuServer/PCI.pm
--- a/QemuServer/PCI.pm 2023-02-09 16:38:26.959570255 +0800
+++ b/QemuServer/PCI.pm 2023-02-09 16:39:00.303333685 +0800
@@ -470,7 +470,7 @@
      my $devicestr = "vfio-pci";

      if ($sysfspath) {
-  $devicestr .= ",sysfsdev=$sysfspath";
+  $devicestr .= ",x-enable-migration=on,sysfsdev=$sysfspath";
      } else {
   $devicestr .= ",host=$pcidevice->{id}";
      }


(责任编辑:IT)