From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 B5B8365A86 for ; Fri, 24 Jul 2020 07:29:10 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id AAB732E8B1 for ; Fri, 24 Jul 2020 07:29:10 +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) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id CDF992E8A7 for ; Fri, 24 Jul 2020 07:29:09 +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 72812432ED for ; Fri, 24 Jul 2020 07:29:09 +0200 (CEST) Date: Fri, 24 Jul 2020 07:29:02 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: PVE development discussion References: <20200518073757.10943-1-f.ebner@proxmox.com> In-Reply-To: <20200518073757.10943-1-f.ebner@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Message-Id: <1595568370.n1rm4aqwrl.astroid@nora.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.053 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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. [proxmox.com, qemu.pm] Subject: [pve-devel] applied: [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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Jul 2020 05:29:10 -0000 with T-B included. since this is pre-config-lock and outside the flocked section, it might=20 make sense to repeat the check in QemuMigrate? then again,=20 creating/deleting replication jobs only locks the replication config and=20 not the VM config, so without changes there it won't be race-free=20 either. On May 18, 2020 9:37 am, Fabian Ebner wrote: > Signed-off-by: Fabian Ebner > --- >=20 > Changes from v1: > * die/warn depending on force (thanks to Thomas and Aaron for the sug= gestion) > * don't die/warn if VM is not replicated at all >=20 > PVE/API2/Qemu.pm | 13 +++++++++++++ > 1 file changed, 13 insertions(+) >=20 > 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({ > =20 > if (PVE::QemuServer::check_running($vmid)) { > die "can't migrate running VM without --online\n" if !$param->{onli= ne}; > + > + my $repl_conf =3D PVE::ReplicationConfig->new(); > + my $is_replicated =3D $repl_conf->check_for_existing_jobs($vmid, 1)= ; > + my $is_replicated_to_target =3D defined($repl_conf->find_local_repl= ication_job($vmid, $target)); > + if ($is_replicated && !$is_replicated_to_target) { > + if ($param->{force}) { > + warn "WARNING: Node '$target' is not a replication target. Existin= g replication " . > + "jobs will fail after migration!\n"; > + } else { > + die "Cannot live-migrate replicated VM to node '$target' - not a r= eplication target." . > + " Use 'force' to override.\n"; > + } > + } > } else { > warn "VM isn't running. Doing offline migration instead.\n" if $par= am->{online}; > $param->{online} =3D 0; > --=20 > 2.20.1 >=20 >=20 > _______________________________________________ > pve-devel mailing list > pve-devel@pve.proxmox.com > https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel >=20 >=20 =