[pve-devel] [PATCH v2 qemu-server 10/16] phase3_cleanup: add move_config

Alexandre Derumier aderumier at odiso.com
Mon Mar 9 16:24:33 CET 2020


Signed-off-by: Alexandre Derumier <aderumier at odiso.com>
---
 PVE/QemuMigrate.pm | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 37db3b8..a5505bd 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -633,17 +633,7 @@ sub phase3_cleanup {
 
     finish_block_jobs($self, $vmid);
 
-    # transfer replication state before move config
-    $self->transfer_replication_state() if $self->{replicated_volumes};
-
-    # move config to remote node
-    my $conffile = PVE::QemuConfig->config_file($vmid);
-    my $newconffile = PVE::QemuConfig->config_file($vmid, $self->{node});
-
-    die "Failed to move config to node '$self->{node}' - rename failed: $!\n"
-        if !rename($conffile, $newconffile);
-
-    $self->switch_replication_job_target() if $self->{replicated_volumes};
+    move_config($self, $vmid);
 
     if ($self->{livemigration}) {
 	if ($self->{storage_migration}) {
@@ -1169,4 +1159,20 @@ sub finish_block_jobs {
     }
 }
 
+sub move_config {
+    my ($self, $vmid) = @_;
+
+    # transfer replication state before move config
+    $self->transfer_replication_state() if $self->{replicated_volumes};
+
+    # move config to remote node
+    my $conffile = PVE::QemuConfig->config_file($vmid);
+    my $newconffile = PVE::QemuConfig->config_file($vmid, $self->{node});
+
+    die "Failed to move config to node '$self->{node}' - rename failed: $!\n"
+        if !rename($conffile, $newconffile);
+
+    $self->switch_replication_job_target() if $self->{replicated_volumes};
+}
+
 1;
-- 
2.20.1




More information about the pve-devel mailing list