From f1c2a53aee0c734846d26d487e46398a2e9ec9a1 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Tue, 30 May 2017 15:30:13 +0200 Subject: [PATCH] migration: implement insecure offline migration --- PVE/QemuMigrate.pm | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm index 100c5835..bf756a6b 100644 --- a/PVE/QemuMigrate.pm +++ b/PVE/QemuMigrate.pm @@ -399,7 +399,8 @@ sub sync_disks { push @{$self->{online_local_volumes}}, $volid; } else { push @{$self->{volumes}}, $volid; - PVE::Storage::storage_migrate($self->{storecfg}, $volid, $self->{ssh_info}, $sid); + my $insecure = $self->{opts}->{migration_type} eq 'insecure'; + PVE::Storage::storage_migrate($self->{storecfg}, $volid, $self->{ssh_info}, $sid, undef, undef, undef, undef, $insecure); } } }; @@ -435,6 +436,20 @@ sub phase1 { $conf->{lock} = 'migrate'; PVE::QemuConfig->write_config($vmid, $conf); + # we use TCP only for unsecure migrations as TCP ssh forward tunnels often + # did appeared to late (they are hard, if not impossible, to check for) + # secure migration use UNIX sockets now, this *breaks* compatibilty when trying + # to migrate from new to old but *not* from old to new. + my $datacenterconf = PVE::Cluster::cfs_read_file('datacenter.cfg'); + + my $migration_type = 'secure'; + if (defined($self->{opts}->{migration_type})) { + $migration_type = $self->{opts}->{migration_type}; + } elsif (defined($datacenterconf->{migration}->{type})) { + $migration_type = $datacenterconf->{migration}->{type}; + } + $self->{opts}->{migration_type} = $migration_type; + sync_disks($self, $vmid); }; @@ -482,18 +497,7 @@ sub phase2 { push @$cmd , 'qm', 'start', $vmid, '--skiplock', '--migratedfrom', $nodename; - # we use TCP only for unsecure migrations as TCP ssh forward tunnels often - # did appeared to late (they are hard, if not impossible, to check for) - # secure migration use UNIX sockets now, this *breaks* compatibilty when trying - # to migrate from new to old but *not* from old to new. - my $datacenterconf = PVE::Cluster::cfs_read_file('datacenter.cfg'); - - my $migration_type = 'secure'; - if (defined($self->{opts}->{migration_type})) { - $migration_type = $self->{opts}->{migration_type}; - } elsif (defined($datacenterconf->{migration}->{type})) { - $migration_type = $datacenterconf->{migration}->{type}; - } + my $migration_type = $self->{opts}->{migration_type}; push @$cmd, '--migration_type', $migration_type;