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

Alexandre Derumier aderumier at odiso.com
Mon Apr 29 12:01:25 CEST 2019


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

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 03d601c..ecdf171 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -612,19 +612,9 @@ sub phase3_cleanup {
     my $tunnel = $self->{tunnel};
 
 	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}) {
 	    # stop nbd server on remote vm - requirement for resume since 2.9
@@ -1145,4 +1135,21 @@ 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.11.0




More information about the pve-devel mailing list