From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <f.ebner@proxmox.com>
Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id DE4CA6D4DD
 for <pve-devel@lists.proxmox.com>; Fri,  5 Feb 2021 09:11:52 +0100 (CET)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id D068E2C770
 for <pve-devel@lists.proxmox.com>; Fri,  5 Feb 2021 09:11:52 +0100 (CET)
Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com
 [212.186.127.180])
 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
 key-exchange X25519 server-signature RSA-PSS (2048 bits))
 (No client certificate requested)
 by firstgate.proxmox.com (Proxmox) with ESMTPS id 5759C2C762
 for <pve-devel@lists.proxmox.com>; Fri,  5 Feb 2021 09:11:52 +0100 (CET)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 1A703461CD
 for <pve-devel@lists.proxmox.com>; Fri,  5 Feb 2021 09:11:52 +0100 (CET)
To: pve-devel@lists.proxmox.com, m.limbeck@proxmox.com
References: <20210203142536.28480-1-m.limbeck@proxmox.com>
 <20210203142536.28480-6-m.limbeck@proxmox.com>
From: Fabian Ebner <f.ebner@proxmox.com>
Message-ID: <295d4f46-fbdb-bb8d-9be1-e9fa1fb6dce0@proxmox.com>
Date: Fri, 5 Feb 2021 09:11:46 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101
 Thunderbird/78.7.0
MIME-Version: 1.0
In-Reply-To: <20210203142536.28480-6-m.limbeck@proxmox.com>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.087 Adjusted score from AWL reputation of From: address
 KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment
 NICE_REPLY_A           -0.182 Looks like a legit reply (A)
 RCVD_IN_DNSWL_MED        -2.3 Sender listed at https://www.dnswl.org/,
 medium trust
 SPF_HELO_NONE           0.001 SPF: HELO does not publish an SPF Record
 SPF_PASS               -0.001 SPF: sender matches SPF record
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [qemumigrate.pm, qemu.pm]
Subject: Re: [pve-devel] [PATCH qemu-server v2] copy conntrack information
 on migration
X-BeenThere: pve-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox VE development discussion <pve-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pve-devel/>
List-Post: <mailto:pve-devel@lists.proxmox.com>
List-Help: <mailto:pve-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel>, 
 <mailto:pve-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Fri, 05 Feb 2021 08:11:52 -0000

Am 03.02.21 um 15:25 schrieb Mira Limbeck:
> Requires the pve-conntrack-tool. On migration the conntrack information
> from the source node is dumped and sent to the target node where it is
> then inserted.
> This helps with open connections during migration when the firewall is active.
> 
> A new 'migrate-conntracks' option is added to the migrate_vm API call.
> 
> Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
> ---
> v2:
>   - added the migrate-conntracks option so that it only copies conntrack
>     information when requested
> 
>   PVE/API2/Qemu.pm   | 5 +++++
>   PVE/QemuMigrate.pm | 5 +++++
>   2 files changed, 10 insertions(+)
> 
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index 3571f5e..8c4336b 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -3556,6 +3556,11 @@ __PACKAGE__->register_method({
>   		minimum => '0',
>   		default => 'migrate limit from datacenter or storage config',
>   	    },
> +	    'migrate-conntracks' => {
> +		description => "Migrate connection tracking info.",
> +		type => 'boolean',
> +		optional => 1,
> +	    }
>   	},
>       },
>       returns => {
> diff --git a/PVE/QemuMigrate.pm b/PVE/QemuMigrate.pm
> index 5c019fc..2ccef2a 100644
> --- a/PVE/QemuMigrate.pm
> +++ b/PVE/QemuMigrate.pm
> @@ -1087,6 +1087,11 @@ sub phase2 {
>   	    die "unable to parse migration status '$stat->{status}' - aborting\n";
>   	}
>       }
> +
> +    if ($self->{opts}->{'migrate-conntracks'}) {
> +	$self->log('info', 'copy conntrack information');
> +	PVE::Tools::run_command([['/usr/bin/pve-conntrack-tool', 'dump'], [@{$self->{rem_ssh}}, '/usr/bin/pve-conntrack-tool', 'insert']]);

Just wondering if having an eval here and still continue with the 
migration if there's a problem would make sense? OTOH one can argue that 
if the option is set and the connection information cannot be copied, 
it's better to abort.

> +    }
>   }
>   
>   sub phase2_cleanup {
>