From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Fabian Ebner <f.ebner@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [pve-devel] [PATCH v5 qemu-server 08/11] migrate: refactor remote VM/tunnel start
Date: Wed, 16 Feb 2022 13:58:19 +0100 [thread overview]
Message-ID: <1645014790.j3zvypjvhr.astroid@nora.none> (raw)
In-Reply-To: <<ce49d9a8-03b6-01ed-ad01-5cc500bfba19@proxmox.com>
On February 11, 2022 2:01 pm, Fabian Ebner wrote:
> Am 09.02.22 um 14:07 schrieb Fabian Grünbichler:
>> no semantic changes intended, except for:
>> - no longer passing the main migration UNIX socket to SSH twice for
>> forwarding
>> - dropping the 'unix:' prefix in start_remote_tunnel's timeout error message
>>
>> Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
>>
>> [..]
>>
>> @@ -82,23 +87,23 @@ sub start_remote_tunnel {
>> if ($unix_socket_try > 100) {
>> $self->{errors} = 1;
>> PVE::Tunnel::finish_tunnel($self->{tunnel});
>> - die "Timeout, migration socket $ruri did not get ready";
>> + die "Timeout, migration socket $tunnel_info->{addr} did not get ready";
>> }
>> $self->{tunnel}->{unix_sockets} = $unix_sockets if (@$unix_sockets);
>>
>> - } elsif ($ruri =~ /^tcp:/) {
>> + } elsif ($tunnel_info->{proto} eq 'tcp') {
>> my $ssh_forward_info = [];
>> - if ($raddr eq "localhost") {
>> + if ($tunnel_info->{addr} eq "localhost") {
>> # for backwards compatibility with older qemu-server versions
>> my $pfamily = PVE::Tools::get_host_address_family($nodename);
>> my $lport = PVE::Tools::next_migrate_port($pfamily);
>> - push @$ssh_forward_info, "$lport:localhost:$rport";
>> + push @$ssh_forward_info, "$lport:localhost:$tunnel_info->{rport}";
>
> Should be $tunnel_info->{port}
right! never triggered since AFAICT this is dead code. we switched to
using unix sockets for SSH migration in 2016/PVE 4[0], and this was just
the fallback for compat reasons. unless I am missing something this can
probably just be dropped altogether/replaced with a
die "secure TCP migration not supported\n";
0: https://git.proxmox.com/?p=qemu-server.git;a=commitdiff;h=1c9d54bfd05e0d017a6e2ac5524d75466b1a4455
source node will always use unix for secure and tcp for insecure
target node will only use 'localhost' as addr for tcp + secure, which no
PVE 5/6/7 source node will ever set
>
>> }
>>
>> $self->{tunnel} = $self->fork_tunnel($ssh_forward_info);
>>
>> } else {
>> - die "unsupported protocol in migration URI: $ruri\n";
>> + die "unsupported protocol in migration URI: $tunnel_info->{proto}\n";
>> }
>> } else {
>> #fork tunnel for insecure migration, to send faster commands like resume
>> @@ -650,52 +655,40 @@ sub phase1_cleanup {
>> }
>> }
>>
>> -sub phase2 {
>> - my ($self, $vmid) = @_;
>> +sub phase2_start_local_cluster {
>> + my ($self, $vmid, $params) = @_;
>>
>> my $conf = $self->{vmconf};
>> my $local_volumes = $self->{local_volumes};
>> my @online_local_volumes = $self->filter_local_volumes('online');
>>
>> $self->{storage_migration} = 1 if scalar(@online_local_volumes);
>> + my $start = $params->{start_params};
>> + my $migrate = $params->{migrate_opts};
>>
>> $self->log('info', "starting VM $vmid on remote node '$self->{node}'");
>>
>> - my $raddr;
>> - my $rport;
>> - my $ruri; # the whole migration dst. URI (protocol:address[:port])
>> - my $nodename = PVE::INotify::nodename();
>> + my $tunnel_info = {};
>>
>> ## start on remote node
>> my $cmd = [@{$self->{rem_ssh}}];
>>
>> - my $spice_ticket;
>> - if (PVE::QemuServer::vga_conf_has_spice($conf->{vga})) {
>> - my $res = mon_cmd($vmid, 'query-spice');
>> - $spice_ticket = $res->{ticket};
>> - }
>> + push @$cmd, 'qm', 'start', $vmid, '--skiplock';
>
> Nit: the parameter $start->{skiplock} that's passed in is ignored
> (although it is always 1 currently)
fixed.
>
>> + push @$cmd, '--migratedfrom', $migrate->{migratedfrom};
>>
>> - push @$cmd , 'qm', 'start', $vmid, '--skiplock', '--migratedfrom', $nodename;
>> + push @$cmd, '--migration_type', $migrate->{type};
>>
>> - my $migration_type = $self->{opts}->{migration_type};
>> + push @$cmd, '--migration_network', $migrate->{network}
>> + if $migrate->{network};
>>
>> - push @$cmd, '--migration_type', $migration_type;
>> + push @$cmd, '--stateuri', $start->{statefile};
>>
>> - push @$cmd, '--migration_network', $self->{opts}->{migration_network}
>> - if $self->{opts}->{migration_network};
>> -
>> - if ($migration_type eq 'insecure') {
>> - push @$cmd, '--stateuri', 'tcp';
>> - } else {
>> - push @$cmd, '--stateuri', 'unix';
>> + if ($start->{forcemachine}) {
>> + push @$cmd, '--machine', $start->{forcemachine};
>> }
>>
>> - if ($self->{forcemachine}) {
>> - push @$cmd, '--machine', $self->{forcemachine};
>> - }
>> -
>> - if ($self->{forcecpu}) {
>> - push @$cmd, '--force-cpu', $self->{forcecpu};
>> + if ($start->{forcecpu}) {
>> + push @$cmd, '--force-cpu', $start->{forcecpu};
>> }
>>
>> if ($self->{storage_migration}) {
>
next prev parent reply other threads:[~2022-02-16 12:58 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-09 13:07 [pve-devel] [PATCH-SERIES 0/21] remote migration Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 common 1/1] add 'map_id' helper for ID maps Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 container 1/3] fix #1532: add target-storage support to migration Fabian Grünbichler
2022-02-10 11:52 ` Fabian Ebner
2022-02-11 8:33 ` Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 container 2/3] config: add strict parser Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH PoC v5 container 3/3] migration: add remote migration Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 guest-common 1/3] migrate: add get_bwlimit helper Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 guest-common 2/3] add tunnel helper module Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 guest-common 3/3] add storage tunnel module Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 qemu-server 01/11] move map_storage to PVE::JSONSchema::map_id Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 qemu-server 02/11] schema: use pve-bridge-id Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 qemu-server 03/11] parse_config: optional strict mode Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 qemu-server 04/11] update_vm: allow simultaneous setting of boot-order and dev Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 qemu-server 05/11] nbd alloc helper: allow passing in explicit format Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 qemu-server 06/11] migrate: move tunnel-helpers to pve-guest-common Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 qemu-server 07/11] mtunnel: add API endpoints Fabian Grünbichler
2022-02-11 13:01 ` Fabian Ebner
[not found] ` <<0b8626f8-df25-05a6-3db3-698591688eab@proxmox.com>
2022-02-16 12:57 ` Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 qemu-server 08/11] migrate: refactor remote VM/tunnel start Fabian Grünbichler
2022-02-11 13:01 ` Fabian Ebner
[not found] ` <<ce49d9a8-03b6-01ed-ad01-5cc500bfba19@proxmox.com>
2022-02-16 12:58 ` Fabian Grünbichler [this message]
2022-02-09 13:07 ` [pve-devel] [PATCH v5 qemu-server 09/11] migrate: add remote migration handling Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 qemu-server 10/11] api: add remote migrate endpoint Fabian Grünbichler
2022-02-11 13:01 ` Fabian Ebner
[not found] ` <<e5069cdd-7a84-9664-2dea-1ac3e68e339c@proxmox.com>
2022-02-16 12:58 ` Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 qemu-server 11/11] qm: add remote-migrate command Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 storage 1/3] storage_migrate_snapshot: skip for btrfs without snapshots Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 storage 2/3] storage_migrate: pull out import/export_prepare Fabian Grünbichler
2022-02-09 13:07 ` [pve-devel] [PATCH v5 storage 3/3] add volume_import/export_start helpers Fabian Grünbichler
2022-02-09 17:56 ` [pve-devel] [PATCH-SERIES 0/21] remote migration Thomas Lamprecht
2022-02-11 10:38 ` [pve-devel] [PATCH qemu-server follow-up] schema: move 'pve-targetstorage' to pve-common Fabian Grünbichler
2022-02-11 10:38 ` [pve-devel] [PATCH common follow-up] schema: take over 'pve-targetstorage' option Fabian Grünbichler
2022-02-11 11:31 ` [pve-devel] [PATCH qemu-server follow-up] schema: move 'pve-targetstorage' to pve-common Fabian Ebner
2022-02-11 13:08 ` [pve-devel] [PATCH-SERIES 0/21] remote migration Fabian Ebner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1645014790.j3zvypjvhr.astroid@nora.none \
--to=f.gruenbichler@proxmox.com \
--cc=f.ebner@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox