[pve-devel] [PATCH 11/19] phase2 : write target vm config after disk create

Alexandre Derumier aderumier at odiso.com
Wed Feb 22 14:33:35 CET 2017


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

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index 1ca445d..13952cb 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -594,6 +594,25 @@ sub phase2 {
 
     die "unable to detect remote migration address\n" if !$raddr;
 
+    if ($self->{opts}->{externalcluster}) {
+
+	my $conf = PVE::QemuConfig->load_config($vmid);
+
+	foreach my $target_drive (keys %{$self->{target_drive}}) {
+	    my $drive = PVE::QemuServer::parse_drive($target_drive, $self->{target_drive}->{$target_drive}->{volid});
+	    $conf->{$target_drive} = PVE::QemuServer::print_drive($vmid, $drive);
+	}
+
+	my $configout = "";
+	foreach my $opt (keys %$conf) {
+	    next if $opt eq 'snapshots';
+	    next if $opt eq 'pending';
+	    $configout .= "$opt: $conf->{$opt}\n";
+	}
+	my $cmdwrite = [@{$self->{rem_ssh}}," /bin/echo -e \"$configout\" > /etc/pve/qemu-server/$targetvmid.conf"];
+	PVE::Tools::run_command($cmdwrite);
+    }
+
     if ($migration_type eq 'secure') {
 	$self->log('info', "start remote tunnel");
 
-- 
2.1.4




More information about the pve-devel mailing list