From nobody Thu Nov 21 17:18:27 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1731938425730784.0328732077423; Mon, 18 Nov 2024 06:00:25 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 996) id 791C31B4B; Mon, 18 Nov 2024 09:00:24 -0500 (EST) Received: from lists.libvirt.org (localhost [IPv6:::1]) by lists.libvirt.org (Postfix) with ESMTP id 51BD71B70; Mon, 18 Nov 2024 08:59:41 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 996) id EAA4D1A0E; Mon, 18 Nov 2024 08:59:36 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 5199919FF for ; Mon, 18 Nov 2024 08:59:36 -0500 (EST) Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-91-ziBb8Gt0OPG-DfBAk91TYg-1; Mon, 18 Nov 2024 08:59:34 -0500 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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 mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D176219540F2 for ; Mon, 18 Nov 2024 13:59:33 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.6]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 075C11956056 for ; Mon, 18 Nov 2024 13:59:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-0.5 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731938376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TPnzwxOqOc1BrE3vrLCuQqyX9QFFAeCBWYRssDsLhYA=; b=eiqvb0mnjWxMlgUtnj8MQC4qgBroOh3ntGCbicf26J/MEv7bs/UJu8p1AWOqbQkOL3xt4I ywmqZ1ka4NnNJnwOTL6zWjEjuyChTdLWAqj1EwjSXEWJCsRbIB7SAaurXzH20c7+nKwrBZ mGXHgMWgfakzOOgGEkgi7TpdVvkzpDo= X-MC-Unique: ziBb8Gt0OPG-DfBAk91TYg-1 X-Mimecast-MFC-AGG-ID: ziBb8Gt0OPG-DfBAk91TYg From: Peter Krempa To: devel@lists.libvirt.org Subject: [PATCH 1/3] Revert "qemu: migration: Improve handling of VIR_MIGRATE_PARAM_DEST_XML with VIR_MIGRATE_PERSIST_DEST" Date: Mon, 18 Nov 2024 14:59:27 +0100 Message-ID: <919db1fe942d774109e69340b0ff53e6f8f45d33.1731938316.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: s2Y1rjytxNxjDil78Typy8gy5x8xeBvcIO8H8969wWY_1731938374 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: HNYLX6B2EJFXKT4TLQRJMHVBEIQGSGB7 X-Message-ID-Hash: HNYLX6B2EJFXKT4TLQRJMHVBEIQGSGB7 X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; header-match-devel.lists.libvirt.org-0; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header X-Mailman-Version: 3.2.2 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1731938427631116600 Content-Type: text/plain; charset="utf-8" The original intention was to improve the behaviour of the VIR_MIGRATE_PERSIST_DEST flag which makes the VM persistent after migration on the destination when used with VIR_MIGRATE_PARAM_DEST_XML. While it worked as intended with p2p migration where the migration is driven from the virtqemud instance on the source of the migration, which can distinguish between the user-provided input XML and the one fetched from the source of the migration, it's not easily possible to achieve the same behaviour with normal migration driven from the client library. The approach also still had corner cases (originally deemed worth changing) such as if the persistent definition was modified it would be overwritten. As there is no clear fix which would improve both styles of migrations with no corner cases revert the change. Upcoming commits will modify the documentation to add warning about the use of VIR_MIGRATE_PERSIST_DEST with VIR_MIGRATE_PARAM_DEST_XML/xmlin without using VIR_MIGRATE_PARAM_PERSIST_XML instead of a code fix. This reverts commit 6a385590926d01ab2f2137d1d0833ae797cd2839. Signed-off-by: Peter Krempa --- src/qemu/qemu_migration.c | 33 ++++++++++----------------------- 1 file changed, 10 insertions(+), 23 deletions(-) diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 832b2946e0..26a92d8ee2 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -4829,7 +4829,6 @@ qemuMigrationSrcCancel(virDomainObj *vm, static int qemuMigrationSrcRun(virQEMUDriver *driver, virDomainObj *vm, - const char *xmlin, const char *persist_xml, const char *cookiein, int cookieinlen, @@ -4902,15 +4901,6 @@ qemuMigrationSrcRun(virQEMUDriver *driver, persist_xml, NULL, NULL))) goto error; - } else if (xmlin) { - /* if input XML is provided, use that one as template for the - * persistent XML. Otherwise user's changes will be thrown awa= y. - */ - if (!(persistDef =3D qemuMigrationAnyPrepareDef(driver, - priv->qemuCaps, - xmlin, - NULL, NULL))) - goto error; } else { virDomainDef *def =3D vm->newDef ? vm->newDef : vm->def; if (!(persistDef =3D qemuDomainDefCopy(driver, priv->qemuCaps,= def, @@ -5267,7 +5257,6 @@ qemuMigrationSrcResume(virDomainObj *vm, static int qemuMigrationSrcPerformNative(virQEMUDriver *driver, virDomainObj *vm, - const char *xmlin, const char *persist_xml, const char *uri, const char *cookiein, @@ -5356,7 +5345,7 @@ qemuMigrationSrcPerformNative(virQEMUDriver *driver, ret =3D qemuMigrationSrcResume(vm, migParams, cookiein, cookieinle= n, cookieout, cookieoutlen, &spec, dconn= , flags); } else { - ret =3D qemuMigrationSrcRun(driver, vm, xmlin, persist_xml, cookie= in, cookieinlen, + ret =3D qemuMigrationSrcRun(driver, vm, persist_xml, cookiein, coo= kieinlen, cookieout, cookieoutlen, flags, resource, &spec, dconn, graphicsuri, migrate_disks, migrate_disks_detect_zero= es, @@ -5374,7 +5363,6 @@ static int qemuMigrationSrcPerformTunnel(virQEMUDriver *driver, virDomainObj *vm, virStreamPtr st, - const char *xmlin, const char *persist_xml, const char *cookiein, int cookieinlen, @@ -5422,7 +5410,7 @@ qemuMigrationSrcPerformTunnel(virQEMUDriver *driver, /* Migration with NBD is not supported with _TUNNELLED, thus * 'migrate_disks_detect_zeroes' is NULL here */ - ret =3D qemuMigrationSrcRun(driver, vm, xmlin, persist_xml, cookiein, = cookieinlen, + ret =3D qemuMigrationSrcRun(driver, vm, persist_xml, cookiein, cookiei= nlen, cookieout, cookieoutlen, flags, resource, &s= pec, dconn, graphicsuri, migrate_disks, NULL, migParams, NULL); @@ -5461,7 +5449,7 @@ qemuMigrationSrcPerformResume(virQEMUDriver *driver, virCloseCallbacksDomainRemove(vm, NULL, qemuMigrationAnyConnectionClos= ed); qemuDomainCleanupRemove(vm, qemuProcessCleanupMigrationJob); - ret =3D qemuMigrationSrcPerformNative(driver, vm, NULL, NULL, uri, + ret =3D qemuMigrationSrcPerformNative(driver, vm, NULL, uri, cookiein, cookieinlen, cookieout, cookieoutlen, flags, 0, NULL, NULL, NULL, NULL, migPara= ms, NULL); @@ -5563,12 +5551,12 @@ qemuMigrationSrcPerformPeer2Peer2(virQEMUDriver *dr= iver, VIR_DEBUG("Perform %p", sconn); ignore_value(qemuMigrationJobStartPhase(vm, QEMU_MIGRATION_PHASE_PERFO= RM2)); if (flags & VIR_MIGRATE_TUNNELLED) - ret =3D qemuMigrationSrcPerformTunnel(driver, vm, st, NULL, NULL, + ret =3D qemuMigrationSrcPerformTunnel(driver, vm, st, NULL, NULL, 0, NULL, NULL, flags, resource, dconn, NULL, NULL, migParams); else - ret =3D qemuMigrationSrcPerformNative(driver, vm, NULL, NULL, uri_= out, + ret =3D qemuMigrationSrcPerformNative(driver, vm, NULL, uri_out, cookie, cookielen, NULL, NULL, /* No out cookie w= ith v2 migration */ flags, resource, dconn, NULL, = NULL, @@ -5838,14 +5826,14 @@ qemuMigrationSrcPerformPeer2Peer3(virQEMUDriver *dr= iver, } else { ignore_value(qemuMigrationJobSetPhase(vm, QEMU_MIGRATION_PHASE_PER= FORM3)); if (flags & VIR_MIGRATE_TUNNELLED) { - ret =3D qemuMigrationSrcPerformTunnel(driver, vm, st, xmlin, p= ersist_xml, + ret =3D qemuMigrationSrcPerformTunnel(driver, vm, st, persist_= xml, cookiein, cookieinlen, &cookieout, &cookieoutlen, flags, bandwidth, dconn, g= raphicsuri, migrate_disks, migParams); } else { - ret =3D qemuMigrationSrcPerformNative(driver, vm, xmlin, persi= st_xml, uri, + ret =3D qemuMigrationSrcPerformNative(driver, vm, persist_xml,= uri, cookiein, cookieinlen, &cookieout, &cookieoutlen, flags, bandwidth, dconn, g= raphicsuri, @@ -6243,7 +6231,7 @@ qemuMigrationSrcPerformJob(virQEMUDriver *driver, if (qemuMigrationJobStartPhase(vm, QEMU_MIGRATION_PHASE_PERFORM2) = < 0) goto endjob; - ret =3D qemuMigrationSrcPerformNative(driver, vm, xmlin, persist_x= ml, uri, cookiein, cookieinlen, + ret =3D qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri= , cookiein, cookieinlen, cookieout, cookieoutlen, flags, resource, NULL, NULL, N= ULL, NULL, migParams, nbdURI); @@ -6308,7 +6296,6 @@ static int qemuMigrationSrcPerformPhase(virQEMUDriver *driver, virConnectPtr conn, virDomainObj *vm, - const char *xmlin, const char *persist_xml, const char *uri, const char *graphicsuri, @@ -6346,7 +6333,7 @@ qemuMigrationSrcPerformPhase(virQEMUDriver *driver, virCloseCallbacksDomainRemove(vm, NULL, qemuMigrationAnyConnectionClos= ed); - if (qemuMigrationSrcPerformNative(driver, vm, xmlin, persist_xml, uri,= cookiein, cookieinlen, + if (qemuMigrationSrcPerformNative(driver, vm, persist_xml, uri, cookie= in, cookieinlen, cookieout, cookieoutlen, flags, resource, NULL, graphicsuri, migrate_disks, migrate_disks_detect_= zeroes, @@ -6450,7 +6437,7 @@ qemuMigrationSrcPerform(virQEMUDriver *driver, } if (v3proto) { - return qemuMigrationSrcPerformPhase(driver, conn, vm, xmlin, persi= st_xml, uri, + return qemuMigrationSrcPerformPhase(driver, conn, vm, persist_xml,= uri, graphicsuri, migrate_disks, migrate_disks_d= etect_zeroes, migParams, --=20 2.47.0