[pve-devel] [PATCH common 3/4] move test for working ssh conection to AbstractMigrate
Thomas Lamprecht
t.lamprecht at proxmox.com
Thu Oct 27 17:00:17 CEST 2016
this needs to be done by both, container and qemu and I reuse it
in AbstractMigrate in a later patch.
Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
src/PVE/AbstractMigrate.pm | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/PVE/AbstractMigrate.pm b/src/PVE/AbstractMigrate.pm
index caa6573..00d0ff5 100644
--- a/src/PVE/AbstractMigrate.pm
+++ b/src/PVE/AbstractMigrate.pm
@@ -82,6 +82,15 @@ sub cmd_logerr {
return &$run_command_quiet_full($self, $cmd, 1, %param);
}
+sub test_remote_ssh_connection {
+ my ($self) = @_;
+
+ my $cmd = [ @{$self->{rem_ssh}}, '/bin/true' ];
+ eval { $self->cmd_quiet($cmd); };
+ die "Can't connect to destination address ($self->{nodeip}) using public " .
+ "key authentication\n" if $@;
+}
+
my $eval_int = sub {
my ($self, $func, @param) = @_;
@@ -146,6 +155,8 @@ sub migrate {
&$eval_int($self, sub { $self->{running} = $self->prepare($self->{vmid}); });
die $@ if $@;
+ $self->test_remote_ssh_connection();
+
&$eval_int($self, sub { $self->phase1($self->{vmid}); });
my $err = $@;
if ($err) {
--
2.1.4
More information about the pve-devel
mailing list