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) server-digest SHA256)
 (No client certificate requested)
 by lists.proxmox.com (Postfix) with ESMTPS id 6C4C665259
 for <pve-devel@lists.proxmox.com>; Wed, 22 Jul 2020 13:38:18 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 503C72006F
 for <pve-devel@lists.proxmox.com>; Wed, 22 Jul 2020 13:37:48 +0200 (CEST)
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 BD10A20062
 for <pve-devel@lists.proxmox.com>; Wed, 22 Jul 2020 13:37:47 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 792F743305
 for <pve-devel@lists.proxmox.com>; Wed, 22 Jul 2020 13:37:47 +0200 (CEST)
To: pve-devel@lists.proxmox.com
References: <20200518073757.10943-1-f.ebner@proxmox.com>
Cc: Thomas Lamprecht <t.lamprecht@proxmox.com>
From: Fabian Ebner <f.ebner@proxmox.com>
Message-ID: <b03371c0-af9b-0b35-c787-06fd9c798a7d@proxmox.com>
Date: Wed, 22 Jul 2020 13:37:31 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101
 Thunderbird/68.10.0
MIME-Version: 1.0
In-Reply-To: <20200518073757.10943-1-f.ebner@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.081 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.001 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. [qemu.pm]
Subject: Re: [pve-devel] [PATCH v2 qemu-server] Fix #2728: die/warn if
 target is not a replication target when live-migrating
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: Wed, 22 Jul 2020 11:38:18 -0000

Ping for this patch

Am 18.05.20 um 09:37 schrieb Fabian Ebner:
> Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
> ---
> 
> Changes from v1:
>      * die/warn depending on force (thanks to Thomas and Aaron for the suggestion)
>      * don't die/warn if VM is not replicated at all
> 
>   PVE/API2/Qemu.pm | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/PVE/API2/Qemu.pm b/PVE/API2/Qemu.pm
> index fd51bf3..cb99f78 100644
> --- a/PVE/API2/Qemu.pm
> +++ b/PVE/API2/Qemu.pm
> @@ -3486,6 +3486,19 @@ __PACKAGE__->register_method({
>   
>   	if (PVE::QemuServer::check_running($vmid)) {
>   	    die "can't migrate running VM without --online\n" if !$param->{online};
> +
> +	    my $repl_conf = PVE::ReplicationConfig->new();
> +	    my $is_replicated = $repl_conf->check_for_existing_jobs($vmid, 1);
> +	    my $is_replicated_to_target = defined($repl_conf->find_local_replication_job($vmid, $target));
> +	    if ($is_replicated && !$is_replicated_to_target) {
> +		if ($param->{force}) {
> +		    warn "WARNING: Node '$target' is not a replication target. Existing replication " .
> +		         "jobs will fail after migration!\n";
> +		} else {
> +		    die "Cannot live-migrate replicated VM to node '$target' - not a replication target." .
> +		        " Use 'force' to override.\n";
> +		}
> +	    }
>   	} else {
>   	    warn "VM isn't running. Doing offline migration instead.\n" if $param->{online};
>   	    $param->{online} = 0;
>