[pve-devel] [PATCH 06/19] phase2 : write vm config to externalcluster new vmid.conf

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


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

diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
index a2fa17a..616632c 100644
--- a/PVE/QemuMigrate.pm
+++ b/PVE/QemuMigrate.pm
@@ -473,6 +473,7 @@ sub phase2 {
 
     if ($self->{opts}->{externalcluster}) {
 	$self->log('info', "Creating a new VM on remote external node '$self->{node}'");
+
 	## start on remote node
 	my $cmdcreate = [@{$self->{rem_ssh}}];
 	push @$cmdcreate , 'qm', 'create';
@@ -484,6 +485,15 @@ sub phase2 {
                 $vmid = $1;
             }
 	});
+
+	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);
     }
 
     $self->log('info', "starting VM $vmid on remote node '$self->{node}'");
-- 
2.1.4




More information about the pve-devel mailing list